Version Notes
initial extension of Protected-Shops for Magento
Download this release
Release Info
Developer | Viktor Franz |
Extension | protected-shops |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- .doc/NrApps/ProtectedShops/20140424_Doku_Schnittstelle_ProtectedShops.pdf +0 -0
- app/code/community/NRApps/ProtectedShops/Block/Adminhtml/System/Config/Form/Field/Map.php +90 -0
- app/code/community/NRApps/ProtectedShops/Block/Adminhtml/System/Config/Form/Renderer/Select.php +33 -0
- app/code/community/NRApps/ProtectedShops/Block/Adminhtml/System/Config/Form/Renderer/SelectGroup.php +44 -0
- app/code/community/NRApps/ProtectedShops/Block/Adminhtml/System/Config/Import.php +67 -0
- app/code/community/NRApps/ProtectedShops/Block/Adminhtml/System/Config/Info.php +67 -0
- app/code/community/NRApps/ProtectedShops/Helper/Config.php +141 -0
- app/code/community/NRApps/ProtectedShops/Helper/Data.php +85 -0
- app/code/community/NRApps/ProtectedShops/Model/Api.php +280 -0
- app/code/community/NRApps/ProtectedShops/Model/Cron.php +100 -0
- app/code/community/NRApps/ProtectedShops/Model/Flag.php +150 -0
- app/code/community/NRApps/ProtectedShops/Model/System/Config/Backend/Serialized/Map.php +44 -0
- app/code/community/NRApps/ProtectedShops/Model/System/Config/Source/Interval.php +47 -0
- app/code/community/NRApps/ProtectedShops/controllers/Adminhtml/Nrappsprotectedshops/ConfigController.php +75 -0
- app/code/community/NRApps/ProtectedShops/etc/adminhtml.xml +33 -0
- app/code/community/NRApps/ProtectedShops/etc/config.xml +98 -0
- app/code/community/NRApps/ProtectedShops/etc/system.xml +124 -0
- app/design/adminhtml/default/default/template/nrapps_protectedshops/import.phtml +69 -0
- app/design/adminhtml/default/default/template/nrapps_protectedshops/info.phtml +73 -0
- app/etc/modules/NRApps_ProtectedShops.xml +20 -0
- app/locale/de_DE/NRApps_ProtectedShops.csv +40 -0
- app/locale/de_DE/template/email/nrapps_protectedshops_auto_update_error_email.html +6 -0
- app/locale/en_US/NRApps_ProtectedShops.csv +40 -0
- app/locale/en_US/template/email/nrapps_protectedshops_auto_update_error_email.html +6 -0
- package.xml +24 -0
.doc/NrApps/ProtectedShops/20140424_Doku_Schnittstelle_ProtectedShops.pdf
ADDED
Binary file
|
app/code/community/NRApps/ProtectedShops/Block/Adminhtml/System/Config/Form/Field/Map.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Block_Adminhtml_System_Config_Form_Field_Map
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Block_Adminhtml_System_Config_Form_Field_Map extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
*
|
21 |
+
*/
|
22 |
+
public function __construct()
|
23 |
+
{
|
24 |
+
/** @var $helper NRApps_ProtectedShops_Helper_Data */
|
25 |
+
$helper = Mage::helper('nrapps_protectedshops');
|
26 |
+
|
27 |
+
$this->addColumn('document', array(
|
28 |
+
'label' => Mage::helper('nrapps_protectedshops')->__('Document'),
|
29 |
+
'style' => 'width:250px',
|
30 |
+
'renderer' => Mage::app()->getLayout()->createBlock('nrapps_protectedshops/adminhtml_system_config_form_renderer_select')->setOptions($helper->getDocumentOptions()),
|
31 |
+
));
|
32 |
+
|
33 |
+
$this->addColumn('destination', array(
|
34 |
+
'label' => Mage::helper('nrapps_protectedshops')->__('Destination'),
|
35 |
+
'style' => 'width:250px',
|
36 |
+
'renderer' => Mage::app()->getLayout()->createBlock('nrapps_protectedshops/adminhtml_system_config_form_renderer_selectGroup')->setOptions($helper->getDestinationOptions()),
|
37 |
+
));
|
38 |
+
|
39 |
+
$this->addColumn('format', array(
|
40 |
+
'label' => Mage::helper('nrapps_protectedshops')->__('Format'),
|
41 |
+
'style' => 'width:150px',
|
42 |
+
'renderer' => Mage::app()->getLayout()->createBlock('nrapps_protectedshops/adminhtml_system_config_form_renderer_select')->setOptions($helper->getFormatOptions()),
|
43 |
+
));
|
44 |
+
|
45 |
+
$this->_addAfter = false;
|
46 |
+
$this->_addButtonLabel = Mage::helper('nrapps_protectedshops')->__('Add Row');
|
47 |
+
|
48 |
+
parent::__construct();
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @return array
|
54 |
+
*/
|
55 |
+
public function getArrayRows()
|
56 |
+
{
|
57 |
+
if (null !== $this->_arrayRowsCache) {
|
58 |
+
return $this->_arrayRowsCache;
|
59 |
+
}
|
60 |
+
|
61 |
+
$result = array();
|
62 |
+
|
63 |
+
/** @var Varien_Data_Form_Element_Abstract */
|
64 |
+
$element = $this->getElement();
|
65 |
+
|
66 |
+
if ($element->getValue() && is_array($element->getValue())) {
|
67 |
+
|
68 |
+
foreach ($element->getValue() as $rowId => $row) {
|
69 |
+
|
70 |
+
foreach ($row as $key => $value) {
|
71 |
+
|
72 |
+
if ($key == 'document') {
|
73 |
+
$row['document_' . $value] = 'selected="selected"';
|
74 |
+
} else if ($key == 'destination') {
|
75 |
+
$row['destination_' . $value] = 'selected="selected"';
|
76 |
+
} elseif ($key == 'format') {
|
77 |
+
$row['format_' . $value] = 'selected="selected"';
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
$row['_id'] = $rowId;
|
82 |
+
$result[$rowId] = new Varien_Object($row);
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
$this->_arrayRowsCache = $result;
|
87 |
+
|
88 |
+
return $this->_arrayRowsCache;
|
89 |
+
}
|
90 |
+
}
|
app/code/community/NRApps/ProtectedShops/Block/Adminhtml/System/Config/Form/Renderer/Select.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Block_Adminhtml_System_Config_Form_Renderer_Select
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Block_Adminhtml_System_Config_Form_Renderer_Select extends Mage_Core_Block_Abstract
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
protected function _toHtml()
|
23 |
+
{
|
24 |
+
$column = $this->getColumn();
|
25 |
+
$options = '';
|
26 |
+
|
27 |
+
foreach ($this->getOptions() as $value => $label) {
|
28 |
+
$options .= '<option #{' . $this->getColumnName() . '_' . $value . '} value="' . $value . '">' . $label . '</option>';
|
29 |
+
}
|
30 |
+
|
31 |
+
return '<select class="select" name="' . $this->getInputName() . '"' . (isset($column['style']) ? ' style="' . $column['style'] . '"' : '') . '>' . $options . '</select>';
|
32 |
+
}
|
33 |
+
}
|
app/code/community/NRApps/ProtectedShops/Block/Adminhtml/System/Config/Form/Renderer/SelectGroup.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Block_Adminhtml_System_Config_Form_Renderer_SelectGroup
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Block_Adminhtml_System_Config_Form_Renderer_SelectGroup extends Mage_Core_Block_Abstract
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
protected function _toHtml()
|
23 |
+
{
|
24 |
+
$column = $this->getColumn();
|
25 |
+
$options = '';
|
26 |
+
|
27 |
+
foreach ($this->getOptions() as $value) {
|
28 |
+
if (is_array($value) && array_key_exists('label', $value) && array_key_exists('value', $value)) {
|
29 |
+
|
30 |
+
if (is_array($value['value'])) {
|
31 |
+
$options .= '<optgroup label="' . $value['label'] . '">';
|
32 |
+
foreach ($value['value'] as $subValue) {
|
33 |
+
$options .= '<option #{' . $this->getColumnName() . '_' . $subValue['value'] . '} value="' . $subValue['value'] . '">' . $subValue['label'] . '</option>';
|
34 |
+
}
|
35 |
+
$options .= '</optgroup>';
|
36 |
+
} else {
|
37 |
+
$options .= '<option #{' . $this->getColumnName() . '_' . $value['value'] . '} value="' . $value['value'] . '">' . $value['label'] . '</option>';
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
return '<select class="select" name="' . $this->getInputName() . '"' . (isset($column['style']) ? ' style="' . $column['style'] . '"' : '') . '>' . $options . '</select>';
|
43 |
+
}
|
44 |
+
}
|
app/code/community/NRApps/ProtectedShops/Block/Adminhtml/System/Config/Import.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Block_Adminhtml_System_Config_Import
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Block_Adminhtml_System_Config_Import extends Mage_Adminhtml_Block_System_Config_Form_Field
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Set template to itself
|
21 |
+
*
|
22 |
+
* @return Mage_Adminhtml_Block_Customer_System_Config_Validatevat
|
23 |
+
*/
|
24 |
+
protected function _prepareLayout()
|
25 |
+
{
|
26 |
+
parent::_prepareLayout();
|
27 |
+
if (!$this->getTemplate()) {
|
28 |
+
$this->setTemplate('nrapps_protectedshops/import.phtml');
|
29 |
+
}
|
30 |
+
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Unset some non-related element parameters
|
37 |
+
*
|
38 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
39 |
+
*
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
43 |
+
{
|
44 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
45 |
+
|
46 |
+
return parent::render($element);
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get the button and scripts contents
|
52 |
+
*
|
53 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
58 |
+
{
|
59 |
+
$this->addData(array(
|
60 |
+
'button_label' => Mage::helper('nrapps_protectedshops')->__('Import Documents'),
|
61 |
+
'html_id' => $element->getHtmlId(),
|
62 |
+
'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/nrappsprotectedshops_config/import')
|
63 |
+
));
|
64 |
+
|
65 |
+
return $this->_toHtml();
|
66 |
+
}
|
67 |
+
}
|
app/code/community/NRApps/ProtectedShops/Block/Adminhtml/System/Config/Info.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Block_Adminhtml_System_Config_Apply
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Block_Adminhtml_System_Config_Info extends Mage_Adminhtml_Block_System_Config_Form_Field
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Set template to itself
|
21 |
+
*
|
22 |
+
* @return Mage_Adminhtml_Block_Customer_System_Config_Validatevat
|
23 |
+
*/
|
24 |
+
protected function _prepareLayout()
|
25 |
+
{
|
26 |
+
parent::_prepareLayout();
|
27 |
+
if (!$this->getTemplate()) {
|
28 |
+
$this->setTemplate('nrapps_protectedshops/info.phtml');
|
29 |
+
}
|
30 |
+
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Unset some non-related element parameters
|
37 |
+
*
|
38 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
39 |
+
*
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
43 |
+
{
|
44 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
45 |
+
|
46 |
+
return parent::render($element);
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get the button and scripts contents
|
52 |
+
*
|
53 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
54 |
+
*
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
58 |
+
{
|
59 |
+
$this->addData(array(
|
60 |
+
'button_label' => Mage::helper('nrapps_protectedshops')->__('Get/Show Documents Info'),
|
61 |
+
'html_id' => $element->getHtmlId(),
|
62 |
+
'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/nrappsprotectedshops_config/info')
|
63 |
+
));
|
64 |
+
|
65 |
+
return $this->_toHtml();
|
66 |
+
}
|
67 |
+
}
|
app/code/community/NRApps/ProtectedShops/Helper/Config.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Helper_Config
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Helper_Config extends Mage_Core_Helper_Abstract
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @param null $store
|
21 |
+
*
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function getApiUrl($store = null)
|
25 |
+
{
|
26 |
+
return trim(Mage::getStoreConfig('nrapps_protectedshops/setting/api_uri', $store));
|
27 |
+
}
|
28 |
+
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @param null $store
|
32 |
+
*
|
33 |
+
* @return string
|
34 |
+
*/
|
35 |
+
public function getShopId($store = null)
|
36 |
+
{
|
37 |
+
return trim(Mage::getStoreConfig('nrapps_protectedshops/setting/shop_id', $store));
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @param null $store
|
43 |
+
*
|
44 |
+
* @return array
|
45 |
+
*/
|
46 |
+
public function getMap($store = null)
|
47 |
+
{
|
48 |
+
$mapping = trim(Mage::getStoreConfig('nrapps_protectedshops/setting/map', $store));
|
49 |
+
$mapping = @unserialize($mapping);
|
50 |
+
|
51 |
+
return (array)$mapping;
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @param null $store
|
57 |
+
*
|
58 |
+
* @return bool
|
59 |
+
*/
|
60 |
+
public function isHashValidate($store = null)
|
61 |
+
{
|
62 |
+
return (bool)Mage::getStoreConfig('nrapps_protectedshops/setting/hash_validate', $store);
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @param null $store
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
public function isAutoUpdateIsActive($store = null)
|
72 |
+
{
|
73 |
+
return (bool)Mage::getStoreConfig('nrapps_protectedshops/auto_update/is_active', $store);
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @param null $store
|
79 |
+
*
|
80 |
+
* @return int
|
81 |
+
*/
|
82 |
+
public function getAutoUpdateInterval($store = null)
|
83 |
+
{
|
84 |
+
return (int)Mage::getStoreConfig('nrapps_protectedshops/auto_update/interval', $store);
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param null $store
|
90 |
+
*
|
91 |
+
* @return int
|
92 |
+
*/
|
93 |
+
public function getAutoUpdateErrorEmailThreshold($store = null)
|
94 |
+
{
|
95 |
+
return (int)Mage::getStoreConfig('nrapps_protectedshops/auto_update/error_email_threshold', $store);
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @param null $store
|
101 |
+
*
|
102 |
+
* @return string
|
103 |
+
*/
|
104 |
+
public function getAutoUpdateErrorEmailSenderIdentity($store = null)
|
105 |
+
{
|
106 |
+
return trim(Mage::getStoreConfig('nrapps_protectedshops/auto_update/error_email_sender_identity', $store));
|
107 |
+
}
|
108 |
+
|
109 |
+
|
110 |
+
/**
|
111 |
+
* @param null $store
|
112 |
+
*
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
public function getAutoUpdateErrorEmailRecipientProtectedShops($store = null)
|
116 |
+
{
|
117 |
+
return trim(Mage::getStoreConfig('nrapps_protectedshops/auto_update/error_email_recipient_protectedshops', $store));
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @param null $store
|
123 |
+
*
|
124 |
+
* @return string
|
125 |
+
*/
|
126 |
+
public function getAutoUpdateErrorEmailRecipient($store = null)
|
127 |
+
{
|
128 |
+
return trim(Mage::getStoreConfig('nrapps_protectedshops/auto_update/error_email_recipient', $store));
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
/**
|
133 |
+
* @param null $store
|
134 |
+
*
|
135 |
+
* @return string
|
136 |
+
*/
|
137 |
+
public function getAutoUpdateErrorEmailTemplate($store = null)
|
138 |
+
{
|
139 |
+
return trim(Mage::getStoreConfig('nrapps_protectedshops/auto_update/error_email_template', $store));
|
140 |
+
}
|
141 |
+
}
|
app/code/community/NRApps/ProtectedShops/Helper/Data.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Helper_Data
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Helper_Data extends Mage_Core_Helper_Abstract
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @return array
|
21 |
+
*/
|
22 |
+
public function getDocumentOptions()
|
23 |
+
{
|
24 |
+
|
25 |
+
$documents = Mage::getModel('nrapps_protectedshops/flag')->getDocuments();
|
26 |
+
|
27 |
+
if ($documents) {
|
28 |
+
return array_combine($documents, $documents);
|
29 |
+
}
|
30 |
+
|
31 |
+
return $documents;
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function getFormatOptions()
|
39 |
+
{
|
40 |
+
return array(
|
41 |
+
'Html' => $this->__('HTML'),
|
42 |
+
'HtmlLite' => $this->__('HTML-Lite'),
|
43 |
+
'Text' => $this->__('Text'),
|
44 |
+
//'Pdf' => $this->__('PDF'),
|
45 |
+
);
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @return array
|
51 |
+
*/
|
52 |
+
public function getDestinationOptions()
|
53 |
+
{
|
54 |
+
$options = array();
|
55 |
+
|
56 |
+
$options['cms_page'] = array('label' => $this->__('CMS Pages'));
|
57 |
+
|
58 |
+
foreach (Mage::getResourceModel('cms/page_collection')->setOrder('page_id', 'ASC') as $item) {
|
59 |
+
$options['cms_page']['value'][] = array(
|
60 |
+
'label' => sprintf('%s | %s', $item->getId(), $item->getTitle()),
|
61 |
+
'value' => sprintf('cms/page#%s', $item->getId()),
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
$options['cms_block'] = array('label' => $this->__('CMS Blocks'));
|
66 |
+
|
67 |
+
foreach (Mage::getResourceModel('cms/block_collection')->setOrder('block_id', 'ASC') as $item) {
|
68 |
+
$options['cms_block']['value'][] = array(
|
69 |
+
'label' => sprintf('%s | %s', $item->getId(), $item->getTitle()),
|
70 |
+
'value' => sprintf('cms/block#%s', $item->getId()),
|
71 |
+
);
|
72 |
+
}
|
73 |
+
|
74 |
+
$options['agreement'] = array('label' => $this->__('Agreements'));
|
75 |
+
|
76 |
+
foreach (Mage::getResourceModel('checkout/agreement_collection')->setOrder('agreement_id', 'ASC') as $item) {
|
77 |
+
$options['agreement']['value'][] = array(
|
78 |
+
'label' => sprintf('%s | %s', $item->getId(), $item->getName()),
|
79 |
+
'value' => sprintf('checkout/agreement#%s', $item->getId()),
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
return $options;
|
84 |
+
}
|
85 |
+
}
|
app/code/community/NRApps/ProtectedShops/Model/Api.php
ADDED
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Model_Api
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Model_Api
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var NRApps_ProtectedShops_Helper_Data
|
21 |
+
*/
|
22 |
+
protected $_helper;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var NRApps_ProtectedShops_Helper_Config
|
26 |
+
*/
|
27 |
+
protected $_config;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var NRApps_ProtectedShops_Model_Flag
|
31 |
+
*/
|
32 |
+
protected $_flag;
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
*
|
37 |
+
*/
|
38 |
+
public function __construct()
|
39 |
+
{
|
40 |
+
$this->_helper = Mage::helper('nrapps_protectedshops/data');
|
41 |
+
$this->_config = Mage::helper('nrapps_protectedshops/config');
|
42 |
+
$this->_flag = Mage::getModel('nrapps_protectedshops/flag');
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @return array
|
48 |
+
*/
|
49 |
+
public function info()
|
50 |
+
{
|
51 |
+
$documentInfoShop = array(
|
52 |
+
'error' => array(),
|
53 |
+
'info' => array(),
|
54 |
+
);
|
55 |
+
|
56 |
+
try {
|
57 |
+
foreach ($this->_getDocumentInfoMap() as $shopId) {
|
58 |
+
|
59 |
+
$documentInfoShop['info'][] = $this->_helper->__('Document Info for Shop Id: %s', $shopId);
|
60 |
+
|
61 |
+
try {
|
62 |
+
|
63 |
+
foreach ($this->_getDocumentInfo($shopId) as $documentType => $documentDate) {
|
64 |
+
|
65 |
+
$documentInfoShop['info'][] = $this->_helper->__(' %s: %s', $documentType, $documentDate);
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
} catch (Exception $e) {
|
70 |
+
$documentInfoShop['error'][$e->getMessage()] = $e->getMessage();
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
} catch (Exception $e) {
|
75 |
+
$documentInfoShop['error'][$e->getMessage()] = $e->getMessage();
|
76 |
+
}
|
77 |
+
|
78 |
+
return $documentInfoShop;
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @return array
|
84 |
+
*/
|
85 |
+
public function import()
|
86 |
+
{
|
87 |
+
$error = array();
|
88 |
+
|
89 |
+
try {
|
90 |
+
foreach ($this->_getDocumentMap() as $map) {
|
91 |
+
|
92 |
+
try {
|
93 |
+
$document = $this->_getDocument($map['shop_id'], $map['document'], $map['format']);
|
94 |
+
|
95 |
+
foreach ($map['destination'] as $destination) {
|
96 |
+
|
97 |
+
try {
|
98 |
+
$this->_updateDestination($destination, $document);
|
99 |
+
} catch (Exception $e) {
|
100 |
+
$error[$e->getMessage()] = $e->getMessage();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
} catch (Exception $e) {
|
105 |
+
$error[$e->getMessage()] = $e->getMessage();
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
} catch (Exception $e) {
|
110 |
+
$error[$e->getMessage()] = $e->getMessage();
|
111 |
+
}
|
112 |
+
|
113 |
+
return $error;
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
/**
|
118 |
+
* @return array
|
119 |
+
*/
|
120 |
+
private function _getDocumentMap()
|
121 |
+
{
|
122 |
+
$mapList = array();
|
123 |
+
|
124 |
+
foreach (Mage::app()->getStores() as $store) {
|
125 |
+
|
126 |
+
$shopId = $this->_config->getShopId($store);
|
127 |
+
|
128 |
+
if ($shopId) {
|
129 |
+
foreach ($this->_config->getMap($store) as $mapLine) {
|
130 |
+
|
131 |
+
$map = array(
|
132 |
+
'shop_id' => $shopId,
|
133 |
+
'document' => $mapLine['document'],
|
134 |
+
'format' => $mapLine['format']
|
135 |
+
);
|
136 |
+
|
137 |
+
$mapKey = implode('|', $map);
|
138 |
+
|
139 |
+
if (!array_key_exists($mapKey, $mapList)) {
|
140 |
+
$mapList[$mapKey] = $map;
|
141 |
+
}
|
142 |
+
|
143 |
+
$mapList[$mapKey]['destination'][$mapLine['destination']] = $mapLine['destination'];
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
if (!$mapList) {
|
149 |
+
Mage::throwException($this->_helper->__('Configuration not completed.'));
|
150 |
+
}
|
151 |
+
|
152 |
+
return $mapList;
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
/**
|
157 |
+
* @return array
|
158 |
+
*/
|
159 |
+
private function _getDocumentInfoMap()
|
160 |
+
{
|
161 |
+
$mapList = array();
|
162 |
+
|
163 |
+
foreach (Mage::app()->getStores() as $store) {
|
164 |
+
|
165 |
+
if ($shopId = $this->_config->getShopId($store)) {
|
166 |
+
$mapList[$shopId] = $shopId;
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
if (!$mapList) {
|
171 |
+
Mage::throwException($this->_helper->__('Configuration not completed.'));
|
172 |
+
}
|
173 |
+
|
174 |
+
return $mapList;
|
175 |
+
}
|
176 |
+
|
177 |
+
|
178 |
+
/**
|
179 |
+
* @param string $shopId
|
180 |
+
* @param string $document
|
181 |
+
* @param string $format
|
182 |
+
*
|
183 |
+
* @return string
|
184 |
+
* @throws Exception
|
185 |
+
*/
|
186 |
+
protected function _getDocument($shopId, $document, $format)
|
187 |
+
{
|
188 |
+
$apiUrl = sprintf('%s?Request=GetDocument&ShopId=%s&Document=%s&Format=%s', $this->_config->getApiUrl(), $shopId, $document, $format);
|
189 |
+
$client = new Zend_Http_Client($apiUrl);
|
190 |
+
$response = $client->request();
|
191 |
+
|
192 |
+
if ($response->getStatus() != 200) {
|
193 |
+
Mage::throwException($this->_helper->__('API Response Status Error'));
|
194 |
+
}
|
195 |
+
|
196 |
+
if ($response->getHeader('Content-type') != 'text/xml') {
|
197 |
+
Mage::throwException($this->_helper->__('API Response Content Type Error'));
|
198 |
+
}
|
199 |
+
|
200 |
+
$documentData = simplexml_load_string($response->getBody());
|
201 |
+
|
202 |
+
if ($documentData->error) {
|
203 |
+
Mage::throwException((string)$documentData->error->msg);
|
204 |
+
}
|
205 |
+
|
206 |
+
if ($this->_config->isHashValidate() && md5((string)$documentData->Document) != (string)$documentData->MD5) {
|
207 |
+
Mage::throwException($this->_helper->__('API Response Document Hash Error %s - %s.', (string)$documentData->MD5, md5((string)$documentData->Document)));
|
208 |
+
}
|
209 |
+
|
210 |
+
return (string)$documentData->Document;
|
211 |
+
}
|
212 |
+
|
213 |
+
|
214 |
+
/**
|
215 |
+
* @param $shopId
|
216 |
+
*
|
217 |
+
* @return string
|
218 |
+
*/
|
219 |
+
protected function _getDocumentInfo($shopId)
|
220 |
+
{
|
221 |
+
$apiUrl = sprintf('%s?Request=GetDocumentInfo&ShopId=%s&', $this->_config->getApiUrl(), $shopId);
|
222 |
+
$client = new Zend_Http_Client($apiUrl);
|
223 |
+
$response = $client->request();
|
224 |
+
|
225 |
+
if ($response->getStatus() != 200) {
|
226 |
+
Mage::throwException($this->_helper->__('API Response Status Error'));
|
227 |
+
}
|
228 |
+
|
229 |
+
if ($response->getHeader('Content-type') != 'text/xml') {
|
230 |
+
Mage::throwException($this->_helper->__('API Response Content Type Error'));
|
231 |
+
}
|
232 |
+
|
233 |
+
$documentData = simplexml_load_string($response->getBody());
|
234 |
+
|
235 |
+
if ($documentData->error) {
|
236 |
+
Mage::throwException((string)$documentData->error->msg);
|
237 |
+
}
|
238 |
+
|
239 |
+
$this->_flag->setDocuments(array_keys((array)$documentData->DocumentDate));
|
240 |
+
|
241 |
+
return (array)$documentData->DocumentDate;
|
242 |
+
}
|
243 |
+
|
244 |
+
|
245 |
+
/**
|
246 |
+
* @param string $destination
|
247 |
+
* @param string $content
|
248 |
+
*
|
249 |
+
* @return $this
|
250 |
+
*/
|
251 |
+
protected function _updateDestination($destination, $content)
|
252 |
+
{
|
253 |
+
$destination = explode('#', $destination);
|
254 |
+
$modelClass = array_shift($destination);
|
255 |
+
$entityId = array_shift($destination);
|
256 |
+
|
257 |
+
$model = Mage::getModel($modelClass);
|
258 |
+
$model->load($entityId);
|
259 |
+
|
260 |
+
if ($model->getId()) {
|
261 |
+
if ($modelClass == 'cms/page') {
|
262 |
+
$model->setData('content', $content);
|
263 |
+
$model->setData('stores', $model->getData('store_id'));
|
264 |
+
$model->save();
|
265 |
+
} elseif ($modelClass == 'cms/block') {
|
266 |
+
$model->setData('content', $content);
|
267 |
+
$model->save();
|
268 |
+
} elseif ($modelClass == 'checkout/agreement') {
|
269 |
+
$model->setData('content', $content);
|
270 |
+
$model->save();
|
271 |
+
} else {
|
272 |
+
Mage::throwException($this->_helper->__('Unknown model: "%s"', $model));
|
273 |
+
}
|
274 |
+
} else {
|
275 |
+
Mage::throwException($this->_helper->__('Unknown model entity: "%s" (%s)', $entityId, $model));
|
276 |
+
}
|
277 |
+
|
278 |
+
return $this;
|
279 |
+
}
|
280 |
+
}
|
app/code/community/NRApps/ProtectedShops/Model/Cron.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Model_Cron
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Model_Cron extends NRApps_ProtectedShops_Model_Api
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
*
|
21 |
+
*/
|
22 |
+
const FUZZY_TIME = 300;
|
23 |
+
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @param Mage_Cron_Model_Schedule $cron
|
27 |
+
*
|
28 |
+
* @return $this
|
29 |
+
*/
|
30 |
+
public function scheduling(Mage_Cron_Model_Schedule $cron)
|
31 |
+
{
|
32 |
+
if ($this->_config->isAutoUpdateIsActive()) {
|
33 |
+
|
34 |
+
if ($this->_flag->getErrorCount() || time() > $this->_getScheduleTime()) {
|
35 |
+
|
36 |
+
$this->_flag->setScheduleTime(time());
|
37 |
+
|
38 |
+
if ($error = $this->import()) {
|
39 |
+
|
40 |
+
$cron->setMessages(implode("\n", $error));
|
41 |
+
|
42 |
+
$this->_flag->incrementErrorCount();
|
43 |
+
|
44 |
+
if ($this->_flag->getErrorCount() >= $this->_config->getAutoUpdateErrorEmailThreshold()) {
|
45 |
+
|
46 |
+
$this->_sendErrorMessage($error);
|
47 |
+
}
|
48 |
+
|
49 |
+
} else {
|
50 |
+
$this->_flag->unsetErrorCount();
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @return int
|
61 |
+
*/
|
62 |
+
protected function _getScheduleTime()
|
63 |
+
{
|
64 |
+
return $this->_config->getAutoUpdateInterval() * 60 * 60 + $this->_flag->getScheduleTime() - self::FUZZY_TIME;
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @param $error
|
70 |
+
*/
|
71 |
+
protected function _sendErrorMessage($error)
|
72 |
+
{
|
73 |
+
$emailTo = array(
|
74 |
+
$this->_config->getAutoUpdateErrorEmailRecipientProtectedShops(),
|
75 |
+
$this->_config->getAutoUpdateErrorEmailRecipient(),
|
76 |
+
);
|
77 |
+
|
78 |
+
$templateId = $this->_config->getAutoUpdateErrorEmailTemplate();
|
79 |
+
$sender = $this->_config->getAutoUpdateErrorEmailSenderIdentity();
|
80 |
+
|
81 |
+
/** @var $emailTemplate Mage_Core_Model_Email_Template */
|
82 |
+
$emailTemplate = Mage::getModel('core/email_template');
|
83 |
+
|
84 |
+
foreach ($emailTo as $email) {
|
85 |
+
|
86 |
+
if ($email) {
|
87 |
+
|
88 |
+
$emailTemplate->setDesignConfig(array('area' => 'adminhtml', 'store' => Mage_Core_Model_App::ADMIN_STORE_ID));
|
89 |
+
$emailTemplate->sendTransactional(
|
90 |
+
$templateId,
|
91 |
+
$sender,
|
92 |
+
$email,
|
93 |
+
null,
|
94 |
+
array('error' => implode("\n", (array)$error)),
|
95 |
+
Mage_Core_Model_App::ADMIN_STORE_ID
|
96 |
+
);
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
app/code/community/NRApps/ProtectedShops/Model/Flag.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Model_Flag
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Model_Flag
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var Mage_Core_Model_Flag
|
21 |
+
*/
|
22 |
+
protected $_flag;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var array
|
26 |
+
*/
|
27 |
+
protected $_flagData;
|
28 |
+
|
29 |
+
|
30 |
+
/**
|
31 |
+
*
|
32 |
+
*/
|
33 |
+
public function __construct()
|
34 |
+
{
|
35 |
+
$this->_flag = Mage::getModel('core/flag', array('flag_code' => 'nrapps_protectedshops'));
|
36 |
+
$this->_flag->loadSelf();
|
37 |
+
|
38 |
+
$this->_flagData = (array)$this->_flag->getFlagData();
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
/**
|
43 |
+
*
|
44 |
+
*/
|
45 |
+
public function __destruct()
|
46 |
+
{
|
47 |
+
$this->_flag->setFlagData($this->_flagData);
|
48 |
+
$this->_flag->save();
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @param string $key
|
54 |
+
* @param mixed $value
|
55 |
+
*/
|
56 |
+
public function setFlag($key, $value)
|
57 |
+
{
|
58 |
+
$this->_flagData[(string)$key] = $value;
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param string $key
|
64 |
+
*
|
65 |
+
* @return mixed
|
66 |
+
*/
|
67 |
+
public function getFlag($key)
|
68 |
+
{
|
69 |
+
if (array_key_exists((string)$key, $this->_flagData)) {
|
70 |
+
return $this->_flagData[(string)$key];
|
71 |
+
}
|
72 |
+
|
73 |
+
return null;
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @param array $documents
|
79 |
+
*
|
80 |
+
* @return $this
|
81 |
+
*/
|
82 |
+
public function setDocuments(array $documents)
|
83 |
+
{
|
84 |
+
$this->setFlag('documents', $documents);
|
85 |
+
|
86 |
+
return $this;
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @return array
|
92 |
+
*/
|
93 |
+
public function getDocuments()
|
94 |
+
{
|
95 |
+
return (array)$this->getFlag('documents');
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @return int
|
101 |
+
*/
|
102 |
+
public function getErrorCount()
|
103 |
+
{
|
104 |
+
return $this->getFlag('error_count') ? (int)$this->getFlag('error_count') : 0;
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
/**
|
109 |
+
* @return $this
|
110 |
+
*/
|
111 |
+
public function incrementErrorCount()
|
112 |
+
{
|
113 |
+
$this->setFlag('error_count', $this->getErrorCount() + 1);
|
114 |
+
|
115 |
+
return $this;
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
/**
|
120 |
+
* @return $this
|
121 |
+
*/
|
122 |
+
public function unsetErrorCount()
|
123 |
+
{
|
124 |
+
$this->setFlag('error_count', 0);
|
125 |
+
|
126 |
+
return $this;
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @param $time
|
132 |
+
*
|
133 |
+
* @return $this
|
134 |
+
*/
|
135 |
+
public function setScheduleTime($time)
|
136 |
+
{
|
137 |
+
$this->setFlag('schedule_time', (int)$time);
|
138 |
+
|
139 |
+
return $this;
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
/**
|
144 |
+
* @return int
|
145 |
+
*/
|
146 |
+
public function getScheduleTime()
|
147 |
+
{
|
148 |
+
return $this->getFlag('schedule_time') ? (int)$this->getFlag('schedule_time') : 0;
|
149 |
+
}
|
150 |
+
}
|
app/code/community/NRApps/ProtectedShops/Model/System/Config/Backend/Serialized/Map.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Model_System_Config_Backend_Serialized_Map
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Model_System_Config_Backend_Serialized_Map extends Mage_Adminhtml_Model_System_Config_Backend_Serialized
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
*
|
21 |
+
*/
|
22 |
+
protected function _beforeSave()
|
23 |
+
{
|
24 |
+
$value = $this->getValue();
|
25 |
+
$valueSorted = array();
|
26 |
+
|
27 |
+
if (is_array($value)) {
|
28 |
+
|
29 |
+
foreach (array_keys(Mage::helper('nrapps_protectedshops')->getDocumentOptions()) as $legalText) {
|
30 |
+
|
31 |
+
foreach ($value as $key => $row) {
|
32 |
+
|
33 |
+
if (is_array($row) && array_key_exists('document', $row) && $row['document'] == $legalText) {
|
34 |
+
$valueSorted[$key] = $row;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
$this->setValue($valueSorted);
|
41 |
+
|
42 |
+
parent::_beforeSave();
|
43 |
+
}
|
44 |
+
}
|
app/code/community/NRApps/ProtectedShops/Model/System/Config/Source/Interval.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Model_System_Config_Source_Interval
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Model_System_Config_Source_Interval
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Options getter
|
21 |
+
*
|
22 |
+
* @return array
|
23 |
+
*/
|
24 |
+
public function toOptionArray()
|
25 |
+
{
|
26 |
+
return array(
|
27 |
+
array('value' => 6, 'label' => Mage::helper('nrapps_protectedshops')->__('6 Hours')),
|
28 |
+
array('value' => 12, 'label' => Mage::helper('nrapps_protectedshops')->__('12 Hours')),
|
29 |
+
array('value' => 24, 'label' => Mage::helper('nrapps_protectedshops')->__('24 Hours')),
|
30 |
+
);
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Get options in "key-value" format
|
36 |
+
*
|
37 |
+
* @return array
|
38 |
+
*/
|
39 |
+
public function toArray()
|
40 |
+
{
|
41 |
+
return array(
|
42 |
+
6 => Mage::helper('nrapps_protectedshops')->__('6 Hours'),
|
43 |
+
12 => Mage::helper('nrapps_protectedshops')->__('12 Hours'),
|
44 |
+
24 => Mage::helper('nrapps_protectedshops')->__('24 Hours'),
|
45 |
+
);
|
46 |
+
}
|
47 |
+
}
|
app/code/community/NRApps/ProtectedShops/controllers/Adminhtml/Nrappsprotectedshops/ConfigController.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class NRApps_ProtectedShops_Adminhtml_Nrappsprotectedshops_ConfigController
|
14 |
+
*/
|
15 |
+
class NRApps_ProtectedShops_Adminhtml_Nrappsprotectedshops_ConfigController extends Mage_Adminhtml_Controller_Action
|
16 |
+
{
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Insert legislative texts
|
21 |
+
*
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
public function importAction()
|
25 |
+
{
|
26 |
+
try {
|
27 |
+
$errors = Mage::getModel('nrapps_protectedshops/api')->import();
|
28 |
+
|
29 |
+
if ($errors) {
|
30 |
+
|
31 |
+
foreach ($errors as $error) {
|
32 |
+
Mage::getSingleton('adminhtml/session')->addError($error);
|
33 |
+
}
|
34 |
+
} else {
|
35 |
+
|
36 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('nrapps_protectedshops')->__('Import legal text success'));
|
37 |
+
}
|
38 |
+
} catch (Exception $e) {
|
39 |
+
|
40 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('nrapps_protectedshops')->__(Mage::helper('nrapps_protectedshops')->__($e->getMessage())));
|
41 |
+
}
|
42 |
+
|
43 |
+
$this->_redirect('adminhtml/system_config/edit', array('section' => 'nrapps_protectedshops'));
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Insert legislative texts
|
49 |
+
*
|
50 |
+
* @return void
|
51 |
+
*/
|
52 |
+
public function infoAction()
|
53 |
+
{
|
54 |
+
try {
|
55 |
+
$info = Mage::getModel('nrapps_protectedshops/api')->info();
|
56 |
+
|
57 |
+
if ($info['error']) {
|
58 |
+
|
59 |
+
foreach ($info['error'] as $error) {
|
60 |
+
Mage::getSingleton('adminhtml/session')->addError($error);
|
61 |
+
}
|
62 |
+
} else {
|
63 |
+
|
64 |
+
foreach ($info['info'] as $info) {
|
65 |
+
Mage::getSingleton('adminhtml/session')->addNotice($info);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
} catch (Exception $e) {
|
69 |
+
|
70 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('nrapps_protectedshops')->__($e->getMessage()));
|
71 |
+
}
|
72 |
+
|
73 |
+
$this->_redirect('adminhtml/system_config/edit', array('section' => 'nrapps_protectedshops'));
|
74 |
+
}
|
75 |
+
}
|
app/code/community/NRApps/ProtectedShops/etc/adminhtml.xml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category NRApps
|
5 |
+
* @package NRApps_ProtectedShops
|
6 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
8 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
9 |
+
* @author Viktor Franz <vf@integer-net.de>
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
|
13 |
+
<config>
|
14 |
+
<acl>
|
15 |
+
<resources>
|
16 |
+
<admin>
|
17 |
+
<children>
|
18 |
+
<system>
|
19 |
+
<children>
|
20 |
+
<config>
|
21 |
+
<children>
|
22 |
+
<nrapps_protectedshops translate="title" module="nrapps_protectedshops">
|
23 |
+
<title>Protected Shops</title>
|
24 |
+
</nrapps_protectedshops>
|
25 |
+
</children>
|
26 |
+
</config>
|
27 |
+
</children>
|
28 |
+
</system>
|
29 |
+
</children>
|
30 |
+
</admin>
|
31 |
+
</resources>
|
32 |
+
</acl>
|
33 |
+
</config>
|
app/code/community/NRApps/ProtectedShops/etc/config.xml
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category NRApps
|
5 |
+
* @package NRApps_ProtectedShops
|
6 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
8 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
9 |
+
* @author Viktor Franz <vf@integer-net.de>
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
|
13 |
+
<config>
|
14 |
+
<modules>
|
15 |
+
<NRApps_ProtectedShops>
|
16 |
+
<version>1.0.0</version>
|
17 |
+
</NRApps_ProtectedShops>
|
18 |
+
</modules>
|
19 |
+
<global>
|
20 |
+
<helpers>
|
21 |
+
<nrapps_protectedshops>
|
22 |
+
<class>NRApps_ProtectedShops_Helper</class>
|
23 |
+
</nrapps_protectedshops>
|
24 |
+
</helpers>
|
25 |
+
<blocks>
|
26 |
+
<nrapps_protectedshops>
|
27 |
+
<class>NRApps_ProtectedShops_Block</class>
|
28 |
+
</nrapps_protectedshops>
|
29 |
+
</blocks>
|
30 |
+
<models>
|
31 |
+
<nrapps_protectedshops>
|
32 |
+
<class>NRApps_ProtectedShops_Model</class>
|
33 |
+
</nrapps_protectedshops>
|
34 |
+
</models>
|
35 |
+
<template>
|
36 |
+
<email>
|
37 |
+
<nrapps_protectedshops_auto_update_error_email_template translate="label" module="nrapps_protectedshops">
|
38 |
+
<label>Protected Shops Auto Update Error</label>
|
39 |
+
<file>nrapps_protectedshops_auto_update_error_email.html</file>
|
40 |
+
<type>text</type>
|
41 |
+
</nrapps_protectedshops_auto_update_error_email_template>
|
42 |
+
</email>
|
43 |
+
</template>
|
44 |
+
</global>
|
45 |
+
<admin>
|
46 |
+
<routers>
|
47 |
+
<adminhtml>
|
48 |
+
<args>
|
49 |
+
<modules>
|
50 |
+
<NRApps_ProtectedShops before="Mage_Adminhtml">NRApps_ProtectedShops_Adminhtml</NRApps_ProtectedShops>
|
51 |
+
</modules>
|
52 |
+
</args>
|
53 |
+
</adminhtml>
|
54 |
+
</routers>
|
55 |
+
</admin>
|
56 |
+
<adminhtml>
|
57 |
+
<translate>
|
58 |
+
<modules>
|
59 |
+
<NRApps_ProtectedShops>
|
60 |
+
<files>
|
61 |
+
<default>NRApps_ProtectedShops.csv</default>
|
62 |
+
</files>
|
63 |
+
</NRApps_ProtectedShops>
|
64 |
+
</modules>
|
65 |
+
</translate>
|
66 |
+
</adminhtml>
|
67 |
+
<crontab>
|
68 |
+
<jobs>
|
69 |
+
<nrapps_protectedshops>
|
70 |
+
<schedule>
|
71 |
+
<cron_expr>43 */1 * * *</cron_expr>
|
72 |
+
</schedule>
|
73 |
+
<run>
|
74 |
+
<model>nrapps_protectedshops/cron::scheduling</model>
|
75 |
+
</run>
|
76 |
+
</nrapps_protectedshops>
|
77 |
+
</jobs>
|
78 |
+
</crontab>
|
79 |
+
<default>
|
80 |
+
<nrapps_protectedshops>
|
81 |
+
<setting>
|
82 |
+
<api_uri><![CDATA[https://www.protectedshops.de/api/]]></api_uri>
|
83 |
+
<shop_id/>
|
84 |
+
<map/>
|
85 |
+
<hash_validate>0</hash_validate>
|
86 |
+
</setting>
|
87 |
+
<auto_update>
|
88 |
+
<is_active>0</is_active>
|
89 |
+
<interval>12</interval>
|
90 |
+
<error_email_threshold>3</error_email_threshold>
|
91 |
+
<error_email_recipient_protectedshops />
|
92 |
+
<error_email_recipient />
|
93 |
+
<error_email_sender_identity>general</error_email_sender_identity>
|
94 |
+
<error_email_template>nrapps_protectedshops_auto_update_error_email_template</error_email_template>
|
95 |
+
</auto_update>
|
96 |
+
</nrapps_protectedshops>
|
97 |
+
</default>
|
98 |
+
</config>
|
app/code/community/NRApps/ProtectedShops/etc/system.xml
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category NRApps
|
5 |
+
* @package NRApps_ProtectedShops
|
6 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
8 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
9 |
+
* @author Viktor Franz <vf@integer-net.de>
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
|
13 |
+
<config>
|
14 |
+
<sections>
|
15 |
+
<nrapps_protectedshops translate="label comment" module="nrapps_protectedshops">
|
16 |
+
<label>Protected Shops</label>
|
17 |
+
<tab>general</tab>
|
18 |
+
<frontend_type>text</frontend_type>
|
19 |
+
<sort_order>2000</sort_order>
|
20 |
+
<show_in_default>1</show_in_default>
|
21 |
+
<show_in_website>1</show_in_website>
|
22 |
+
<show_in_store>1</show_in_store>
|
23 |
+
<groups>
|
24 |
+
<setting>
|
25 |
+
<label>Settings</label>
|
26 |
+
<sort_order>10</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
<fields>
|
31 |
+
<shop_id>
|
32 |
+
<label>Shop Id</label>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>10</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</shop_id>
|
39 |
+
<map>
|
40 |
+
<label>Map</label>
|
41 |
+
<frontend_model>nrapps_protectedshops/adminhtml_system_config_form_field_map</frontend_model>
|
42 |
+
<backend_model>nrapps_protectedshops/system_config_backend_serialized_map</backend_model>
|
43 |
+
<sort_order>20</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>1</show_in_website>
|
46 |
+
<show_in_store>1</show_in_store>
|
47 |
+
</map>
|
48 |
+
<info>
|
49 |
+
<frontend_model>nrapps_protectedshops/adminhtml_system_config_info</frontend_model>
|
50 |
+
<sort_order>30</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</info>
|
55 |
+
<apply>
|
56 |
+
<frontend_model>nrapps_protectedshops/adminhtml_system_config_import</frontend_model>
|
57 |
+
<sort_order>40</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</apply>
|
62 |
+
</fields>
|
63 |
+
</setting>
|
64 |
+
<auto_update>
|
65 |
+
<label>Auto Update</label>
|
66 |
+
<sort_order>20</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
<fields>
|
71 |
+
<is_active>
|
72 |
+
<label>Active</label>
|
73 |
+
<frontend_type>select</frontend_type>
|
74 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
75 |
+
<sort_order>10</sort_order>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>0</show_in_website>
|
78 |
+
<show_in_store>0</show_in_store>
|
79 |
+
</is_active>
|
80 |
+
<interval>
|
81 |
+
<label>Interval</label>
|
82 |
+
<frontend_type>select</frontend_type>
|
83 |
+
<source_model>nrapps_protectedshops/system_config_source_interval</source_model>
|
84 |
+
<sort_order>20</sort_order>
|
85 |
+
<depends><is_active>1</is_active></depends>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>0</show_in_website>
|
88 |
+
<show_in_store>0</show_in_store>
|
89 |
+
</interval>
|
90 |
+
<error_email_recipient>
|
91 |
+
<label>On Error Send Emails To</label>
|
92 |
+
<frontend_type>text</frontend_type>
|
93 |
+
<sort_order>30</sort_order>
|
94 |
+
<depends><is_active>1</is_active></depends>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>0</show_in_website>
|
97 |
+
<show_in_store>0</show_in_store>
|
98 |
+
</error_email_recipient>
|
99 |
+
<error_email_sender_identity>
|
100 |
+
<label>On Error Email Sender</label>
|
101 |
+
<frontend_type>select</frontend_type>
|
102 |
+
<source_model>adminhtml/system_config_source_email_identity</source_model>
|
103 |
+
<sort_order>40</sort_order>
|
104 |
+
<depends><is_active>1</is_active></depends>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>0</show_in_website>
|
107 |
+
<show_in_store>0</show_in_store>
|
108 |
+
</error_email_sender_identity>
|
109 |
+
<error_email_template translate="label">
|
110 |
+
<label>On Error Email Template</label>
|
111 |
+
<frontend_type>select</frontend_type>
|
112 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
113 |
+
<sort_order>50</sort_order>
|
114 |
+
<depends><is_active>1</is_active></depends>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>0</show_in_website>
|
117 |
+
<show_in_store>0</show_in_store>
|
118 |
+
</error_email_template>
|
119 |
+
</fields>
|
120 |
+
</auto_update>
|
121 |
+
</groups>
|
122 |
+
</nrapps_protectedshops>
|
123 |
+
</sections>
|
124 |
+
</config>
|
app/design/adminhtml/default/default/template/nrapps_protectedshops/import.phtml
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @see NRApps_ProtectedShops_Block_Adminhtml_System_Config_Import
|
13 |
+
* @see NRApps_ProtectedShops_Adminhtml_nrappsprotectedshops_ConfigController
|
14 |
+
* @var $this NRApps_ProtectedShops_Block_Adminhtml_System_Config_Import
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
|
18 |
+
<script type="text/javascript">
|
19 |
+
//<![CDATA[
|
20 |
+
|
21 |
+
NRAppsProtectedShopsImport = Class.create();
|
22 |
+
NRAppsProtectedShopsImport.prototype = {
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
*/
|
27 |
+
initialize: function () {
|
28 |
+
this.lock = false;
|
29 |
+
|
30 |
+
Event.observe('config_edit_form', 'change', function () {
|
31 |
+
this.lock = true;
|
32 |
+
}.bind(this));
|
33 |
+
},
|
34 |
+
|
35 |
+
/**
|
36 |
+
*
|
37 |
+
*/
|
38 |
+
exec: function () {
|
39 |
+
if (this.lock) {
|
40 |
+
this._showLockErrorMessage();
|
41 |
+
} else {
|
42 |
+
window.location = '<?php echo $this->getAjaxUrl() ?>';
|
43 |
+
}
|
44 |
+
},
|
45 |
+
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* @private
|
49 |
+
*/
|
50 |
+
_showLockErrorMessage: function () {
|
51 |
+
|
52 |
+
var message = '<div id="messages"><ul class="messages"><li class="notice-msg"><ul><li><span><?php echo $this->__('Please save settings before import documents.') ?></span></li></ul></li></ul></div>';
|
53 |
+
|
54 |
+
if ($('messages')) {
|
55 |
+
$('messages').replace(message);
|
56 |
+
} else {
|
57 |
+
$('content').down().insert({top: message});
|
58 |
+
}
|
59 |
+
}
|
60 |
+
};
|
61 |
+
|
62 |
+
var nrAppsProtectedShopsImport = new NRAppsProtectedShopsImport();
|
63 |
+
|
64 |
+
//]]>
|
65 |
+
</script>
|
66 |
+
|
67 |
+
<button type="button" onclick="nrAppsProtectedShopsImport.exec();" id="<?php echo $this->getHtmlId() ?>" class="scalable" style="width: 200px;" >
|
68 |
+
<span><?php echo $this->escapeHtml($this->getButtonLabel()) ?></span>
|
69 |
+
</button>
|
app/design/adminhtml/default/default/template/nrapps_protectedshops/info.phtml
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category NRApps
|
4 |
+
* @package NRApps_ProtectedShops
|
5 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
7 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
8 |
+
* @author Viktor Franz <vf@integer-net.de>
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @see NRApps_ProtectedShops_Block_Adminhtml_System_Config_Info
|
13 |
+
* @see NRApps_ProtectedShops_Adminhtml_nrappsprotectedshops_ConfigController
|
14 |
+
* @var $this NRApps_ProtectedShops_Block_Adminhtml_System_Config_Info
|
15 |
+
*/
|
16 |
+
?>
|
17 |
+
|
18 |
+
<script type="text/javascript">
|
19 |
+
//<![CDATA[
|
20 |
+
|
21 |
+
NRAppsProtectedShopsInfo = Class.create();
|
22 |
+
NRAppsProtectedShopsInfo.prototype = {
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
*/
|
27 |
+
initialize: function () {
|
28 |
+
this.lock = false;
|
29 |
+
|
30 |
+
Event.observe('config_edit_form', 'change', function () {
|
31 |
+
this.lock = true;
|
32 |
+
}.bind(this));
|
33 |
+
},
|
34 |
+
|
35 |
+
/**
|
36 |
+
*
|
37 |
+
*/
|
38 |
+
exec: function () {
|
39 |
+
if (this.lock) {
|
40 |
+
this._showLockErrorMessage();
|
41 |
+
} else {
|
42 |
+
window.location = '<?php echo $this->getAjaxUrl() ?>';
|
43 |
+
}
|
44 |
+
},
|
45 |
+
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* @private
|
49 |
+
*/
|
50 |
+
_showLockErrorMessage: function () {
|
51 |
+
|
52 |
+
var message = '<div id="messages"><ul class="messages"><li class="notice-msg"><ul><li><span><?php echo $this->__('Please save settings before get document info.') ?></span></li></ul></li></ul></div>';
|
53 |
+
|
54 |
+
if ($('messages')) {
|
55 |
+
$('messages').replace(message);
|
56 |
+
} else {
|
57 |
+
$('content').down().insert({top: message});
|
58 |
+
}
|
59 |
+
}
|
60 |
+
};
|
61 |
+
|
62 |
+
var nrAppsProtectedShopsInfo = new NRAppsProtectedShopsInfo();
|
63 |
+
|
64 |
+
//]]>
|
65 |
+
</script>
|
66 |
+
|
67 |
+
<div style="width: 800px;">
|
68 |
+
<button type="button" onclick="nrAppsProtectedShopsInfo.exec();" id="<?php echo $this->getHtmlId() ?>" class="scalable" style="width: 200px;">
|
69 |
+
<span><?php echo $this->escapeHtml($this->getButtonLabel()) ?></span>
|
70 |
+
</button>
|
71 |
+
<span><?php echo $this->__('Press button to load document types.') ?></span>
|
72 |
+
</div>
|
73 |
+
|
app/etc/modules/NRApps_ProtectedShops.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category NRApps
|
5 |
+
* @package NRApps_ProtectedShops
|
6 |
+
* @copyright Copyright (c) 2014 integer_net GmbH (http://www.integer-net.de/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software Licence 3.0 (OSL-3.0)
|
8 |
+
* @author nr-apps.com (http://www.nr-apps.com/) powered by integer_net GmbH
|
9 |
+
* @author Viktor Franz <vf@integer-net.de>
|
10 |
+
*/
|
11 |
+
-->
|
12 |
+
|
13 |
+
<config>
|
14 |
+
<modules>
|
15 |
+
<NRApps_ProtectedShops>
|
16 |
+
<active>true</active>
|
17 |
+
<codePool>community</codePool>
|
18 |
+
</NRApps_ProtectedShops>
|
19 |
+
</modules>
|
20 |
+
</config>
|
app/locale/de_DE/NRApps_ProtectedShops.csv
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Protected Shops","Protected Shops"
|
2 |
+
"Settings","Settings"
|
3 |
+
"Shop Id","Shop Id"
|
4 |
+
"Map","Map"
|
5 |
+
"Get/Show Documents Info","Get/Show Documents Info"
|
6 |
+
"Press button to load document types.","Press button to load document types."
|
7 |
+
"Please save settings before get document info.","Please save settings before get document info."
|
8 |
+
"Import Documents","Import Documents"
|
9 |
+
"Please save settings before import documents.","Please save settings before import documents."
|
10 |
+
"Document","Document"
|
11 |
+
"Destination","Destination"
|
12 |
+
"CMS Pages","CMS Pages"
|
13 |
+
"CMS Blocks","CMS Blocks"
|
14 |
+
"Agreements","Agreements"
|
15 |
+
"Unknown model: ""%s""","Unknown model: ""%s"""
|
16 |
+
"Unknown model entity: ""%s""","Unknown model entity: ""%s"""
|
17 |
+
"Format","Format"
|
18 |
+
"HTML","HTML"
|
19 |
+
"HTML-Lite","HTML-Lite"
|
20 |
+
"Text","Text"
|
21 |
+
"PDF","PDF"
|
22 |
+
"Add Row","Add Row"
|
23 |
+
"Auto Update","Auto Update"
|
24 |
+
"Active","Active"
|
25 |
+
"Interval","Interval"
|
26 |
+
"6 Hours","6 Hours"
|
27 |
+
"12 Hours","12 Hours"
|
28 |
+
"24 Hours","24 Hours"
|
29 |
+
"On Error Send Emails To","On Error Send Emails To"
|
30 |
+
"On Error Email Sender","On Error Email Sender"
|
31 |
+
"On Error Email Template","On Error Email Template"
|
32 |
+
"Protected Shops Auto Update Error","Protected Shops Auto Update Error"
|
33 |
+
"Import legal text success","Import legal text success"
|
34 |
+
"Document Info for Shop Id: %s","Document Info for Shop Id: %s"
|
35 |
+
"Configuration not completed.","Configuration not completed."
|
36 |
+
"API Response Status Error","API Response Status Error"
|
37 |
+
"API Response Content Type Error","API Response Content Type Error"
|
38 |
+
"API Response Document Hash Error %s - %s.","API Response Document Hash Error %s - %s."
|
39 |
+
"API Response Status Error","API Response Status Error"
|
40 |
+
"API Response Content Type Error","API Response Content Type Error"
|
app/locale/de_DE/template/email/nrapps_protectedshops_auto_update_error_email.html
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject Protected Shops Auto Update Error@-->
|
2 |
+
|
3 |
+
Protected Shops Auto Update Error Report
|
4 |
+
----------------------------------------
|
5 |
+
|
6 |
+
{{var error}}
|
app/locale/en_US/NRApps_ProtectedShops.csv
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Protected Shops","Protected Shops"
|
2 |
+
"Settings","Settings"
|
3 |
+
"Shop Id","Shop Id"
|
4 |
+
"Map","Map"
|
5 |
+
"Get/Show Documents Info","Get/Show Documents Info"
|
6 |
+
"Press button to load document types.","Press button to load document types."
|
7 |
+
"Please save settings before get document info.","Please save settings before get document info."
|
8 |
+
"Import Documents","Import Documents"
|
9 |
+
"Please save settings before import documents.","Please save settings before import documents."
|
10 |
+
"Document","Document"
|
11 |
+
"Destination","Destination"
|
12 |
+
"CMS Pages","CMS Pages"
|
13 |
+
"CMS Blocks","CMS Blocks"
|
14 |
+
"Agreements","Agreements"
|
15 |
+
"Unknown model: ""%s""","Unknown model: ""%s"""
|
16 |
+
"Unknown model entity: ""%s""","Unknown model entity: ""%s"""
|
17 |
+
"Format","Format"
|
18 |
+
"HTML","HTML"
|
19 |
+
"HTML-Lite","HTML-Lite"
|
20 |
+
"Text","Text"
|
21 |
+
"PDF","PDF"
|
22 |
+
"Add Row","Add Row"
|
23 |
+
"Auto Update","Auto Update"
|
24 |
+
"Active","Active"
|
25 |
+
"Interval","Interval"
|
26 |
+
"6 Hours","6 Hours"
|
27 |
+
"12 Hours","12 Hours"
|
28 |
+
"24 Hours","24 Hours"
|
29 |
+
"On Error Send Emails To","On Error Send Emails To"
|
30 |
+
"On Error Email Sender","On Error Email Sender"
|
31 |
+
"On Error Email Template","On Error Email Template"
|
32 |
+
"Protected Shops Auto Update Error","Protected Shops Auto Update Error"
|
33 |
+
"Import legal text success","Import legal text success"
|
34 |
+
"Document Info for Shop Id: %s","Document Info for Shop Id: %s"
|
35 |
+
"Configuration not completed.","Configuration not completed."
|
36 |
+
"API Response Status Error","API Response Status Error"
|
37 |
+
"API Response Content Type Error","API Response Content Type Error"
|
38 |
+
"API Response Document Hash Error %s - %s.","API Response Document Hash Error %s - %s."
|
39 |
+
"API Response Status Error","API Response Status Error"
|
40 |
+
"API Response Content Type Error","API Response Content Type Error"
|
app/locale/en_US/template/email/nrapps_protectedshops_auto_update_error_email.html
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject Protected Shops Auto Update Error@-->
|
2 |
+
|
3 |
+
Protected Shops Auto Update Error Report
|
4 |
+
----------------------------------------
|
5 |
+
|
6 |
+
{{var error}}
|
package.xml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>protected-shops</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>The extension from Protected Shops helps to transfer the legal texts i.e. terms and conditions, notice of revocation, imprint and privacy policy automatically in the own online shop. If the law changes, these texts update automatically and the extension synchronizes the new one to the right position. At that point, online traders are protected against legal proceedings.</summary>
|
10 |
+
<description>Protected Shops creates legal texts like terms and conditions, notice of revocation, imprint and privacy policy for their customers and helps the traders to fulfill the often complicated legal obligations in online trading with consumers. The law texts are based on current legislation which is subject to changes through new laws or court decisions. The law texts therefore have to be amended regularly. Protected Shops takes care of these adjustments and supplies them to the traders.
|
11 |
+

|
12 |
+
At the same time the business model from the traders changes regularly and causes modifications in the legal texts. For example adding a payment method in the online shop can affect both the terms and conditions as well as the privacy policy.
|
13 |
+

|
14 |
+
The extension helps the trader with necessary changes in his legal texts and helps him to implement them automatically and completely. The texts are provided over an API in many different forms (Text, HTML, PDF) from Protected Shops. The trader can decide which texts he wants to use from Protected Shops and in which form he wants to use them. The texts are not only implemented to display them on the website but can also be integrated in the process of the shop.
|
15 |
+

|
16 |
+
Synchronizing happens in an asynchronous manner and regularly, the frequency of the updating can be determined by the customer himself. It is also possible to synchronizing the law text immediately at the push of a button.</description>
|
17 |
+
<notes>initial extension of Protected-Shops for Magento</notes>
|
18 |
+
<authors><author><name>Viktor Franz</name><user>vf</user><email>vf@integer-net.de</email></author></authors>
|
19 |
+
<date>2014-06-30</date>
|
20 |
+
<time>16:03:31</time>
|
21 |
+
<contents><target name="magecommunity"><dir name="NRApps"><dir name="ProtectedShops"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Map.php" hash="cfc0e720c09668b41209c534bbbef657"/></dir><dir name="Renderer"><file name="Select.php" hash="bb36c368ee4bc0a50aa3a22909dbdd7d"/><file name="SelectGroup.php" hash="839b91998657fe14cf473d2046eeb7a8"/></dir></dir><file name="Import.php" hash="cf3e867b8b88654b9ff1d87c5dae90f8"/><file name="Info.php" hash="ab54d2466cb8958fdbfde02524012adf"/></dir></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="537035de1315b7a0d2950d2633141930"/><file name="Data.php" hash="dd51a45a6a92a49239b446acf4e0af49"/></dir><dir name="Model"><file name="Api.php" hash="4ed2c61a97406df2fb05dca7e7671e44"/><file name="Cron.php" hash="a935fe448226e7f359a58d8f82cb0876"/><file name="Flag.php" hash="637f7394087f25923496c4c6c4c062e2"/><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Serialized"><file name="Map.php" hash="d50c8bc845fe6a2fe727716d4f622018"/></dir></dir><dir name="Source"><file name="Interval.php" hash="1768f5dfb7f4252c504ba116b5da8271"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Nrappsprotectedshops"><file name="ConfigController.php" hash="16141d834f816decad9e2a87d777ee52"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="08f8082c7b4b36d6fbae2480b94f3adc"/><file name="config.xml" hash="a1cb8f977561d4433c8f336f8a2a402d"/><file name="system.xml" hash="79f009879ddaf827e5ec13926d3bd418"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="nrapps_protectedshops"><file name="import.phtml" hash="13da0c3d8883c4b998e2a12a67fa9f54"/><file name="info.phtml" hash="f9e564578fa0968583301a5982c0d9c1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NRApps_ProtectedShops.xml" hash="6345ff7f79efcf572542d1c2191500b5"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="NRApps_ProtectedShops.csv" hash="e60b15170306c52afb50be26274e0f69"/><dir name="template"><dir name="email"><file name="nrapps_protectedshops_auto_update_error_email.html" hash="43dddd67339dc07006c3e3052be0aa9c"/></dir></dir></dir><dir name="en_US"><file name="NRApps_ProtectedShops.csv" hash="e60b15170306c52afb50be26274e0f69"/><dir name="template"><dir name="email"><file name="nrapps_protectedshops_auto_update_error_email.html" hash="43dddd67339dc07006c3e3052be0aa9c"/></dir></dir></dir></target><target name="mage"><dir name=".doc"><dir name="NrApps"><dir name="ProtectedShops"><file name="20140424_Doku_Schnittstelle_ProtectedShops.pdf " hash="7df363585e3116e16dde8cb0a1f773a1"/></dir></dir></dir></target></contents>
|
22 |
+
<compatible/>
|
23 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
|
24 |
+
</package>
|