janolaw_agb2 - Version 0.3.1

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.3.1
Comparing to
See all releases


Code changes from version 0.2.6 to 0.3.1

app/code/community/Janolaw/Agb/Model/Email/Queue.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class Janolaw_Agb_Model_Email_Queue extends Mage_Core_Model_Email_Queue
4
  {
5
 
6
  /**
@@ -11,6 +11,18 @@ class Janolaw_Agb_Model_Email_Queue extends 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()
@@ -18,6 +30,7 @@ class Janolaw_Agb_Model_Email_Queue extends Mage_Core_Model_Email_Queue
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
 
@@ -31,18 +44,6 @@ class Janolaw_Agb_Model_Email_Queue extends Mage_Core_Model_Email_Queue
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) {
@@ -73,6 +74,17 @@ class Janolaw_Agb_Model_Email_Queue extends Mage_Core_Model_Email_Queue
73
  }
74
 
75
  try {
 
 
 
 
 
 
 
 
 
 
 
76
  $mailer->send();
77
  unset($mailer);
78
  $message->setProcessedAt(Varien_Date::formatDate(true));
1
  <?php
2
 
3
+ class Janolaw_Agb_Model_Email_Queue extends Janolaw_Agb_Model_Email_Queue_Compatibility
4
  {
5
 
6
  /**
11
  */
12
  public function send()
13
  {
14
+ //Use Aschroder_SMTPPro :: send events
15
+ if(Mage::helper('core')->isModuleEnabled('Aschroder_SMTPPro')
16
+ && Mage::helper('smtppro')->isEnabled()
17
+ && version_compare(
18
+ (string)Mage::getConfig()->getNode()->modules->Aschroder_SMTPPro->version,
19
+ '2.0.6', '>'
20
+ )
21
+ ) {
22
+ return parent::send();
23
+ }
24
+
25
+ //Rewrite Core :: send
26
  /** @var $collection Mage_Core_Model_Resource_Email_Queue_Collection */
27
  $collection = Mage::getModel('core/email_queue')->getCollection()
28
  ->addOnlyForSendingFilter()
30
  ->setCurPage(1)
31
  ->load();
32
 
33
+
34
  ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
35
  ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
36
 
44
  }
45
 
46
  $mailer = new Zend_Mail('utf-8');
 
 
 
 
 
 
 
 
 
 
 
 
47
  foreach ($message->getRecipients() as $recipient) {
48
  list($email, $name, $type) = $recipient;
49
  switch ($type) {
74
  }
75
 
76
  try {
77
+ //Begin
78
+ //Added event before sending
79
+ Mage::dispatchEvent(
80
+ 'janolaw_send_queue_before',
81
+ array(
82
+ 'mail' => $mailer,
83
+ 'message' => $message,
84
+ )
85
+ );
86
+ //End
87
+
88
  $mailer->send();
89
  unset($mailer);
90
  $message->setProcessedAt(Varien_Date::formatDate(true));
app/code/community/Janolaw/Agb/Model/Email/Queue/Compatibility.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (Mage::helper('core')->isModuleEnabled('Aschroder_SMTPPro')
3
+ && Mage::helper('smtppro')->isEnabled()
4
+ && version_compare(
5
+ (string)Mage::getConfig()->getNode()->modules->Aschroder_SMTPPro->version,
6
+ '2.0.6', '>'
7
+ )
8
+ ) {
9
+ class Janolaw_Agb_Model_Email_Queue_Compatibility
10
+ extends Aschroder_SMTPPro_Model_Email_Queue
11
+ {
12
+
13
+ }
14
+ } else {
15
+ class Janolaw_Agb_Model_Email_Queue_Compatibility
16
+ extends Mage_Core_Model_Email_Queue
17
+ {
18
+
19
+ }
20
+ }
app/code/community/Janolaw/Agb/Model/Email/Template.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class Janolaw_Agb_Model_Email_Template extends Mage_Core_Model_Email_Template
4
  {
5
 
6
  public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null)
1
  <?php
2
 
3
+ class Janolaw_Agb_Model_Email_Template extends Janolaw_Agb_Model_Email_Template_Compatibility
4
  {
5
 
6
  public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null)
app/code/community/Janolaw/Agb/Model/Email/Template/Compatibility.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (Mage::helper('core')->isModuleEnabled('Aschroder_SMTPPro')
3
+ && Mage::helper('smtppro')->isEnabled()
4
+ && version_compare(
5
+ (string)Mage::getConfig()->getNode()->modules->Aschroder_SMTPPro->version,
6
+ '2.0.6', '>'
7
+ )
8
+ ) {
9
+ class Janolaw_Agb_Model_Email_Template_Compatibility
10
+ extends Aschroder_SMTPPro_Model_Email_Template
11
+ {
12
+
13
+ }
14
+ } else {
15
+ class Janolaw_Agb_Model_Email_Template_Compatibility
16
+ extends Mage_Core_Model_Email_Template
17
+ {
18
+
19
+ }
20
+ }
app/code/community/Janolaw/Agb/Model/Observer.php CHANGED
@@ -27,6 +27,7 @@ class Janolaw_Agb_Model_Observer extends Mage_Core_Model_Abstract
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
  );
@@ -113,7 +114,7 @@ class Janolaw_Agb_Model_Observer extends Mage_Core_Model_Abstract
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')
27
  */
28
  protected $_attachedPdfTypes = array(
29
  \Janolaw_Agb_Model_CmsAssistant::TYPE_TAC => 'agbdownload/janoloaw_agb_pdf/agb',
30
+ \Janolaw_Agb_Model_CmsAssistant::TYPE_PRIVACY => 'agbdownload/janoloaw_agb_pdf/datasecurity',
31
  \Janolaw_Agb_Model_CmsAssistant::TYPE_REVOCATION => 'agbdownload/janoloaw_agb_pdf/wiederruf',
32
  \Janolaw_Agb_Model_CmsAssistant::TYPE_WITHDRAWAL => 'agbdownload/janoloaw_agb_pdf/withdrawal'
33
  );
114
  /** @var Janolaw_Agb_Model_Email_Queue $message */
115
  $message = $observer->getData('message');
116
  /** @var Zend_Mail $mailer */
117
+ $mailer = $observer->getData('mail');
118
 
119
  if($message
120
  && $message->getData('event_type')
app/code/community/Janolaw/Agb/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Janolaw_Agb>
5
- <version>0.2.6</version>
6
  </Janolaw_Agb>
7
  </modules>
8
  <global>
@@ -62,6 +62,17 @@
62
  </neworder_add_attachement>
63
  </observers>
64
  </janolaw_send_queue_before>
 
 
 
 
 
 
 
 
 
 
 
65
  </events>
66
  </global>
67
 
2
  <config>
3
  <modules>
4
  <Janolaw_Agb>
5
+ <version>0.3.1</version>
6
  </Janolaw_Agb>
7
  </modules>
8
  <global>
62
  </neworder_add_attachement>
63
  </observers>
64
  </janolaw_send_queue_before>
65
+
66
+ <!-- pdf attachments to queue email (since magento CE 1.9.1)-->
67
+ <!-- called by aschroder_smtppro module -->
68
+ <aschroder_smtppro_queue_before_send>
69
+ <observers>
70
+ <neworder_add_attachement>
71
+ <class>agbdownloader/observer</class>
72
+ <method>addAttachmentQueueEmail</method>
73
+ </neworder_add_attachement>
74
+ </observers>
75
+ </aschroder_smtppro_queue_before_send>
76
  </events>
77
  </global>
78
 
app/code/community/Janolaw/Agb/etc/system.xml CHANGED
@@ -120,18 +120,25 @@
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
 
120
  <sort_order>10</sort_order>
121
  <show_in_default>1</show_in_default>
122
  </agb>
123
+ <datasecurity translate="label">
124
+ <label>Datenschutzerklärung</label>
125
+ <frontend_type>select</frontend_type>
126
+ <source_model>adminhtml/system_config_source_yesno</source_model>
127
+ <sort_order>20</sort_order>
128
+ <show_in_default>1</show_in_default>
129
+ </datasecurity>
130
  <wiederruf translate="label">
131
  <label>Widerrufsbelehrung</label>
132
  <frontend_type>select</frontend_type>
133
  <source_model>adminhtml/system_config_source_yesno</source_model>
134
+ <sort_order>30</sort_order>
135
  <show_in_default>1</show_in_default>
136
  </wiederruf>
137
  <withdrawal translate="label">
138
  <label>Muster-Widerrufsformular</label>
139
  <frontend_type>select</frontend_type>
140
  <source_model>adminhtml/system_config_source_yesno</source_model>
141
+ <sort_order>40</sort_order>
142
  <show_in_default>1</show_in_default>
143
  </withdrawal>
144
 
app/design/adminhtml/default/default/template/janolawagb/setup.phtml CHANGED
@@ -600,7 +600,12 @@ $_withdrawalFormAvailable = (bool) Mage::getSingleton('agbdownloader/downloader'
600
  }
601
 
602
  jlform.defaultAjaxSuccessHandler = function(response) {
603
- var result = response.responseText.evalJSON();
 
 
 
 
 
604
  if (result.message) {
605
  alert(result.message);
606
  } else {
600
  }
601
 
602
  jlform.defaultAjaxSuccessHandler = function(response) {
603
+ var result;
604
+ try {
605
+ result = response.responseText.evalJSON();
606
+ } catch (e) {
607
+ result = {}; // will trigger an error alert...
608
+ }
609
  if (result.message) {
610
  alert(result.message);
611
  } else {
package.xml CHANGED
@@ -1,5 +1,5 @@
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
@@ -10,4 +10,4 @@ potentially releveant vor german users of magento.
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>
1
  <?xml version="1.0"?>
2
+ <package><name>janolaw_agb2</name><version>0.3.1</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
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>2017-08-22</date><time>6:56:00</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="shell"><file name="janolaw.php" hash="1c4e7e6127945159875f1bedc553f152"/></dir><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="janolawagb"><file name="setup.phtml" hash="bb3b25ab47c25fc53c012e2dd761a458"/><dir name="status"><file name="config.phtml" hash="a380ede88dd5656443b8c94b7bc3f08a"/></dir></dir></dir><dir name="layout"><dir name="janolawagb"><file name="agbdownloader.xml" hash="fa6b3549599e1aa29098a34bf8d380d2"/></dir></dir></dir></dir></dir></dir><dir name="locale"><dir name="de_DE"><file name="Janolaw_Agb.csv" hash="c48ae823e065c96b9ececb96911ef475"/></dir></dir><dir name="code"><dir name="community"><dir name="Janolaw"><dir name="Agb"><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="Block"><dir name="Adminhtml"><file name="Setup.php" hash="f5acf1c70aa6e5527c2e295b25a3aec2"/><dir name="System"><dir name="Config"><dir name="Form"><file name="Field.php" hash="9b18f17435d393e8ed929b71d2f650d2"/></dir><dir name="Fieldset"><file name="Pdf.php" hash="718ec820f9964497e9602788e7991540"/></dir></dir></dir><dir name="Status"><file name="Config.php" hash="a4c9fa828480555239e1f1af60332288"/></dir></dir></dir><dir name="sql"><dir name="agb_setup"><file name="mysql4-install-0.1.4.php" hash="71c2909026e4e76c0d5d0707795d3051"/></dir></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="6a22d5c3a48d204ed2144af6a54050fe"/><file name="RemoteException.php" hash="7ba3d53a8e943fab51668a508cd0a2fa"/><file name="Setup.php" hash="ecb8afc63f1609a51baf364612eb226c"/><dir name="Resource"><file name="Downloader.php" hash="e7a6fd4edb5afb0c8a0be7a4864596bb"/></dir><dir name="Email"><file name="Queue.php" hash="d3ddaa87bdae6f69799680f5f74d3a82"/><file name="Template.php" hash="e7e40eaeda1999e906eeaafefff4f4c2"/><dir name="Template"><file name="Compatibility.php" hash="3ac88ad58777dfcc1b92adf77fdb5b96"/></dir><dir name="Attachment"><file name="Pdf.php" hash="ccfe55d2f1ee57975697142937b2e05d"/></dir><dir name="Queue"><file name="Compatibility.php" hash="d86fc17cd50c45bb8381008785240525"/></dir></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="95b8cbc583fde6a3775571ad4945422e"/><file name="system.xml" hash="faf695d41217691f09b3fe4c6b10be51"/></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></target></contents></package>