janolaw_agb2 - Version 0.2.6

Version Notes

Compatibility with the new features provided by Janolaw Service:
Multilangual text versions, PDF support.

Download this release

Release Info

Developer team in medias
Extension janolaw_agb2
Version 0.2.6
Comparing to
See all releases


Code changes from version 0.1.6 to 0.2.6

Files changed (23) hide show
  1. app/code/community/Janolaw/Agb/Block/Adminhtml/Status/Config.php +3 -0
  2. app/code/community/Janolaw/Agb/Block/Adminhtml/System/Config/Fieldset/Pdf.php +80 -0
  3. app/code/community/Janolaw/Agb/Block/Adminhtml/System/Config/Form/Field.php +32 -0
  4. app/code/community/Janolaw/Agb/Helper/Data.php +62 -0
  5. app/code/community/Janolaw/Agb/Helper/Email.php +74 -0
  6. app/code/community/Janolaw/Agb/Helper/HttpStatusNotSuccessfulException.php +1 -1
  7. app/code/community/Janolaw/Agb/Helper/NoBlockWhitelistException.php +7 -0
  8. app/code/community/Janolaw/Agb/Model/CmsAssistant.php +7 -0
  9. app/code/community/Janolaw/Agb/Model/Downloader.php +206 -43
  10. app/code/community/Janolaw/Agb/Model/Email/Attachment/Pdf.php +119 -0
  11. app/code/community/Janolaw/Agb/Model/Email/Queue.php +95 -0
  12. app/code/community/Janolaw/Agb/Model/Email/Template.php +2 -2
  13. app/code/community/Janolaw/Agb/Model/Observer.php +129 -38
  14. app/code/community/Janolaw/Agb/Model/Source/Language.php +36 -0
  15. app/code/community/Janolaw/Agb/controllers/Adminhtml/Janolaw/SetupController.php +20 -0
  16. app/code/community/Janolaw/Agb/controllers/Adminhtml/Janolaw/StatusController.php +5 -0
  17. app/code/community/Janolaw/Agb/data/agb_setup/data-upgrade-0.2.5-0.2.6.php +31 -0
  18. app/code/community/Janolaw/Agb/etc/adminhtml.xml +8 -0
  19. app/code/community/Janolaw/Agb/etc/config.xml +25 -7
  20. app/code/community/Janolaw/Agb/etc/system.xml +56 -36
  21. app/design/adminhtml/default/default/template/janolawagb/setup.phtml +157 -47
  22. app/locale/de_DE/Janolaw_Agb.csv +26 -1
  23. package.xml +12 -41
app/code/community/Janolaw/Agb/Block/Adminhtml/Status/Config.php CHANGED
@@ -43,6 +43,9 @@ class Janolaw_Agb_Block_Adminhtml_Status_Config extends Mage_Adminhtml_Block_Abs
43
  $shopId = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_SHOP_ID, 0);
44
  $userId = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_USER_ID, 0);
45
  $baseUrl = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_API_BASE_URL, 0);
 
 
 
46
 
47
  if (empty($shopId)) {
48
  $missing['shop_id'] = 'Shop Id';
43
  $shopId = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_SHOP_ID, 0);
44
  $userId = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_USER_ID, 0);
45
  $baseUrl = Mage::getStoreConfig(\Janolaw_Agb_Model_Downloader::XML_PATH_API_BASE_URL, 0);
46
+ $shopId = trim($shopId);
47
+ $userId = trim($userId);
48
+ $baseUrl = trim($baseUrl);
49
 
50
  if (empty($shopId)) {
51
  $missing['shop_id'] = 'Shop Id';
app/code/community/Janolaw/Agb/Block/Adminhtml/System/Config/Fieldset/Pdf.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Janolaw_Agb_Block_Adminhtml_System_Config_Fieldset_Pdf
4
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
5
+ {
6
+
7
+ /**
8
+ * @var Janolaw_Agb_Model_Downloader
9
+ */
10
+ protected $_downloader;
11
+
12
+ public function render(Varien_Data_Form_Element_Abstract $element)
13
+ {
14
+ if (!$this->_getDownloader()->checkPdfAvailable()) {
15
+ $this->_clearChildren($element);
16
+ }
17
+ return parent::render($element);
18
+ }
19
+
20
+ /**
21
+ * Removes all children of the given fieldset
22
+ *
23
+ * @param Varien_Data_Form_Element_Abstract $fieldset
24
+ */
25
+ protected function _clearChildren(Varien_Data_Form_Element_Abstract $fieldset)
26
+ {
27
+ if (!$fieldset instanceof Varien_Data_Form_Element_Fieldset) {
28
+ return;
29
+ }
30
+ // note: we cannot rely on element ids when iterating and removing
31
+ // elements in one single loop (because elements are renumbered
32
+ // during remove method)
33
+ while (($cnt = $fieldset->getElements()->count()) > 0) {
34
+ $iterator = $fieldset->getElements()->getIterator();
35
+ $iterator->rewind();
36
+ $elem = $iterator->current();
37
+ $fieldset->getElements()->remove($elem->getId());
38
+ if ($cnt === $fieldset->getElements()->count()) {
39
+ break; // just to make sure we never end up in an endless loop
40
+ }
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Return header comment part of html for fieldset
46
+ *
47
+ * @param Varien_Data_Form_Element_Abstract $element
48
+ * @return string
49
+ */
50
+ protected function _getHeaderCommentHtml($element)
51
+ {
52
+ if ($this->_getDownloader()->checkPdfAvailable()) {
53
+ return parent::_getHeaderCommentHtml($element);
54
+ }
55
+ $notAvailableNotice = $this->__(
56
+ 'Please check, if you have booked the multi-language option of the janolaw service.'
57
+ );
58
+ $additionalNote = <<<EOT
59
+ Please note:
60
+ If you don't want to regenerate the texts, you should insert the documents to the order confirmation email using the snippets. This should add the content of the documents to the email text.
61
+ You find an overview of the available snippets in the Janolaw AGB Hosting Setup, step 3
62
+ Important:
63
+ The terms and conditions, cancellation policy and the withdrawal form must be sent by e-mail or at the latest with the dispatch of goods.
64
+ EOT;
65
+
66
+ $additionalNote = $this->__($additionalNote);
67
+ $notAvailableNotice .= '<br /><br />'
68
+ . str_replace("\n", '<br /><br />', $additionalNote);
69
+
70
+ return '<div class="comment">' . $notAvailableNotice . '</div>';
71
+ }
72
+
73
+ protected function _getDownloader()
74
+ {
75
+ if (!isset($this->_downloader)) {
76
+ $this->_downloader = Mage::getSingleton('agbdownloader/downloader');
77
+ }
78
+ return $this->_downloader;
79
+ }
80
+ }
app/code/community/Janolaw/Agb/Block/Adminhtml/System/Config/Form/Field.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Does not show the field if janolaw pdfs are not available
5
+ */
6
+ class Janolaw_Agb_Block_Adminhtml_System_Config_Form_Field
7
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
8
+ {
9
+
10
+ /**
11
+ * {@inheritDoc}
12
+ */
13
+ public function render(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ if ($this->_canShowField()) {
16
+ return parent::render($element);
17
+ }
18
+ return '';
19
+ }
20
+
21
+ /**
22
+ * Returns true if the field should be rendered, false otherwise
23
+ *
24
+ * @return bool
25
+ */
26
+ protected function _canShowField()
27
+ {
28
+ /* @var $downloader Janolaw_Agb_Model_Downloader */
29
+ $downloader = Mage::getSingleton('agbdownloader/downloader');
30
+ return $downloader->checkPdfAvailable();
31
+ }
32
+ }
app/code/community/Janolaw/Agb/Helper/Data.php CHANGED
@@ -59,6 +59,30 @@ class Janolaw_Agb_Helper_Data extends Mage_Core_Helper_Abstract
59
  }
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  protected function _isShellContext()
63
  {
64
  return !isset($_SERVER['REQUEST_METHOD']);
@@ -96,6 +120,44 @@ class Janolaw_Agb_Helper_Data extends Mage_Core_Helper_Abstract
96
  $this->_client->resetParameters(true);
97
  $this->_client->setUri($url);
98
  }
 
 
 
 
 
99
  return $this->_client;
100
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
59
  }
60
  }
61
 
62
+ /**
63
+ * Add attachment to mailer
64
+ * @param Zend_Mail $mailer
65
+ * @param $pdfTitle
66
+ * @param $pdfPath
67
+ * @return Zend_Mail
68
+ */
69
+ public function addAttachment(Zend_Mail $mailer, $pdfTitle, $pdfPath){
70
+ if ($pdfPath) {
71
+ try {
72
+ $pdf = Zend_Pdf::load($pdfPath);
73
+ $mimePart = new Janolaw_Agb_Model_Email_Attachment_Pdf(
74
+ $pdf->render(),
75
+ $pdfTitle
76
+ );
77
+ $mailer->addAttachment($mimePart);
78
+ } catch (Exception $e) {
79
+ Mage::logException($e);
80
+ }
81
+ }
82
+
83
+ return $mailer;
84
+ }
85
+
86
  protected function _isShellContext()
87
  {
88
  return !isset($_SERVER['REQUEST_METHOD']);
120
  $this->_client->resetParameters(true);
121
  $this->_client->setUri($url);
122
  }
123
+
124
+ //Set Zend_Http_Client_Adapter_Curl Adapter. With default Zend_Http_Client_Adapter_Socket adapter pdf does not work
125
+ $adapter = new Zend_Http_Client_Adapter_Curl();
126
+ $this->_client->setAdapter($adapter);
127
+
128
  return $this->_client;
129
  }
130
+
131
+ /**
132
+ * Adds the block type 'cms/block' to the whitelist, so
133
+ * processed templates may include janolaw texts which
134
+ * are stored as cms blocks
135
+ *
136
+ * @throws Janolaw_Agb_Helper_NoBlockWhitelistException
137
+ */
138
+ public function allowCmsBlockIncludes()
139
+ {
140
+ $allowedBlock = 'cms/block';
141
+
142
+ $block = Mage::getModel('admin/block');
143
+ if (false === $block) {
144
+ throw new Janolaw_Agb_Helper_NoBlockWhitelistException('Block whitelist does not exist');
145
+ }
146
+
147
+ // load collection of all previously defined blocks to prevent publicates (block_name is unique)
148
+ $existingBlocksByName = array();
149
+ foreach ($block->getCollection() as $b) {
150
+ /* @var $b Mage_Admin_Model_Block */
151
+ $existingBlocksByName[$b->getData('block_name')] = $b;
152
+ }
153
+
154
+ if (array_key_exists($allowedBlock, $existingBlocksByName)) {
155
+ $block = $existingBlocksByName[$allowedBlock];
156
+ } else {
157
+ $block = Mage::getModel('admin/block');
158
+ $block->setData('block_name', $allowedBlock);
159
+ }
160
+ $block->setData('is_allowed', 1);
161
+ $block->save();
162
+ }
163
  }
app/code/community/Janolaw/Agb/Helper/Email.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Janolaw_Agb_Helper_Email
5
+ {
6
+
7
+ /**
8
+ * According to rfc5987
9
+ *
10
+ * See http://stackoverflow.com/questions/4968272/how-can-i-encode-a-filename-in-php-according-to-rfc-2231
11
+ * See http://tools.ietf.org/html/rfc5987
12
+ *
13
+ * @param string $paramName The header parameter's name, e.g. "filename"
14
+ * @param string $paramValue The header parameter's value, e.g. "Doc.pdf"
15
+ * @param string $eol End of line character
16
+ * @param string $charset Charset of the $paramValue string
17
+ * @param string $lang Optional the language of the value, e.g. 'en'
18
+ * @param int $lineLength The maximal line length of the email header
19
+ *
20
+ * @return bool|string
21
+ */
22
+ public function encodeHeaderParam(
23
+ $paramName,
24
+ $paramValue,
25
+ $eol = "\n",
26
+ $charset='utf-8',
27
+ $lang='',
28
+ $lineLength=78
29
+ ) {
30
+ if (strlen($paramName) === 0
31
+ || preg_match('/[\x00-\x20*\'%()<>@,;:\\\\"\/[\]?=\x80-\xFF]/', $paramName)
32
+ ) {
33
+ throw new InvalidArgumentException('Invalid param name: ' . $paramName);
34
+ }
35
+ // HEXDIG representation, preceded by charset and language
36
+ $paramValue = strtoupper(bin2hex($paramValue));
37
+ if (strlen($paramValue) / 2 * 3 + strlen($paramName)
38
+ + strlen($charset) + strlen($lang) + 5 <= $lineLength
39
+ ) {
40
+ // everything fits into one line
41
+ return " $paramName*=$charset'$lang'"
42
+ . '%' . implode('%', str_split($paramValue, 2));
43
+ }
44
+
45
+ // else: create multiple lines
46
+ $prefixPattern = " $paramName*%s*="; // %s will be replaced with index
47
+
48
+ // start the first line with meta data and prefix
49
+ $currentLine = sprintf($prefixPattern, 0) . "$charset'$lang'";
50
+ $lines = array();
51
+ if (strlen($currentLine) + 4 > $lineLength) { // 4 = 3 characters for 3 pct-encoded entity + 1 trailing ";"
52
+ throw new InvalidArgumentException('Line length is not enough for given paramenters.');
53
+ }
54
+ do {
55
+ if (null === $currentLine) {
56
+ $currentLine = sprintf($prefixPattern, count($lines));
57
+ }
58
+ if (strlen($currentLine) + 3 > $lineLength) {
59
+ // split line
60
+ $lines[] = $currentLine;
61
+ $currentLine = null;
62
+ } else {
63
+ // add an entity (note: $paramValue must always be a multiple of 2,
64
+ // as it was created by bin2hex)
65
+ $currentLine .= '%' . substr($paramValue, 0, 2);
66
+ $paramValue = substr($paramValue, 2);
67
+ }
68
+ } while (strlen($paramValue));
69
+ if ($currentLine !== null) {
70
+ $lines[] = $currentLine;
71
+ }
72
+ return implode(";$eol", $lines);
73
+ }
74
+ }
app/code/community/Janolaw/Agb/Helper/HttpStatusNotSuccessfulException.php CHANGED
@@ -9,7 +9,7 @@ class Janolaw_Agb_Helper_HttpStatusNotSuccessfulException extends Exception
9
  */
10
  public $response;
11
 
12
- public function __counstruct(Zend_Http_Response $response, $msg = null)
13
  {
14
  if (is_null($msg)) {
15
  $msg = 'Unexpected Http status code: ' . $response->getStatus();
9
  */
10
  public $response;
11
 
12
+ public function __construct(Zend_Http_Response $response, $msg = null)
13
  {
14
  if (is_null($msg)) {
15
  $msg = 'Unexpected Http status code: ' . $response->getStatus();
app/code/community/Janolaw/Agb/Helper/NoBlockWhitelistException.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // indicates that there is no block whitelist, i.e. the patch supee 6788
4
+ // is not installed (and magento version is less than 1.9.2.2)
5
+ class Janolaw_Agb_Helper_NoBlockWhitelistException extends Exception
6
+ {
7
+ }
app/code/community/Janolaw/Agb/Model/CmsAssistant.php CHANGED
@@ -8,6 +8,7 @@ class Janolaw_Agb_Model_CmsAssistant extends Mage_Catalog_Model_Abstract
8
  const TYPE_TAC = 'tac';
9
  const TYPE_PRIVACY = 'privacy';
10
  const TYPE_IMPRINT = 'imprint';
 
11
 
12
  /** @var array blocks to search for... */
13
  protected static $_blocks = array(
@@ -28,6 +29,9 @@ class Janolaw_Agb_Model_CmsAssistant extends Mage_Catalog_Model_Abstract
28
  ),
29
  self::TYPE_IMPRINT => array(
30
  'Impressum_block' // janolaq old setup script
 
 
 
31
  )
32
  );
33
 
@@ -88,6 +92,9 @@ class Janolaw_Agb_Model_CmsAssistant extends Mage_Catalog_Model_Abstract
88
  case self::TYPE_IMPRINT:
89
  $path = Janolaw_Agb_Model_Downloader::XML_PATH_IMPRINT_ID;
90
  break;
 
 
 
91
  default:
92
  throw new InvalidArgumentException('invalid type ' . $type);
93
  }
8
  const TYPE_TAC = 'tac';
9
  const TYPE_PRIVACY = 'privacy';
10
  const TYPE_IMPRINT = 'imprint';
11
+ const TYPE_WITHDRAWAL = 'withdrawal';
12
 
13
  /** @var array blocks to search for... */
14
  protected static $_blocks = array(
29
  ),
30
  self::TYPE_IMPRINT => array(
31
  'Impressum_block' // janolaq old setup script
32
+ ),
33
+ self::TYPE_WITHDRAWAL => array(
34
+ 'withdrawal_block' // janolaq old setup script
35
  )
36
  );
37
 
92
  case self::TYPE_IMPRINT:
93
  $path = Janolaw_Agb_Model_Downloader::XML_PATH_IMPRINT_ID;
94
  break;
95
+ case self::TYPE_WITHDRAWAL:
96
+ $path = Janolaw_Agb_Model_Downloader::XML_PATH_WITHDRAWAL_ID;
97
+ break;
98
  default:
99
  throw new InvalidArgumentException('invalid type ' . $type);
100
  }
app/code/community/Janolaw/Agb/Model/Downloader.php CHANGED
@@ -1,8 +1,4 @@
1
  <?php
2
- /*
3
- * To change this template, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
 
7
 
8
  class Janolaw_Agb_Model_Downloader
@@ -14,6 +10,7 @@ class Janolaw_Agb_Model_Downloader
14
  const XML_PATH_SHOP_ID = 'agbdownload/janoloaw_agb_user/shopid';
15
  const XML_PATH_USER_ID = 'agbdownload/janoloaw_agb_user/userid';
16
  const XML_PATH_API_BASE_URL = 'agbdownload/janoloaw_agb_user/api_base_url';
 
17
 
18
  // cms block/page definitions
19
  const XML_PATH_TAC_ID = 'agbdownload/janoloaw_agb_cms/agbid';
@@ -24,6 +21,8 @@ class Janolaw_Agb_Model_Downloader
24
 
25
  const XML_PATH_PRIVACY_ID = 'agbdownload/janoloaw_agb_cms/datenschutzid';
26
 
 
 
27
  const FLAG_CODE = 'janolaw_download_state';
28
 
29
  protected $_pdfBasePath;
@@ -44,6 +43,13 @@ class Janolaw_Agb_Model_Downloader
44
  */
45
  protected $_urlCache = array();
46
 
 
 
 
 
 
 
 
47
  /**
48
  * @var array
49
  */
@@ -56,24 +62,69 @@ class Janolaw_Agb_Model_Downloader
56
  Janolaw_Agb_Model_CmsAssistant::TYPE_TAC => array(
57
  'filename' => 'terms_include.html',
58
  'config_id' => self::XML_PATH_TAC_ID,
59
- 'pdf_filename' => null, // currently we don't support pdf's, so we just set it to null
60
  ),
61
  Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT => array(
62
  'filename' => 'legaldetails_include.html',
63
  'config_id' => self::XML_PATH_IMPRINT_ID,
64
- 'pdf_filename' => null,
65
  ),
66
  Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION => array(
67
  'filename' => 'revocation_include.html',
68
  'config_id' => self::XML_PATH_REVOCATION_ID,
69
- 'pdf_filename' => null,
70
  ),
71
  Janolaw_Agb_Model_CmsAssistant::TYPE_PRIVACY => array(
72
  'filename' => 'datasecurity_include.html',
73
  'config_id' => self::XML_PATH_PRIVACY_ID,
74
- 'pdf_filename' => null,
75
- )
76
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
  /**
@@ -81,24 +132,41 @@ class Janolaw_Agb_Model_Downloader
81
  */
82
  public function download()
83
  {
 
 
 
84
  $stores = Mage::app()->getStores();
85
 
86
- // first fetch content for the default store
87
- // note: this just creates blocks for all texts in default scope to
88
- // prevent errors due to missing blocks. We therefor do not check if
89
- // synchronization is enabled in global (default) scope in the configuration.
90
- // (using the block is another -- independant -- topic)
91
- $errors = $this->_updateAllContent(0);
92
-
93
- /* @var $store Mage_Core_Model_Store */;
94
- foreach ($stores as $store) {
95
- $storeId = $store->getId();
96
- if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $storeId)) {
97
- continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
- $e = $this->_updateAllContent($storeId);
100
- $errors = array_merge($errors, $e);
101
  }
 
102
  $this->_getHelper()->printErrors($errors);
103
  if ($errors) {
104
  Mage::log($errors, Zend_Log::ERR);
@@ -124,7 +192,11 @@ class Janolaw_Agb_Model_Downloader
124
  public function getPdfPath($storeId, $pdfName)
125
  {
126
  $storeCode = $store = Mage::app()->getStore($storeId)->getCode();
127
- return $this->_pdfBasePath . DIRECTORY_SEPARATOR . $storeCode . DIRECTORY_SEPARATOR . $pdfName;
 
 
 
 
128
  }
129
 
130
  /**
@@ -135,7 +207,7 @@ class Janolaw_Agb_Model_Downloader
135
  */
136
  public function getPdfPathByType($storeId, $type)
137
  {
138
- if (!in_array($type, $this->_contentItems)) {
139
  return null;
140
  }
141
  $pdfName = $this->_contentItems[$type]['pdf_filename'];
@@ -149,6 +221,45 @@ class Janolaw_Agb_Model_Downloader
149
  return null;
150
  }
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  protected function _storeLastSyncState(array $errors)
153
  {
154
  /* @var $flagModel Mage_Core_Model_Flag */
@@ -166,10 +277,12 @@ class Janolaw_Agb_Model_Downloader
166
 
167
  /**
168
  * @param int|string $storeId
 
 
169
  *
170
  * @return array
171
  */
172
- protected function _updateAllContent($storeId)
173
  {
174
  $errors = array();
175
  foreach ($this->_contentItems as $itemDefinition) {
@@ -183,6 +296,10 @@ class Janolaw_Agb_Model_Downloader
183
 
184
  try {
185
  $cmsId = $this->_getResourceModel()->getCmsId($cmsIdent, $storeId);
 
 
 
 
186
  if ($cmsId === false) {
187
  // no block exists for the given identifier and store. Create one.
188
  $cmsId = $this->_getResourceModel()->createCmsBlock($cmsIdent, $storeId);
@@ -201,13 +318,11 @@ class Janolaw_Agb_Model_Downloader
201
  }
202
 
203
  // handle pdf file...
204
- if (isset($itemDefinition['pdf_filename'])) {
205
- $pdfFile = $this->_downloadPdf($storeId, $itemDefinition['pdf_filename']);
206
- if ($pdfFile) {
207
- $pathRelToMedia = $this->_getStoreCodeById($storeId) . '/' . $itemDefinition['pdf_filename'];
208
- $pdfIncludeMarkup = '<p class="janolaw_pdf"><a href="{{media url=\'' . $pathRelToMedia . '\'}}">'
209
- . $pdfFile . '</a></p>';
210
- $content .= "\n" . $pdfIncludeMarkup;
211
  }
212
  }
213
  $this->_getResourceModel()->updateCmsContent($cmsId, $content);
@@ -216,7 +331,7 @@ class Janolaw_Agb_Model_Downloader
216
  $msg .= ' Store id = ' . $storeId . '; Item definition = ' . print_r($itemDefinition, true);
217
  $wrapperException = new Exception($msg, 0, $e);
218
  Mage::logException($wrapperException);
219
- $errors[] = $e->getMessage();
220
  }
221
  }
222
  return $errors;
@@ -230,30 +345,64 @@ class Janolaw_Agb_Model_Downloader
230
  /**
231
  * @param $storeId
232
  * @param $pdfFilename
 
233
  *
234
  * @return null|string Returns the filename where the pdf was saved to or null if it is not available
235
  * @throws Exception
236
  * @throws Janolaw_Agb_Helper_HttpStatusNotSuccessfulException
237
  */
238
- protected function _downloadPdf($storeId, $pdfFilename) {
239
  if (empty($pdfFilename)) {
240
  return null;
241
  }
242
  try {
243
  $url = $this->_buildApiUrl($pdfFilename, $storeId);
 
244
  $content = $this->_getHelper()->getRemoteContent($url);
245
  $pdf = Zend_Pdf::parse($content);
246
- $filename = $this->getPdfPath($storeId, $pdfFilename);
 
 
247
  $pdf->save($filename);
248
  return $filename;
249
  } catch (Janolaw_Agb_Model_MissingConfigException $e) {
250
  return null; // ignore it, as we have logged that before...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  } catch (Janolaw_Agb_Helper_HttpStatusNotSuccessfulException $e) {
252
- if ($e->response->getStatus() == 404) {
253
- // document not available, that's ok.
254
- return null;
255
- } // other return codes are not expected. Redirects are handled automatically by Zend_Http_Client.
256
- throw $e;
257
  } // don't catch other exceptions (e.g. Zend_Pdf_Exception may occur)
258
  }
259
 
@@ -285,6 +434,9 @@ class Janolaw_Agb_Model_Downloader
285
  $baseUrl = Mage::getStoreConfig(self::XML_PATH_API_BASE_URL, $storeId);
286
  $userId = Mage::getStoreConfig(self::XML_PATH_USER_ID, $storeId);
287
  $shopId = Mage::getStoreConfig(self::XML_PATH_SHOP_ID, $storeId);
 
 
 
288
 
289
  if (!$baseUrl || !$userId || !$shopId) {
290
  throw new Janolaw_Agb_Model_MissingConfigException(
@@ -292,8 +444,10 @@ class Janolaw_Agb_Model_Downloader
292
  );
293
  }
294
 
295
- return rtrim($baseUrl, '/\\') . '/' . urlencode($userId) . '/' . urlencode($shopId) . '/'
296
  . urlencode($this->_getLanguageUrlPart($storeId)) . '/' . $fileName;
 
 
297
  }
298
 
299
  /**
@@ -308,7 +462,8 @@ class Janolaw_Agb_Model_Downloader
308
  */
309
  protected function _getLanguageUrlPart($storeId)
310
  {
311
- return 'de';
 
312
  }
313
 
314
  /**
@@ -332,4 +487,12 @@ class Janolaw_Agb_Model_Downloader
332
  }
333
  return $this->_resource;
334
  }
 
 
 
 
 
 
 
 
335
  }
1
  <?php
 
 
 
 
2
 
3
 
4
  class Janolaw_Agb_Model_Downloader
10
  const XML_PATH_SHOP_ID = 'agbdownload/janoloaw_agb_user/shopid';
11
  const XML_PATH_USER_ID = 'agbdownload/janoloaw_agb_user/userid';
12
  const XML_PATH_API_BASE_URL = 'agbdownload/janoloaw_agb_user/api_base_url';
13
+ const XML_PATH_LANGUAGE = 'agbdownload/janoloaw_agb_user/language';
14
 
15
  // cms block/page definitions
16
  const XML_PATH_TAC_ID = 'agbdownload/janoloaw_agb_cms/agbid';
21
 
22
  const XML_PATH_PRIVACY_ID = 'agbdownload/janoloaw_agb_cms/datenschutzid';
23
 
24
+ const XML_PATH_WITHDRAWAL_ID = 'agbdownload/janoloaw_agb_cms/withdrawalid';
25
+
26
  const FLAG_CODE = 'janolaw_download_state';
27
 
28
  protected $_pdfBasePath;
43
  */
44
  protected $_urlCache = array();
45
 
46
+ /**
47
+ * Cache pdf check result
48
+ *
49
+ * @var bool|null
50
+ */
51
+ protected $_isPdfAvailable = null;
52
+
53
  /**
54
  * @var array
55
  */
62
  Janolaw_Agb_Model_CmsAssistant::TYPE_TAC => array(
63
  'filename' => 'terms_include.html',
64
  'config_id' => self::XML_PATH_TAC_ID,
 
65
  ),
66
  Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT => array(
67
  'filename' => 'legaldetails_include.html',
68
  'config_id' => self::XML_PATH_IMPRINT_ID,
 
69
  ),
70
  Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION => array(
71
  'filename' => 'revocation_include.html',
72
  'config_id' => self::XML_PATH_REVOCATION_ID,
 
73
  ),
74
  Janolaw_Agb_Model_CmsAssistant::TYPE_PRIVACY => array(
75
  'filename' => 'datasecurity_include.html',
76
  'config_id' => self::XML_PATH_PRIVACY_ID,
77
+ ),
 
78
  );
79
+ if ($this->checkPdfAvailable()) {
80
+ $this->_contentItems[Janolaw_Agb_Model_CmsAssistant::TYPE_TAC]['pdf_filename']
81
+ = 'terms.pdf';
82
+ $this->_contentItems[Janolaw_Agb_Model_CmsAssistant::TYPE_TAC]['pdf_title']
83
+ = array(
84
+ 'de' => 'AGB',
85
+ 'gb' => 'General Terms and Conditions',
86
+ 'fr' => 'Conditions Générales de Vente'
87
+ );
88
+
89
+ $this->_contentItems[Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT]['pdf_filename']
90
+ = 'legaldetails.pdf';
91
+ $this->_contentItems[Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT]['pdf_title']
92
+ = array(
93
+ 'de' => 'Impressum',
94
+ 'gb' => 'Imprint',
95
+ 'fr' => 'Mentions légales'
96
+ );
97
+
98
+ $this->_contentItems[Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION]['pdf_filename']
99
+ = 'revocation.pdf';
100
+ $this->_contentItems[Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION]['pdf_title']
101
+ = array(
102
+ 'de' => 'Widerrufsbelehrung',
103
+ 'gb' => 'Instructions on withdrawal',
104
+ 'fr' => 'Informations standardisées sur la rétractation'
105
+ );
106
+
107
+ $this->_contentItems[Janolaw_Agb_Model_CmsAssistant::TYPE_PRIVACY]['pdf_filename']
108
+ = 'datasecurity.pdf';
109
+ $this->_contentItems[Janolaw_Agb_Model_CmsAssistant::TYPE_PRIVACY]['pdf_title']
110
+ = array(
111
+ 'de' => 'Datenschutzerklärung',
112
+ 'gb' => 'Data privacy policy',
113
+ 'fr' => 'Déclaration quant à la protection des données'
114
+ );
115
+
116
+ // withdrawal is only available since janolaw version 3 (where pdfs are available)
117
+ $this->_contentItems[Janolaw_Agb_Model_CmsAssistant::TYPE_WITHDRAWAL] = array(
118
+ 'filename' => 'model-withdrawal-form_include.html',
119
+ 'config_id' => self::XML_PATH_WITHDRAWAL_ID,
120
+ 'pdf_filename' => 'model-withdrawal-form.pdf',
121
+ 'pdf_title' => array(
122
+ 'de' => 'Muster-Widerrufsformular',
123
+ 'gb' => 'Model withdrawal form',
124
+ 'fr' => 'Modèle de formulaire de rétractation'
125
+ ),
126
+ );
127
+ }
128
  }
129
 
130
  /**
132
  */
133
  public function download()
134
  {
135
+ //Download default css
136
+ $this->_downloadCss();
137
+
138
  $stores = Mage::app()->getStores();
139
 
140
+ if (Mage::app()->isSingleStoreMode()) {
141
+ // only update one store's blocks. The blocks may be assigned
142
+ // to either the default store (id 0) or the single store.
143
+ // Note that if you edit a block of default store in single store mode,
144
+ // magento will change its store id to the single store's id
145
+ $singleStore = reset($stores);
146
+ $storeId = $singleStore->getId();
147
+ if (Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $storeId)) {
148
+ $errors = $this->_updateAllContent($storeId, true);
149
+ } else {
150
+ $errors = array();
151
+ }
152
+ } else {
153
+ // first fetch content for the default store
154
+ // note: this just creates blocks for all texts in default scope to
155
+ // prevent errors due to missing blocks. We therefor do not check if
156
+ // synchronization is enabled in global (default) scope in the configuration.
157
+ // (using the block is another -- independent -- topic)
158
+ $errors = $this->_updateAllContent(0);
159
+ /* @var $store Mage_Core_Model_Store */;
160
+ foreach ($stores as $store) {
161
+ $storeId = $store->getId();
162
+ if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $storeId)) {
163
+ continue;
164
+ }
165
+ $e = $this->_updateAllContent($storeId);
166
+ $errors = array_merge($errors, $e);
167
  }
 
 
168
  }
169
+
170
  $this->_getHelper()->printErrors($errors);
171
  if ($errors) {
172
  Mage::log($errors, Zend_Log::ERR);
192
  public function getPdfPath($storeId, $pdfName)
193
  {
194
  $storeCode = $store = Mage::app()->getStore($storeId)->getCode();
195
+ $dir = $this->_pdfBasePath . DIRECTORY_SEPARATOR . $storeCode;
196
+ if(!file_exists($dir)){
197
+ mkdir($dir, 0777, true);
198
+ }
199
+ return $dir . DIRECTORY_SEPARATOR . $pdfName;
200
  }
201
 
202
  /**
207
  */
208
  public function getPdfPathByType($storeId, $type)
209
  {
210
+ if (!isset($this->_contentItems[$type]['pdf_filename'])) {
211
  return null;
212
  }
213
  $pdfName = $this->_contentItems[$type]['pdf_filename'];
221
  return null;
222
  }
223
 
224
+ /**
225
+ * @param $type
226
+ * @param $storeId
227
+ * @return null|string Returns null if pdf was not found
228
+ */
229
+ public function getPdfTitleByType($type, $storeId)
230
+ {
231
+ $pdfTitle = null;
232
+ if (!isset($this->_contentItems[$type]['pdf_title'])) {
233
+ return null;
234
+ }
235
+ $pdfTitle = $this->_contentItems[$type]['pdf_title'][$this->_getLanguageUrlPart($storeId)];
236
+ if (!$pdfTitle) {
237
+ return null;
238
+ }
239
+ return $pdfTitle;
240
+ }
241
+
242
+ /**
243
+ * @return bool
244
+ */
245
+ public function checkPdfAvailable()
246
+ {
247
+ if (!isset($this->_isPdfAvailable)) {
248
+ // check imprint pdf for default store
249
+ $store = Mage::app()->getDefaultStoreView()->getId();
250
+ $filename = 'legaldetails.pdf'; // try legaldetails to test the service version
251
+ try {
252
+ $this->_isPdfAvailable = (null !== $this->_downloadPdf($store, $filename));
253
+ } catch (Janolaw_Agb_Helper_HttpStatusNotSuccessfulException $e) {
254
+ $this->_isPdfAvailable = false;
255
+ } catch (Exception $e) {
256
+ // any other exception, do also return false to not break anything
257
+ $this->_isPdfAvailable = false;
258
+ }
259
+ }
260
+ return $this->_isPdfAvailable;
261
+ }
262
+
263
  protected function _storeLastSyncState(array $errors)
264
  {
265
  /* @var $flagModel Mage_Core_Model_Flag */
277
 
278
  /**
279
  * @param int|string $storeId
280
+ * @param bool $isSingleStore If true, the default store is also
281
+ * searched for blocks to update
282
  *
283
  * @return array
284
  */
285
+ protected function _updateAllContent($storeId, $isSingleStore = false)
286
  {
287
  $errors = array();
288
  foreach ($this->_contentItems as $itemDefinition) {
296
 
297
  try {
298
  $cmsId = $this->_getResourceModel()->getCmsId($cmsIdent, $storeId);
299
+ if ($cmsId === false && $isSingleStore) {
300
+ // try default store
301
+ $cmsId = $this->_getResourceModel()->getCmsId($cmsIdent, 0);
302
+ }
303
  if ($cmsId === false) {
304
  // no block exists for the given identifier and store. Create one.
305
  $cmsId = $this->_getResourceModel()->createCmsBlock($cmsIdent, $storeId);
318
  }
319
 
320
  // handle pdf file...
321
+ if (isset($itemDefinition['pdf_title'][$this->_getLanguageUrlPart($storeId)])) {
322
+ try {
323
+ $this->_downloadPdf($storeId, $itemDefinition['pdf_filename']);
324
+ } catch (Janolaw_Agb_Helper_HttpStatusNotSuccessfulException $e) {
325
+ // this is ok..
 
 
326
  }
327
  }
328
  $this->_getResourceModel()->updateCmsContent($cmsId, $content);
331
  $msg .= ' Store id = ' . $storeId . '; Item definition = ' . print_r($itemDefinition, true);
332
  $wrapperException = new Exception($msg, 0, $e);
333
  Mage::logException($wrapperException);
334
+ $errors[] = $e->getMessage() . '; file = "' . $itemDefinition['filename'];
335
  }
336
  }
337
  return $errors;
345
  /**
346
  * @param $storeId
347
  * @param $pdfFilename
348
+ * @param $pdfTitle
349
  *
350
  * @return null|string Returns the filename where the pdf was saved to or null if it is not available
351
  * @throws Exception
352
  * @throws Janolaw_Agb_Helper_HttpStatusNotSuccessfulException
353
  */
354
+ protected function _downloadPdf($storeId, $pdfFilename, $pdfTitle=null) {
355
  if (empty($pdfFilename)) {
356
  return null;
357
  }
358
  try {
359
  $url = $this->_buildApiUrl($pdfFilename, $storeId);
360
+
361
  $content = $this->_getHelper()->getRemoteContent($url);
362
  $pdf = Zend_Pdf::parse($content);
363
+
364
+ if(!$pdfTitle) $pdfTitle = $pdfFilename;
365
+ $filename = $this->getPdfPath($storeId, $pdfTitle);
366
  $pdf->save($filename);
367
  return $filename;
368
  } catch (Janolaw_Agb_Model_MissingConfigException $e) {
369
  return null; // ignore it, as we have logged that before...
370
+ } catch (Zend_Http_Client_Exception $e) {
371
+ return null; // ignore it, as we have logged that before...
372
+ } // don't catch other exceptions (e.g. Zend_Pdf_Exception may occur)
373
+ }
374
+
375
+ /**
376
+ * Download CSS file ans save it in /skin/frontend/base/default/css/agbdownloader.css
377
+ * @return null
378
+ * @throws Exception
379
+ * @throws Janolaw_Agb_Helper_HttpStatusNotSuccessfulException
380
+ */
381
+ protected function _downloadCss() {
382
+ try {
383
+ $url = 'http://www.janolaw.de/agb-service/shops/janolaw.css';
384
+
385
+ $content = $this->_getHelper()->getRemoteContent($url);
386
+
387
+ $file = 'agbdownloader.css';
388
+ $cssDir = Mage::getBaseDir('skin') . DS . 'frontend' . DS . 'base' . DS . 'default' . DS . 'css';
389
+ $cssFile = $cssDir . DS . $file;
390
+
391
+ if (!is_dir($cssDir)) {
392
+ mkdir($cssDir, true);
393
+ chmod($cssDir, 0755);
394
+ }
395
+
396
+ if (!file_exists($cssFile)) {
397
+ file_put_contents($cssFile, $content);
398
+ chmod($cssFile, 0644);
399
+ }
400
+ } catch (Janolaw_Agb_Model_MissingConfigException $e) {
401
+ return null; // ignore it, as we have logged that before...
402
+ } catch (Zend_Http_Client_Exception $e) {
403
+ return null; // ignore it, as we have logged that before...
404
  } catch (Janolaw_Agb_Helper_HttpStatusNotSuccessfulException $e) {
405
+ return null; // ignore it, as we have logged that before...
 
 
 
 
406
  } // don't catch other exceptions (e.g. Zend_Pdf_Exception may occur)
407
  }
408
 
434
  $baseUrl = Mage::getStoreConfig(self::XML_PATH_API_BASE_URL, $storeId);
435
  $userId = Mage::getStoreConfig(self::XML_PATH_USER_ID, $storeId);
436
  $shopId = Mage::getStoreConfig(self::XML_PATH_SHOP_ID, $storeId);
437
+ $shopId = trim($shopId);
438
+ $userId = trim($userId);
439
+ $baseUrl = trim($baseUrl);
440
 
441
  if (!$baseUrl || !$userId || !$shopId) {
442
  throw new Janolaw_Agb_Model_MissingConfigException(
444
  );
445
  }
446
 
447
+ $apiUrl = rtrim($baseUrl, '/\\') . '/' . urlencode($userId) . '/' . urlencode($shopId) . '/'
448
  . urlencode($this->_getLanguageUrlPart($storeId)) . '/' . $fileName;
449
+
450
+ return $apiUrl;
451
  }
452
 
453
  /**
462
  */
463
  protected function _getLanguageUrlPart($storeId)
464
  {
465
+ $lang = Mage::getStoreConfig(self::XML_PATH_LANGUAGE, $storeId);
466
+ return $lang;
467
  }
468
 
469
  /**
487
  }
488
  return $this->_resource;
489
  }
490
+
491
+ /**
492
+ * Get contentItems
493
+ * @return array
494
+ */
495
+ public function getContentItems(){
496
+ return $this->_contentItems;
497
+ }
498
  }
app/code/community/Janolaw/Agb/Model/Email/Attachment/Pdf.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Specialization of Zend Mime Part for pdf files used as email
5
+ * attachment.
6
+ *
7
+ * Solves encoding problem of attachment filename
8
+ */
9
+ class Janolaw_Agb_Model_Email_Attachment_Pdf extends Zend_Mime_Part
10
+ {
11
+
12
+ public function __construct(
13
+ $body,
14
+ $filename,
15
+ $encoding = Zend_Mime::ENCODING_BASE64
16
+ )
17
+ {
18
+ parent::__construct($body);
19
+
20
+ $this->encoding = $encoding;
21
+ $this->type = 'application/pdf';
22
+ $this->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
23
+ $this->filename = $filename;
24
+ }
25
+
26
+ /**
27
+ * Create and return the array of headers for this MIME part
28
+ *
29
+ * @access public
30
+ * @return array
31
+ */
32
+ public function getHeadersArray($EOL = Zend_Mime::LINEEND)
33
+ {
34
+ $headers = array();
35
+
36
+ $contentType = $this->_renderContentTypeHeader($EOL);
37
+ $headers[] = array('Content-Type', $contentType);
38
+
39
+ if ($this->encoding) {
40
+ $headers[] = array('Content-Transfer-Encoding', $this->encoding);
41
+ }
42
+
43
+ if ($this->id) {
44
+ $headers[] = array('Content-ID', '<' . $this->id . '>');
45
+ }
46
+
47
+ if ($this->disposition) {
48
+ $disposition = $this->_renderDispositionHeader($EOL);
49
+ $headers[] = array('Content-Disposition', $disposition);
50
+ }
51
+
52
+ if ($this->description) {
53
+ $headers[] = array('Content-Description', $this->description);
54
+ }
55
+
56
+ if ($this->location) {
57
+ $headers[] = array('Content-Location', $this->location);
58
+ }
59
+
60
+ if ($this->language){
61
+ $headers[] = array('Content-Language', $this->language);
62
+ }
63
+
64
+ return $headers;
65
+ }
66
+
67
+ /**
68
+ * @param $EOL
69
+ *
70
+ * @return string
71
+ */
72
+ protected function _renderContentTypeHeader($EOL)
73
+ {
74
+ $contentType = $this->type;
75
+ if ($this->charset) {
76
+ $contentType .= '; charset=' . $this->charset;
77
+ }
78
+
79
+ if ($this->filename) {
80
+ $qEncodedFilename = Zend_Mime::encodeQuotedPrintableHeader(
81
+ $this->filename,
82
+ 'UTF-8',
83
+ Zend_Mime::LINELENGTH - strlen(' name=""')
84
+ );
85
+ $contentType .= ';' . $EOL . ' name="' . $qEncodedFilename . '"';
86
+ }
87
+
88
+ if ($this->boundary) {
89
+ $contentType .= ';' . $EOL
90
+ . " boundary=\"" . $this->boundary . '"';
91
+ }
92
+
93
+ return $contentType;
94
+ }
95
+
96
+ /**
97
+ * @param $EOL
98
+ * @return string
99
+ */
100
+ protected function _renderDispositionHeader($EOL)
101
+ {
102
+ if (!$this->disposition) {
103
+ Mage::log('empty disposition', Zend_Log::ERR);
104
+ return '';
105
+ }
106
+ $disposition = $this->disposition;
107
+ if ($this->filename) {
108
+ try {
109
+ $filename = $helper = Mage::helper('agbdownloader/email')
110
+ ->encodeHeaderParam('filename', $this->filename);
111
+ $disposition .= ';' . $EOL . $filename;
112
+ } catch (Exception $e) {
113
+ Mage::logException($e);
114
+ }
115
+ }
116
+ return $disposition;
117
+ }
118
+
119
+ }
app/code/community/Janolaw/Agb/Model/Email/Queue.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Janolaw_Agb_Model_Email_Queue extends Mage_Core_Model_Email_Queue
4
+ {
5
+
6
+ /**
7
+ * Send all messages in a queue
8
+ * REWRITE: add event before each email sending
9
+ *
10
+ * @return Mage_Core_Model_Email_Queue
11
+ */
12
+ public function send()
13
+ {
14
+ /** @var $collection Mage_Core_Model_Resource_Email_Queue_Collection */
15
+ $collection = Mage::getModel('core/email_queue')->getCollection()
16
+ ->addOnlyForSendingFilter()
17
+ ->setPageSize(self::MESSAGES_LIMIT_PER_CRON_RUN)
18
+ ->setCurPage(1)
19
+ ->load();
20
+
21
+ ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
22
+ ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
23
+
24
+ /** @var $message Mage_Core_Model_Email_Queue */
25
+ foreach ($collection as $message) {
26
+ if ($message->getId()) {
27
+ $parameters = new Varien_Object($message->getMessageParameters());
28
+ if ($parameters->getReturnPathEmail() !== null) {
29
+ $mailTransport = new Zend_Mail_Transport_Sendmail("-f" . $parameters->getReturnPathEmail());
30
+ Zend_Mail::setDefaultTransport($mailTransport);
31
+ }
32
+
33
+ $mailer = new Zend_Mail('utf-8');
34
+
35
+ //Begin
36
+ //Added event before sending
37
+ Mage::dispatchEvent(
38
+ 'janolaw_send_queue_before',
39
+ array(
40
+ 'mailer' => $mailer,
41
+ 'message' => $message,
42
+ )
43
+ );
44
+ //End
45
+
46
+ foreach ($message->getRecipients() as $recipient) {
47
+ list($email, $name, $type) = $recipient;
48
+ switch ($type) {
49
+ case self::EMAIL_TYPE_BCC:
50
+ $mailer->addBcc($email, '=?utf-8?B?' . base64_encode($name) . '?=');
51
+ break;
52
+ case self::EMAIL_TYPE_TO:
53
+ case self::EMAIL_TYPE_CC:
54
+ default:
55
+ $mailer->addTo($email, '=?utf-8?B?' . base64_encode($name) . '?=');
56
+ break;
57
+ }
58
+ }
59
+
60
+ if ($parameters->getIsPlain()) {
61
+ $mailer->setBodyText($message->getMessageBody());
62
+ } else {
63
+ $mailer->setBodyHTML($message->getMessageBody());
64
+ }
65
+
66
+ $mailer->setSubject('=?utf-8?B?' . base64_encode($parameters->getSubject()) . '?=');
67
+ $mailer->setFrom($parameters->getFromEmail(), $parameters->getFromName());
68
+ if ($parameters->getReplyTo() !== null) {
69
+ $mailer->setReplyTo($parameters->getReplyTo());
70
+ }
71
+ if ($parameters->getReturnTo() !== null) {
72
+ $mailer->setReturnPath($parameters->getReturnTo());
73
+ }
74
+
75
+ try {
76
+ $mailer->send();
77
+ unset($mailer);
78
+ $message->setProcessedAt(Varien_Date::formatDate(true));
79
+ $message->save();
80
+ }
81
+ catch (Exception $e) {
82
+ unset($mailer);
83
+ $oldDevMode = Mage::getIsDeveloperMode();
84
+ Mage::setIsDeveloperMode(true);
85
+ Mage::logException($e);
86
+ Mage::setIsDeveloperMode($oldDevMode);
87
+
88
+ return false;
89
+ }
90
+ }
91
+ }
92
+
93
+ return $this;
94
+ }
95
+ }
app/code/community/Janolaw/Agb/Model/Email/Template.php CHANGED
@@ -8,7 +8,7 @@ class Janolaw_Agb_Model_Email_Template extends Mage_Core_Model_Email_Template
8
  Mage::dispatchEvent(
9
  'janolaw_send_transactional_before',
10
  array(
11
- 'tempalte_id' => $templateId,
12
  'sender' => $sender,
13
  'recipient_email' => $email,
14
  'recipient_name' => $name,
@@ -23,7 +23,7 @@ class Janolaw_Agb_Model_Email_Template extends Mage_Core_Model_Email_Template
23
  Mage::dispatchEvent(
24
  'janolaw_send_transactional_after',
25
  array(
26
- 'tempalte_id' => $templateId,
27
  'sender' => $sender,
28
  'recipient_email' => $email,
29
  'recipient_name' => $name,
8
  Mage::dispatchEvent(
9
  'janolaw_send_transactional_before',
10
  array(
11
+ 'template_id' => $templateId,
12
  'sender' => $sender,
13
  'recipient_email' => $email,
14
  'recipient_name' => $name,
23
  Mage::dispatchEvent(
24
  'janolaw_send_transactional_after',
25
  array(
26
+ 'template_id' => $templateId,
27
  'sender' => $sender,
28
  'recipient_email' => $email,
29
  'recipient_name' => $name,
app/code/community/Janolaw/Agb/Model/Observer.php CHANGED
@@ -3,10 +3,33 @@
3
 
4
  class Janolaw_Agb_Model_Observer extends Mage_Core_Model_Abstract
5
  {
 
 
 
 
 
 
 
 
6
 
7
- const XML_PATH_ATTACHMENT_TAC = 'sales_email/order/include_tac_pdf';
 
 
 
 
 
 
 
8
 
9
- const XML_PATH_ATTACHMENT_REVOCATION = 'sales_email/order/include_revocation_pdf';
 
 
 
 
 
 
 
 
10
 
11
  protected $_downloader;
12
 
@@ -63,51 +86,49 @@ class Janolaw_Agb_Model_Observer extends Mage_Core_Model_Abstract
63
  *
64
  * @param Varien_Event_Observer $observer
65
  */
66
- public function addAttachmentToNewOrderEmail(Varien_Event_Observer $observer)
67
  {
68
  $templateId = $observer->getData('template_id');
69
  $storeId = $observer->getData('store_id');
70
 
71
- $newOrderTemplates = array(
72
- Mage::getStoreConfig(\Mage_Sales_Model_Order::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId),
73
- Mage::getStoreConfig(\Mage_Sales_Model_Order::XML_PATH_EMAIL_TEMPLATE, $storeId),
74
- );
75
- if (in_array($templateId, $newOrderTemplates)) {
76
  $templateModel = $observer->getData('template_model');
77
- $this->_addAttachment($templateModel, $storeId, self::XML_PATH_ATTACHMENT_TAC);
78
- $this->_addAttachment($templateModel, $storeId, self::XML_PATH_ATTACHMENT_REVOCATION);
 
 
 
 
79
  }
80
  }
81
 
82
- protected function _addAttachment(Mage_Core_Model_Email_Template $template, $storeId, $includeConfigPath)
 
 
 
 
 
 
83
  {
84
- switch ($includeConfigPath) {
85
- case self::XML_PATH_ATTACHMENT_TAC:
86
- $type = Janolaw_Agb_Model_CmsAssistant::TYPE_TAC;
87
- $attachmentFilename = $this->_getHelper()->__('Terms-and-conditions') . '.pdf';
88
- break;
89
- case self::XML_PATH_ATTACHMENT_REVOCATION:
90
- $type = Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION;
91
- $attachmentFilename = $this->_getHelper()->__('Revocation-policy') . '.pdf';
92
- break;
93
- default:
94
- return;
95
- }
96
- if (Mage::getStoreConfigFlag($includeConfigPath, $storeId)) {
97
- $pdfPath = $this->_getDownloader()->getPdfPathByType($storeId, $type);
98
- if ($pdfPath) {
99
- try {
100
- $pdf = Zend_Pdf::load($pdfPath);
101
- $template->getMail()->createAttachment(
102
- $pdf->render(),
103
- Zend_Mime::TYPE_OCTETSTREAM,
104
- Zend_Mime::DISPOSITION_ATTACHMENT,
105
- Zend_Mime::ENCODING_BASE64,
106
- $attachmentFilename
107
- );
108
- } catch (Exception $e) {
109
- Mage::logException($e);
110
- }
111
  }
112
  }
113
  }
@@ -123,8 +144,78 @@ class Janolaw_Agb_Model_Observer extends Mage_Core_Model_Abstract
123
  return $this->_downloader;
124
  }
125
 
 
 
 
126
  protected function _getHelper()
127
  {
128
  return Mage::helper('agbdownloader');
129
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  }
3
 
4
  class Janolaw_Agb_Model_Observer extends Mage_Core_Model_Abstract
5
  {
6
+ /**
7
+ * Array with allowed email templates where pdf documents would be attached
8
+ * @var array
9
+ */
10
+ protected $_allowedEmailTemplateWithAttachment = array(
11
+ \Mage_Sales_Model_Order::XML_PATH_EMAIL_GUEST_TEMPLATE,
12
+ \Mage_Sales_Model_Order::XML_PATH_EMAIL_TEMPLATE
13
+ );
14
 
15
+ /**
16
+ * Array with allowed queue types where pdf documents would be attached
17
+ * \Mage_Sales_Model_Order::EMAIL_EVENT_TYPE
18
+ * @var array
19
+ */
20
+ protected $_allowedEmailQueueWithAttachment = array(
21
+ 'new_order'
22
+ );
23
 
24
+ /**
25
+ * Janolaw_Agb_Model_CmsAssistant::ITEM => system config path to enabled selectbox
26
+ * @var array
27
+ */
28
+ protected $_attachedPdfTypes = array(
29
+ \Janolaw_Agb_Model_CmsAssistant::TYPE_TAC => 'agbdownload/janoloaw_agb_pdf/agb',
30
+ \Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION => 'agbdownload/janoloaw_agb_pdf/wiederruf',
31
+ \Janolaw_Agb_Model_CmsAssistant::TYPE_WITHDRAWAL => 'agbdownload/janoloaw_agb_pdf/withdrawal'
32
+ );
33
 
34
  protected $_downloader;
35
 
86
  *
87
  * @param Varien_Event_Observer $observer
88
  */
89
+ public function addAttachmentTransactionEmail(Varien_Event_Observer $observer)
90
  {
91
  $templateId = $observer->getData('template_id');
92
  $storeId = $observer->getData('store_id');
93
 
94
+ if (in_array($templateId, $this->getAllowedEmailTemplateWithAttachment($storeId))) {
 
 
 
 
95
  $templateModel = $observer->getData('template_model');
96
+ foreach($this->getAttachedPdfTypes($storeId) as $type => $configPath){
97
+ $pdfTitle = $this->_getDownloader()->getPdfTitleByType($type, $storeId).'.pdf';
98
+ $pdfPath = $this->_getDownloader()->getPdfPathByType($storeId, $type);
99
+
100
+ $this->_getHelper()->addAttachment($templateModel->getMail(), $pdfTitle, $pdfPath);
101
+ }
102
  }
103
  }
104
 
105
+ /**
106
+ * event: janolaw_send_queue_before
107
+ * @see \Janolaw_Agb_Model_Email_Queue::send
108
+ *
109
+ * @param Varien_Event_Observer $observer
110
+ */
111
+ public function addAttachmentQueueEmail(Varien_Event_Observer $observer)
112
  {
113
+ /** @var Janolaw_Agb_Model_Email_Queue $message */
114
+ $message = $observer->getData('message');
115
+ /** @var Zend_Mail $mailer */
116
+ $mailer = $observer->getData('mailer');
117
+
118
+ if($message
119
+ && $message->getData('event_type')
120
+ && $this->_validEmailQueueType($message->getData('event_type'))
121
+ ){
122
+ $storeId = $this->_storeIdByQueueObject(
123
+ $message->getData('entity_type'),
124
+ $message->getData('entity_id')
125
+ );
126
+
127
+ foreach($this->getAttachedPdfTypes($storeId) as $type => $configPath){
128
+ $pdfTitle = $this->_getDownloader()->getPdfTitleByType($type, $storeId).'.pdf';
129
+ $pdfPath = $this->_getDownloader()->getPdfPathByType($storeId, $type);
130
+
131
+ $this->_getHelper()->addAttachment($mailer, $pdfTitle, $pdfPath);
 
 
 
 
 
 
 
 
132
  }
133
  }
134
  }
144
  return $this->_downloader;
145
  }
146
 
147
+ /**
148
+ * @return Janolaw_Agb_Helper_Data
149
+ */
150
  protected function _getHelper()
151
  {
152
  return Mage::helper('agbdownloader');
153
  }
154
+
155
+ /**
156
+ * get AllowedEmailTemplateWithAttachment
157
+ * @param $storeId
158
+ * @return array
159
+ */
160
+ public function getAllowedEmailTemplateWithAttachment($storeId){
161
+ $items = array();
162
+ foreach($this->_allowedEmailTemplateWithAttachment as $path){
163
+ $templateId = Mage::getStoreConfig($path, $storeId);
164
+ if($templateId) $items[] = $templateId;
165
+ }
166
+ return $items;
167
+ }
168
+
169
+ /**
170
+ * get AllowedEmailQueueWithAttachment
171
+ * @return array
172
+ */
173
+ public function getAllowedEmailQueueWithAttachment(){
174
+ return $this->_allowedEmailQueueWithAttachment;
175
+ }
176
+
177
+ /**
178
+ * get AttachedPdfTypes
179
+ * @param $storeId
180
+ * @return array
181
+ */
182
+ public function getAttachedPdfTypes($storeId){
183
+ $items = array();
184
+ foreach ($this->_attachedPdfTypes as $type => $configPathEnablePdfAttachment) {
185
+ if(Mage::getStoreConfigFlag($configPathEnablePdfAttachment, $storeId)) $items[$type] = $configPathEnablePdfAttachment;
186
+ }
187
+ return $items;
188
+ }
189
+
190
+ /**
191
+ * Check queue email type
192
+ * @param $event_type
193
+ * @return bool
194
+ */
195
+ private function _validEmailQueueType($event_type){
196
+ if(in_array($event_type, $this->getAllowedEmailQueueWithAttachment())) return true;
197
+ else return false;
198
+ }
199
+
200
+ /**
201
+ * @param $entity_type
202
+ * @param $entity_id
203
+ * @return int
204
+ */
205
+ private function _storeIdByQueueObject($entity_type, $entity_id){
206
+ $storeId = 0;
207
+
208
+ try {
209
+ switch($entity_type){
210
+ case 'order':
211
+ $entity_id = intval($entity_id);
212
+ $storeId = Mage::getModel('sales/order')->load($entity_id)->getStoreId();
213
+ break;
214
+ }
215
+ } catch (Exception $e) {
216
+ Mage::logException($e);
217
+ }
218
+
219
+ return $storeId;
220
+ }
221
  }
app/code/community/Janolaw/Agb/Model/Source/Language.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Janolaw_Agb_Model_Source_Language
4
+ {
5
+
6
+ /**
7
+ * Config options for available janolaw languages. This depends
8
+ * on the janolaw service version.
9
+ *
10
+ * @return array
11
+ */
12
+ public function toOptionArray()
13
+ {
14
+ $options = array();
15
+ $options[] = array(
16
+ 'value' => 'de',
17
+ 'label' => Mage::helper('agbdownloader')->__('German')
18
+ );
19
+
20
+ /* @var $downloader Janolaw_Agb_Model_Downloader */
21
+ $downloader = Mage::getSingleton('agbdownloader/downloader');
22
+ if ($downloader->checkPdfAvailable()) {
23
+ // we're in version 3 (or maybe higher) of the janolaw service, where
24
+ // additional languages are available
25
+ $options[] = array(
26
+ 'value' => 'gb',
27
+ 'label' => Mage::helper('agbdownloader')->__('English')
28
+ );
29
+ $options[] = array(
30
+ 'value' => 'fr',
31
+ 'label' => Mage::helper('agbdownloader')->__('French')
32
+ );
33
+ }
34
+ return $options;
35
+ }
36
+ }
app/code/community/Janolaw/Agb/controllers/Adminhtml/Janolaw/SetupController.php CHANGED
@@ -5,6 +5,11 @@ class Janolaw_Agb_Adminhtml_Janolaw_SetupController extends Mage_Adminhtml_Contr
5
 
6
  protected $_lastError = '';
7
 
 
 
 
 
 
8
  /**
9
  * Show setup page
10
  */
@@ -79,6 +84,21 @@ class Janolaw_Agb_Adminhtml_Janolaw_SetupController extends Mage_Adminhtml_Contr
79
  }
80
  }
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  /**
83
  * If request has a parameter 'is_ajax', then a json response is sendt.
84
  * Otherwise, the message is added to the session (as success or error message, depending on $success)
5
 
6
  protected $_lastError = '';
7
 
8
+ protected function _isAllowed()
9
+ {
10
+ return Mage::getSingleton('admin/session')->isAllowed('admin/system/janolaw/setup');
11
+ }
12
+
13
  /**
14
  * Show setup page
15
  */
84
  }
85
  }
86
 
87
+ public function allowCmsBlockIncludesAction()
88
+ {
89
+ $helper = $this->_getHelper();
90
+ try {
91
+ $helper->allowCmsBlockIncludes();
92
+ $successMsg = $helper->__('Successfully defined cms block type as \'allowed\' in block whitelist');
93
+ $this->_endRequest(true, $successMsg);
94
+ } catch (Janolaw_Agb_Helper_NoBlockWhitelistException $e) {
95
+ $msg = $helper->__(
96
+ 'There is no block whitelist avaialable in your system. Please install the Magento Security patch SUPEE-6788'
97
+ );
98
+ $this->_endRequest(false, $msg);
99
+ }
100
+ }
101
+
102
  /**
103
  * If request has a parameter 'is_ajax', then a json response is sendt.
104
  * Otherwise, the message is added to the session (as success or error message, depending on $success)
app/code/community/Janolaw/Agb/controllers/Adminhtml/Janolaw/StatusController.php CHANGED
@@ -4,6 +4,11 @@
4
  class Janolaw_Agb_Adminhtml_Janolaw_StatusController extends Mage_Adminhtml_Controller_Action
5
  {
6
 
 
 
 
 
 
7
  /**
8
  * Print info about state of janolaw module..
9
  */
4
  class Janolaw_Agb_Adminhtml_Janolaw_StatusController extends Mage_Adminhtml_Controller_Action
5
  {
6
 
7
+ protected function _isAllowed()
8
+ {
9
+ return Mage::getSingleton('admin/session')->isAllowed('admin/system/janolaw/status');
10
+ }
11
+
12
  /**
13
  * Print info about state of janolaw module..
14
  */
app/code/community/Janolaw/Agb/data/agb_setup/data-upgrade-0.2.5-0.2.6.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // this blocks should be allowed...
4
+ $blocks = array(
5
+ 'cms/block',
6
+ );
7
+
8
+ // check if block whitelist exists
9
+ if (false === Mage::getModel('admin/block')) {
10
+ return; // cannot add block type to non-existant whitelist
11
+ }
12
+
13
+
14
+ // load collection of all previously defined blocks to prevent publicates (block_name is unique)
15
+
16
+ $existingBlocksByName = array();
17
+ foreach (Mage::getModel('admin/block')->getCollection() as $b) {
18
+ /* @var $b Mage_Admin_Model_Block */
19
+ $existingBlocksByName[$b->getData('block_name')] = $b;
20
+ }
21
+
22
+ foreach ($blocks as $allowedBlock) {
23
+ if (\array_key_exists($allowedBlock, $existingBlocksByName)) {
24
+ $block = $existingBlocksByName[$allowedBlock];
25
+ } else {
26
+ $block = Mage::getModel('admin/block');
27
+ $block->setData('block_name', $allowedBlock);
28
+ }
29
+ $block->setData('is_allowed', 1);
30
+ $block->save();
31
+ }
app/code/community/Janolaw/Agb/etc/adminhtml.xml CHANGED
@@ -39,6 +39,14 @@
39
  <janolaw translate="title">
40
  <title>Janolaw AGB</title>
41
  <sort_order>10</sort_order>
 
 
 
 
 
 
 
 
42
  </janolaw>
43
  </children>
44
  </system>
39
  <janolaw translate="title">
40
  <title>Janolaw AGB</title>
41
  <sort_order>10</sort_order>
42
+ <children>
43
+ <status>
44
+ <title>Status</title>
45
+ </status>
46
+ <setup>
47
+ <title>Setup</title>
48
+ </setup>
49
+ </children>
50
  </janolaw>
51
  </children>
52
  </system>
app/code/community/Janolaw/Agb/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Janolaw_Agb>
5
- <version>0.1.6</version>
6
  </Janolaw_Agb>
7
  </modules>
8
  <global>
@@ -17,6 +17,7 @@
17
  <core>
18
  <rewrite>
19
  <email_template>Janolaw_Agb_Model_Email_Template</email_template>
 
20
  </rewrite>
21
  </core>
22
  </models>
@@ -42,17 +43,25 @@
42
  </agb_setup>
43
  </resources>
44
  <events>
45
- <!-- we do not support pdf attachments yet, but will probably do so later.. -->
46
- <!--
47
  <janolaw_send_transactional_before>
48
  <observers>
49
  <neworder_add_attachement>
50
  <class>agbdownloader/observer</class>
51
- <method>addAttachmentToNewOrderEmail</method>
52
  </neworder_add_attachement>
53
  </observers>
54
  </janolaw_send_transactional_before>
55
- -->
 
 
 
 
 
 
 
 
 
56
  </events>
57
  </global>
58
 
@@ -118,18 +127,27 @@
118
  </observers>
119
  </core_block_abstract_to_html_before>
120
  </events>
 
 
 
 
 
 
 
121
  </frontend>
122
 
123
  <default>
124
  <agbdownload>
125
  <janoloaw_agb_user>
126
  <api_base_url><![CDATA[http://www.janolaw.de/agb-service/shops]]></api_base_url>
 
127
  </janoloaw_agb_user>
128
  <janoloaw_agb_cms>
129
  <agbid></agbid> <!-- empty values prevent the system from creating or overwriting any pages/blocks, so we use that as default... -->
130
  <impressumid></impressumid>
131
  <wiederrufid></wiederrufid>
132
  <datenschutzid></datenschutzid>
 
133
  </janoloaw_agb_cms>
134
  </agbdownload>
135
  </default>
@@ -139,7 +157,7 @@
139
  <janolaw_import_all>
140
  <schedule>
141
  <!-- every second hour -->
142
- <cron_expr>* */2 * * *</cron_expr>
143
  </schedule>
144
  <run>
145
  <model>agbdownloader/downloader::download</model>
@@ -147,4 +165,4 @@
147
  </janolaw_import_all>
148
  </jobs>
149
  </crontab>
150
- </config>
2
  <config>
3
  <modules>
4
  <Janolaw_Agb>
5
+ <version>0.2.6</version>
6
  </Janolaw_Agb>
7
  </modules>
8
  <global>
17
  <core>
18
  <rewrite>
19
  <email_template>Janolaw_Agb_Model_Email_Template</email_template>
20
+ <email_queue>Janolaw_Agb_Model_Email_Queue</email_queue>
21
  </rewrite>
22
  </core>
23
  </models>
43
  </agb_setup>
44
  </resources>
45
  <events>
46
+ <!-- pdf attachments to transaction email -->
 
47
  <janolaw_send_transactional_before>
48
  <observers>
49
  <neworder_add_attachement>
50
  <class>agbdownloader/observer</class>
51
+ <method>addAttachmentTransactionEmail</method>
52
  </neworder_add_attachement>
53
  </observers>
54
  </janolaw_send_transactional_before>
55
+
56
+ <!-- pdf attachments to queue email (since magento CE 1.9.1)-->
57
+ <janolaw_send_queue_before>
58
+ <observers>
59
+ <neworder_add_attachement>
60
+ <class>agbdownloader/observer</class>
61
+ <method>addAttachmentQueueEmail</method>
62
+ </neworder_add_attachement>
63
+ </observers>
64
+ </janolaw_send_queue_before>
65
  </events>
66
  </global>
67
 
127
  </observers>
128
  </core_block_abstract_to_html_before>
129
  </events>
130
+ <layout>
131
+ <updates>
132
+ <baseprice>
133
+ <file>agbdownloader.xml</file>
134
+ </baseprice>
135
+ </updates>
136
+ </layout>
137
  </frontend>
138
 
139
  <default>
140
  <agbdownload>
141
  <janoloaw_agb_user>
142
  <api_base_url><![CDATA[http://www.janolaw.de/agb-service/shops]]></api_base_url>
143
+ <language>de</language>
144
  </janoloaw_agb_user>
145
  <janoloaw_agb_cms>
146
  <agbid></agbid> <!-- empty values prevent the system from creating or overwriting any pages/blocks, so we use that as default... -->
147
  <impressumid></impressumid>
148
  <wiederrufid></wiederrufid>
149
  <datenschutzid></datenschutzid>
150
+ <withdrawalid></withdrawalid>
151
  </janoloaw_agb_cms>
152
  </agbdownload>
153
  </default>
157
  <janolaw_import_all>
158
  <schedule>
159
  <!-- every second hour -->
160
+ <cron_expr>5 */2 * * *</cron_expr>
161
  </schedule>
162
  <run>
163
  <model>agbdownloader/downloader::download</model>
165
  </janolaw_import_all>
166
  </jobs>
167
  </crontab>
168
+ </config>
app/code/community/Janolaw/Agb/etc/system.xml CHANGED
@@ -1,37 +1,6 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <config>
3
  <sections>
4
- <!-- currently we do not support pdf attachments... but do not delete, as we will support that later. -->
5
- <!--
6
- <sales_email>
7
- <groups>
8
- <order>
9
- <fields>
10
- <include_tac_pdf translate="label comment" module="agbdownloader">
11
- <label><![CDATA[Include T&C pdf as Attachment]]></label>
12
- <comment>Note that this only works if a pdf is available from janolaw</comment>
13
- <frontend_type>select</frontend_type>
14
- <source_model>adminhtml/system_config_source_yesno</source_model>
15
- <sort_order>3</sort_order>
16
- <show_in_default>1</show_in_default>
17
- <show_in_website>1</show_in_website>
18
- <show_in_store>1</show_in_store>
19
- </include_tac_pdf>
20
- <include_revocation_pdf translate="label comment" module="agbdownloader">
21
- <label><![CDATA[Include revocation pdf as Attachment]]></label>
22
- <comment>Note that this only works if a pdf is available from janolaw</comment>
23
- <frontend_type>select</frontend_type>
24
- <source_model>adminhtml/system_config_source_yesno</source_model>
25
- <sort_order>3</sort_order>
26
- <show_in_default>1</show_in_default>
27
- <show_in_website>1</show_in_website>
28
- <show_in_store>1</show_in_store>
29
- </include_revocation_pdf>
30
- </fields>
31
- </order>
32
- </groups>
33
- </sales_email>
34
- -->
35
  <agbdownload>
36
  <tab>general</tab>
37
  <label>janolaw AGB-Hosting</label>
@@ -41,8 +10,10 @@
41
  <show_in_website>1</show_in_website>
42
  <show_in_store>1</show_in_store>
43
  <groups>
44
- <janoloaw_agb_user translate="label" module="agbdownloader">
45
- <label>Userdaten</label>
 
 
46
  <sort_order>65</sort_order>
47
  <show_in_default>1</show_in_default>
48
  <show_in_website>1</show_in_website>
@@ -52,7 +23,7 @@
52
  <label>Enabled</label>
53
  <frontend_type>select</frontend_type>
54
  <source_model>adminhtml/system_config_source_yesno</source_model>
55
- <sort_order>10</sort_order>
56
  <show_in_default>1</show_in_default>
57
  <show_in_website>1</show_in_website>
58
  <show_in_store>1</show_in_store>
@@ -81,13 +52,23 @@
81
  <show_in_website>0</show_in_website>
82
  <show_in_store>0</show_in_store>
83
  </api_base_url>
 
 
 
 
 
 
 
 
 
 
84
  </fields>
85
  </janoloaw_agb_user>
86
 
87
  <!-- only in default scope, as store specific data is handled by cms (multiple records per identifier possible) -->
88
- <janoloaw_agb_cms translate="label,comment" module="agbdownloader">
89
  <label>Storage definitions</label>
90
- <comment>Defines block identifiers where the legal texts from janolaw are stored. Note that the content inside the blocks defined here is overwritten when synchronizing with Janolaw Hosting (in all stores!).</comment>
91
  <sort_order>75</sort_order>
92
  <show_in_default>1</show_in_default>
93
  <fields>
@@ -115,8 +96,47 @@
115
  <sort_order>15</sort_order>
116
  <show_in_default>1</show_in_default>
117
  </datenschutzid>
 
 
 
 
 
 
 
 
118
  </fields>
119
  </janoloaw_agb_cms>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  </groups>
121
  </agbdownload>
122
  </sections>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <config>
3
  <sections>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  <agbdownload>
5
  <tab>general</tab>
6
  <label>janolaw AGB-Hosting</label>
10
  <show_in_website>1</show_in_website>
11
  <show_in_store>1</show_in_store>
12
  <groups>
13
+ <janoloaw_agb_user translate="label comment" module="agbdownloader">
14
+ <label>User data</label>
15
+ <comment><![CDATA[Basic settings to connect to the Janolaw service. Note that after downgrading, you must save the configuration again, to make sure that no unsupported languages are configured. Please do a manual synchronisation (System > Janolaw AGB Hosting > Status) after changing this settings.]]></comment>
16
+ <expanded>1</expanded>
17
  <sort_order>65</sort_order>
18
  <show_in_default>1</show_in_default>
19
  <show_in_website>1</show_in_website>
23
  <label>Enabled</label>
24
  <frontend_type>select</frontend_type>
25
  <source_model>adminhtml/system_config_source_yesno</source_model>
26
+ <sort_order>5</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>
52
  <show_in_website>0</show_in_website>
53
  <show_in_store>0</show_in_store>
54
  </api_base_url>
55
+
56
+ <language translate="label">
57
+ <label>Language</label>
58
+ <frontend_type>select</frontend_type>
59
+ <sort_order>25</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ <source_model>agbdownloader/source_language</source_model>
64
+ </language>
65
  </fields>
66
  </janoloaw_agb_user>
67
 
68
  <!-- only in default scope, as store specific data is handled by cms (multiple records per identifier possible) -->
69
+ <janoloaw_agb_cms translate="label comment" module="agbdownloader">
70
  <label>Storage definitions</label>
71
+ <comment><![CDATA[Defines block identifiers where the legal texts from janolaw are stored. Note that the content inside the blocks defined here is overwritten when synchronizing with Janolaw Hosting (in all stores!).]]></comment>
72
  <sort_order>75</sort_order>
73
  <show_in_default>1</show_in_default>
74
  <fields>
96
  <sort_order>15</sort_order>
97
  <show_in_default>1</show_in_default>
98
  </datenschutzid>
99
+ <withdrawalid translate="label">
100
+ <label>Muster-Widerrufsformular Block (string identifier)</label>
101
+ <frontend_type>text</frontend_type>
102
+ <!-- custom frontend model to check if it should be shown or not -->
103
+ <frontend_model>agbdownloader/adminhtml_system_config_form_field</frontend_model>
104
+ <sort_order>17</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ </withdrawalid>
107
  </fields>
108
  </janoloaw_agb_cms>
109
+
110
+ <janoloaw_agb_pdf translate="label" module="agbdownloader">
111
+ <label>Enable PDF attachment to all emails</label>
112
+ <frontend_model>agbdownloader/adminhtml_system_config_fieldset_pdf</frontend_model>
113
+ <sort_order>85</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <fields>
116
+ <agb translate="label">
117
+ <label>AGB</label>
118
+ <frontend_type>select</frontend_type>
119
+ <source_model>adminhtml/system_config_source_yesno</source_model>
120
+ <sort_order>10</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ </agb>
123
+ <wiederruf translate="label">
124
+ <label>Widerrufsbelehrung</label>
125
+ <frontend_type>select</frontend_type>
126
+ <source_model>adminhtml/system_config_source_yesno</source_model>
127
+ <sort_order>10</sort_order>
128
+ <show_in_default>1</show_in_default>
129
+ </wiederruf>
130
+ <withdrawal translate="label">
131
+ <label>Muster-Widerrufsformular</label>
132
+ <frontend_type>select</frontend_type>
133
+ <source_model>adminhtml/system_config_source_yesno</source_model>
134
+ <sort_order>20</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ </withdrawal>
137
+
138
+ </fields>
139
+ </janoloaw_agb_pdf>
140
  </groups>
141
  </agbdownload>
142
  </sections>
app/design/adminhtml/default/default/template/janolawagb/setup.phtml CHANGED
@@ -15,6 +15,7 @@ $urlModel = Mage::getModel('adminhtml/url');
15
  $linkSysConfig = $urlModel->getUrl('adminhtml/system_config/edit', array('section' => 'agbdownload'));
16
  $staticBlockUrl = $urlModel->getUrl('adminhtml/cms_block/index');
17
  $cmsPageUrl = $urlModel->getUrl('adminhtml/cms_page/index');
 
18
  $agreementsUrl = $urlModel->getUrl('adminhtml/checkout_agreement/index');
19
 
20
  /* @var $cmsAssistant Janolaw_Agb_Model_CmsAssistant */
@@ -23,6 +24,9 @@ $blockCandidates = $cmsAssistant->getBlockCandidates();
23
 
24
  $actionSetBlockId = $urlModel->getUrl('adminhtml/janolaw_setup/setBlockIdentifier');
25
  $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement');
 
 
 
26
  ?>
27
 
28
  <div class="content-header">
@@ -67,31 +71,31 @@ $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement'
67
  </div>
68
  <div class="fieldset">
69
  <?php if ($isInstalledMageSetup): ?>
70
- <p>
71
- Auf Ihrem System ist bereits das Modul <b>FireGento_MageSetup</b> installiert. Diese arbeitet optimal mit
72
- dem Janolaw Modul zusammen.
73
- </p>
74
  <?php elseif ($isInstalledGermanSetup): ?>
75
- <p>
76
- Auf Ihrem System ist bereits das Modul <b>FireGento_GermanSetup</b> installiert. Diese arbeitet optimal mit
77
- dem Janolaw Modul zusammen.
78
- </p>
79
  <?php elseif ($isInstalledSymmetricsAgreement): ?>
80
- <p>
81
- Auf Ihrem System ist bereits das Modul <b>Symmetrics_Agreement</b> (als Teil der Modulsammlung Market
82
- Ready Germany) installiert. Diese arbeitet optimal mit dem Janolaw Modul zusammen.
83
- </p>
84
  <?php else: ?>
85
- <p>
86
- Auf Ihrem System ist kein (bekanntes) Modul installiert, das die Einbindung von den AGB und
87
- Widerruf-Texten in den Checkout-Prozess vornimmt. Wir empfehlen dazu das Modul
88
- <a href="http://www.magentocommerce.com/magento-connect/firegento-magesetup.html">MageSetup von FireGento</a>.
89
- Falls Sie dieses Modul installieren wollen, installieren <b>und initialisieren</b> Sie dieses Modul bitte
90
- <b>bevor</b> Sie mit diesem Setup weiterfahren (beachten Sie dazu die Hinweise des Anbieters).
91
- Sie erreichen diese Setup-Seite anschließend wieder über den Menü-Punkt System -&gt; Janolaw AGB Hosting
92
- -&gt; Setup.
93
- Alternativ können Sie das Janolaw Modul auch standalone nutzen.
94
- </p>
95
  <?php endif; ?>
96
  </div>
97
  </div>
@@ -135,10 +139,10 @@ $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement'
135
  $currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_TAC_ID, 0);
136
  ?>
137
  <?php if ($currentValue): ?>
138
- <p>
139
- Dieser Wert ist bereits konfiguriert. Der aktuelle Wert ist <i><?php echo $currentValue; ?></i>.
140
- Sie können den Wert so belassen oder ihn ändern.
141
- </p>
142
  <?php endif; ?>
143
 
144
  <?php $blocks = $blockCandidates[Janolaw_Agb_Model_CmsAssistant::TYPE_TAC]; ?>
@@ -174,10 +178,10 @@ $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement'
174
  $currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_REVOCATION_ID, 0);
175
  ?>
176
  <?php if ($currentValue): ?>
177
- <p>
178
- Dieser Wert ist bereits konfiguriert. Der aktuelle Wert ist <i><?php echo $currentValue; ?></i>.
179
- Sie können den Wert so belassen oder ihn ändern.
180
- </p>
181
  <?php endif; ?>
182
 
183
  <?php $blocks = $blockCandidates[Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION]; ?>
@@ -279,6 +283,53 @@ $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement'
279
  <input type="hidden" name="type" value="<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT; ?>"/>
280
  <button>CMS-Block Bezeichner für Impressum setzen</button><br />
281
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  </div>
283
  </div>
284
 
@@ -307,9 +358,10 @@ $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement'
307
  </div>
308
  <div class="fieldset">
309
  <p>
310
- In der Regel sollen alle vier Texte als CMS-Seite in Ihrem Shop angezeigt werden. Dazu müssen CMS-Seiten
311
- erstellt werden (wenn sie nicht bereits existieren) und die oben konfigurierten CMS-Blöcke eingebunden
312
- werden.
 
313
  </p>
314
  <p>
315
  Als ersten Schritt müssen Sie dazu herausfinden, welche Seiten bereits existieren. Die schon erwähnten Module
@@ -373,8 +425,8 @@ $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement'
373
  <pre><?php echo $cmsAssistant->getCmsDirectiveSnippet($currentValue); ?></pre>
374
  <?php else: ?>
375
  <p>
376
- Es wurde noch kein CMS-Block zur Speicherung der Datenschutzbestimmungen definiert. (Bitte befolgen Sie die Anweisungen
377
- aus Schritt 2).
378
  </p>
379
  <?php endif; ?>
380
 
@@ -390,6 +442,18 @@ $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement'
390
  </p>
391
  <?php endif; ?>
392
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  <br />
394
  <p>
395
  Nun sollten Sie sicherstellen, dass die angelegten Seiten verlinkt werden. Meistens
@@ -398,6 +462,30 @@ $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement'
398
  &quot;footer_links&quot; (bzw. &quot;footer_links_company&quot; ab v1.9), bei dem Sie
399
  Links zu den neu angelegten Seiten definieren können.
400
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
  </div>
402
  </div>
403
 
@@ -507,16 +595,38 @@ $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement'
507
  jlform.block_revocation = new varienForm("form_block_id_revocation", "");
508
  jlform.block_privacy = new varienForm("form_block_id_privacy", "");
509
  jlform.block_imprint = new varienForm("form_block_id_imprint", "");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
510
  document.observe("dom:loaded", function() {
511
  var jlform_fkey = new Element("input", {
512
  "type" : "hidden",
513
  "name" : "form_key",
514
  "value" : FORM_KEY
515
  });
 
 
516
  document.getElementById("form_block_id_tac").insert(jlform_fkey.clone());
517
  document.getElementById("form_block_id_revocation").insert(jlform_fkey.clone());
518
  document.getElementById("form_block_id_privacy").insert(jlform_fkey.clone());
519
  document.getElementById("form_block_id_imprint").insert(jlform_fkey.clone());
 
 
 
520
  });
521
 
522
  jlform.createAgreement = function(agreement_type) {
@@ -536,19 +646,19 @@ $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement'
536
  var req = new Ajax.Request("<?php echo $actionSaveAgreement; ?>", {
537
  "method": "post",
538
  "parameters": data,
539
- onSuccess: function(response) {
540
- var result = response.responseText.evalJSON();
541
- if (result.message) {
542
- alert(result.message);
543
- } else {
544
- alert("Ein Fehler ist aufgetreten");
545
- }
546
- },
547
- onFailure: function(response) {
548
- alert("Ein Fehler ist aufgetreten");
549
- }
550
  });
551
- }
 
 
 
 
 
 
 
 
 
552
 
553
  </script>
554
 
15
  $linkSysConfig = $urlModel->getUrl('adminhtml/system_config/edit', array('section' => 'agbdownload'));
16
  $staticBlockUrl = $urlModel->getUrl('adminhtml/cms_block/index');
17
  $cmsPageUrl = $urlModel->getUrl('adminhtml/cms_page/index');
18
+ $blockWhitlistUrl = $urlModel->getUrl('adminhtml/permissions_block/index');
19
  $agreementsUrl = $urlModel->getUrl('adminhtml/checkout_agreement/index');
20
 
21
  /* @var $cmsAssistant Janolaw_Agb_Model_CmsAssistant */
24
 
25
  $actionSetBlockId = $urlModel->getUrl('adminhtml/janolaw_setup/setBlockIdentifier');
26
  $actionSaveAgreement = $urlModel->getUrl('adminhtml/janolaw_setup/saveAgreement');
27
+ $actionAllowCmsBlocks = $urlModel->getUrl('adminhtml/janolaw_setup/allowCmsBlockIncludes');
28
+
29
+ $_withdrawalFormAvailable = (bool) Mage::getSingleton('agbdownloader/downloader')->checkPdfAvailable();
30
  ?>
31
 
32
  <div class="content-header">
71
  </div>
72
  <div class="fieldset">
73
  <?php if ($isInstalledMageSetup): ?>
74
+ <p>
75
+ Auf Ihrem System ist bereits das Modul <b>FireGento_MageSetup</b> installiert. Diese arbeitet optimal mit
76
+ dem Janolaw Modul zusammen.
77
+ </p>
78
  <?php elseif ($isInstalledGermanSetup): ?>
79
+ <p>
80
+ Auf Ihrem System ist bereits das Modul <b>FireGento_GermanSetup</b> installiert. Diese arbeitet optimal mit
81
+ dem Janolaw Modul zusammen.
82
+ </p>
83
  <?php elseif ($isInstalledSymmetricsAgreement): ?>
84
+ <p>
85
+ Auf Ihrem System ist bereits das Modul <b>Symmetrics_Agreement</b> (als Teil der Modulsammlung Market
86
+ Ready Germany) installiert. Diese arbeitet optimal mit dem Janolaw Modul zusammen.
87
+ </p>
88
  <?php else: ?>
89
+ <p>
90
+ Auf Ihrem System ist kein (bekanntes) Modul installiert, das die Einbindung von den AGB und
91
+ Widerruf-Texten in den Checkout-Prozess vornimmt. Wir empfehlen dazu das Modul
92
+ <a href="http://www.magentocommerce.com/magento-connect/firegento-magesetup.html">MageSetup von FireGento</a>.
93
+ Falls Sie dieses Modul installieren wollen, installieren <b>und initialisieren</b> Sie dieses Modul bitte
94
+ <b>bevor</b> Sie mit diesem Setup weiterfahren (beachten Sie dazu die Hinweise des Anbieters).
95
+ Sie erreichen diese Setup-Seite anschließend wieder über den Menü-Punkt System -&gt; Janolaw AGB Hosting
96
+ -&gt; Setup.
97
+ Alternativ können Sie das Janolaw Modul auch standalone nutzen.
98
+ </p>
99
  <?php endif; ?>
100
  </div>
101
  </div>
139
  $currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_TAC_ID, 0);
140
  ?>
141
  <?php if ($currentValue): ?>
142
+ <p>
143
+ Dieser Wert ist bereits konfiguriert. Der aktuelle Wert ist <i><?php echo $currentValue; ?></i>.
144
+ Sie können den Wert so belassen oder ihn ändern.
145
+ </p>
146
  <?php endif; ?>
147
 
148
  <?php $blocks = $blockCandidates[Janolaw_Agb_Model_CmsAssistant::TYPE_TAC]; ?>
178
  $currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_REVOCATION_ID, 0);
179
  ?>
180
  <?php if ($currentValue): ?>
181
+ <p>
182
+ Dieser Wert ist bereits konfiguriert. Der aktuelle Wert ist <i><?php echo $currentValue; ?></i>.
183
+ Sie können den Wert so belassen oder ihn ändern.
184
+ </p>
185
  <?php endif; ?>
186
 
187
  <?php $blocks = $blockCandidates[Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION]; ?>
283
  <input type="hidden" name="type" value="<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_IMPRINT; ?>"/>
284
  <button>CMS-Block Bezeichner für Impressum setzen</button><br />
285
  </form>
286
+
287
+ <!-- Withdrawal (disable if janolaw version < 3) -->
288
+
289
+ <br />
290
+ <b>CMS-Block zur Speicherung der Muster-Widerrufsformular</b>
291
+ <?php if ($_withdrawalFormAvailable): ?>
292
+ <?php
293
+ $currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_WITHDRAWAL_ID, 0);
294
+ ?>
295
+ <?php if ($currentValue): ?>
296
+ <p>
297
+ Dieser Wert ist bereits konfiguriert. Der aktuelle Wert ist <i><?php echo $currentValue; ?></i>.
298
+ Sie können den Wert so belassen oder ihn ändern.
299
+ </p>
300
+ <?php endif; ?>
301
+ <?php $blocks = $blockCandidates[Janolaw_Agb_Model_CmsAssistant::TYPE_WITHDRAWAL]; ?>
302
+ <?php if (empty($blocks)): ?>
303
+ <p>Es wurden keine passenden Blöcke gefunden.</p>
304
+ <?php else: ?>
305
+ <p>Es wurden folgende Blöcke gefunden, die wahrscheinlich zur Speicherung der Datenschutzbestimmungen dienen:</p>
306
+ <ul style="margin-left: 1.5em; list-style-type: disc;">
307
+ <?php foreach ($blocks as $bCandidate => $isActive): ?>
308
+ <li>
309
+ <?php
310
+ echo $bCandidate;
311
+ if (!$isActive) echo ' (aktuell nicht aktiviert)';
312
+ ?>
313
+ </li>
314
+ <?php endforeach; ?>
315
+ </ul>
316
+ <?php endif; ?>
317
+
318
+
319
+ <form method="post" id="form_block_id_withdrawal" action="<?php echo $actionSetBlockId; ?>" onsubmit="jlform.block_withdrawal.submit()">
320
+ <label for="block_id_withdrawal">Setzte Bezeichner für CMS-Block, in den die Datenschutzbestimmungen gespeichert werden sollen (Kopieren Sie einen der oben vorgeschlagenen Blöcke oder wählen Sie einen eigenen Bezeichner):</label><br />
321
+ <input id="block_id_withdrawal" name="block_identifier" class="validate-xml-identifier input-text" type="text" value="<?php echo $currentValue ?: ''?>"/>
322
+ <input type="hidden" name="type" value="<?php echo Janolaw_Agb_Model_CmsAssistant::TYPE_WITHDRAWAL; ?>"/>
323
+ <button>CMS-Block Bezeichner für Muster-Widerrufsformular setzen</button><br />
324
+ </form>
325
+ <?php else: ?>
326
+ <p class="error">
327
+ Sie verwenden eine ältere Versiondes AGB Hosting-Service von janolaw.
328
+ Bitte legen Sie für das Muster-Widerrufsformular eine neue Seite im Content Bereich an und
329
+ kopieren den Inhalt des Muster-Widerrufsformular herein.
330
+ </p>
331
+ <?php endif; ?>
332
+
333
  </div>
334
  </div>
335
 
358
  </div>
359
  <div class="fieldset">
360
  <p>
361
+ Die 5 Texte müssen als CMS-Seite in Ihrem Shop angezeigt werden. Die AGB, Widerrufsbelehrung und
362
+ das Muster-Widerrufsformular müssen per E-Mail oder spätestens mit dem Warenversand in Papierform zuschickt werden.
363
+ Dazu müssen CMS-Seiten erstellt werden (wenn sie nicht bereits existieren) und die oben konfigurierten
364
+ CMS-Blöcke eingebunden werden.
365
  </p>
366
  <p>
367
  Als ersten Schritt müssen Sie dazu herausfinden, welche Seiten bereits existieren. Die schon erwähnten Module
425
  <pre><?php echo $cmsAssistant->getCmsDirectiveSnippet($currentValue); ?></pre>
426
  <?php else: ?>
427
  <p>
428
+ Es wurde noch kein CMS-Block zur Speicherung der Datenschutzbestimmungen definiert. (Bitte befolgen Sie die Anweisungen
429
+ aus Schritt 2).
430
  </p>
431
  <?php endif; ?>
432
 
442
  </p>
443
  <?php endif; ?>
444
 
445
+ <br />
446
+ <b>Snippet zur Einbindung der Muster-Widerrufsformular:</b>
447
+ <?php $currentValue = Mage::getStoreConfig(Janolaw_Agb_Model_Downloader::XML_PATH_WITHDRAWAL_ID, 0); ?>
448
+ <?php if ($currentValue): ?>
449
+ <pre><?php echo $cmsAssistant->getCmsDirectiveSnippet($currentValue); ?></pre>
450
+ <?php else: ?>
451
+ <p>
452
+ Es wurde noch kein CMS-Block zur Speicherung des Muster-Widerrufsformular definiert. (Bitte befolgen Sie die Anweisungen
453
+ aus Schritt 2).
454
+ </p>
455
+ <?php endif; ?>
456
+
457
  <br />
458
  <p>
459
  Nun sollten Sie sicherstellen, dass die angelegten Seiten verlinkt werden. Meistens
462
  &quot;footer_links&quot; (bzw. &quot;footer_links_company&quot; ab v1.9), bei dem Sie
463
  Links zu den neu angelegten Seiten definieren können.
464
  </p>
465
+
466
+ <p style="background-color: white; border: 1px solid black; padding: 1em;">
467
+ Bitte beachten Sie: Seit der Magento-Version CE-1.9.2.2, bzw. dem Patch <i>SUPEE-6788</i>
468
+ werden in Templates eingebundene CMS-Blöcke aus Sicherheitsgründen gegen eine Whitelist geprüft.
469
+ Ist dieser Block-Typ nicht in der Whitelist definiert, wird der entsprechende Text
470
+ nicht ausgegeben.
471
+
472
+ <br/><br/>
473
+
474
+ Das Modul fügt automatisch den Block Typ <code>cms/block</code> zur Whitelist, der für die
475
+ Speicherung der Gesetzestexte verwendet wird. Falls Sie den Patch erst nach der Installation
476
+ dieses Moduls hinzugefügt haben, können Sie den folgenden Button klicken, um CMS Blöcke
477
+ zu erlauben.
478
+
479
+ <br/><br/>
480
+ <button onclick="jlform.allowCmsBlockIncludes();">CMS-Block Bezeichner für Muster-Widerrufsformular setzen</button>
481
+ <br/><br/>
482
+
483
+ Außerdem können Sie die
484
+ <a target="_blank" href="<?php echo $blockWhitlistUrl; ?>">Whitelist hier</a>
485
+ manuell verwalten.
486
+ (Wenn der link nicht funktioniert, existiert
487
+ die Whitelist nicht, Sie sollten in diesem Fall den Security patch SUPEE-6788 installieren).
488
+ </p>
489
  </div>
490
  </div>
491
 
595
  jlform.block_revocation = new varienForm("form_block_id_revocation", "");
596
  jlform.block_privacy = new varienForm("form_block_id_privacy", "");
597
  jlform.block_imprint = new varienForm("form_block_id_imprint", "");
598
+ if (document.getElementById("form_block_id_withdrawal")) {
599
+ jlform.block_withdrawal = new varienForm("form_block_id_withdrawal", "");
600
+ }
601
+
602
+ jlform.defaultAjaxSuccessHandler = function(response) {
603
+ var result = response.responseText.evalJSON();
604
+ if (result.message) {
605
+ alert(result.message);
606
+ } else {
607
+ alert("Ein Fehler ist aufgetreten");
608
+ }
609
+ };
610
+
611
+ jlform.defaultAjaxErrorHandler = function(response) {
612
+ alert("Ein Fehler ist aufgetreten");
613
+ };
614
+
615
  document.observe("dom:loaded", function() {
616
  var jlform_fkey = new Element("input", {
617
  "type" : "hidden",
618
  "name" : "form_key",
619
  "value" : FORM_KEY
620
  });
621
+ var withdrawalBlock = document.getElementById("form_block_id_withdrawal"); // perhaps not available
622
+
623
  document.getElementById("form_block_id_tac").insert(jlform_fkey.clone());
624
  document.getElementById("form_block_id_revocation").insert(jlform_fkey.clone());
625
  document.getElementById("form_block_id_privacy").insert(jlform_fkey.clone());
626
  document.getElementById("form_block_id_imprint").insert(jlform_fkey.clone());
627
+ if (withdrawalBlock) {
628
+ withdrawalBlock.insert(jlform_fkey.clone());
629
+ }
630
  });
631
 
632
  jlform.createAgreement = function(agreement_type) {
646
  var req = new Ajax.Request("<?php echo $actionSaveAgreement; ?>", {
647
  "method": "post",
648
  "parameters": data,
649
+ onSuccess: jlform.defaultAjaxSuccessHandler,
650
+ onFailure: jlform.defaultAjaxErrorHandler
 
 
 
 
 
 
 
 
 
651
  });
652
+ };
653
+
654
+ jlform.allowCmsBlockIncludes = function() {
655
+ var req = new Ajax.Request("<?php echo $actionAllowCmsBlocks; ?>", {
656
+ method: "post",
657
+ parameters: { form_key: FORM_KEY, is_ajax: 1 },
658
+ onSuccess: jlform.defaultAjaxSuccessHandler,
659
+ onFailure: jlform.defaultAjaxErrorHandler
660
+ });
661
+ };
662
 
663
  </script>
664
 
app/locale/de_DE/Janolaw_Agb.csv CHANGED
@@ -21,8 +21,33 @@
21
  "Include T&C pdf as Attachment","AGB als PDF-Anhang hinzufügen"
22
  "Include revocation pdf as Attachment","Widerrufsbelehrung als PDF-Anhang hinzufügen"
23
  "Terms-and-conditions","AGB"
 
24
  "Revocation-policy","Widerrufsbelehrung"
 
 
25
  "Given block identifer (%s) has the wrong format.","Der angegebene Block-Bezeichner (%s) hat ein ungültiges Format"
26
  "Given block identifier is too large (only 255 characters allowed at maximum)","Der angegebene Block-Bezeichner ist zu lang (maximal 255 Zeichen sind erlaubt)"
27
  "Missing configuration for","Fehlende Konfiguration für"
28
- "Edit configuration","Konfiguration bearbeiten"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  "Include T&C pdf as Attachment","AGB als PDF-Anhang hinzufügen"
22
  "Include revocation pdf as Attachment","Widerrufsbelehrung als PDF-Anhang hinzufügen"
23
  "Terms-and-conditions","AGB"
24
+ "Legal-details","Legal-details"
25
  "Revocation-policy","Widerrufsbelehrung"
26
+ "Data-security","Data-security"
27
+ "Withdrawal","Muster-Widerrufsformular"
28
  "Given block identifer (%s) has the wrong format.","Der angegebene Block-Bezeichner (%s) hat ein ungültiges Format"
29
  "Given block identifier is too large (only 255 characters allowed at maximum)","Der angegebene Block-Bezeichner ist zu lang (maximal 255 Zeichen sind erlaubt)"
30
  "Missing configuration for","Fehlende Konfiguration für"
31
+ "Edit configuration","Konfiguration bearbeiten"
32
+ "Enable PDF attachment to all emails","Enable PDF attachment to all emails"
33
+ "German","Deutsch"
34
+ "English","English"
35
+ "French","Französisch"
36
+ "Please check, if you have booked the multi-language option of the janolaw service.","Bitte prüfen Sie, ob Sie die Texte neu generiert haben und für die optionale mehrsprachige Version den Service bei janolaw gebucht haben."
37
+ "Please note:
38
+ If you don't want to regenerate the texts, you should insert the documents to the order confirmation email using the snippets. This should add the content of the documents to the email text.
39
+ You find an overview of the available snippets in the Janolaw AGB Hosting Setup, step 3
40
+ Important:
41
+ The terms and conditions, cancellation policy and the withdrawal form must be sent by e-mail or at the latest with the dispatch of goods.","Hinweis:
42
+ Wenn Sie die Texte nicht neu generieren möchten dann fügen Sie bitte die Dokumente mit den Snippets in die E-Mail Auftragsbestätigung mit ein. Der Wortlaut der ausgewählten Texte wird dann automatisch in die E-Mail eingebunden.
43
+ Eine Übersicht der Snippets finden Sie im Janolaw AGB Hosting – Setup Schritt 3
44
+ Wichtig:
45
+ Die AGB, Widerrufsbelehrung und das Muster-Widerrufsformular müssen per E-Mail oder spätestens mit dem Warenversand in Papierform zuschickt werden."
46
+ "User data","Userdaten"
47
+ "Storage definitions","Speicher-Definition"
48
+ "Enable PDF attachment to all emails","Aktiviere PDF Anhänge für alle E-Mails"
49
+ "Defines block identifiers where the legal texts from janolaw are stored. Note that the content inside the blocks defined here is overwritten when synchronizing with Janolaw Hosting (in all stores!).","Definiert die CMS-Block Schlüssel (identifier), in denen die Texte gespeichert werden. Bitte beachten Sie, dass diese Texte beim Synchronisieren überschrieben werden!"
50
+ "Basic settings to connect to the Janolaw service. Note that after downgrading, you must save the configuration again, to make sure that no unsupported languages are configured. Please do a manual synchronisation (System > Janolaw AGB Hosting > Status) after changing this settings.","Grundlegende Einstellungen zur Verbindung zum Janolaw Service. Bitte beachten Sie, dass nach Änderung der Daten die Konfiguration nochmal erneut gespeichert werden muss, um sicherzustellen, dass eine unterstützte Sprache konfiguriert ist. Bitte starten Sie eine manuelle Synchronisation (unter System > Janolaw AGB Hosting > Status) nachdem Sie die Konfiguration geändert haben."
51
+
52
+ "There is no block whitelist avaialable in your system. Please install the Magento Security patch SUPEE-6788","Es existiert keine Block Whitelist in Ihrem System. Bitte installieren Sie den Magento Security patch SUPEE-6788"
53
+ "Successfully defined cms block type as 'allowed' in block whitelist","CMS Block Type erfolgreich als 'erlaubt' definiert."
package.xml CHANGED
@@ -1,42 +1,13 @@
1
  <?xml version="1.0"?>
2
- <package>
3
- <name>janolaw_agb2</name>
4
- <version>0.1.6</version>
5
- <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
- <channel>community</channel>
8
- <extends/>
9
- <summary>Dieses Modul integriert die von Janolaw AGB Hosting bereitgestellten Texte (AGB, Widerrufsbelehrung, Impressum, Datenschutzbestimmungen) in Ihren Magento-Shop.&#xD;
10
- </summary>
11
- <description>&lt;p&gt;&#xD;
12
- Mittlerweile hinl&#xE4;nglich bekannt sind die Abmahnrisiken durch Fehler z.&amp;nbsp;B. in den AGB, der Datenschutzerkl&#xE4;rung oder der Widerrufsbelehrung. Um das Risiko einer teuren Abmahnung zu verringern, gibt es jetzt f&#xFC;r Magento die Extension Janolaw_Agb2.&#xD;
13
- Diese bietet eine Schnittstelle zum AGB Hosting-Service des Online-Rechtsdienstleisters &lt;i&gt;janolaw AG&lt;/i&gt;.&#xD;
14
- Nach jeder rechtlichen &#xC4;nderung werden die Texte durch &lt;i&gt;Janolaw&lt;/i&gt; entsprechend angepasst und &#xFC;ber einen Cronjob automatisch in Ihrem Magento-Shop aktualisiert.&#xD;
15
- Nach korrekter Konfiguration muss sich ein Shopbetreiber also keine Sorgen mehr um fehlerhafte oder l&#xFC;ckenhafte AGB, Datenschutzerkl&#xE4;rungen oder Widerrufsbelehrungen machen. Detail zu den Angeboten von &lt;i&gt;Janolaw&lt;/i&gt; finden Sie unter&#xD;
16
- &lt;a href="http://www.janolaw.de/internetrecht/internetshop/abmahnschutz-internetshop.html"&gt;http://www.janolaw.de/internetrecht/internetshop/abmahnschutz-internetshop.html&lt;/a&gt;.&#xD;
17
- &lt;/p&gt;&#xD;
18
- &#xD;
19
- &lt;p&gt;&#xD;
20
- &lt;b&gt;Achtung&lt;/b&gt;: Diese Extension ersetzt die &#xE4;ltere Version unter &lt;a href="http://www.magentocommerce.com/magento-connect/janolaw-agb-hosting.html"&gt;http://www.magentocommerce.com/magento-connect/janolaw-agb-hosting.html&lt;/a&gt;. Sollten Sie noch die alte Version installiert haben, deinstallieren Sie bitte die alte Version und installieren anschlie&#xDF;end die neue Version.&#xD;
21
- &lt;/p&gt;&#xD;
22
- &#xD;
23
- &lt;p&gt;&#xD;
24
- Diese Extension ist kompatibel zu den Extensions GermanSetup bzw. MageSetup von FireGento, sowie zu Market Ready Germany. Im Gegensatz zur Vorg&#xE4;ngerversion kann sie jedoch auch Standalone eingesetzt werden.&#xD;
25
- &lt;/p&gt;&#xD;
26
- &#xD;
27
- &lt;p&gt;&#xD;
28
- Hinweise zur Konfiguration:&#xD;
29
- &lt;/p&gt;&#xD;
30
- &lt;ul&gt;&#xD;
31
- &lt;li&gt;Voraussetzung f&#xFC;r die automatische Aktualisierung der Texte ist die korrekte Konfiguration der Magento-Cronjobs.&lt;/li&gt;&#xD;
32
- &lt;li&gt;Nach der Installation f&#xFC;hrt die Setup-Seite (im Magento-Backend unter &lt;i&gt;System -&amp;gt; Konfiguration -&amp;gt; Janolaw AGB Hosting -&amp;gt; Setup&lt;/i&gt; zu finden) durch die Konfiguration.&lt;/li&gt;&#xD;
33
- &lt;/ul&gt;</description>
34
- <notes>Janolaw_Agb2 ist eine umfangreiche &#xDC;berarbeitung der Vorg&#xE4;nger-Extension Janolaw_Agb. Unter anderem ist die Extension nicht mehr abh&#xE4;ngig von Market Ready Germany. Sie kann standalone, oder aber im Zusammenspiel mit FireGento_MageSetup (bzw. deren Vorg&#xE4;nger FireGento_GermanSetup) oder MarketReadyGermany verwendet werden. Wenn Sie die Vorg&#xE4;nger-Version installiert haben, empfehlen wir, diese erst zu deinstallieren (dazu entfernen Sie einfach die Dateien "app/etc/Janolaw_All.xml", "app/code/community/Janolaw/update_agb.php" und den kompletten Ordner "app/code/community/Janolaw/Agb".). Anschlie&#xDF;end kann die neue Version Janolaw_Agb2 installiert werden.&#xD;
35
- Nach Installation dieser Version sollten Sie den Cache leeren, sich abmelden und neu anmelden, und dann unter System -&gt; Konfiguration -&gt; Janolaw AGB Hosting -&gt; Setup die Anweisungen zur Konfiguration befolgen.</notes>
36
- <authors><author><name>Claudio Kressibucher</name><user>ckressibucher</user><email>ck@inmedias.de</email></author><author><name>team in medias</name><user>team_in_medias</user><email>e.lammenett@inmedias.de</email></author></authors>
37
- <date>2014-08-18</date>
38
- <time>14:51:52</time>
39
- <contents><target name="magecommunity"><dir name="Janolaw"><dir name="Agb"><dir name="Block"><dir name="Adminhtml"><file name="Setup.php" hash="f5acf1c70aa6e5527c2e295b25a3aec2"/><dir name="Status"><file name="Config.php" hash="d76825cf02c65b5e15de56e9fcf0c2e8"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d5460210a5bfd6624e3d3343dda36995"/><file name="HttpStatusNotSuccessfulException.php" hash="0a0bb085993ebf7d02539a38df3e574b"/></dir><dir name="Model"><file name="CmsAssistant.php" hash="00bcb7358abfde81168d3c83273d4cb7"/><file name="Downloader.php" hash="f50a1bd6f68d7828d0b98802e52f9688"/><dir name="Email"><file name="Template.php" hash="1bae9a5024b3ed6212c7de1134999e3b"/></dir><file name="MissingConfigException.php" hash="85f354bd9846700b454e5236349b79ee"/><file name="Observer.php" hash="e1a0aacd89234b312f77b2aebf351f56"/><file name="RemoteException.php" hash="7ba3d53a8e943fab51668a508cd0a2fa"/><dir name="Resource"><file name="Downloader.php" hash="e7a6fd4edb5afb0c8a0be7a4864596bb"/></dir><file name="Setup.php" hash="ecb8afc63f1609a51baf364612eb226c"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Janolaw"><file name="SetupController.php" hash="ff8ea509ff4eb7f1f86b0c563733ff5b"/><file name="StatusController.php" hash="3f985c74590a103747368aacd63cfd2e"/></dir></dir></dir><dir name="data"><dir name="agb_setup"><file name="data-upgrade-0.1.5-0.1.6.php" hash="e22329b3a6cb81614092430957b2489a"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4aa748b5daab21aeabd0b55949e9ccba"/><file name="config.xml" hash="65775bc529f0215a4265a807b6db7e31"/><file name="system.xml" hash="54ab79b04ca6284aab172f73e6da287b"/></dir><dir name="sql"><dir name="agb_setup"><file name="mysql4-install-0.1.4.php" hash="71c2909026e4e76c0d5d0707795d3051"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="janolawagb"><file name="agbdownloader.xml" hash="fa6b3549599e1aa29098a34bf8d380d2"/></dir></dir><dir name="template"><dir name="janolawagb"><file name="setup.phtml" hash="b012b046dfcd1bf6b7d886803d16ca65"/><dir name="status"><file name="config.phtml" hash="a380ede88dd5656443b8c94b7bc3f08a"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Janolaw_Agb.csv" hash="20f82ffced3db78fe1921b30507a5845"/></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Janolaw_Agb.xml" hash="d5195b8cc8c533d48bdd33cb5aa14c44"/><file name="Janolaw_All.xml" hash="0cc9865429cdba17a980e5f91ce6acc6"/></dir></dir></dir><dir name="shell"><file name="janolaw.php" hash="1c4e7e6127945159875f1bedc553f152"/></dir></target></contents>
40
- <compatible/>
41
- <dependencies><required><php><min>5.2.0</min><max>5.100.0</max></php></required></dependencies>
42
- </package>
1
  <?xml version="1.0"?>
2
+ <package><name>janolaw_agb2</name><version>0.2.6</version><stability>stable</stability><license>OSL-3.0</license><channel>community</channel><extends></extends><summary>This module integrates the legal texts provided by Janolaw AGB Hosting into your magento store.</summary><description>Use the extension Janolaw_Agb2 to reduce the risk of warning letters
3
+ according to faults in terms and conditions, billing agreements and
4
+ revocations. The module implements an inteface between the shop and
5
+ the janolaw AG hosting-service. Text in shop are updated time
6
+ controlled according to the current law by a cronjob. Details
7
+ to the offered service are availabel at janolaw.de. The Extension is
8
+ potentially releveant vor german users of magento.
9
+
10
+ This extension is compatible to GermanSetup / MageSetup by FireGento
11
+ and Market Ready Germany. Standalone usage of this module (without
12
+ any "german specifc" extension) is also possible.</description><notes>Compatibility with the new features provided by Janolaw Service:
13
+ Multilangual text versions, PDF support.</notes><authors><author><name>team in medias</name><user>team_in_medias</user><email>technik@inmedias.de</email></author><author><name>Claudio Kressibucher</name><user>ckressibucher</user><email>ck@inmedias.com</email></author></authors><date>2015-12-17</date><time>6:35:23</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>5.100.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Janolaw"><dir name="Agb"><dir name="Block"><dir name="Adminhtml"><file name="Setup.php" hash="f5acf1c70aa6e5527c2e295b25a3aec2"/><dir name="Status"><file name="Config.php" hash="a4c9fa828480555239e1f1af60332288"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Pdf.php" hash="718ec820f9964497e9602788e7991540"/></dir><dir name="Form"><file name="Field.php" hash="9b18f17435d393e8ed929b71d2f650d2"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ab62742561aa7b703d5aa649aa7bc0c5"/><file name="Email.php" hash="97221e8a4fd6a2820d2e35179ec00d3c"/><file name="HttpStatusNotSuccessfulException.php" hash="e250de181b7e661ba3e6f61c9d5e0700"/><file name="NoBlockWhitelistException.php" hash="a354dbff026f66ab81ef2b040677e39a"/></dir><dir name="Model"><file name="CmsAssistant.php" hash="cf1b0b88a7276ec091531bd5b984fb94"/><file name="Downloader.php" hash="1645c7d58354b5c11f5d6e0fddf0591c"/><file name="MissingConfigException.php" hash="85f354bd9846700b454e5236349b79ee"/><file name="Observer.php" hash="fe7be312504e5df9980b19af127d2431"/><file name="RemoteException.php" hash="7ba3d53a8e943fab51668a508cd0a2fa"/><file name="Setup.php" hash="ecb8afc63f1609a51baf364612eb226c"/><dir name="Email"><file name="Queue.php" hash="f06fd79fc7e7d2bceea6f7ae51719404"/><file name="Template.php" hash="e58550587398d320f1b7470865862709"/><dir name="Attachment"><file name="Pdf.php" hash="ccfe55d2f1ee57975697142937b2e05d"/></dir></dir><dir name="Resource"><file name="Downloader.php" hash="e7a6fd4edb5afb0c8a0be7a4864596bb"/></dir><dir name="Source"><file name="Language.php" hash="5efafc68e0f3ddb633a2c7873fe2098c"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Janolaw"><file name="SetupController.php" hash="919a7bda7825b35b4f9b3722acc4cf48"/><file name="StatusController.php" hash="d0e393f8e01d2993c107313df010f1ed"/></dir></dir></dir><dir name="data"><dir name="agb_setup"><file name="data-upgrade-0.1.5-0.1.6.php" hash="e22329b3a6cb81614092430957b2489a"/><file name="data-upgrade-0.2.5-0.2.6.php" hash="e21f957bc5419d12094b110a8b3b6a96"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="7a360b4dd14f531baeb07a67eda0945f"/><file name="config.xml" hash="8fc45ce00d5f1e17a9a7326c5cbc6667"/><file name="system.xml" hash="83f1f870117e79c5bed08284b91ecf8e"/></dir><dir name="sql"><dir name="agb_setup"><file name="mysql4-install-0.1.4.php" hash="71c2909026e4e76c0d5d0707795d3051"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="janolawagb"><file name="agbdownloader.xml" hash="fa6b3549599e1aa29098a34bf8d380d2"/></dir></dir><dir name="template"><dir name="janolawagb"><file name="setup.phtml" hash="325a8099bffe6c2a286fdab65bc145d5"/><dir name="status"><file name="config.phtml" hash="a380ede88dd5656443b8c94b7bc3f08a"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Janolaw_Agb.xml" hash="d5195b8cc8c533d48bdd33cb5aa14c44"/><file name="Janolaw_All.xml" hash="0cc9865429cdba17a980e5f91ce6acc6"/></dir></dir><dir name="locale"><dir name="de_DE"><file name="Janolaw_Agb.csv" hash="c48ae823e065c96b9ececb96911ef475"/></dir></dir></dir><dir name="shell"><file name="janolaw.php" hash="1c4e7e6127945159875f1bedc553f152"/></dir></target></contents></package>