Auguria_Sponsorship - Version 1.2.2

Version Notes

If you have ideas for improvements or find bugs, please send them to Franck Charpentier at www.auguria.net, with Auguria LastReviews as part of the subject line.

Download this release

Release Info

Developer Magento Core Team
Extension Auguria_Sponsorship
Version 1.2.2
Comparing to
See all releases


Code changes from version 1.0.10 to 1.2.2

Files changed (166) hide show
  1. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Change.php +1 -1
  2. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Change/Edit.php +3 -3
  3. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Change/Edit/Tab/Form.php +16 -16
  4. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Change/Edit/Tabs.php +4 -4
  5. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Change/Grid.php +28 -26
  6. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Customer/Tabs/Sponsorship.php +74 -0
  7. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Link.php +1 -1
  8. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Link/Edit.php +3 -3
  9. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Link/Edit/Tab/Form.php +3 -3
  10. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Link/Edit/Tabs.php +4 -4
  11. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Link/Grid.php +12 -12
  12. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Openinviter.php +1 -1
  13. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Openinviter/Edit.php +5 -5
  14. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Openinviter/Edit/Tab/Form.php +8 -8
  15. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Openinviter/Edit/Tabs.php +4 -4
  16. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Openinviter/Grid.php +16 -16
  17. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sales/Order/Invoice/Totals.php +25 -0
  18. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sales/Order/Totals.php +25 -0
  19. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sponsorship.php +8 -8
  20. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sponsorship/Edit.php +3 -3
  21. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sponsorship/Edit/Tab/Form.php +5 -5
  22. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sponsorship/Edit/Tabs.php +4 -4
  23. app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sponsorship/Grid.php +15 -15
  24. app/code/community/Auguria/Sponsorship/Block/Customer/Account/PointsDetail.php +450 -279
  25. app/code/community/Auguria/Sponsorship/Block/Customer/Form/Boost.php +1 -1
  26. app/code/community/Auguria/Sponsorship/Block/Customer/Form/PointsChange.php +8 -1
  27. app/code/community/Auguria/Sponsorship/Block/Customer/Widget/Name.php +1 -1
  28. app/code/community/Auguria/Sponsorship/Block/Customer/Widget/Virement.php +4 -12
  29. app/code/community/Auguria/Sponsorship/Block/Sales/Order/Totals.php +24 -0
  30. app/code/community/Auguria/Sponsorship/Block/Sponsorship.php +5 -5
  31. app/code/community/Auguria/Sponsorship/Helper/Config.php +420 -0
  32. app/code/community/Auguria/Sponsorship/Helper/Data.php +303 -16
  33. app/code/community/Auguria/Sponsorship/Helper/Mail.php +21 -9
  34. app/code/community/Auguria/Sponsorship/Model/Adminhtml/System/Config/Backend/Sponsorship/Entier.php +3 -3
  35. app/code/community/Auguria/Sponsorship/Model/Adminhtml/System/Config/Backend/Sponsorship/Float.php +3 -3
  36. app/code/community/Auguria/Sponsorship/Model/Adminhtml/System/Config/Backend/Sponsorship/Mode.php +36 -0
  37. app/code/community/Auguria/Sponsorship/Model/Adminhtml/System/Config/Backend/Sponsorship/NaturalNumber.php +3 -3
  38. app/code/community/Auguria/Sponsorship/Model/Adminhtml/System/Config/Source/Mode.php +26 -0
  39. app/code/community/Auguria/Sponsorship/Model/ApplyValidity.php +68 -0
  40. app/code/community/Auguria/Sponsorship/Model/AutoBoost.php +9 -8
  41. app/code/community/Auguria/Sponsorship/Model/Change.php +1 -1
  42. app/code/community/Auguria/Sponsorship/Model/Changestatut.php +4 -4
  43. app/code/community/Auguria/Sponsorship/Model/Customer/Customer.php +0 -112
  44. app/code/community/Auguria/Sponsorship/Model/Eav/Entity/Setup.php +32 -0
  45. app/code/community/Auguria/Sponsorship/Model/{Sponsorlog.php → Log.php} +2 -2
  46. app/code/community/Auguria/Sponsorship/Model/Mysql4/CatalogFidelityPoint.php +1 -1
  47. app/code/community/Auguria/Sponsorship/Model/Mysql4/CatalogFidelityPoint/Collection.php +1 -1
  48. app/code/community/Auguria/Sponsorship/Model/Mysql4/CatalogSponsorPoint.php +1 -1
  49. app/code/community/Auguria/Sponsorship/Model/Mysql4/CatalogSponsorPoint/Collection.php +1 -1
  50. app/code/community/Auguria/Sponsorship/Model/Mysql4/Change.php +1 -1
  51. app/code/community/Auguria/Sponsorship/Model/Mysql4/Change/Collection.php +1 -1
  52. app/code/community/Auguria/Sponsorship/Model/Mysql4/FidelityLog/Collection.php +0 -15
  53. app/code/community/Auguria/Sponsorship/Model/Mysql4/Fidelitylog.php +0 -15
  54. app/code/community/Auguria/Sponsorship/Model/Mysql4/{Sponsorlog/Collection.php → Log.php} +13 -14
  55. app/code/community/Auguria/Sponsorship/Model/{Fidelitylog.php → Mysql4/Log/Collection.php} +14 -14
  56. app/code/community/Auguria/Sponsorship/Model/Mysql4/Rule.php +8 -6
  57. app/code/community/Auguria/Sponsorship/Model/Mysql4/Sponsorlog.php +0 -15
  58. app/code/community/Auguria/Sponsorship/Model/Mysql4/Sponsorship.php +1 -1
  59. app/code/community/Auguria/Sponsorship/Model/Mysql4/Sponsorship/Collection.php +1 -1
  60. app/code/community/Auguria/Sponsorship/Model/Mysql4/Sponsorshipopeninviter.php +1 -1
  61. app/code/community/Auguria/Sponsorship/Model/Mysql4/Sponsorshipopeninviter/Collection.php +1 -1
  62. app/code/community/Auguria/Sponsorship/Model/Observer.php +793 -299
  63. app/code/community/Auguria/Sponsorship/Model/Openinviter.php +2 -2
  64. app/code/community/Auguria/Sponsorship/Model/Sponsorship.php +1 -1
  65. app/code/community/Auguria/Sponsorship/Model/Sponsorshipopeninviter.php +1 -1
  66. app/code/community/Auguria/Sponsorship/Model/Status.php +2 -2
  67. app/code/community/Auguria/Sponsorship/Model/Total/Creditmemo/Discount.php +17 -0
  68. app/code/community/Auguria/Sponsorship/Model/Total/Invoice/Discount.php +17 -0
  69. app/code/community/Auguria/Sponsorship/Model/Total/Quote/Discount.php +154 -0
  70. app/code/community/Auguria/Sponsorship/Model/Validator.php +0 -253
  71. app/code/community/Auguria/Sponsorship/controllers/Adminhtml/ChangeController.php +21 -48
  72. app/code/community/Auguria/Sponsorship/controllers/Adminhtml/LinkController.php +7 -10
  73. app/code/community/Auguria/Sponsorship/controllers/Adminhtml/OpeninviterController.php +14 -14
  74. app/code/community/Auguria/Sponsorship/controllers/Adminhtml/SponsorshipController.php +11 -11
  75. app/code/community/Auguria/Sponsorship/controllers/BoostController.php +5 -5
  76. app/code/community/Auguria/Sponsorship/controllers/Customer/AccountController.php +0 -226
  77. app/code/community/Auguria/Sponsorship/controllers/FidelitypointsController.php +0 -353
  78. app/code/community/Auguria/Sponsorship/controllers/IndexController.php +49 -45
  79. app/code/community/Auguria/Sponsorship/controllers/OpeninviterController.php +18 -18
  80. app/code/community/Auguria/Sponsorship/controllers/PointsController.php +391 -0
  81. app/code/community/Auguria/Sponsorship/controllers/SponsorpointsController.php +0 -353
  82. app/code/community/Auguria/Sponsorship/etc/config.xml +318 -140
  83. app/code/community/Auguria/Sponsorship/etc/system.xml +422 -61
  84. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-install-0.1.0.php +46 -0
  85. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.0-0.1.1.php +69 -0
  86. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.1-0.1.2.php +57 -0
  87. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.10-0.1.11.php +30 -0
  88. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.2-0.1.3.php +87 -0
  89. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.3-0.1.4.php +39 -0
  90. app/code/community/Auguria/Sponsorship/sql/{sponsorship_setup → auguria_sponsorship_setup}/mysql4-upgrade-0.1.4-0.1.5.php +4 -3
  91. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.5-0.1.6.php +44 -0
  92. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.6-0.1.7.php +18 -0
  93. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.7-0.1.8.php +49 -0
  94. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.8-0.1.9.php +22 -0
  95. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.0.10-1.1.0.php +50 -0
  96. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.0.3-1.0.4.php +26 -0
  97. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.0.7-1.0.8.php +21 -0
  98. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.0.8-1.0.9.php +38 -0
  99. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.0-1.1.1.php +121 -0
  100. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.1-1.1.2.php +27 -0
  101. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.2-1.1.3.php +76 -0
  102. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.3-1.1.4.php +24 -0
  103. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.4-1.1.5.php +125 -0
  104. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.5-1.1.6.php +32 -0
  105. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.6-1.1.7.php +16 -0
  106. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.7-1.1.8.php +37 -0
  107. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.8-1.1.9.php +15 -0
  108. app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.9-1.2.0.php +15 -0
  109. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-install-0.1.0.php +0 -41
  110. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.0-0.1.1.php +0 -68
  111. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.1-0.1.2.php +0 -52
  112. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.10-0.1.11.php +0 -30
  113. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.2-0.1.3.php +0 -87
  114. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.3-0.1.4.php +0 -40
  115. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.5-0.1.6.php +0 -39
  116. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.6-0.1.7.php +0 -18
  117. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.7-0.1.8.php +0 -49
  118. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.8-0.1.9.php +0 -22
  119. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-1.0.3-1.0.4.php +0 -23
  120. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-1.0.7-1.0.8.php +0 -21
  121. app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-1.0.8-1.0.9.php +0 -36
  122. app/design/adminhtml/default/default/layout/auguria/sponsorship.xml +38 -0
  123. app/design/adminhtml/default/default/layout/sponsorship.xml +0 -31
  124. app/design/adminhtml/default/default/template/auguria/sponsorship/customer/tabs/sponsorship.phtml +224 -0
  125. app/design/frontend/base/default/layout/auguria/sponsorship.xml +140 -0
  126. app/design/frontend/base/default/template/auguria/sponsorship/customer/account/accumulatedpointsdetail.phtml +289 -0
  127. app/design/frontend/base/default/template/auguria/sponsorship/customer/account/dashboard/accumulated_points.phtml +32 -0
  128. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/account/dashboard/fidelity_points.phtml +6 -2
  129. app/design/frontend/base/default/template/auguria/sponsorship/customer/account/dashboard/points.phtml +23 -0
  130. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/account/dashboard/sponsor_points.phtml +4 -2
  131. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/account/fidelitypointsdetail.phtml +0 -0
  132. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/account/sponsorpointsdetail.phtml +0 -0
  133. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/boost.phtml +2 -2
  134. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/edit.phtml +4 -4
  135. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/pointschange.phtml +3 -2
  136. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/pointschange/pointschange_cash.phtml +0 -0
  137. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/pointschange/pointschange_coupon.phtml +1 -1
  138. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/pointschange/pointschange_gift.phtml +0 -0
  139. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/register.phtml +7 -7
  140. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/widget/name.phtml +0 -0
  141. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/widget/virement.phtml +0 -0
  142. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/openinviter.phtml +1 -1
  143. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/openinviterimport.phtml +1 -1
  144. app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/sponsorship.phtml +2 -2
  145. app/design/frontend/default/default/layout/sponsorship.xml +0 -140
  146. app/design/frontend/default/default/template/sponsorship/customer/account/dashboard.phtml +0 -35
  147. app/locale/de_DE/template/email/{sponsorship_coupon.html → auguria/sponsorship/sponsorship_coupon.html} +0 -0
  148. app/locale/de_DE/template/email/{sponsorship_invitation.html → auguria/sponsorship/sponsorship_invitation.html} +0 -0
  149. app/locale/en_US/Auguria_Sponsorship.csv +264 -0
  150. app/locale/en_US/template/email/{sponsorship_coupon.html → auguria/sponsorship/sponsorship_coupon.html} +0 -0
  151. app/locale/en_US/template/email/{sponsorship_invitation.html → auguria/sponsorship/sponsorship_invitation.html} +0 -0
  152. app/locale/es_ES/template/email/{sponsorship_coupon.html → auguria/sponsorship/sponsorship_coupon.html} +0 -0
  153. app/locale/es_ES/template/email/{sponsorship_invitation.html → auguria/sponsorship/sponsorship_invitation.html} +0 -0
  154. app/locale/fr_FR/Auguria_Sponsorship.csv +64 -3
  155. app/locale/fr_FR/template/email/{sponsorship_coupon.html → auguria/sponsorship/sponsorship_coupon.html} +0 -0
  156. app/locale/fr_FR/template/email/{sponsorship_invitation.html → auguria/sponsorship/sponsorship_invitation.html} +0 -0
  157. app/locale/fr_FR/template/email/auguria/sponsorship/sponsorship_notification.html +73 -0
  158. js/{tableorderer → auguria/sponsorship}/table_orderer.js +0 -0
  159. media/sponsorship/openinviter/fleurs jaune.jpg +0 -0
  160. package.xml +21 -18
  161. skin/frontend/{default/default/css → base/default/css/auguria/sponsorship}/tableorderer.css +6 -36
  162. skin/frontend/{default/default/images → base/default/images/auguria/sponsorship}/tableorderer/asc.gif +0 -0
  163. skin/frontend/{default/default/images → base/default/images/auguria/sponsorship}/tableorderer/bg.gif +0 -0
  164. skin/frontend/{default/default/images/tableorderer/bkg_toolbar.gif → base/default/images/auguria/sponsorship/tableorderer/bkg_pager.gif} +0 -0
  165. skin/frontend/base/default/images/auguria/sponsorship/tableorderer/bkg_toolbar.gif +0 -0
  166. skin/frontend/{default/default/images → base/default/images/auguria/sponsorship}/tableorderer/desc.gif +0 -0
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Change.php CHANGED
@@ -10,7 +10,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Change extends Mage_Adminhtml_Block_Wi
10
  public function __construct()
11
  {
12
  $this->_controller = 'adminhtml_change';
13
- $this->_blockGroup = 'sponsorship';
14
  $this->_headerText = $this->__('Points exchanges list');
15
  parent::__construct();
16
  $this->removeButton('add');
10
  public function __construct()
11
  {
12
  $this->_controller = 'adminhtml_change';
13
+ $this->_blockGroup = 'auguria_sponsorship';
14
  $this->_headerText = $this->__('Points exchanges list');
15
  parent::__construct();
16
  $this->removeButton('add');
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Change/Edit.php CHANGED
@@ -34,7 +34,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Edit extends Mage_Adminhtml_Blo
34
  ), 1);
35
 
36
  $this->_objectId = 'id';
37
- $this->_blockGroup = 'sponsorship';
38
  $this->_controller = 'adminhtml_change';
39
  $this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save'));
40
  $this->_updateButton('delete', 'label', Mage::helper('adminhtml')->__('Save'));
@@ -63,9 +63,9 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Edit extends Mage_Adminhtml_Blo
63
  public function getHeaderText()
64
  {
65
  if( Mage::registry('change_data') && Mage::registry('change_data')->getId() ) {
66
- return Mage::helper('sponsorship')->__("Edition of the change '%s'", $this->htmlEscape(Mage::registry('change_data')->getId()));
67
  } else {
68
- return Mage::helper('sponsorship')->__('Add a change');
69
  }
70
  }
71
  }
34
  ), 1);
35
 
36
  $this->_objectId = 'id';
37
+ $this->_blockGroup = 'auguria_sponsorship';
38
  $this->_controller = 'adminhtml_change';
39
  $this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save'));
40
  $this->_updateButton('delete', 'label', Mage::helper('adminhtml')->__('Save'));
63
  public function getHeaderText()
64
  {
65
  if( Mage::registry('change_data') && Mage::registry('change_data')->getId() ) {
66
+ return Mage::helper('auguria_sponsorship')->__("Edition of the change '%s'", $this->htmlEscape(Mage::registry('change_data')->getId()));
67
  } else {
68
+ return Mage::helper('auguria_sponsorship')->__('Add a change');
69
  }
70
  }
71
  }
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Change/Edit/Tab/Form.php CHANGED
@@ -11,81 +11,81 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Edit_Tab_Form extends Mage_Admi
11
  {
12
  $form = new Varien_Data_Form();
13
  $this->setForm($form);
14
- $fieldset = $form->addFieldset('change_form', array('legend'=>Mage::helper('sponsorship')->__('Change information')));
15
 
16
  $fieldset->addField('customer_id', 'text', array(
17
- 'label' => Mage::helper('sponsorship')->__('Customer'),
18
  'class' => 'required-entry',
19
  'required' => true,
20
  'name' => 'customer_id',
21
  ))->setReadonly(true, true);
22
 
23
  $fieldset->addField('type', 'select', array(
24
- 'label' => Mage::helper('sponsorship')->__('Type'),
25
  'required' => true,
26
  'name' => 'type',
27
  'values' => array(
28
  array(
29
  'value' => 'cash',
30
- 'label' => Mage::helper('sponsorship')->__('Cash'),
31
  ),
32
 
33
  array(
34
  'value' => 'gift',
35
- 'label' => Mage::helper('sponsorship')->__('Gifts'),
36
  ),
37
  array(
38
  'value' => 'coupon',
39
- 'label' => Mage::helper('sponsorship')->__('Vouchers'),
40
  ),
41
  ),
42
  ))->setReadonly(true, true);
43
 
44
  $fieldset->addField('module', 'select', array(
45
- 'label' => Mage::helper('sponsorship')->__('Module'),
46
  'required' => true,
47
  'name' => 'module',
48
  'values' => array(
49
  array(
50
  'value' => 'fidelity',
51
- 'label' => Mage::helper('sponsorship')->__('Fidelity'),
52
  ),
53
 
54
  array(
55
  'value' => 'sponsor',
56
- 'label' => Mage::helper('sponsorship')->__('Sponsorship'),
57
  ),
58
  ),
59
  ))->setReadonly(true, true);
60
 
61
  $fieldset->addField('statut', 'select', array(
62
- 'label' => Mage::helper('sponsorship')->__('Status'),
63
  'name' => 'statut',
64
  'values' => array(
65
  array(
66
  'value' => 'waiting',
67
- 'label' => Mage::helper('sponsorship')->__('Waiting'),
68
  ),
69
 
70
  array(
71
  'value' => 'exported',
72
- 'label' => Mage::helper('sponsorship')->__('Exported'),
73
  ),
74
  array(
75
  'value' => 'solved',
76
- 'label' => Mage::helper('sponsorship')->__('Solved'),
77
  ),
78
 
79
  array(
80
  'value' => 'canceled',
81
- 'label' => Mage::helper('sponsorship')->__('Canceled'),
82
  ),
83
  ),
84
  ));
85
 
86
  $fieldset->addField('datetime', 'date', array(
87
- 'label' => Mage::helper('sponsorship')->__('Creation date'),
88
- 'title' => Mage::helper('sponsorship')->__('Creation date'),
89
  'required' => true,
90
  'name' => 'datetime',
91
  'image' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'/adminhtml/default/default/images/grid-cal.gif',
11
  {
12
  $form = new Varien_Data_Form();
13
  $this->setForm($form);
14
+ $fieldset = $form->addFieldset('change_form', array('legend'=>Mage::helper('auguria_sponsorship')->__('Change information')));
15
 
16
  $fieldset->addField('customer_id', 'text', array(
17
+ 'label' => Mage::helper('auguria_sponsorship')->__('Customer'),
18
  'class' => 'required-entry',
19
  'required' => true,
20
  'name' => 'customer_id',
21
  ))->setReadonly(true, true);
22
 
23
  $fieldset->addField('type', 'select', array(
24
+ 'label' => Mage::helper('auguria_sponsorship')->__('Type'),
25
  'required' => true,
26
  'name' => 'type',
27
  'values' => array(
28
  array(
29
  'value' => 'cash',
30
+ 'label' => Mage::helper('auguria_sponsorship')->__('Cash'),
31
  ),
32
 
33
  array(
34
  'value' => 'gift',
35
+ 'label' => Mage::helper('auguria_sponsorship')->__('Gifts'),
36
  ),
37
  array(
38
  'value' => 'coupon',
39
+ 'label' => Mage::helper('auguria_sponsorship')->__('Vouchers'),
40
  ),
41
  ),
42
  ))->setReadonly(true, true);
43
 
44
  $fieldset->addField('module', 'select', array(
45
+ 'label' => Mage::helper('auguria_sponsorship')->__('Module'),
46
  'required' => true,
47
  'name' => 'module',
48
  'values' => array(
49
  array(
50
  'value' => 'fidelity',
51
+ 'label' => Mage::helper('auguria_sponsorship')->__('Fidelity'),
52
  ),
53
 
54
  array(
55
  'value' => 'sponsor',
56
+ 'label' => Mage::helper('auguria_sponsorship')->__('Sponsorship'),
57
  ),
58
  ),
59
  ))->setReadonly(true, true);
60
 
61
  $fieldset->addField('statut', 'select', array(
62
+ 'label' => Mage::helper('auguria_sponsorship')->__('Status'),
63
  'name' => 'statut',
64
  'values' => array(
65
  array(
66
  'value' => 'waiting',
67
+ 'label' => Mage::helper('auguria_sponsorship')->__('Waiting'),
68
  ),
69
 
70
  array(
71
  'value' => 'exported',
72
+ 'label' => Mage::helper('auguria_sponsorship')->__('Exported'),
73
  ),
74
  array(
75
  'value' => 'solved',
76
+ 'label' => Mage::helper('auguria_sponsorship')->__('Solved'),
77
  ),
78
 
79
  array(
80
  'value' => 'canceled',
81
+ 'label' => Mage::helper('auguria_sponsorship')->__('Canceled'),
82
  ),
83
  ),
84
  ));
85
 
86
  $fieldset->addField('datetime', 'date', array(
87
+ 'label' => Mage::helper('auguria_sponsorship')->__('Creation date'),
88
+ 'title' => Mage::helper('auguria_sponsorship')->__('Creation date'),
89
  'required' => true,
90
  'name' => 'datetime',
91
  'image' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'/adminhtml/default/default/images/grid-cal.gif',
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Change/Edit/Tabs.php CHANGED
@@ -13,15 +13,15 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Edit_Tabs extends Mage_Adminhtm
13
  parent::__construct();
14
  $this->setId('change_tabs');
15
  $this->setDestElementId('edit_form');
16
- $this->setTitle(Mage::helper('sponsorship')->__('Exchange detail'));
17
  }
18
 
19
  protected function _beforeToHtml()
20
  {
21
  $this->addTab('form_section', array(
22
- 'label' => Mage::helper('sponsorship')->__('Exchange detail'),
23
- 'title' => Mage::helper('sponsorship')->__('Exchange detail'),
24
- 'content' => $this->getLayout()->createBlock('sponsorship/adminhtml_change_edit_tab_form')->toHtml(),
25
  ));
26
 
27
  return parent::_beforeToHtml();
13
  parent::__construct();
14
  $this->setId('change_tabs');
15
  $this->setDestElementId('edit_form');
16
+ $this->setTitle(Mage::helper('auguria_sponsorship')->__('Exchange detail'));
17
  }
18
 
19
  protected function _beforeToHtml()
20
  {
21
  $this->addTab('form_section', array(
22
+ 'label' => Mage::helper('auguria_sponsorship')->__('Exchange detail'),
23
+ 'title' => Mage::helper('auguria_sponsorship')->__('Exchange detail'),
24
+ 'content' => $this->getLayout()->createBlock('auguria_sponsorship/adminhtml_change_edit_tab_form')->toHtml(),
25
  ));
26
 
27
  return parent::_beforeToHtml();
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Change/Grid.php CHANGED
@@ -18,11 +18,11 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Grid extends Mage_Adminhtml_Blo
18
 
19
  protected function _prepareCollection()
20
  {
21
- $collection = Mage::getResourceModel('sponsorship/change_collection')
22
  ->addNameToSelect()
23
  ;
24
  /*
25
- $collection = Mage::getModel('sponsorship/change')->getCollection();
26
  foreach ($collection as $change)
27
  {
28
  $customer = mage::getModel("customer/customer")->load($change->getCustomerId());
@@ -37,21 +37,21 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Grid extends Mage_Adminhtml_Blo
37
  protected function _prepareColumns()
38
  {
39
  $this->addColumn('sponsorship_change_id', array(
40
- 'header' => Mage::helper('sponsorship')->__('ID'),
41
  'align' =>'right',
42
  'width' => '20px',
43
  'index' => 'sponsorship_change_id',
44
  ));
45
 
46
  $this->addColumn('customer_id', array(
47
- 'header' => Mage::helper('sponsorship')->__('Customer ID'),
48
  'align' =>'right',
49
  'width' => '20px',
50
  'index' => 'customer_id',
51
  ));
52
 
53
  $this->addColumn('customer_name', array(
54
- 'header' => Mage::helper('sponsorship')->__('Customer name'),
55
  'align' =>'left',
56
  'filter' => false,
57
  'index' => 'customer_name',
@@ -59,40 +59,42 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Grid extends Mage_Adminhtml_Blo
59
 
60
 
61
  $this->addColumn('type', array(
62
- 'header' => Mage::helper('sponsorship')->__('Type'),
63
  'index' => 'type',
64
  'type' => 'options',
65
  'options' => array(
66
- 'cash' => 'Cash',
67
- 'gift' => 'Cadeaux',
68
- 'coupon' => 'Bons de réductions',
 
69
  ),
70
  ));
71
 
72
  $this->addColumn('module', array(
73
- 'header' => Mage::helper('sponsorship')->__('Module'),
74
  'index' => 'module',
75
  'type' => 'options',
76
  'options' => array(
77
- 'fidelity' => 'Fidélité',
78
- 'sponsor' => 'Parrainage',
 
79
  ),
80
  ));
81
 
82
  $this->addColumn('points', array(
83
- 'header' => Mage::helper('sponsorship')->__('Points'),
84
  'align' =>'right',
85
  'index' => 'points',
86
  ));
87
 
88
  $this->addColumn('value', array(
89
- 'header' => Mage::helper('sponsorship')->__('Value'),
90
  'align' =>'right',
91
  'index' => 'value',
92
  ));
93
 
94
  $this->addColumn('datetime', array(
95
- 'header' => Mage::helper('sponsorship')->__('Date'),
96
  'align' =>'right',
97
  'index' => 'datetime',
98
  'type' => 'datetime',
@@ -100,7 +102,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Grid extends Mage_Adminhtml_Blo
100
  ));
101
 
102
  $this->addColumn('statut', array(
103
- 'header' => Mage::helper('sponsorship')->__('Status'),
104
  'align' => 'left',
105
  'index' => 'statut',
106
  'type' => 'options',
@@ -114,13 +116,13 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Grid extends Mage_Adminhtml_Blo
114
 
115
  $this->addColumn('action',
116
  array(
117
- 'header' => Mage::helper('sponsorship')->__('Action'),
118
  'width' => '100',
119
  'type' => 'action',
120
  'getter' => 'getId',
121
  'actions' => array(
122
  array(
123
- 'caption' => Mage::helper('sponsorship')->__('Edit'),
124
  'url' => array('base'=> '*/*/edit'),
125
  'field' => 'id'
126
  )
@@ -131,8 +133,8 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Grid extends Mage_Adminhtml_Blo
131
  'is_system' => true,
132
  ));
133
 
134
- $this->addExportType('*/*/exportCsv', Mage::helper('sponsorship')->__('CSV'));
135
- $this->addExportType('*/*/exportXml', Mage::helper('sponsorship')->__('XML'));
136
 
137
  return parent::_prepareColumns();
138
  }
@@ -143,24 +145,24 @@ class Auguria_Sponsorship_Block_Adminhtml_Change_Grid extends Mage_Adminhtml_Blo
143
  $this->getMassactionBlock()->setFormFieldName('change');
144
 
145
  // $this->getMassactionBlock()->addItem('delete', array(
146
- // 'label' => Mage::helper('sponsorship')->__('Delete'),
147
  // 'url' => $this->getUrl('*/*/massDelete'),
148
- // 'confirm' => Mage::helper('sponsorship')->__('Are you sure?')
149
  // ));
150
 
151
- $statuses = Mage::getSingleton('sponsorship/changestatut')->getOptionArray();
152
 
153
  array_unshift($statuses, array('label'=>'', 'value'=>''));
154
  $this->getMassactionBlock()->addItem('statut', array(
155
- 'label'=> Mage::helper('sponsorship')->__('Update status'),
156
  'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
157
- 'confirm' => Mage::helper('sponsorship')->__('Are you sure to process mass action?'),
158
  'additional' => array(
159
  'visibility' => array(
160
  'name' => 'statut',
161
  'type' => 'select',
162
  'class' => 'required-entry',
163
- 'label' => Mage::helper('sponsorship')->__('Status'),
164
  'values' => $statuses
165
  )
166
  )
18
 
19
  protected function _prepareCollection()
20
  {
21
+ $collection = Mage::getResourceModel('auguria_sponsorship/change_collection')
22
  ->addNameToSelect()
23
  ;
24
  /*
25
+ $collection = Mage::getModel('auguria_sponsorship/change')->getCollection();
26
  foreach ($collection as $change)
27
  {
28
  $customer = mage::getModel("customer/customer")->load($change->getCustomerId());
37
  protected function _prepareColumns()
38
  {
39
  $this->addColumn('sponsorship_change_id', array(
40
+ 'header' => Mage::helper('auguria_sponsorship')->__('ID'),
41
  'align' =>'right',
42
  'width' => '20px',
43
  'index' => 'sponsorship_change_id',
44
  ));
45
 
46
  $this->addColumn('customer_id', array(
47
+ 'header' => Mage::helper('auguria_sponsorship')->__('Customer ID'),
48
  'align' =>'right',
49
  'width' => '20px',
50
  'index' => 'customer_id',
51
  ));
52
 
53
  $this->addColumn('customer_name', array(
54
+ 'header' => Mage::helper('auguria_sponsorship')->__('Customer name'),
55
  'align' =>'left',
56
  'filter' => false,
57
  'index' => 'customer_name',
59
 
60
 
61
  $this->addColumn('type', array(
62
+ 'header' => Mage::helper('auguria_sponsorship')->__('Type'),
63
  'index' => 'type',
64
  'type' => 'options',
65
  'options' => array(
66
+ 'cash' => Mage::helper('auguria_sponsorship')->__('Cash'),
67
+ 'gift' => Mage::helper('auguria_sponsorship')->__('Gift'),
68
+ 'coupon' => Mage::helper('auguria_sponsorship')->__('Coupon code'),
69
+ 'cart' => Mage::helper('auguria_sponsorship')->__('Cart'),
70
  ),
71
  ));
72
 
73
  $this->addColumn('module', array(
74
+ 'header' => Mage::helper('auguria_sponsorship')->__('Module'),
75
  'index' => 'module',
76
  'type' => 'options',
77
  'options' => array(
78
+ 'fidelity' => Mage::helper('auguria_sponsorship')->__('Fidelity'),
79
+ 'sponsor' => Mage::helper('auguria_sponsorship')->__('Sponsorship'),
80
+ 'accumulated' => Mage::helper('auguria_sponsorship')->__('Fidelité et parrainage'),
81
  ),
82
  ));
83
 
84
  $this->addColumn('points', array(
85
+ 'header' => Mage::helper('auguria_sponsorship')->__('Points'),
86
  'align' =>'right',
87
  'index' => 'points',
88
  ));
89
 
90
  $this->addColumn('value', array(
91
+ 'header' => Mage::helper('auguria_sponsorship')->__('Value'),
92
  'align' =>'right',
93
  'index' => 'value',
94
  ));
95
 
96
  $this->addColumn('datetime', array(
97
+ 'header' => Mage::helper('auguria_sponsorship')->__('Date'),
98
  'align' =>'right',
99
  'index' => 'datetime',
100
  'type' => 'datetime',
102
  ));
103
 
104
  $this->addColumn('statut', array(
105
+ 'header' => Mage::helper('auguria_sponsorship')->__('Status'),
106
  'align' => 'left',
107
  'index' => 'statut',
108
  'type' => 'options',
116
 
117
  $this->addColumn('action',
118
  array(
119
+ 'header' => Mage::helper('auguria_sponsorship')->__('Action'),
120
  'width' => '100',
121
  'type' => 'action',
122
  'getter' => 'getId',
123
  'actions' => array(
124
  array(
125
+ 'caption' => Mage::helper('auguria_sponsorship')->__('Edit'),
126
  'url' => array('base'=> '*/*/edit'),
127
  'field' => 'id'
128
  )
133
  'is_system' => true,
134
  ));
135
 
136
+ $this->addExportType('*/*/exportCsv', Mage::helper('auguria_sponsorship')->__('CSV'));
137
+ $this->addExportType('*/*/exportXml', Mage::helper('auguria_sponsorship')->__('XML'));
138
 
139
  return parent::_prepareColumns();
140
  }
145
  $this->getMassactionBlock()->setFormFieldName('change');
146
 
147
  // $this->getMassactionBlock()->addItem('delete', array(
148
+ // 'label' => Mage::helper('auguria_sponsorship')->__('Delete'),
149
  // 'url' => $this->getUrl('*/*/massDelete'),
150
+ // 'confirm' => Mage::helper('auguria_sponsorship')->__('Are you sure?')
151
  // ));
152
 
153
+ $statuses = Mage::getSingleton('auguria_sponsorship/changestatut')->getOptionArray();
154
 
155
  array_unshift($statuses, array('label'=>'', 'value'=>''));
156
  $this->getMassactionBlock()->addItem('statut', array(
157
+ 'label'=> Mage::helper('auguria_sponsorship')->__('Update status'),
158
  'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
159
+ 'confirm' => Mage::helper('auguria_sponsorship')->__('Are you sure to process mass action?'),
160
  'additional' => array(
161
  'visibility' => array(
162
  'name' => 'statut',
163
  'type' => 'select',
164
  'class' => 'required-entry',
165
+ 'label' => Mage::helper('auguria_sponsorship')->__('Status'),
166
  'values' => $statuses
167
  )
168
  )
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Customer/Tabs/Sponsorship.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Block_Adminhtml_Customer_Tabs_Sponsorship extends Mage_Adminhtml_Block_Template
9
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
10
+ {
11
+ public function __construct()
12
+ {
13
+ $this->setTemplate('auguria/sponsorship/customer/tabs/sponsorship.phtml');
14
+ }
15
+
16
+ public function getTabLabel()
17
+ {
18
+ return $this->__('Fidelity and Sponsorship');
19
+ }
20
+
21
+ /**
22
+ * Return Tab title
23
+ *
24
+ * @return string
25
+ */
26
+ public function getTabTitle()
27
+ {
28
+ return $this->__('Fidelity and Sponsorship');
29
+ }
30
+
31
+ /**
32
+ * Can show tab in tabs
33
+ *
34
+ * @return boolean
35
+ */
36
+ public function canShowTab()
37
+ {
38
+ if (Mage::registry('current_customer')->getId()) {
39
+ return true;
40
+ }
41
+ return false;
42
+ }
43
+ /**
44
+ * Tab is hidden
45
+ *
46
+ * @return boolean
47
+ */
48
+ public function isHidden()
49
+ {
50
+ if (Mage::registry('current_customer')->getId()) {
51
+ return false;
52
+ }
53
+ return true;
54
+ }
55
+
56
+
57
+ public function getCustomer()
58
+ {
59
+ if (!$this->_customer) {
60
+ $this->_customer = Mage::registry('current_customer');
61
+ }
62
+ return $this->_customer;
63
+ }
64
+
65
+ public function formatDate($date=null, $format='short', $showTime=false)
66
+ {
67
+ if (empty($date)) {
68
+ return '';
69
+ }
70
+ else {
71
+ return parent::formatDate($date, $format, $showTime);
72
+ }
73
+ }
74
+ }
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Link.php CHANGED
@@ -10,7 +10,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Link extends Mage_Adminhtml_Block_Widg
10
  public function __construct()
11
  {
12
  $this->_controller = 'adminhtml_link';
13
- $this->_blockGroup = 'sponsorship';
14
  $this->_headerText = $this->__('Sponsorships list');
15
  parent::__construct();
16
  $this->removeButton('add');
10
  public function __construct()
11
  {
12
  $this->_controller = 'adminhtml_link';
13
+ $this->_blockGroup = 'auguria_sponsorship';
14
  $this->_headerText = $this->__('Sponsorships list');
15
  parent::__construct();
16
  $this->removeButton('add');
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Link/Edit.php CHANGED
@@ -34,7 +34,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Link_Edit extends Mage_Adminhtml_Block
34
  ), 1);
35
 
36
  $this->_objectId = 'id';
37
- $this->_blockGroup = 'sponsorship';
38
  $this->_controller = 'adminhtml_link';
39
  $this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save'));
40
  $this->_updateButton('delete', 'label', Mage::helper('adminhtml')->__('Delete'));
@@ -63,9 +63,9 @@ class Auguria_Sponsorship_Block_Adminhtml_Link_Edit extends Mage_Adminhtml_Block
63
  public function getHeaderText()
64
  {
65
  if( Mage::registry('link_data') && Mage::registry('link_data')->getId() ) {
66
- return Mage::helper('sponsorship')->__("Edition of the sponsorship '%s'", $this->htmlEscape(Mage::registry('link_data')->getId()));
67
  } else {
68
- return Mage::helper('sponsorship')->__('Add a sponsorship');
69
  }
70
  }
71
  }
34
  ), 1);
35
 
36
  $this->_objectId = 'id';
37
+ $this->_blockGroup = 'auguria_sponsorship';
38
  $this->_controller = 'adminhtml_link';
39
  $this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save'));
40
  $this->_updateButton('delete', 'label', Mage::helper('adminhtml')->__('Delete'));
63
  public function getHeaderText()
64
  {
65
  if( Mage::registry('link_data') && Mage::registry('link_data')->getId() ) {
66
+ return Mage::helper('auguria_sponsorship')->__("Edition of the sponsorship '%s'", $this->htmlEscape(Mage::registry('link_data')->getId()));
67
  } else {
68
+ return Mage::helper('auguria_sponsorship')->__('Add a sponsorship');
69
  }
70
  }
71
  }
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Link/Edit/Tab/Form.php CHANGED
@@ -11,17 +11,17 @@ class Auguria_Sponsorship_Block_Adminhtml_Link_Edit_Tab_Form extends Mage_Adminh
11
  {
12
  $form = new Varien_Data_Form();
13
  $this->setForm($form);
14
- $fieldset = $form->addFieldset('link_form', array('legend'=>Mage::helper('sponsorship')->__('Sponsorship information')));
15
 
16
  $fieldset->addField('entity_id', 'text', array(
17
- 'label' => Mage::helper('sponsorship')->__('Godson'),
18
  'class' => 'required-entry',
19
  'required' => true,
20
  'name' => 'entity_id',
21
  ))->setReadonly(true);
22
 
23
  $fieldset->addField('sponsor', 'text', array(
24
- 'label' => Mage::helper('sponsorship')->__('Sponsor'),
25
  'name' => 'sponsor',
26
  ));
27
 
11
  {
12
  $form = new Varien_Data_Form();
13
  $this->setForm($form);
14
+ $fieldset = $form->addFieldset('link_form', array('legend'=>Mage::helper('auguria_sponsorship')->__('Sponsorship information')));
15
 
16
  $fieldset->addField('entity_id', 'text', array(
17
+ 'label' => Mage::helper('auguria_sponsorship')->__('Godson'),
18
  'class' => 'required-entry',
19
  'required' => true,
20
  'name' => 'entity_id',
21
  ))->setReadonly(true);
22
 
23
  $fieldset->addField('sponsor', 'text', array(
24
+ 'label' => Mage::helper('auguria_sponsorship')->__('Sponsor'),
25
  'name' => 'sponsor',
26
  ));
27
 
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Link/Edit/Tabs.php CHANGED
@@ -13,15 +13,15 @@ class Auguria_Sponsorship_Block_Adminhtml_Link_Edit_Tabs extends Mage_Adminhtml_
13
  parent::__construct();
14
  $this->setId('link_tabs');
15
  $this->setDestElementId('edit_form');
16
- $this->setTitle(Mage::helper('sponsorship')->__('Sponsorship detail'));
17
  }
18
 
19
  protected function _beforeToHtml()
20
  {
21
  $this->addTab('form_section', array(
22
- 'label' => Mage::helper('sponsorship')->__('Sponsorship detail'),
23
- 'title' => Mage::helper('sponsorship')->__('Sponsorship detail'),
24
- 'content' => $this->getLayout()->createBlock('sponsorship/adminhtml_link_edit_tab_form')->toHtml(),
25
  ));
26
 
27
  return parent::_beforeToHtml();
13
  parent::__construct();
14
  $this->setId('link_tabs');
15
  $this->setDestElementId('edit_form');
16
+ $this->setTitle(Mage::helper('auguria_sponsorship')->__('Sponsorship detail'));
17
  }
18
 
19
  protected function _beforeToHtml()
20
  {
21
  $this->addTab('form_section', array(
22
+ 'label' => Mage::helper('auguria_sponsorship')->__('Sponsorship detail'),
23
+ 'title' => Mage::helper('auguria_sponsorship')->__('Sponsorship detail'),
24
+ 'content' => $this->getLayout()->createBlock('auguria_sponsorship/adminhtml_link_edit_tab_form')->toHtml(),
25
  ));
26
 
27
  return parent::_beforeToHtml();
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Link/Grid.php CHANGED
@@ -42,40 +42,40 @@ class Auguria_Sponsorship_Block_Adminhtml_Link_Grid extends Mage_Adminhtml_Block
42
  protected function _prepareColumns()
43
  {
44
  $this->addColumn('id', array(
45
- 'header' => Mage::helper('sponsorship')->__('ID'),
46
  'align' =>'right',
47
  'width' =>'20px',
48
  'index' => 'entity_id',
49
  ));
50
 
51
  $this->addColumn('id_parrain', array(
52
- 'header' => Mage::helper('sponsorship')->__('Sponsor ID'),
53
  'align' =>'right',
54
  'width' =>'20px',
55
  'index' => 'sponsor',
56
  ));
57
 
58
  $this->addColumn('parrain', array(
59
- 'header' => Mage::helper('sponsorship')->__('Sponsor'),
60
  'align' =>'left',
61
  'index' => 'sponsor_name',
62
  ));
63
 
64
  $this->addColumn('id_filleul', array(
65
- 'header' => Mage::helper('sponsorship')->__('Godson ID'),
66
  'align' =>'right',
67
  'width' =>'20px',
68
  'index' => 'entity_id',
69
  ));
70
 
71
  $this->addColumn('filleul', array(
72
- 'header' => Mage::helper('sponsorship')->__('Godson'),
73
  'align' =>'left',
74
  'index' => 'name',
75
  ));
76
 
77
  $this->addColumn('date_inscription', array(
78
- 'header' => Mage::helper('sponsorship')->__('Listing date'),
79
  'align' =>'left',
80
  'align' =>'right',
81
  'index' => 'created_at',
@@ -84,7 +84,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Link_Grid extends Mage_Adminhtml_Block
84
  ));
85
 
86
  $this->addColumn('date_last_order', array(
87
- 'header' => Mage::helper('sponsorship')->__('Last order date'),
88
  'align' =>'left',
89
  'align' =>'right',
90
  'index' => 'date_last_order',
@@ -92,8 +92,8 @@ class Auguria_Sponsorship_Block_Adminhtml_Link_Grid extends Mage_Adminhtml_Block
92
  'format' => Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
93
  ));
94
 
95
- $this->addExportType('*/*/exportCsv', Mage::helper('sponsorship')->__('CSV'));
96
- $this->addExportType('*/*/exportXml', Mage::helper('sponsorship')->__('XML'));
97
 
98
  return parent::_prepareColumns();
99
  }
@@ -103,13 +103,13 @@ class Auguria_Sponsorship_Block_Adminhtml_Link_Grid extends Mage_Adminhtml_Block
103
  $this->setMassactionIdField('id_filleul');
104
  $this->getMassactionBlock()->setFormFieldName('sponsorship');
105
 
106
- $statuses = Mage::getSingleton('sponsorship/changestatut')->getOptionArray();
107
 
108
  array_unshift($statuses, array('label'=>'', 'value'=>''));
109
  $this->getMassactionBlock()->addItem('sponsor', array(
110
- 'label'=> Mage::helper('sponsorship')->__('Supprimer Parrainages'),
111
  'url' => $this->getUrl('*/*/massDelete', array('_current'=>true)),
112
- 'confirm' => Mage::helper('sponsorship')->__('Are you sure to process mass action?')
113
  )
114
  );
115
  return $this;
42
  protected function _prepareColumns()
43
  {
44
  $this->addColumn('id', array(
45
+ 'header' => Mage::helper('auguria_sponsorship')->__('ID'),
46
  'align' =>'right',
47
  'width' =>'20px',
48
  'index' => 'entity_id',
49
  ));
50
 
51
  $this->addColumn('id_parrain', array(
52
+ 'header' => Mage::helper('auguria_sponsorship')->__('Sponsor ID'),
53
  'align' =>'right',
54
  'width' =>'20px',
55
  'index' => 'sponsor',
56
  ));
57
 
58
  $this->addColumn('parrain', array(
59
+ 'header' => Mage::helper('auguria_sponsorship')->__('Sponsor'),
60
  'align' =>'left',
61
  'index' => 'sponsor_name',
62
  ));
63
 
64
  $this->addColumn('id_filleul', array(
65
+ 'header' => Mage::helper('auguria_sponsorship')->__('Godson ID'),
66
  'align' =>'right',
67
  'width' =>'20px',
68
  'index' => 'entity_id',
69
  ));
70
 
71
  $this->addColumn('filleul', array(
72
+ 'header' => Mage::helper('auguria_sponsorship')->__('Godson'),
73
  'align' =>'left',
74
  'index' => 'name',
75
  ));
76
 
77
  $this->addColumn('date_inscription', array(
78
+ 'header' => Mage::helper('auguria_sponsorship')->__('Listing date'),
79
  'align' =>'left',
80
  'align' =>'right',
81
  'index' => 'created_at',
84
  ));
85
 
86
  $this->addColumn('date_last_order', array(
87
+ 'header' => Mage::helper('auguria_sponsorship')->__('Last order date'),
88
  'align' =>'left',
89
  'align' =>'right',
90
  'index' => 'date_last_order',
92
  'format' => Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
93
  ));
94
 
95
+ $this->addExportType('*/*/exportCsv', Mage::helper('auguria_sponsorship')->__('CSV'));
96
+ $this->addExportType('*/*/exportXml', Mage::helper('auguria_sponsorship')->__('XML'));
97
 
98
  return parent::_prepareColumns();
99
  }
103
  $this->setMassactionIdField('id_filleul');
104
  $this->getMassactionBlock()->setFormFieldName('sponsorship');
105
 
106
+ $statuses = Mage::getSingleton('auguria_sponsorship/changestatut')->getOptionArray();
107
 
108
  array_unshift($statuses, array('label'=>'', 'value'=>''));
109
  $this->getMassactionBlock()->addItem('sponsor', array(
110
+ 'label'=> Mage::helper('auguria_sponsorship')->__('Supprimer Parrainages'),
111
  'url' => $this->getUrl('*/*/massDelete', array('_current'=>true)),
112
+ 'confirm' => Mage::helper('auguria_sponsorship')->__('Are you sure to process mass action?')
113
  )
114
  );
115
  return $this;
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Openinviter.php CHANGED
@@ -10,7 +10,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Openinviter extends Mage_Adminhtml_Blo
10
  public function __construct()
11
  {
12
  $this->_controller = 'adminhtml_openinviter';
13
- $this->_blockGroup = 'sponsorship';
14
  $this->_headerText = $this->__('Open inviter providers');
15
  $this->_addButtonLabel = $this->__('Add a provider');
16
  parent::__construct();
10
  public function __construct()
11
  {
12
  $this->_controller = 'adminhtml_openinviter';
13
+ $this->_blockGroup = 'auguria_sponsorship';
14
  $this->_headerText = $this->__('Open inviter providers');
15
  $this->_addButtonLabel = $this->__('Add a provider');
16
  parent::__construct();
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Openinviter/Edit.php CHANGED
@@ -12,7 +12,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Openinviter_Edit extends Mage_Adminhtm
12
  parent::__construct();
13
 
14
  $this->_objectId = 'id';
15
- $this->_blockGroup = 'sponsorship';
16
  $this->_controller = 'adminhtml_openinviter';
17
 
18
  $this->_addButton('back', array(
@@ -21,17 +21,17 @@ class Auguria_Sponsorship_Block_Adminhtml_Openinviter_Edit extends Mage_Adminhtm
21
  'class' => 'back',
22
  ), -1);
23
 
24
- $this->_updateButton('save', 'label', Mage::helper('sponsorship')->__('Save'));
25
- $this->_updateButton('delete', 'label', Mage::helper('sponsorship')->__('Delete'));
26
 
27
  }
28
 
29
  public function getHeaderText()
30
  {
31
  if( Mage::registry('openinviter_data') && Mage::registry('openinviter_data')->getId() ) {
32
- return Mage::helper('sponsorship')->__("Edition of the Open inviter provider '%s'", $this->htmlEscape(Mage::registry('openinviter_data')->getName()));
33
  } else {
34
- return Mage::helper('sponsorship')->__('Add a provider');
35
  }
36
  }
37
  }
12
  parent::__construct();
13
 
14
  $this->_objectId = 'id';
15
+ $this->_blockGroup = 'auguria_sponsorship';
16
  $this->_controller = 'adminhtml_openinviter';
17
 
18
  $this->_addButton('back', array(
21
  'class' => 'back',
22
  ), -1);
23
 
24
+ $this->_updateButton('save', 'label', Mage::helper('auguria_sponsorship')->__('Save'));
25
+ $this->_updateButton('delete', 'label', Mage::helper('auguria_sponsorship')->__('Delete'));
26
 
27
  }
28
 
29
  public function getHeaderText()
30
  {
31
  if( Mage::registry('openinviter_data') && Mage::registry('openinviter_data')->getId() ) {
32
+ return Mage::helper('auguria_sponsorship')->__("Edition of the Open inviter provider '%s'", $this->htmlEscape(Mage::registry('openinviter_data')->getName()));
33
  } else {
34
+ return Mage::helper('auguria_sponsorship')->__('Add a provider');
35
  }
36
  }
37
  }
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Openinviter/Edit/Tab/Form.php CHANGED
@@ -11,12 +11,12 @@ class Auguria_Sponsorship_Block_Adminhtml_Openinviter_Edit_Tab_Form extends Mage
11
  {
12
  $form = new Varien_Data_Form();
13
  $this->setForm($form);
14
- $fieldset = $form->addFieldset('openinviter_form', array('legend'=>Mage::helper('sponsorship')->__("Provider information")));
15
- $openinviter = Mage::getModel('sponsorship/openinviter');
16
  $plugins = $openinviter->getPluginsArray();
17
 
18
  $fieldset->addField('code', 'select', array(
19
- 'label' => Mage::helper('sponsorship')->__('Code'),
20
  'class' => 'required-entry',
21
  'required' => true,
22
  'name' => 'code',
@@ -24,28 +24,28 @@ class Auguria_Sponsorship_Block_Adminhtml_Openinviter_Edit_Tab_Form extends Mage
24
  ));
25
 
26
  $fieldset->addField('name', 'text', array(
27
- 'label' => Mage::helper('sponsorship')->__('Name'),
28
  'name' => 'name',
29
  ));
30
 
31
  $fieldset->addField('status', 'select', array(
32
- 'label' => Mage::helper('sponsorship')->__('Status'),
33
  'name' => 'status',
34
  'values' => array(
35
  array(
36
  'value' => 1,
37
- 'label' => Mage::helper('sponsorship')->__('Enabled'),
38
  ),
39
 
40
  array(
41
  'value' => 2,
42
- 'label' => Mage::helper('sponsorship')->__('Disabled'),
43
  ),
44
  ),
45
  ));
46
 
47
  $fieldset->addField('image', 'image', array(
48
- 'label' => Mage::helper('sponsorship')->__('Image'),
49
  'required' => false,
50
  'name' => 'openinviterimage',
51
  ));
11
  {
12
  $form = new Varien_Data_Form();
13
  $this->setForm($form);
14
+ $fieldset = $form->addFieldset('openinviter_form', array('legend'=>Mage::helper('auguria_sponsorship')->__("Provider information")));
15
+ $openinviter = Mage::getModel('auguria_sponsorship/openinviter');
16
  $plugins = $openinviter->getPluginsArray();
17
 
18
  $fieldset->addField('code', 'select', array(
19
+ 'label' => Mage::helper('auguria_sponsorship')->__('Code'),
20
  'class' => 'required-entry',
21
  'required' => true,
22
  'name' => 'code',
24
  ));
25
 
26
  $fieldset->addField('name', 'text', array(
27
+ 'label' => Mage::helper('auguria_sponsorship')->__('Name'),
28
  'name' => 'name',
29
  ));
30
 
31
  $fieldset->addField('status', 'select', array(
32
+ 'label' => Mage::helper('auguria_sponsorship')->__('Status'),
33
  'name' => 'status',
34
  'values' => array(
35
  array(
36
  'value' => 1,
37
+ 'label' => Mage::helper('auguria_sponsorship')->__('Enabled'),
38
  ),
39
 
40
  array(
41
  'value' => 2,
42
+ 'label' => Mage::helper('auguria_sponsorship')->__('Disabled'),
43
  ),
44
  ),
45
  ));
46
 
47
  $fieldset->addField('image', 'image', array(
48
+ 'label' => Mage::helper('auguria_sponsorship')->__('Image'),
49
  'required' => false,
50
  'name' => 'openinviterimage',
51
  ));
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Openinviter/Edit/Tabs.php CHANGED
@@ -13,15 +13,15 @@ class Auguria_Sponsorship_Block_Adminhtml_Openinviter_Edit_Tabs extends Mage_Adm
13
  parent::__construct();
14
  $this->setId('openinviter_tabs');
15
  $this->setDestElementId('edit_form');
16
- $this->setTitle(Mage::helper('sponsorship')->__('Provider detail'));
17
  }
18
 
19
  protected function _beforeToHtml()
20
  {
21
  $this->addTab('form_section', array(
22
- 'label' => Mage::helper('sponsorship')->__('Provider detail'),
23
- 'title' => Mage::helper('sponsorship')->__('Provider detail'),
24
- 'content' => $this->getLayout()->createBlock('sponsorship/adminhtml_openinviter_edit_tab_form')->toHtml(),
25
  ));
26
 
27
  return parent::_beforeToHtml();
13
  parent::__construct();
14
  $this->setId('openinviter_tabs');
15
  $this->setDestElementId('edit_form');
16
+ $this->setTitle(Mage::helper('auguria_sponsorship')->__('Provider detail'));
17
  }
18
 
19
  protected function _beforeToHtml()
20
  {
21
  $this->addTab('form_section', array(
22
+ 'label' => Mage::helper('auguria_sponsorship')->__('Provider detail'),
23
+ 'title' => Mage::helper('auguria_sponsorship')->__('Provider detail'),
24
+ 'content' => $this->getLayout()->createBlock('auguria_sponsorship/adminhtml_openinviter_edit_tab_form')->toHtml(),
25
  ));
26
 
27
  return parent::_beforeToHtml();
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Openinviter/Grid.php CHANGED
@@ -18,7 +18,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Openinviter_Grid extends Mage_Adminhtm
18
 
19
  protected function _prepareCollection()
20
  {
21
- $collection = Mage::getResourceModel('sponsorship/sponsorshipopeninviter_collection')
22
  ;
23
  $this->setCollection($collection);
24
  return parent::_prepareCollection();
@@ -27,48 +27,48 @@ class Auguria_Sponsorship_Block_Adminhtml_Openinviter_Grid extends Mage_Adminhtm
27
  protected function _prepareColumns()
28
  {
29
  $this->addColumn('sponsorship_openinviter_id', array(
30
- 'header' => Mage::helper('sponsorship')->__('ID'),
31
  'align' =>'right',
32
  'index' => 'sponsorship_openinviter_id',
33
  ));
34
 
35
  $this->addColumn('code', array(
36
- 'header' => Mage::helper('sponsorship')->__('Code'),
37
  'index' => 'code',
38
  ));
39
 
40
  $this->addColumn('name', array(
41
- 'header' => Mage::helper('sponsorship')->__('Name'),
42
  'index' => 'name',
43
  ));
44
 
45
  $this->addColumn('image', array(
46
- 'header' => Mage::helper('sponsorship')->__('Image'),
47
  'align' =>'center',
48
  'width' => '50px',
49
  'filter' => false,
50
  'sortable' => false,
51
- 'renderer' => 'sponsorship/adminhtml_widget_grid_renderer',
52
  ));
53
 
54
  $this->addColumn('status', array(
55
- 'header' => Mage::helper('sponsorship')->__('Status'),
56
  'index' => 'status',
57
  'type' => 'options',
58
  'options' => array(
59
- 1 => Mage::helper('sponsorship')->__('Enabled'),
60
- 2 => Mage::helper('sponsorship')->__('Disabled'),
61
  ),
62
  ));
63
 
64
  $this->addColumn('action',
65
  array(
66
- 'header' => Mage::helper('sponsorship')->__('Action'),
67
  'type' => 'action',
68
  'getter' => 'getId',
69
  'actions' => array(
70
  array(
71
- 'caption' => Mage::helper('sponsorship')->__('Edit'),
72
  'url' => array('base'=> '*/*/edit'),
73
  'field' => 'id'
74
  )
@@ -88,23 +88,23 @@ class Auguria_Sponsorship_Block_Adminhtml_Openinviter_Grid extends Mage_Adminhtm
88
  $this->getMassactionBlock()->setFormFieldName('openinviter');
89
 
90
  $this->getMassactionBlock()->addItem('delete', array(
91
- 'label' => Mage::helper('sponsorship')->__('Delete'),
92
  'url' => $this->getUrl('*/*/massDelete'),
93
- 'confirm' => Mage::helper('sponsorship')->__('Are you sure?')
94
  ));
95
 
96
- $statuses = Mage::getSingleton('sponsorship/status')->getOptionArray();
97
 
98
  array_unshift($statuses, array('label'=>'', 'value'=>''));
99
  $this->getMassactionBlock()->addItem('status', array(
100
- 'label'=> Mage::helper('sponsorship')->__('Change status'),
101
  'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
102
  'additional' => array(
103
  'visibility' => array(
104
  'name' => 'status',
105
  'type' => 'select',
106
  'class' => 'required-entry',
107
- 'label' => Mage::helper('sponsorship')->__('Status'),
108
  'values' => $statuses
109
  )
110
  )
18
 
19
  protected function _prepareCollection()
20
  {
21
+ $collection = Mage::getResourceModel('auguria_sponsorship/sponsorshipopeninviter_collection')
22
  ;
23
  $this->setCollection($collection);
24
  return parent::_prepareCollection();
27
  protected function _prepareColumns()
28
  {
29
  $this->addColumn('sponsorship_openinviter_id', array(
30
+ 'header' => Mage::helper('auguria_sponsorship')->__('ID'),
31
  'align' =>'right',
32
  'index' => 'sponsorship_openinviter_id',
33
  ));
34
 
35
  $this->addColumn('code', array(
36
+ 'header' => Mage::helper('auguria_sponsorship')->__('Code'),
37
  'index' => 'code',
38
  ));
39
 
40
  $this->addColumn('name', array(
41
+ 'header' => Mage::helper('auguria_sponsorship')->__('Name'),
42
  'index' => 'name',
43
  ));
44
 
45
  $this->addColumn('image', array(
46
+ 'header' => Mage::helper('auguria_sponsorship')->__('Image'),
47
  'align' =>'center',
48
  'width' => '50px',
49
  'filter' => false,
50
  'sortable' => false,
51
+ 'renderer' => 'auguria_sponsorship/adminhtml_widget_grid_renderer',
52
  ));
53
 
54
  $this->addColumn('status', array(
55
+ 'header' => Mage::helper('auguria_sponsorship')->__('Status'),
56
  'index' => 'status',
57
  'type' => 'options',
58
  'options' => array(
59
+ 1 => Mage::helper('auguria_sponsorship')->__('Enabled'),
60
+ 2 => Mage::helper('auguria_sponsorship')->__('Disabled'),
61
  ),
62
  ));
63
 
64
  $this->addColumn('action',
65
  array(
66
+ 'header' => Mage::helper('auguria_sponsorship')->__('Action'),
67
  'type' => 'action',
68
  'getter' => 'getId',
69
  'actions' => array(
70
  array(
71
+ 'caption' => Mage::helper('auguria_sponsorship')->__('Edit'),
72
  'url' => array('base'=> '*/*/edit'),
73
  'field' => 'id'
74
  )
88
  $this->getMassactionBlock()->setFormFieldName('openinviter');
89
 
90
  $this->getMassactionBlock()->addItem('delete', array(
91
+ 'label' => Mage::helper('auguria_sponsorship')->__('Delete'),
92
  'url' => $this->getUrl('*/*/massDelete'),
93
+ 'confirm' => Mage::helper('auguria_sponsorship')->__('Are you sure?')
94
  ));
95
 
96
+ $statuses = Mage::getSingleton('auguria_sponsorship/status')->getOptionArray();
97
 
98
  array_unshift($statuses, array('label'=>'', 'value'=>''));
99
  $this->getMassactionBlock()->addItem('status', array(
100
+ 'label'=> Mage::helper('auguria_sponsorship')->__('Change status'),
101
  'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
102
  'additional' => array(
103
  'visibility' => array(
104
  'name' => 'status',
105
  'type' => 'select',
106
  'class' => 'required-entry',
107
+ 'label' => Mage::helper('auguria_sponsorship')->__('Status'),
108
  'values' => $statuses
109
  )
110
  )
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sales/Order/Invoice/Totals.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Block_Adminhtml_Sales_Order_Invoice_Totals extends Mage_Adminhtml_Block_Sales_Order_Invoice_Totals
9
+ {
10
+ protected function _initTotals()
11
+ {
12
+ parent::_initTotals();
13
+ $source = $this->getSource();
14
+ if (((float)$this->getSource()->getAuguriaSponsorshipDiscountAmount()) != 0) {
15
+ $auguriaSponsorshipDiscountTotal = new Varien_Object(array(
16
+ 'code' => 'auguria_sponsorship_discount',
17
+ 'value'=> $source->getAuguriaSponsorshipDiscountAmount(),
18
+ 'base_value'=> $source->getBaseAuguriaSponsorshipDiscountAmount(),
19
+ 'label'=> Mage::helper('auguria_sponsorship')->__('Sponsorship and fidelity discount')
20
+ ));
21
+ $this->addTotal($auguriaSponsorshipDiscountTotal);
22
+ }
23
+ return $this;
24
+ }
25
+ }
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sales/Order/Totals.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Block_Adminhtml_Sales_Order_Totals extends Mage_Adminhtml_Block_Sales_Order_Totals
9
+ {
10
+ protected function _initTotals()
11
+ {
12
+ parent::_initTotals();
13
+ $source = $this->getSource();
14
+ if (((float)$this->getSource()->getAuguriaSponsorshipDiscountAmount()) != 0) {
15
+ $auguriaSponsorshipDiscountTotal = new Varien_Object(array(
16
+ 'code' => 'auguria_sponsorship_discount',
17
+ 'value'=> $source->getAuguriaSponsorshipDiscountAmount(),
18
+ 'base_value'=> $source->getBaseAuguriaSponsorshipDiscountAmount(),
19
+ 'label'=> Mage::helper('auguria_sponsorship')->__('Sponsorship and fidelity discount')
20
+ ));
21
+ $this->addTotal($auguriaSponsorshipDiscountTotal);
22
+ }
23
+ return $this;
24
+ }
25
+ }
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sponsorship.php CHANGED
@@ -7,12 +7,12 @@
7
  */
8
  class Auguria_Sponsorship_Block_Adminhtml_Sponsorship extends Mage_Adminhtml_Block_Widget_Grid_Container
9
  {
10
- public function __construct()
11
- {
12
- $this->_controller = 'adminhtml_sponsorship';
13
- $this->_blockGroup = 'sponsorship';
14
- $this->_headerText = $this->__('Invitations list');
15
- parent::__construct();
16
- $this->removeButton('add');
17
- }
18
  }
7
  */
8
  class Auguria_Sponsorship_Block_Adminhtml_Sponsorship extends Mage_Adminhtml_Block_Widget_Grid_Container
9
  {
10
+ public function __construct()
11
+ {
12
+ $this->_controller = 'adminhtml_sponsorship';
13
+ $this->_blockGroup = 'auguria_sponsorship';
14
+ $this->_headerText = $this->__('Invitations list');
15
+ parent::__construct();
16
+ $this->removeButton('add');
17
+ }
18
  }
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sponsorship/Edit.php CHANGED
@@ -34,7 +34,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Sponsorship_Edit extends Mage_Adminhtm
34
  ), 1);
35
 
36
  $this->_objectId = 'id';
37
- $this->_blockGroup = 'sponsorship';
38
  $this->_controller = 'adminhtml_sponsorship';
39
 
40
  $this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save'));
@@ -64,9 +64,9 @@ class Auguria_Sponsorship_Block_Adminhtml_Sponsorship_Edit extends Mage_Adminhtm
64
  public function getHeaderText()
65
  {
66
  if( Mage::registry('sponsorship_data') && Mage::registry('sponsorship_data')->getId() ) {
67
- return Mage::helper('sponsorship')->__("Edition of the invitation '%s'", $this->htmlEscape(Mage::registry('sponsorship_data')->getId()));
68
  } else {
69
- return Mage::helper('sponsorship')->__('Add an invitation');
70
  }
71
  }
72
  }
34
  ), 1);
35
 
36
  $this->_objectId = 'id';
37
+ $this->_blockGroup = 'auguria_sponsorship';
38
  $this->_controller = 'adminhtml_sponsorship';
39
 
40
  $this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save'));
64
  public function getHeaderText()
65
  {
66
  if( Mage::registry('sponsorship_data') && Mage::registry('sponsorship_data')->getId() ) {
67
+ return Mage::helper('auguria_sponsorship')->__("Edition of the invitation '%s'", $this->htmlEscape(Mage::registry('sponsorship_data')->getId()));
68
  } else {
69
+ return Mage::helper('auguria_sponsorship')->__('Add an invitation');
70
  }
71
  }
72
  }
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sponsorship/Edit/Tab/Form.php CHANGED
@@ -11,25 +11,25 @@ class Auguria_Sponsorship_Block_Adminhtml_Sponsorship_Edit_Tab_Form extends Mage
11
  {
12
  $form = new Varien_Data_Form();
13
  $this->setForm($form);
14
- $fieldset = $form->addFieldset('sponsorship_form', array('legend'=>Mage::helper('sponsorship')->__("Invitation information")));
15
 
16
  $fieldset->addField('parent_id', 'text', array(
17
- 'label' => Mage::helper('sponsorship')->__('Related ID'),
18
  'class' => 'required-entry',
19
  'required' => true,
20
  'name' => 'parent_id',
21
  ));
22
 
23
  $fieldset->addField('child_mail', 'text', array(
24
- 'label' => Mage::helper('sponsorship')->__('Guest mail'),
25
  'required' => true,
26
  'name' => 'child_mail',
27
  ));
28
 
29
  $fieldset->addField('datetime', 'date', array(
30
  'name' => 'datetime',
31
- 'title' => Mage::helper('sponsorship')->__("Date"),
32
- 'label' => Mage::helper('sponsorship')->__("Date"),
33
  'required' => true,
34
  'image' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'/adminhtml/default/default/images/grid-cal.gif',
35
  'input_format' => Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
11
  {
12
  $form = new Varien_Data_Form();
13
  $this->setForm($form);
14
+ $fieldset = $form->addFieldset('sponsorship_form', array('legend'=>Mage::helper('auguria_sponsorship')->__("Invitation information")));
15
 
16
  $fieldset->addField('parent_id', 'text', array(
17
+ 'label' => Mage::helper('auguria_sponsorship')->__('Related ID'),
18
  'class' => 'required-entry',
19
  'required' => true,
20
  'name' => 'parent_id',
21
  ));
22
 
23
  $fieldset->addField('child_mail', 'text', array(
24
+ 'label' => Mage::helper('auguria_sponsorship')->__('Guest mail'),
25
  'required' => true,
26
  'name' => 'child_mail',
27
  ));
28
 
29
  $fieldset->addField('datetime', 'date', array(
30
  'name' => 'datetime',
31
+ 'title' => Mage::helper('auguria_sponsorship')->__("Date"),
32
+ 'label' => Mage::helper('auguria_sponsorship')->__("Date"),
33
  'required' => true,
34
  'image' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'/adminhtml/default/default/images/grid-cal.gif',
35
  'input_format' => Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sponsorship/Edit/Tabs.php CHANGED
@@ -13,15 +13,15 @@ class Auguria_Sponsorship_Block_Adminhtml_Sponsorship_Edit_Tabs extends Mage_Adm
13
  parent::__construct();
14
  $this->setId('sponsorship_tabs');
15
  $this->setDestElementId('edit_form');
16
- $this->setTitle(Mage::helper('sponsorship')->__('Invitation detail'));
17
  }
18
 
19
  protected function _beforeToHtml()
20
  {
21
  $this->addTab('form_section', array(
22
- 'label' => Mage::helper('sponsorship')->__('Invitation detail'),
23
- 'title' => Mage::helper('sponsorship')->__('Invitation detail'),
24
- 'content' => $this->getLayout()->createBlock('sponsorship/adminhtml_sponsorship_edit_tab_form')->toHtml(),
25
  ));
26
 
27
  return parent::_beforeToHtml();
13
  parent::__construct();
14
  $this->setId('sponsorship_tabs');
15
  $this->setDestElementId('edit_form');
16
+ $this->setTitle(Mage::helper('auguria_sponsorship')->__('Invitation detail'));
17
  }
18
 
19
  protected function _beforeToHtml()
20
  {
21
  $this->addTab('form_section', array(
22
+ 'label' => Mage::helper('auguria_sponsorship')->__('Invitation detail'),
23
+ 'title' => Mage::helper('auguria_sponsorship')->__('Invitation detail'),
24
+ 'content' => $this->getLayout()->createBlock('auguria_sponsorship/adminhtml_sponsorship_edit_tab_form')->toHtml(),
25
  ));
26
 
27
  return parent::_beforeToHtml();
app/code/community/Auguria/Sponsorship/Block/Adminhtml/Sponsorship/Grid.php CHANGED
@@ -19,7 +19,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Sponsorship_Grid extends Mage_Adminhtm
19
 
20
  protected function _prepareCollection()
21
  {
22
- $collection = Mage::getResourceModel('sponsorship/sponsorship_collection')
23
  ;//->addChildNameToSelect();
24
  $this->setCollection($collection);
25
  return parent::_prepareCollection();
@@ -28,51 +28,51 @@ class Auguria_Sponsorship_Block_Adminhtml_Sponsorship_Grid extends Mage_Adminhtm
28
  protected function _prepareColumns()
29
  {
30
  $this->addColumn('sponsorship_id', array(
31
- 'header' => Mage::helper('sponsorship')->__('ID'),
32
  'align' =>'right',
33
  //'width' => '40px',
34
  'index' => 'sponsorship_id',
35
  ));
36
 
37
  $this->addColumn('parent_id', array(
38
- 'header' => Mage::helper('sponsorship')->__('Related ID'),
39
  'align' =>'right',
40
  //'width' => '40px',
41
  'index' => 'parent_id',
42
  ));
43
 
44
  $this->addColumn('parent_name', array(
45
- 'header' => Mage::helper('sponsorship')->__('Related name'),
46
  'index' => 'parent_name',
47
  ));
48
 
49
  $this->addColumn('parent_mail', array(
50
- 'header' => Mage::helper('sponsorship')->__('Related mail'),
51
  'align' =>'left',
52
  'index' => 'parent_mail',
53
  ));
54
 
55
  $this->addColumn('child_firstname', array(
56
- 'header' => Mage::helper('sponsorship')->__('Guest first name'),
57
  'index' => 'child_firstname',
58
  ));
59
  $this->addColumn('child_lastname', array(
60
- 'header' => Mage::helper('sponsorship')->__('Guest last name'),
61
  'index' => 'child_lastname',
62
  ));
63
 
64
  $this->addColumn('child_mail', array(
65
- 'header' => Mage::helper('sponsorship')->__('Guest mail'),
66
  'index' => 'child_mail',
67
  ));
68
 
69
  $this->addColumn('message', array(
70
- 'header' => Mage::helper('sponsorship')->__('Message'),
71
  'index' => 'message',
72
  ));
73
 
74
  $this->addColumn('datetime', array(
75
- 'header' => Mage::helper('sponsorship')->__("Date"),
76
  'align' =>'right',
77
  'index' => 'datetime',
78
  'type' => 'datetime',
@@ -80,7 +80,7 @@ class Auguria_Sponsorship_Block_Adminhtml_Sponsorship_Grid extends Mage_Adminhtm
80
  ));
81
 
82
  $this->addColumn('datetime_boost', array(
83
- 'header' => Mage::helper('sponsorship')->__("Recovery date"),
84
  'align' =>'right',
85
  'index' => 'datetime_boost',
86
  'type' => 'datetime',
@@ -89,13 +89,13 @@ class Auguria_Sponsorship_Block_Adminhtml_Sponsorship_Grid extends Mage_Adminhtm
89
 
90
  $this->addColumn('action',
91
  array(
92
- 'header' => Mage::helper('sponsorship')->__('Action'),
93
  //'width' => '100',
94
  'type' => 'action',
95
  'getter' => 'getId',
96
  'actions' => array(
97
  array(
98
- 'caption' => Mage::helper('sponsorship')->__('Edit'),
99
  'url' => array('base'=> '*/*/edit'),
100
  'field' => 'id'
101
  )
@@ -106,8 +106,8 @@ class Auguria_Sponsorship_Block_Adminhtml_Sponsorship_Grid extends Mage_Adminhtm
106
  'is_system' => true,
107
  ));
108
 
109
- $this->addExportType('*/*/exportCsv', Mage::helper('sponsorship')->__('CSV'));
110
- $this->addExportType('*/*/exportXml', Mage::helper('sponsorship')->__('XML'));
111
 
112
  return parent::_prepareColumns();
113
  }
19
 
20
  protected function _prepareCollection()
21
  {
22
+ $collection = Mage::getResourceModel('auguria_sponsorship/sponsorship_collection')
23
  ;//->addChildNameToSelect();
24
  $this->setCollection($collection);
25
  return parent::_prepareCollection();
28
  protected function _prepareColumns()
29
  {
30
  $this->addColumn('sponsorship_id', array(
31
+ 'header' => Mage::helper('auguria_sponsorship')->__('ID'),
32
  'align' =>'right',
33
  //'width' => '40px',
34
  'index' => 'sponsorship_id',
35
  ));
36
 
37
  $this->addColumn('parent_id', array(
38
+ 'header' => Mage::helper('auguria_sponsorship')->__('Related ID'),
39
  'align' =>'right',
40
  //'width' => '40px',
41
  'index' => 'parent_id',
42
  ));
43
 
44
  $this->addColumn('parent_name', array(
45
+ 'header' => Mage::helper('auguria_sponsorship')->__('Related name'),
46
  'index' => 'parent_name',
47
  ));
48
 
49
  $this->addColumn('parent_mail', array(
50
+ 'header' => Mage::helper('auguria_sponsorship')->__('Related mail'),
51
  'align' =>'left',
52
  'index' => 'parent_mail',
53
  ));
54
 
55
  $this->addColumn('child_firstname', array(
56
+ 'header' => Mage::helper('auguria_sponsorship')->__('Guest first name'),
57
  'index' => 'child_firstname',
58
  ));
59
  $this->addColumn('child_lastname', array(
60
+ 'header' => Mage::helper('auguria_sponsorship')->__('Guest last name'),
61
  'index' => 'child_lastname',
62
  ));
63
 
64
  $this->addColumn('child_mail', array(
65
+ 'header' => Mage::helper('auguria_sponsorship')->__('Guest mail'),
66
  'index' => 'child_mail',
67
  ));
68
 
69
  $this->addColumn('message', array(
70
+ 'header' => Mage::helper('auguria_sponsorship')->__('Message'),
71
  'index' => 'message',
72
  ));
73
 
74
  $this->addColumn('datetime', array(
75
+ 'header' => Mage::helper('auguria_sponsorship')->__("Date"),
76
  'align' =>'right',
77
  'index' => 'datetime',
78
  'type' => 'datetime',
80
  ));
81
 
82
  $this->addColumn('datetime_boost', array(
83
+ 'header' => Mage::helper('auguria_sponsorship')->__("Recovery date"),
84
  'align' =>'right',
85
  'index' => 'datetime_boost',
86
  'type' => 'datetime',
89
 
90
  $this->addColumn('action',
91
  array(
92
+ 'header' => Mage::helper('auguria_sponsorship')->__('Action'),
93
  //'width' => '100',
94
  'type' => 'action',
95
  'getter' => 'getId',
96
  'actions' => array(
97
  array(
98
+ 'caption' => Mage::helper('auguria_sponsorship')->__('Edit'),
99
  'url' => array('base'=> '*/*/edit'),
100
  'field' => 'id'
101
  )
106
  'is_system' => true,
107
  ));
108
 
109
+ $this->addExportType('*/*/exportCsv', Mage::helper('auguria_sponsorship')->__('CSV'));
110
+ $this->addExportType('*/*/exportXml', Mage::helper('auguria_sponsorship')->__('XML'));
111
 
112
  return parent::_prepareColumns();
113
  }
app/code/community/Auguria/Sponsorship/Block/Customer/Account/PointsDetail.php CHANGED
@@ -7,292 +7,463 @@
7
  */
8
  class Auguria_Sponsorship_Block_Customer_Account_PointsDetail extends Mage_Customer_Block_Account_Dashboard
9
  {
10
- public function _prepareLayout()
11
- {
12
  return parent::_prepareLayout();
13
- }
14
-
15
- public function isFidelityChangeEnabled ()
16
- {
17
- $isEnable = false;
18
- if ($this->getFidelityCashConfig()) {
19
- $isEnable = true;
20
- }
21
- elseif ($this->getFidelityCouponConfig()) {
22
- $isEnable = true;
23
- }
24
- elseif ($this->getFidelityGiftConfig()) {
25
- $isEnable = true;
26
- }
27
- return $isEnable;
28
- }
29
-
30
- public function isSponsorChangeEnabled ()
31
- {
32
- $isEnable = false;
33
- if ($this->getSponsorCashConfig()) {
34
- $isEnable = true;
35
- }
36
- elseif ($this->getSponsorCouponConfig()) {
37
- $isEnable = true;
38
- }
39
- elseif ($this->getSponsorGiftConfig()) {
40
- $isEnable = true;
41
- }
42
- return $isEnable;
43
- }
44
-
45
- public function getFidelityEnabledConfig ()
46
- {
47
- $fidelity_enabled = Mage::getStoreConfig('sponsorship/fidelity/fidelity_enabled');
48
- return $fidelity_enabled;
49
- }
50
-
51
- public function getFidelityCashConfig ()
52
- {
53
- $fidelity_cash = Mage::getStoreConfig('sponsorship/fidelity/fidelity_cash');
54
- return $fidelity_cash;
55
- }
56
-
57
- public function getFidelityCouponConfig ()
58
- {
59
- $fidelity_coupon = Mage::getStoreConfig('sponsorship/fidelity/fidelity_coupon');
60
- return $fidelity_coupon;
61
- }
62
-
63
- public function getFidelityGiftConfig ()
64
- {
65
- $fidelity_gift = Mage::getStoreConfig('sponsorship/fidelity/fidelity_gift');
66
- return $fidelity_gift;
67
- }
68
-
69
- public function getFidelityMaxCashConfig ()
70
- {
71
- $fidelity_max_cash = Mage::getStoreConfig('sponsorship/fidelity/fidelity_max_cash');
72
- return $fidelity_max_cash;
73
- }
74
-
75
- public function getFidelityTimeMaxCashConfig ()
76
- {
77
- $fidelity_time_max_cash = Mage::getStoreConfig('sponsorship/fidelity/fidelity_time_max_cash');
78
- return $fidelity_time_max_cash;
79
- }
80
-
81
- public function getSponsorEnabledConfig ()
82
- {
83
- $sponsor_enabled = Mage::getStoreConfig('sponsorship/sponsor/sponsor_enabled');
84
- return $sponsor_enabled;
85
- }
86
-
87
- public function getSponsorCashConfig ()
88
- {
89
- $sponsor_cash = Mage::getStoreConfig('sponsorship/sponsor/sponsor_cash');
90
- return $sponsor_cash;
91
- }
92
-
93
- public function getSponsorCouponConfig ()
94
- {
95
- $sponsor_coupon = Mage::getStoreConfig('sponsorship/sponsor/sponsor_coupon');
96
- return $sponsor_coupon;
97
- }
98
-
99
- public function getSponsorGiftConfig ()
100
- {
101
- $sponsor_gift = Mage::getStoreConfig('sponsorship/sponsor/sponsor_gift');
102
- return $sponsor_gift;
103
- }
104
-
105
- public function getSponsorMaxCashConfig ()
106
- {
107
- $sponsor_max_cash = Mage::getStoreConfig('sponsorship/sponsor/sponsor_max_cash');
108
- return $sponsor_max_cash;
109
- }
110
-
111
- public function getSponsorTimeMaxCashConfig ()
112
- {
113
- $sponsor_time_max_cash = Mage::getStoreConfig('sponsorship/sponsor/sponsor_time_max_cash');
114
- return $sponsor_time_max_cash;
115
- }
116
-
117
- public function getSponsorPointsToCashConfig ()
118
- {
119
- $sponsor_points_to_cash = Mage::getStoreConfig('sponsorship/sponsor/sponsor_points_to_cash');
120
- return $sponsor_points_to_cash;
121
- }
122
-
123
- public function getFidelityPointsToCashConfig ()
124
- {
125
- $fidelity_points_to_cash = Mage::getStoreConfig('sponsorship/fidelity/fidelity_points_to_cash');
126
- return $fidelity_points_to_cash;
127
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
- public function getUserId()
130
- {
131
- if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
132
- return '';
133
- }
134
- $customer = Mage::getSingleton('customer/session')->getCustomerId();
135
- return ($customer);
136
- }
137
-
138
- public function getParrainages() {
139
- $parrains = Mage::getModel("customer/customer")
140
- ->getCollection()
141
- ->addNameToSelect()
142
- ->addAttributeToFilter('sponsor', $this->getUserId());
 
 
 
143
  $parrains = $parrains->getData();
144
  return $parrains;
145
- }
146
-
147
- public function getNbParrainages ($customerId)
148
- {
149
- $sponsor = Mage::getModel("customer/customer")
150
- ->getCollection()
151
- //->addExpressionAttributeToSelect('nbSponsor','COUNT("entity_id")','sponsor')
152
- ->addFilter('e.is_active', 1)
153
- ->addAttributeToFilter('sponsor', $customerId)
154
- //->groupByAttribute('entity_id');
155
- ->count();
156
- return $sponsor;
157
- }
158
-
159
- public function getDateDernCde ($customerId)
160
- {
161
- $commande = Mage::getModel("sales/order")
162
- ->getCollection()
163
- ->addAttributeToFilter('customer_id',$customerId)
164
- ->addAttributeToSort('created_at', 'asc')
165
- ->getLastItem();
166
- if ($commande) {
167
- return $commande['created_at'];
168
- }
169
- else {
170
- return null;
171
- }
172
-
173
- }
174
-
175
- public function getCommandes()
176
- {
177
- $commandes = Mage::getModel("sales/order")
178
- ->getCollection()
179
- ->addAttributeToFilter('customer_id',$this->getUserId())
180
- ->addAttributeToSort('created_at', 'desc')
181
- ->setPageSize(5);
182
- return $commandes->getData();
183
- }
184
-
185
- public function getOrderFidelityPoints($orderId)
186
- {
187
- $order = Mage::getModel("sales/order")->load($orderId);
188
- $points = 0;
189
-
190
- foreach ($order->getAllItems() as $item)
191
- {
192
- $points = $points + $item->getCartFidelityPoints() + $item->getCatalogFidelityPoints();
193
- }
194
- return $points;
195
- }
196
-
197
- public function getOrderSponsorPoints($orderId)
198
- {
199
- $order = Mage::getModel("sales/order")->load($orderId);
200
- $points = 0;
201
-
202
- foreach ($order->getAllItems() as $item)
203
- {
204
- $points = $points + $item->getCartSponsorPoints() + $item->getCatalogSponsorPoints();
205
- }
206
- return $points;
207
- }
208
-
209
- public function getFidelityPoints()
210
- {
211
- $customer = Mage::getModel("customer/customer")->load($this->getUserId());
212
- $cFP = $customer->getData('fidelity_points');
 
 
 
 
 
 
 
 
 
213
  return $cFP;
214
- }
215
-
216
- public function getSponsorPoints()
217
- {
218
- $customer = Mage::getModel("customer/customer")->load($this->getUserId());
219
- $cSP = $customer->getData('sponsor_points');
 
 
 
 
 
 
 
220
  return $cSP;
221
- }
222
-
223
- public function getBranchPoints($customerId)
224
- {
225
- try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  $resource = Mage::getSingleton('core/resource');
227
  $read = $resource->getConnection('core_read');
228
-
229
  $select = $read->select()
230
- ->from($resource->getTableName('sponsorship/sponsorlog'), 'SUM(points)')
231
- ->where('godson_id=?', $customerId)
232
- ->where('sponsor_id=?', $this->getUserId());
233
- return $read->fetchOne($select);
234
- }
235
- catch (Exception $e) {
236
- }
237
- }
238
-
239
- public function hasChange($module)
240
- {
241
- $changes = mage::getModel("sponsorship/change")
242
- ->getCollection()
243
- ->addAttributeToFilter("module", $module)
244
- ->addAttributeToFilter("customer_id", $this->getUserId())
245
- ->count();
246
- if ($changes)
247
- {
248
- return true;
249
- }
250
- else
251
- {
252
- return false;
253
- }
254
- }
255
-
256
- public function getChanges($module)
257
- {
258
- $changes = mage::getModel("sponsorship/change")
259
- ->getCollection()
260
- ->addAttributeToFilter("module", $module)
261
- ->addAttributeToFilter("customer_id", $this->getUserId())
262
- ->setOrder('datetime', 'desc')
263
- ->setPageSize(5);
264
- return $changes;
265
- }
266
-
267
- public function getInvits()
268
- {
269
- $resource = Mage::getSingleton('core/resource');
270
- $read = $resource->getConnection('core_read');
271
- $select = $read->select()
272
- ->from(Array("s"=>$resource->getTableName('sponsorship/sponsorship')),
273
- Array("*"=>"s.*"))
274
- ->where('s.parent_id=?', $this->getUserId())
275
- ->where('TO_DAYS(NOW()) - TO_DAYS(s.datetime) <= ?', Mage::getStoreConfig('sponsorship/invit_email/sponsor_invitation_validity'))
276
- ->where('s.child_mail NOT IN ?', new Zend_Db_Expr('(select ce.email from '.$resource->getTableName('customer_entity').' ce)'))
277
- ->where('s.datetime = ?', new Zend_Db_Expr('(select max(sp.datetime) from '.$resource->getTableName('sponsorship/sponsorship').' sp where sp.parent_id=s.parent_id and sp.child_mail = s.child_mail)'));
278
- return $read->fetchAll($select);
279
- }
280
-
281
- /**
282
- *
283
- * Check if customer navigator is ie8
284
- * @return boolean
285
- */
286
- public function isIe8()
287
- {
288
- $match=preg_match('/MSIE ([0-9]\.[0-9])/',$_SERVER['HTTP_USER_AGENT'],$reg);
289
- if ($match!=0 && floatval($reg[1]) == 8)
290
- {
291
- return true;
292
- }
293
- else
294
- {
295
- return false;
296
- }
297
- }
298
  }
7
  */
8
  class Auguria_Sponsorship_Block_Customer_Account_PointsDetail extends Mage_Customer_Block_Account_Dashboard
9
  {
10
+ public function _prepareLayout()
11
+ {
12
  return parent::_prepareLayout();
13
+ }
14
+
15
+ /**
16
+ * Fidelity configuration
17
+ */
18
+
19
+ public function isFidelityChangeEnabled ()
20
+ {
21
+ $isEnable = false;
22
+ if ($this->getFidelityCashConfig()) {
23
+ $isEnable = true;
24
+ }
25
+ elseif ($this->getFidelityCouponConfig()) {
26
+ $isEnable = true;
27
+ }
28
+ elseif ($this->getFidelityGiftConfig()) {
29
+ $isEnable = true;
30
+ }
31
+ return $isEnable;
32
+ }
33
+
34
+ public function getFidelityEnabledConfig ()
35
+ {
36
+ return Mage::helper('auguria_sponsorship/config')->isFidelityEnabled();
37
+ }
38
+
39
+ public function getFidelityCashConfig ()
40
+ {
41
+ $fidelity_cash = Mage::getStoreConfig('auguria_sponsorship/fidelity/fidelity_cash');
42
+ return $fidelity_cash;
43
+ }
44
+
45
+ public function getFidelityCouponConfig ()
46
+ {
47
+ $fidelity_coupon = Mage::getStoreConfig('auguria_sponsorship/fidelity/fidelity_coupon');
48
+ return $fidelity_coupon;
49
+ }
50
+
51
+ public function getFidelityGiftConfig ()
52
+ {
53
+ $fidelity_gift = Mage::getStoreConfig('auguria_sponsorship/fidelity/fidelity_gift');
54
+ return $fidelity_gift;
55
+ }
56
+
57
+ public function getFidelityMaxCashConfig ()
58
+ {
59
+ $fidelity_max_cash = Mage::getStoreConfig('auguria_sponsorship/fidelity/fidelity_max_cash');
60
+ return $fidelity_max_cash;
61
+ }
62
+
63
+ public function getFidelityTimeMaxCashConfig ()
64
+ {
65
+ $fidelity_time_max_cash = Mage::getStoreConfig('auguria_sponsorship/fidelity/fidelity_time_max_cash');
66
+ return $fidelity_time_max_cash;
67
+ }
68
+
69
+ public function getFidelityPointsToCashConfig ()
70
+ {
71
+ $fidelity_points_to_cash = Mage::getStoreConfig('auguria_sponsorship/fidelity/fidelity_points_to_cash');
72
+ return $fidelity_points_to_cash;
73
+ }
74
+
75
+ /**
76
+ * Sponsorship configuration
77
+ */
78
+
79
+ public function isSponsorChangeEnabled ()
80
+ {
81
+ $isEnable = false;
82
+ if ($this->getSponsorCashConfig()) {
83
+ $isEnable = true;
84
+ }
85
+ elseif ($this->getSponsorCouponConfig()) {
86
+ $isEnable = true;
87
+ }
88
+ elseif ($this->getSponsorGiftConfig()) {
89
+ $isEnable = true;
90
+ }
91
+ return $isEnable;
92
+ }
93
+
94
+ public function getSponsorEnabledConfig ()
95
+ {
96
+ return Mage::helper('auguria_sponsorship/config')->isSponsorshipEnabled();
97
+ }
98
+
99
+ public function getSponsorCashConfig ()
100
+ {
101
+ $sponsor_cash = Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_cash');
102
+ return $sponsor_cash;
103
+ }
104
+
105
+ public function getSponsorCouponConfig ()
106
+ {
107
+ $sponsor_coupon = Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_coupon');
108
+ return $sponsor_coupon;
109
+ }
110
+
111
+ public function getSponsorGiftConfig ()
112
+ {
113
+ $sponsor_gift = Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_gift');
114
+ return $sponsor_gift;
115
+ }
116
+
117
+ public function getSponsorMaxCashConfig ()
118
+ {
119
+ $sponsor_max_cash = Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_max_cash');
120
+ return $sponsor_max_cash;
121
+ }
122
+
123
+ public function getSponsorTimeMaxCashConfig ()
124
+ {
125
+ $sponsor_time_max_cash = Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_time_max_cash');
126
+ return $sponsor_time_max_cash;
127
+ }
128
+
129
+ public function getSponsorPointsToCashConfig ()
130
+ {
131
+ $sponsor_points_to_cash = Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_points_to_cash');
132
+ return $sponsor_points_to_cash;
133
+ }
134
+
135
+ /**
136
+ * Accumulated configuration
137
+ */
138
+
139
+ public function isAccumulatedChangeEnabled ()
140
+ {
141
+ $isEnable = false;
142
+ if ($this->getAccumulatedCashConfig()) {
143
+ $isEnable = true;
144
+ }
145
+ elseif ($this->getAccumulatedCouponConfig()) {
146
+ $isEnable = true;
147
+ }
148
+ elseif ($this->getAccumulatedGiftConfig()) {
149
+ $isEnable = true;
150
+ }
151
+ return $isEnable;
152
+ }
153
+
154
+ public function getAccumulatedEnabledConfig ()
155
+ {
156
+ return Mage::helper('auguria_sponsorship/config')->isAccumulatedEnabled();
157
+ }
158
+
159
+ public function getAccumulatedCashConfig ()
160
+ {
161
+ $accumulated_cash = Mage::getStoreConfig('auguria_sponsorship/accumulated/cash');
162
+ return $accumulated_cash;
163
+ }
164
+
165
+ public function getAccumulatedCouponConfig ()
166
+ {
167
+ $accumulated_coupon = Mage::getStoreConfig('auguria_sponsorship/accumulated/coupon');
168
+ return $accumulated_coupon;
169
+ }
170
+
171
+ public function getAccumulatedGiftConfig ()
172
+ {
173
+ $accumulated_gift = Mage::getStoreConfig('auguria_sponsorship/accumulated/gift');
174
+ return $accumulated_gift;
175
+ }
176
+
177
+ public function getAccumulatedMaxCashConfig ()
178
+ {
179
+ $accumulated_max_cash = Mage::getStoreConfig('auguria_sponsorship/accumulated/max_cash');
180
+ return $accumulated_max_cash;
181
+ }
182
+
183
+ public function getAccumulatedTimeMaxCashConfig ()
184
+ {
185
+ $accumulated_time_max_cash = Mage::getStoreConfig('auguria_sponsorship/accumulated/time_max_cash');
186
+ return $accumulated_time_max_cash;
187
+ }
188
+
189
+ public function getAccumulatedPointsToCashConfig ()
190
+ {
191
+ $accumulated_points_to_cash = Mage::getStoreConfig('auguria_sponsorship/accumulated/points_to_cash');
192
+ return $accumulated_points_to_cash;
193
+ }
194
 
195
+
196
+
197
+
198
+ public function getUserId()
199
+ {
200
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
201
+ return '';
202
+ }
203
+ $customer = Mage::getSingleton('customer/session')->getCustomerId();
204
+ return ($customer);
205
+ }
206
+
207
+ public function getParrainages() {
208
+ $parrains = Mage::getModel("customer/customer")
209
+ ->getCollection()
210
+ ->addNameToSelect()
211
+ ->addAttributeToFilter('sponsor', $this->getUserId());
212
  $parrains = $parrains->getData();
213
  return $parrains;
214
+ }
215
+
216
+ public function getNbParrainages ($customerId)
217
+ {
218
+ $sponsor = Mage::getModel("customer/customer")
219
+ ->getCollection()
220
+ ->addFilter('e.is_active', 1)
221
+ ->addAttributeToFilter('sponsor', $customerId)
222
+ ->count();
223
+ return $sponsor;
224
+ }
225
+
226
+ public function getDateDernCde ($customerId)
227
+ {
228
+ $commande = Mage::getModel("sales/order")
229
+ ->getCollection()
230
+ ->addAttributeToFilter('customer_id',$customerId)
231
+ ->addAttributeToSort('created_at', 'asc')
232
+ ->getLastItem();
233
+ if ($commande) {
234
+ return $commande['created_at'];
235
+ }
236
+ else {
237
+ return null;
238
+ }
239
+ }
240
+
241
+ public function getCommandes()
242
+ {
243
+ $commandes = Mage::getModel("sales/order")
244
+ ->getCollection()
245
+ ->addAttributeToFilter('customer_id',$this->getUserId())
246
+ ->addAttributeToSort('created_at', 'desc')
247
+ ->setPageSize(5);
248
+ return $commandes->getData();
249
+ }
250
+
251
+ public function getOrderFidelityPoints($orderId)
252
+ {
253
+ $order = Mage::getModel("sales/order")->load($orderId);
254
+ $points = 0;
255
+
256
+ foreach ($order->getAllItems() as $item)
257
+ {
258
+ $points = $points + $item->getCartFidelityPoints() + $item->getCatalogFidelityPoints();
259
+ }
260
+ return $points;
261
+ }
262
+
263
+ public function getOrderAccumulatedPoints($orderId)
264
+ {
265
+ $order = Mage::getModel("sales/order")->load($orderId);
266
+ $points = 0;
267
+
268
+ foreach ($order->getAllItems() as $item)
269
+ {
270
+ $points = $points + $item->getCartFidelityPoints() + $item->getCatalogFidelityPoints()+ $item->getCartSponsorPoints() + $item->getCatalogSponsorPoints();
271
+ }
272
+ return $points;
273
+ }
274
+
275
+ public function getOrderSponsorPoints($orderId)
276
+ {
277
+ $order = Mage::getModel("sales/order")->load($orderId);
278
+ $points = 0;
279
+
280
+ foreach ($order->getAllItems() as $item)
281
+ {
282
+ $points = $points + $item->getCartSponsorPoints() + $item->getCatalogSponsorPoints();
283
+ }
284
+ return $points;
285
+ }
286
+
287
+ public function getFidelityPoints()
288
+ {
289
+ $customer = Mage::getModel("customer/customer")->load($this->getUserId());
290
+ $cFP = $customer->getData('fidelity_points');
291
  return $cFP;
292
+ }
293
+
294
+ public function getSponsorPoints()
295
+ {
296
+ $customer = Mage::getModel("customer/customer")->load($this->getUserId());
297
+ $cSP = $customer->getData('sponsor_points');
298
+ return $cSP;
299
+ }
300
+
301
+ public function getAccumulatedPoints()
302
+ {
303
+ $customer = Mage::getModel("customer/customer")->load($this->getUserId());
304
+ $cSP = $customer->getData('accumulated_points');
305
  return $cSP;
306
+ }
307
+
308
+ public function getBranchPoints($customerId)
309
+ {
310
+ try {
311
+ $resource = Mage::getSingleton('core/resource');
312
+ $read = $resource->getConnection('core_read');
313
+
314
+ $select = $read->select()
315
+ ->from($resource->getTableName('auguria_sponsorship/log'), 'SUM(points)')
316
+ ->where('godson_id=?', $customerId)
317
+ ->where('sponsor_id=?', $this->getUserId());
318
+ return $read->fetchOne($select);
319
+ }
320
+ catch (Exception $e) {
321
+ }
322
+ }
323
+
324
+ public function hasChange($module)
325
+ {
326
+ $changes = mage::getModel("auguria_sponsorship/change")
327
+ ->getCollection()
328
+ ->addAttributeToFilter("module", $module)
329
+ ->addAttributeToFilter("customer_id", $this->getUserId())
330
+ ->count();
331
+ if ($changes)
332
+ {
333
+ return true;
334
+ }
335
+ else
336
+ {
337
+ return false;
338
+ }
339
+ }
340
+
341
+ public function getChanges($module)
342
+ {
343
+ $changes = Mage::getModel("auguria_sponsorship/change")
344
+ ->getCollection()
345
+ ->addAttributeToFilter("module", $module)
346
+ ->addAttributeToFilter("customer_id", $this->getUserId())
347
+ ->setOrder('datetime', 'desc');
348
+ //->setPageSize(5);
349
+ return $changes;
350
+ }
351
+
352
+ public function getPointsMovement()
353
+ {
354
+ $logs = Mage::getResourceModel('auguria_sponsorship/log_collection');
355
+ $logs->getSelect()->where('sponsor_id = ?', $this->getUserId());
356
+ $logs->getSelect()->orWhere('customer_id = ?', $this->getUserId());
357
+ return $logs;
358
+ }
359
+
360
+ public function getAccumulatedPointsValue($points)
361
+ {
362
+ $pointsToCash = Mage::helper('auguria_sponsorship/config')->getPointsToCash('accumulated');
363
+ $result = $pointsToCash['accumulated']*$points;
364
+ return $result;
365
+ }
366
+
367
+ public function isAccumulatedValidityEnabled()
368
+ {
369
+ $validity = Mage::helper('auguria_sponsorship/config')->getPointsValidity('accumulated');
370
+ if((int)$validity['accumulated']>0){
371
+ return true;
372
+ }
373
+ return false;
374
+ }
375
+
376
+ public function getAccumulatedValidity()
377
+ {
378
+ return $this->formatDate($this->getCustomer()->getPointsValidity(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
379
+ }
380
+
381
+ public function getAccumulatedMovementType($movement)
382
+ {
383
+ if ($movement->getRecordType()=='order' && $movement->getPoints()>0) {
384
+ return $this->__('Order');
385
+ }
386
+ elseif($movement->getRecordType()=='order') {
387
+ return $this->__('Order cancellation');
388
+ }
389
+ elseif($movement->getRecordType()=='cart' && $movement->getPoints()<0) {
390
+ return $this->__('Buying');
391
+ }
392
+ elseif($movement->getRecordType()=='cart') {
393
+ return $this->__('Buying cancellation');
394
+ }
395
+ elseif($movement->getRecordType()=='admin' ) {
396
+ return $this->__('Manual changes');
397
+ }
398
+ elseif($movement->getRecordType()=='newsletter') {
399
+ return $this->__('Newsletter subscription');
400
+ }
401
+ elseif($movement->getRecordType()=='validity') {
402
+ return $this->__('Expiry');
403
+ }
404
+ elseif($movement->getRecordType()=='first' && $movement->getCustomerId()!=null) {
405
+ return $this->__('First order');
406
+ }
407
+ elseif($movement->getRecordType()=='first') {
408
+ return $this->__('Godchild first order');
409
+ }
410
+ elseif($movement->getRecordType()=='gift' && $movement->getPoints()<0) {
411
+ return $this->__('Gift exchange');
412
+ }
413
+ elseif($movement->getRecordType()=='gift') {
414
+ return $this->__('Gift exchange cancellation');
415
+ }
416
+ elseif($movement->getRecordType()=='cash' && $movement->getPoints()<0) {
417
+ return $this->__('Cash exchange');
418
+ }
419
+ elseif($movement->getRecordType()=='cash') {
420
+ return $this->__('Cash exchange cancellation');
421
+ }
422
+ elseif($movement->getRecordType()=='coupon_code' && $movement->getPoints()<0) {
423
+ return $this->__('Coupon exchange');
424
+ }
425
+ elseif($movement->getRecordType()=='coupon_code') {
426
+ return $this->__('Coupon exchange cancellation');
427
+ }
428
+ else {
429
+ return $this->__('Movement');
430
+ }
431
+ }
432
+
433
+ public function getInvits()
434
+ {
435
  $resource = Mage::getSingleton('core/resource');
436
  $read = $resource->getConnection('core_read');
437
+ $datetime = Mage::getModel('core/date')->gmtDate();
438
  $select = $read->select()
439
+ ->from(Array("s"=>$resource->getTableName('auguria_sponsorship/sponsorship')),
440
+ Array("*"=>"s.*"))
441
+ ->where('s.parent_id=?', $this->getUserId())
442
+ ->where('TO_DAYS("'.$datetime.'") - TO_DAYS(s.datetime) <= ?', Mage::getStoreConfig('auguria_sponsorship/invitation/sponsor_invitation_validity'))
443
+ ->where('s.child_mail NOT IN ?', new Zend_Db_Expr('(select ce.email from '.$resource->getTableName('customer_entity').' ce
444
+ LEFT JOIN '.$resource->getTableName('eav_attribute').' AS ea ON ce.entity_type_id = ea.entity_type_id AND ea.backend_type = "int" AND ea.attribute_code = "sponsor"
445
+ LEFT JOIN '.$resource->getTableName('customer_entity_int').' AS cev ON ce.entity_id = cev.entity_id AND ea.attribute_id = cev.attribute_id
446
+ WHERE cev.value IS NOT NULL
447
+ )'))
448
+ ->where('s.datetime = ?', new Zend_Db_Expr('(select max(sp.datetime) from '.$resource->getTableName('auguria_sponsorship/sponsorship').' sp where sp.parent_id=s.parent_id and sp.child_mail = s.child_mail)'));
449
+ return $read->fetchAll($select);
450
+ }
451
+
452
+ /**
453
+ *
454
+ * Check if customer navigator is ie8
455
+ * @return boolean
456
+ */
457
+ public function isIe8()
458
+ {
459
+ $match=preg_match('/MSIE ([0-9]\.[0-9])/',$_SERVER['HTTP_USER_AGENT'],$reg);
460
+ if ($match!=0 && floatval($reg[1]) == 8)
461
+ {
462
+ return true;
463
+ }
464
+ else
465
+ {
466
+ return false;
467
+ }
468
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
  }
app/code/community/Auguria/Sponsorship/Block/Customer/Form/Boost.php CHANGED
@@ -17,7 +17,7 @@ class Auguria_Sponsorship_Block_Customer_Form_Boost extends Mage_Customer_Block_
17
  $param = $this->getRequest()->get("sponsorship_id");
18
  if ( $param )
19
  {
20
- $invit = mage::getModel("sponsorship/sponsorship")->load($param);
21
  if ($invit->getParentId() == Mage::getSingleton('customer/session')->getId())
22
  {
23
  return $invit;
17
  $param = $this->getRequest()->get("sponsorship_id");
18
  if ( $param )
19
  {
20
+ $invit = mage::getModel("auguria_sponsorship/sponsorship")->load($param);
21
  if ($invit->getParentId() == Mage::getSingleton('customer/session')->getId())
22
  {
23
  return $invit;
app/code/community/Auguria/Sponsorship/Block/Customer/Form/PointsChange.php CHANGED
@@ -42,9 +42,16 @@ class Auguria_Sponsorship_Block_Customer_Form_PointsChange extends Mage_Customer
42
  return $cSP;
43
  }
44
 
 
 
 
 
 
 
 
45
  public function getPointsToCashConfig ($Module)
46
  {
47
- $options = Mage::getBlockSingleton('sponsorship/customer_account_pointsDetail');
48
  $PointsToCashFunction = 'get'.$Module.'PointsToCashConfig';
49
  $PointsToCash = $options->$PointsToCashFunction();
50
  return $PointsToCash;
42
  return $cSP;
43
  }
44
 
45
+ public function getAccumulatedPoints()
46
+ {
47
+ $customer = Mage::getModel("customer/customer")->load($this->getCustomerId());
48
+ $cSP = $customer->getData('accumulated_points');
49
+ return $cSP;
50
+ }
51
+
52
  public function getPointsToCashConfig ($Module)
53
  {
54
+ $options = Mage::getBlockSingleton('auguria_sponsorship/customer_account_pointsDetail');
55
  $PointsToCashFunction = 'get'.$Module.'PointsToCashConfig';
56
  $PointsToCash = $options->$PointsToCashFunction();
57
  return $PointsToCash;
app/code/community/Auguria/Sponsorship/Block/Customer/Widget/Name.php CHANGED
@@ -12,7 +12,7 @@ class Auguria_Sponsorship_Block_Customer_Widget_Name extends Mage_Customer_Block
12
  Mage_Customer_Block_Widget_Abstract::_construct();
13
 
14
  // default template location
15
- $this->setTemplate('sponsorship/customer/widget/name.phtml');
16
  }
17
 
18
  public function getInvit ($param)
12
  Mage_Customer_Block_Widget_Abstract::_construct();
13
 
14
  // default template location
15
+ $this->setTemplate('auguria/sponsorship/customer/widget/name.phtml');
16
  }
17
 
18
  public function getInvit ($param)
app/code/community/Auguria/Sponsorship/Block/Customer/Widget/Virement.php CHANGED
@@ -10,14 +10,12 @@ class Auguria_Sponsorship_Block_Customer_Widget_Virement extends Mage_Customer_B
10
  public function _construct()
11
  {
12
  parent::_construct();
13
- $this->setTemplate('sponsorship/customer/widget/virement.phtml');
14
  }
15
 
16
  public function isEnabled()
17
- {
18
- //Ajouter si module parrainage actif
19
-
20
- //iban et siret actifs si le client est parrain
21
  $customer = Mage::getModel('customer/customer')
22
  ->getCollection()
23
  ->addAttributeToFilter('sponsor', $this->getCustomer()->getId());
@@ -28,13 +26,7 @@ class Auguria_Sponsorship_Block_Customer_Widget_Virement extends Mage_Customer_B
28
  return false;
29
  }
30
  }
31
-
32
- /*
33
- public function isRequired()
34
- {
35
- return 'req' == $this->getConfig('taxvat_show');
36
- }
37
- */
38
  public function getCustomer()
39
  {
40
  return Mage::getSingleton('customer/session')->getCustomer();
10
  public function _construct()
11
  {
12
  parent::_construct();
13
+ $this->setTemplate('auguria/sponsorship/customer/widget/virement.phtml');
14
  }
15
 
16
  public function isEnabled()
17
+ {
18
+ //iban et siret actifs si le client est parrain ou qu'il a des points de fidélité
 
 
19
  $customer = Mage::getModel('customer/customer')
20
  ->getCollection()
21
  ->addAttributeToFilter('sponsor', $this->getCustomer()->getId());
26
  return false;
27
  }
28
  }
29
+
 
 
 
 
 
 
30
  public function getCustomer()
31
  {
32
  return Mage::getSingleton('customer/session')->getCustomer();
app/code/community/Auguria/Sponsorship/Block/Sales/Order/Totals.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Block_Sales_Order_Totals extends Mage_Sales_Block_Order_Totals
9
+ {
10
+ protected function _initTotals()
11
+ {
12
+ parent::_initTotals();
13
+ $source = $this->getSource();
14
+ if (((float)$this->getSource()->getAuguriaSponsorshipDiscountAmount()) != 0) {
15
+ $auguriaSponsorshipDiscountTotal = new Varien_Object(array(
16
+ 'code' => 'auguria_sponsorship_discount',
17
+ 'value'=> $source->getAuguriaSponsorshipDiscountAmount(),
18
+ 'label'=> Mage::helper('auguria_sponsorship')->__('Sponsorship and fidelity discount')
19
+ ));
20
+ $this->addTotal($auguriaSponsorshipDiscountTotal);
21
+ }
22
+ return $this;
23
+ }
24
+ }
app/code/community/Auguria/Sponsorship/Block/Sponsorship.php CHANGED
@@ -23,7 +23,7 @@ class Auguria_Sponsorship_Block_Sponsorship extends Mage_Core_Block_Template
23
 
24
  public function getMaxRecipients()
25
  {
26
- return Mage::getStoreConfig('sponsorship/invitation/max_recipients');
27
  }
28
 
29
  public function getUserName()
@@ -72,7 +72,7 @@ class Auguria_Sponsorship_Block_Sponsorship extends Mage_Core_Block_Template
72
  if (isset($form['message']['subject']))
73
  return $form['message']['subject'];
74
  else
75
- return Mage::helper('sponsorship/mail')->getSubject();
76
  }
77
 
78
  public function getBodyMessage()
@@ -84,12 +84,12 @@ class Auguria_Sponsorship_Block_Sponsorship extends Mage_Core_Block_Template
84
  if (isset($form['message']['body']))
85
  return $form['message']['body'];
86
  else
87
- return Mage::helper('sponsorship/mail')->getMessage();
88
  }
89
 
90
  public function getFooterMessage()
91
  {
92
- return Mage::helper('sponsorship/mail')->getFooterMessage ($this->getCustomerId());
93
  }
94
 
95
  public function getBackUrl()
@@ -100,7 +100,7 @@ class Auguria_Sponsorship_Block_Sponsorship extends Mage_Core_Block_Template
100
 
101
  public function getActiveProviders()
102
  {
103
- $providers = Mage::getResourceModel('sponsorship/sponsorshipopeninviter_collection')
104
  ->addFieldToFilter('status', 1)
105
  ;
106
  return $providers->getItems();
23
 
24
  public function getMaxRecipients()
25
  {
26
+ return Mage::getStoreConfig('auguria_sponsorship/invitation/max_recipients');
27
  }
28
 
29
  public function getUserName()
72
  if (isset($form['message']['subject']))
73
  return $form['message']['subject'];
74
  else
75
+ return Mage::helper('auguria_sponsorship/mail')->getSubject();
76
  }
77
 
78
  public function getBodyMessage()
84
  if (isset($form['message']['body']))
85
  return $form['message']['body'];
86
  else
87
+ return Mage::helper('auguria_sponsorship/mail')->getMessage();
88
  }
89
 
90
  public function getFooterMessage()
91
  {
92
+ return Mage::helper('auguria_sponsorship/mail')->getFooterMessage ($this->getCustomerId());
93
  }
94
 
95
  public function getBackUrl()
100
 
101
  public function getActiveProviders()
102
  {
103
+ $providers = Mage::getResourceModel('auguria_sponsorship/sponsorshipopeninviter_collection')
104
  ->addFieldToFilter('status', 1)
105
  ;
106
  return $providers->getItems();
app/code/community/Auguria/Sponsorship/Helper/Config.php ADDED
@@ -0,0 +1,420 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Helper_Config extends Mage_Core_Helper_Abstract
9
+ {
10
+ /**
11
+ * Get module mode from config
12
+ * @return string
13
+ */
14
+ public function getModuleMode()
15
+ {
16
+ return Mage::getStoreConfig('auguria_sponsorship/general/module_mode');
17
+ }
18
+
19
+ public function getPointsTypes()
20
+ {
21
+ $types = Array();
22
+ $mode = $this->getModuleMode();
23
+ if ($this->isAccumulatedEnabled()) {
24
+ $types[] = 'accumulated';
25
+ }
26
+ if($this->isFidelityEnabled()) {
27
+ $types[] = 'fidelity';
28
+ }
29
+ if($this->isSponsorshipEnabled()) {
30
+ $types[] = 'sponsor';
31
+ }
32
+ return $types;
33
+ }
34
+
35
+ /**
36
+ * Check if fidelity mode is activated (accumulated not included)
37
+ * @return boolean
38
+ */
39
+ public function isFidelityEnabled()
40
+ {
41
+ $mode = $this->getModuleMode();
42
+ if($mode=='fidelity'
43
+ || $mode=='separated') {
44
+ return true;
45
+ }
46
+ return false;
47
+ }
48
+
49
+ /**
50
+ * Check if sponsorship mode is activated (accumulated not included)
51
+ * @return boolean
52
+ */
53
+ public function isSponsorshipEnabled()
54
+ {
55
+ $mode = $this->getModuleMode();
56
+ if($mode=='sponsorship'
57
+ || $mode=='separated') {
58
+ return true;
59
+ }
60
+ return false;
61
+ }
62
+
63
+ /**
64
+ * Check if accumulated mode is activated
65
+ * @return boolean
66
+ */
67
+ public function isAccumulatedEnabled()
68
+ {
69
+ $mode = $this->getModuleMode();
70
+ if($mode=='accumulated') {
71
+ return true;
72
+ }
73
+ return false;
74
+ }
75
+
76
+ /**
77
+ * Get points validity from configuration depending on mode
78
+ * @param string $mode
79
+ * @return int
80
+ */
81
+ public function getPointsValidity($mode=null)
82
+ {
83
+ $config = Array();
84
+ if ($mode==null) {
85
+ $mode = $this->getModuleMode();
86
+ }
87
+
88
+ if ($mode=='accumulated') {
89
+ $config['accumulated'] = Mage::getStoreConfig('auguria_sponsorship/accumulated/points_validity');
90
+ }
91
+ else {
92
+ if($mode=='separated'
93
+ || $mode=='fidelity') {
94
+ $config['fidelity'] = Mage::getStoreConfig('auguria_sponsorship/fidelity/points_validity');
95
+ }
96
+ if($mode=='separated'
97
+ || $mode=='sponsorship') {
98
+ $config['sponsorship'] = Mage::getStoreConfig('auguria_sponsorship/sponsor/points_validity');
99
+ }
100
+ }
101
+ return $config;
102
+ }
103
+
104
+ public function getFidelityPointsValidity($mode=null)
105
+ {
106
+ if ($mode==null) {
107
+ $mode = $this->getModuleMode();
108
+ }
109
+
110
+ if ($mode=='accumulated') {
111
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/points_validity');
112
+ }
113
+ elseif ($mode=='separated'
114
+ || $mode=='fidelity') {
115
+ return Mage::getStoreConfig('auguria_sponsorship/fidelity/points_validity');
116
+ }
117
+ return 0;
118
+ }
119
+
120
+ public function getSponsorshipPointsValidity($mode=null)
121
+ {
122
+ if ($mode==null) {
123
+ $mode = $this->getModuleMode();
124
+ }
125
+
126
+ if ($mode=='accumulated') {
127
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/points_validity');
128
+ }
129
+ elseif ($mode=='separated'
130
+ || $mode=='sponsorship') {
131
+ return Mage::getStoreConfig('auguria_sponsorship/sponsor/points_validity');
132
+ }
133
+ return 0;
134
+ }
135
+
136
+
137
+ /**
138
+ * Get points to cash value from configuration depending on mode
139
+ * @param string $mode
140
+ * @return float
141
+ */
142
+ public function getPointsToCash($mode=null)
143
+ {
144
+ $config = Array();
145
+ if ($mode==null) {
146
+ $mode = $this->getModuleMode();
147
+ }
148
+ if ($mode=='accumulated') {
149
+ $config['accumulated'] = Mage::getStoreConfig('auguria_sponsorship/accumulated/points_to_cash');
150
+ }
151
+ else {
152
+ if($mode=='separated'
153
+ || $mode=='fidelity') {
154
+ $config['fidelity'] = Mage::getStoreConfig('auguria_sponsorship/fidelity/fidelity_points_to_cash');
155
+ }
156
+ if($mode=='separated'
157
+ || $mode=='sponsorship') {
158
+ $config['sponsorship'] = Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_points_to_cash');
159
+ }
160
+ }
161
+ return $config;
162
+ }
163
+
164
+ /**
165
+ * Check if cart exchange is activated depending on module mode
166
+ * @param string $mode
167
+ * @return boolean
168
+ */
169
+ public function getCartExchangeActivated($mode=null)
170
+ {
171
+ $activated = Array();
172
+ if ($mode==null) {
173
+ $mode = $this->getModuleMode();
174
+ }
175
+ if ($mode=='accumulated') {
176
+ $activated['accumulated'] = Mage::getStoreConfig('auguria_sponsorship/accumulated/cart');
177
+ }
178
+ else {
179
+ if($mode=='separated'
180
+ || $mode=='fidelity') {
181
+ $activated['fidelity'] = Mage::getStoreConfig('auguria_sponsorship/fidelity/fidelity_cart');
182
+ }
183
+ if($mode=='separated'
184
+ || $mode=='sponsorship') {
185
+ $activated['sponsorship'] = Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_cart');
186
+ }
187
+ }
188
+ return $activated;
189
+ }
190
+
191
+ /**
192
+ * Get sponsorship percent from configuration depending on module mode
193
+ * @param string $mode
194
+ * @return float
195
+ */
196
+ public function getSponsorPercent($mode=null)
197
+ {
198
+ if ($mode==null) {
199
+ $mode = $this->getModuleMode();
200
+ }
201
+
202
+ if ($mode=='accumulated') {
203
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/sponsor_percent');
204
+ }
205
+ elseif ($mode=='sponsorship'
206
+ || $mode=='separated') {
207
+ return Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_percent');
208
+ }
209
+ return 0;
210
+ }
211
+
212
+
213
+ /**
214
+ * Check if invit registred users is allowed
215
+ * @param string $mode
216
+ * @return boolean
217
+ */
218
+ public function isRegistredUsersInvitationAllowed($mode=null)
219
+ {
220
+ if ($mode==null) {
221
+ $mode = $this->getModuleMode();
222
+ }
223
+
224
+ if ($mode=='accumulated') {
225
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/allow_invit_registred_users');
226
+ }
227
+ elseif ($mode=='sponsorship'
228
+ || $mode=='separated') {
229
+ return Mage::getStoreConfig('auguria_sponsorship/sponsor/allow_invit_registred_users');
230
+ }
231
+ return 0;
232
+ }
233
+
234
+ /**
235
+ * Get points earned for subscription to the newsletter depending on module mode
236
+ * @param string $mode
237
+ * @return int
238
+ */
239
+ public function getFidelityNewsletterPoints($mode=null)
240
+ {
241
+ if ($mode==null) {
242
+ $mode = $this->getModuleMode();
243
+ }
244
+
245
+ if ($mode=='accumulated') {
246
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/newsletter_points');
247
+ }
248
+ elseif ($mode=='fidelity'
249
+ || $mode=='separated') {
250
+ return Mage::getStoreConfig('auguria_sponsorship/fidelity/newsletter_points');
251
+ }
252
+ return 0;
253
+ }
254
+
255
+ /**
256
+ * Get points earned for first order depending on module mode
257
+ * @param string $mode
258
+ * @return int
259
+ */
260
+ public function getFidelityFirstOrderPoints($mode=null)
261
+ {
262
+ if ($mode==null) {
263
+ $mode = $this->getModuleMode();
264
+ }
265
+
266
+ if ($mode=='accumulated') {
267
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/first_order_points');
268
+ }
269
+ elseif ($mode=='fidelity'
270
+ || $mode=='separated') {
271
+ return Mage::getStoreConfig('auguria_sponsorship/fidelity/first_order_points');
272
+ }
273
+ return 0;
274
+ }
275
+
276
+ /**
277
+ * Get points earned for first order depending on module mode
278
+ * @param string $mode
279
+ * @return int
280
+ */
281
+ public function getGodsonFirstOrderPoints($mode=null)
282
+ {
283
+ if ($mode==null) {
284
+ $mode = $this->getModuleMode();
285
+ }
286
+
287
+ if ($mode=='accumulated') {
288
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/godson_first_order_points');
289
+ }
290
+ elseif ($mode=='fidelity'
291
+ || $mode=='separated') {
292
+ return Mage::getStoreConfig('auguria_sponsorship/sponsor/godson_first_order_points');
293
+ }
294
+ return 0;
295
+ }
296
+
297
+
298
+ /**
299
+ * Get sponsorship max levels from configuration depending on module mode
300
+ * @param string $mode
301
+ * @return float
302
+ */
303
+ public function getSponsorLevels($mode=null)
304
+ {
305
+ if ($mode==null) {
306
+ $mode = $this->getModuleMode();
307
+ }
308
+
309
+ if ($mode=='accumulated') {
310
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/sponsor_levels');
311
+ }
312
+ elseif ($mode=='sponsorship'
313
+ || $mode=='separated') {
314
+ return Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_levels');
315
+ }
316
+ return 0;
317
+ }
318
+
319
+ /**
320
+ * Check if sponsorship notification is enabled depending on module mode
321
+ * @param string $mode
322
+ * @return boolean
323
+ */
324
+ public function isSponsorshipNotificationEnabled($mode=null)
325
+ {
326
+ if ($mode==null) {
327
+ $mode = $this->getModuleMode();
328
+ }
329
+
330
+ if ($mode=='accumulated') {
331
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/notification_enabled');
332
+ }
333
+ elseif ($mode=='sponsorship'
334
+ || $mode=='separated') {
335
+ return Mage::getStoreConfig('auguria_sponsorship/sponsor/notification_enabled');
336
+ }
337
+ return false;
338
+ }
339
+
340
+ /**
341
+ * Check if sponsorship notification is enabled depending on module mode
342
+ * @param string $mode
343
+ * @return boolean
344
+ */
345
+ public function getSponsorshipNotificationTemplate($mode=null)
346
+ {
347
+ if ($mode==null) {
348
+ $mode = $this->getModuleMode();
349
+ }
350
+
351
+ if ($mode=='accumulated') {
352
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/notification');
353
+ }
354
+ elseif ($mode=='sponsorship'
355
+ || $mode=='separated') {
356
+ return Mage::getStoreConfig('auguria_sponsorship/sponsor/notification');
357
+ }
358
+ return false;
359
+ }
360
+
361
+ /**
362
+ * Get sponsorship invitation validity depending on module mode
363
+ * @param string $mode
364
+ * @return float
365
+ */
366
+ public function getInvitationValidity()
367
+ {
368
+
369
+ return Mage::getStoreConfig('auguria_sponsorship/invitation/sponsor_invitation_validity');
370
+ }
371
+
372
+ public function cancelFidelityEarnedPointsOnCreditMemo($mode=null)
373
+ {
374
+ if ($mode==null) {
375
+ $mode = $this->getModuleMode();
376
+ }
377
+
378
+ if ($mode=='accumulated') {
379
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/cancel_earned_points');
380
+ }
381
+ elseif ($mode=='fidelity'
382
+ || $mode=='separated') {
383
+ return Mage::getStoreConfig('auguria_sponsorship/fidelity/cancel_earned_points');
384
+ }
385
+ return false;
386
+
387
+ }
388
+
389
+ public function cancelSponsorshipEarnedPointsOnCreditMemo($mode=null)
390
+ {
391
+ if ($mode==null) {
392
+ $mode = $this->getModuleMode();
393
+ }
394
+
395
+ if ($mode=='accumulated') {
396
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/cancel_earned_points');
397
+ }
398
+ elseif ($mode=='sponsorship'
399
+ || $mode=='separated') {
400
+ return Mage::getStoreConfig('auguria_sponsorship/sponsor/cancel_earned_points');
401
+ }
402
+ return false;
403
+
404
+ }
405
+
406
+ public function cancelUsedPointsOnCreditMemo($type)
407
+ {
408
+ if ($type=='accumulated') {
409
+ return Mage::getStoreConfig('auguria_sponsorship/accumulated/cancel_cart_points');
410
+ }
411
+ elseif ($type=='sponsorship') {
412
+ return Mage::getStoreConfig('auguria_sponsorship/sponsor/cancel_cart_points');
413
+ }
414
+ elseif ($type=='fidelity') {
415
+ return Mage::getStoreConfig('auguria_sponsorship/fidelity/cancel_cart_points');
416
+ }
417
+ return false;
418
+
419
+ }
420
+ }
app/code/community/Auguria/Sponsorship/Helper/Data.php CHANGED
@@ -7,23 +7,27 @@
7
  */
8
  class Auguria_Sponsorship_Helper_Data extends Mage_Core_Helper_Abstract
9
  {
10
- /*
11
- public function versionIsgreaterThanOneThree()
12
- {
13
- $currentVersion = Mage::getVersion();
14
- if (version_compare($currentVersion, '1.4.0')>=0)
15
- return true;
16
- else
17
- return false;
18
- }
19
- */
20
-
21
- public function haveOrder ()
 
 
22
  {
23
- $cId = Mage::getSingleton('customer/session')->getCustomerId();
 
 
24
  $commande = Mage::getModel("sales/order")
25
  ->getCollection()
26
- ->addAttributeToFilter('customer_id',$cId);
27
  if ($commande->getData()) {
28
  return true;
29
  }
@@ -37,9 +41,9 @@ class Auguria_Sponsorship_Helper_Data extends Mage_Core_Helper_Abstract
37
  {
38
  $idParrain = '';
39
  $cookie = new Mage_Core_Model_Cookie;
40
- $sponsorInvitationValidity = Mage::getStoreConfig('sponsorship/sponsor/sponsor_invitation_validity');
41
  //recherche du mail dans les logs actifs
42
- $parrainageLog = Mage::getModel("sponsorship/sponsorship")
43
  ->getCollection()
44
  ->addAttributeToFilter('child_mail', $emailCustomer)
45
  ->addDateToFilter('datetime', $sponsorInvitationValidity)
@@ -64,4 +68,287 @@ class Auguria_Sponsorship_Helper_Data extends Mage_Core_Helper_Abstract
64
  }
65
  return $idParrain;
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  }
7
  */
8
  class Auguria_Sponsorship_Helper_Data extends Mage_Core_Helper_Abstract
9
  {
10
+ public function isASponsor($customerId = null)
11
+ {
12
+ if ($customerId == null) {
13
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
14
+ }
15
+ $godchildren = Mage::getResourceModel('customer/customer_collection')
16
+ ->addAttributeToFilter('sponsor', $customerId);
17
+ if ($godchildren->count()>0) {
18
+ return true;
19
+ }
20
+ return false;
21
+ }
22
+
23
+ public function haveOrder ($customerId = null)
24
  {
25
+ if ($customerId == null) {
26
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
27
+ }
28
  $commande = Mage::getModel("sales/order")
29
  ->getCollection()
30
+ ->addAttributeToFilter('customer_id',$customerId);
31
  if ($commande->getData()) {
32
  return true;
33
  }
41
  {
42
  $idParrain = '';
43
  $cookie = new Mage_Core_Model_Cookie;
44
+ $sponsorInvitationValidity = Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_invitation_validity');
45
  //recherche du mail dans les logs actifs
46
+ $parrainageLog = Mage::getModel("auguria_sponsorship/sponsorship")
47
  ->getCollection()
48
  ->addAttributeToFilter('child_mail', $emailCustomer)
49
  ->addDateToFilter('datetime', $sponsorInvitationValidity)
68
  }
69
  return $idParrain;
70
  }
71
+
72
+ /**
73
+ * Check SIRET format
74
+ * @string $siret
75
+ * @return boolean
76
+ */
77
+ public function isSiret ($siret)
78
+ {
79
+ $siret = str_replace ( ' ', '', $siret );
80
+ if (strlen ( $siret ) != 14 || !is_numeric ( $siret )) {
81
+ return false;
82
+ }
83
+ $siren = substr ( $siret, 0, 9 );
84
+ if (! $this->isSiren ( $siren )) {
85
+ return false;
86
+ }
87
+ $total = 0;
88
+ for($i = 0; $i < 14; $i++) {
89
+ $temp = substr ( $siret, $i, 1 );
90
+ if ($i % 2 == 0) {
91
+ $temp *= 2;
92
+ if ($temp > 9) {
93
+ $temp -= 9;
94
+ }
95
+ }
96
+ $total += $temp;
97
+ }
98
+ return (($total % 10) == 0);
99
+ }
100
+
101
+ /**
102
+ * Check SIREN format
103
+ * @param string $siren
104
+ * @return boolean
105
+ */
106
+ public function isSiren($siren)
107
+ {
108
+ $siren = str_replace ( ' ', '', $siren );
109
+ if (strlen ( $siren ) != 9 || !is_numeric ( $siren )) {
110
+ return false;
111
+ }
112
+ $total = 0;
113
+ for($i = 0; $i < 9; $i++) {
114
+ $temp = substr ( $siren, $i, 1 );
115
+ if ($i % 2 == 1) {
116
+ $temp *= 2;
117
+ if ($temp > 9) {
118
+ $temp -= 9;
119
+ }
120
+ }
121
+ $total += $temp;
122
+ }
123
+ return (($total % 10) == 0);
124
+ }
125
+
126
+ public function getPoints($customer=null)
127
+ {
128
+ if($customer==null){
129
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
130
+ }
131
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
132
+ $points = Array();
133
+
134
+ if ($mode=='accumulated') {
135
+ $points['accumulated'] = (float)$customer->getAccumulatedPoints();
136
+ }
137
+ else {
138
+ if($mode=='separated'
139
+ || $mode=='fidelity') {
140
+ $points['fidelity'] = (float)$customer->getFidelityPoints();
141
+ }
142
+ if($mode=='separated'
143
+ || $mode=='sponsorship') {
144
+ $points['sponsorship'] = (float)$customer->getSponsorPoints();
145
+ }
146
+ }
147
+ return $points;
148
+ }
149
+
150
+ public function getFidelityPoints($customer=null)
151
+ {
152
+ if($customer==null){
153
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
154
+ }
155
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
156
+ $points = 0;
157
+
158
+ if ($mode=='accumulated') {
159
+ $points = (float)$customer->getAccumulatedPoints();
160
+ }
161
+ elseif($mode=='separated'
162
+ || $mode=='fidelity') {
163
+ $points = (float)$customer->getFidelityPoints();
164
+ }
165
+ return $points;
166
+ }
167
+
168
+ public function getSponsorshipPoints($customer=null)
169
+ {
170
+ if($customer==null){
171
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
172
+ }
173
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
174
+ $points = 0;
175
+
176
+ if ($mode=='accumulated') {
177
+ $points = (float)$customer->getAccumulatedPoints();
178
+ }
179
+ elseif($mode=='separated'
180
+ || $mode=='sponsorship') {
181
+ $points = (float)$customer->getSponsorPoints();
182
+ }
183
+ return $points;
184
+ }
185
+
186
+ public function setFidelityPoints($customer=null, $points=0)
187
+ {
188
+ if($customer==null){
189
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
190
+ }
191
+
192
+ if (Mage::helper('auguria_sponsorship/config')->isAccumulatedEnabled()) {
193
+ $pointsType = 'accumulated_points';
194
+ }
195
+ else {
196
+ $pointsType = 'fidelity_points';
197
+ }
198
+
199
+ $customer->setData($pointsType, $points);
200
+
201
+ return $customer;
202
+ }
203
+
204
+ public function setSponsorshipPoints($customer=null, $points=0)
205
+ {
206
+ if($customer==null){
207
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
208
+ }
209
+
210
+ if (Mage::helper('auguria_sponsorship/config')->isAccumulatedEnabled()) {
211
+ $pointsType = 'accumulated_points';
212
+ }
213
+ else {
214
+ $pointsType = 'sponsor_points';
215
+ }
216
+
217
+ $customer->setData($pointsType, $points);
218
+
219
+ return $customer;
220
+ }
221
+
222
+ public function setSponsorshipValidity($customer=null)
223
+ {
224
+ if($customer==null){
225
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
226
+ }
227
+ if (Mage::helper('auguria_sponsorship/config')->isAccumulatedEnabled()) {
228
+ $validityType = 'points_validity';
229
+ }
230
+ else {
231
+ $validityType = 'sponsor_points_validity';
232
+ }
233
+ $validity = $this->getPointsValidity('sponsorship');
234
+ if(isset($validity['sponsorship'])) {
235
+ $customer->setData($validityType,$validity['sponsorship']);
236
+ }
237
+
238
+ return $customer;
239
+ }
240
+
241
+ public function setFidelityValidity($customer=null)
242
+ {
243
+ if($customer==null){
244
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
245
+ }
246
+ if (Mage::helper('auguria_sponsorship/config')->isAccumulatedEnabled()) {
247
+ $validityType = 'points_validity';
248
+ }
249
+ else {
250
+ $validityType = 'fidelity_points_validity';
251
+ }
252
+ $validity = $this->getPointsValidity('fidelity');
253
+ if(isset($validity['fidelity'])) {
254
+ $customer->setData($validityType,$validity['fidelity']);
255
+ }
256
+
257
+ return $customer;
258
+ }
259
+
260
+ public function addFidelityPoints($customer=null, $points=0)
261
+ {
262
+ if($customer==null){
263
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
264
+ }
265
+ $originalPoints = $this->getFidelityPoints($customer);
266
+
267
+ $this->setFidelityPoints($customer, (float)$originalPoints+(float)$points);
268
+ $this->setFidelityValidity($customer);
269
+
270
+ return $customer;
271
+ }
272
+
273
+ public function addSponsorshipPoints($customer=null, $points=0)
274
+ {
275
+ if($customer==null){
276
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
277
+ }
278
+ $originalPoints = $this->getSponsorshipPoints($customer);
279
+
280
+ $this->setSponsorshipPoints($customer, (float)$originalPoints+(float)$points);
281
+ $this->setSponsorshipValidity($customer);
282
+
283
+ return $customer;
284
+ }
285
+
286
+ public function getPointsValidity($type=null)
287
+ {
288
+ $validity = Array();
289
+ $dateValidity = Array();
290
+
291
+ if ($type==null) {
292
+ $validity['fidelity'] = Mage::helper('auguria_sponsorship/config')->getFidelityPointsValidity();
293
+ $validity['sponsorship'] = Mage::helper('auguria_sponsorship/config')->getSponsorshipPointsValidity();
294
+ }
295
+ elseif($type=='fidelity') {
296
+ $validity['fidelity'] = Mage::helper('auguria_sponsorship/config')->getFidelityPointsValidity();
297
+ }
298
+ elseif($type=='sponsorship') {
299
+ $validity['sponsorship'] = Mage::helper('auguria_sponsorship/config')->getSponsorshipPointsValidity();
300
+ }
301
+
302
+ if (count($validity)>0) {
303
+ foreach ($validity as $type=>$day) {
304
+ if ($day>0) {
305
+ $date = new Zend_Date();
306
+ $date->addDay($day);
307
+ $dateValidity[$type] = $date->toString(Zend_Date::ISO_8601);
308
+ }
309
+ }
310
+ }
311
+ return $dateValidity;
312
+ }
313
+
314
+ public function getCash($customer=null)
315
+ {
316
+ if($customer==null){
317
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
318
+ }
319
+ $points = $this->getPoints($customer);
320
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
321
+ $pointsToCash = Mage::helper('auguria_sponsorship/config')->getPointsToCash($mode);
322
+ $cash = Array();
323
+ if ($mode=='accumulated') {
324
+ $cash['accumulated'] = (float)$pointsToCash['accumulated']*((float)$customer->getAccumulatedPoints());
325
+ }
326
+ else {
327
+ if($mode=='separated'
328
+ || $mode=='fidelity') {
329
+ $cash['fidelity'] = (float)$pointsToCash['fidelity']*(float)$customer->getFidelityPoints();
330
+ }
331
+ if($mode=='separated'
332
+ || $mode=='sponsorship') {
333
+ $cash['sponsorship'] = (float)$pointsToCash['sponsorship']*(float)$customer->getSponsorPoints();
334
+ }
335
+ }
336
+ return $cash;
337
+ }
338
+
339
+ /**
340
+ * Get sponsor id from customer id
341
+ * @param integer $cId
342
+ */
343
+ public function getSponsorId($cId)
344
+ {
345
+ $customer = Mage::getModel('customer/customer')->load($cId);
346
+ $sponsorId = $customer->getSponsor();
347
+ if ($sponsorId != null && $sponsorId != 0) {
348
+ return $sponsorId;
349
+ }
350
+ else {
351
+ return false;
352
+ }
353
+ }
354
  }
app/code/community/Auguria/Sponsorship/Helper/Mail.php CHANGED
@@ -57,17 +57,29 @@ class Auguria_Sponsorship_Helper_Mail extends Mage_Core_Helper_Abstract
57
 
58
  public function recipientMailIsCustomer($mail)
59
  {
 
60
  $customer = mage::getModel("customer/customer")
61
  ->getCollection()
62
  ->addAttributeToFilter("email",$mail);
63
  if (count($customer)==1)
64
  {
65
- return true;
66
- }
67
- else
68
- {
69
- return false;
 
 
 
 
 
 
 
 
 
 
70
  }
 
71
  }
72
 
73
  public function processMail($post)
@@ -195,13 +207,13 @@ class Auguria_Sponsorship_Helper_Mail extends Mage_Core_Helper_Abstract
195
  //si sponsorship_id est envoyé : c'est un update
196
  if (isset ($mail['sponsorship_id']))
197
  {
198
- $invit = mage::getModel("sponsorship/sponsorship")->load($mail["sponsorship_id"]);
199
  $data = $invit->getData();
200
  $data["datetime_boost"] = $mail['datetime_boost'];
201
  }
202
  else
203
  {
204
- $invit = mage::getModel("sponsorship/sponsorship");
205
  $data["datetime"] = $mail['datetime'];
206
  }
207
  $data["parent_id"] = $mail["sender_id"];
@@ -236,7 +248,7 @@ class Auguria_Sponsorship_Helper_Mail extends Mage_Core_Helper_Abstract
236
  $recipient_email = $mail["recipient_email"];
237
  $recipient = $mail["recipient_firstname"]." ".$mail["recipient_lastname"];
238
 
239
- $mailTemplate = Mage::getModel('sponsorship/Core_Email_Template');
240
 
241
  $postObject = new Varien_Object();
242
  $postObject->setData(Array ("sender_name" => $sender_name,
@@ -254,7 +266,7 @@ class Auguria_Sponsorship_Helper_Mail extends Mage_Core_Helper_Abstract
254
  ->setReplyTo($sender_email)
255
  ->setReturnPath($sender_email)
256
  ->sendTransactional(
257
- Mage::getStoreConfig('sponsorship/invitation/template'),
258
  $sender,
259
  $recipient_email,
260
  $recipient,
57
 
58
  public function recipientMailIsCustomer($mail)
59
  {
60
+ //check if email is registred
61
  $customer = mage::getModel("customer/customer")
62
  ->getCollection()
63
  ->addAttributeToFilter("email",$mail);
64
  if (count($customer)==1)
65
  {
66
+ //check if recipient is already a sponsor
67
+ //check if we can invit registred user
68
+ if (Mage::getStoreConfig('auguria_sponsorship/sponsor/allow_invit_registred_users')) {
69
+ //check if registred user has already ordered
70
+ if (Mage::helper('auguria_sponsorship')->haveOrder($customer->getFirstItem()->getId())) {
71
+ return true;
72
+ }
73
+ //check if registred user has godchild
74
+ elseif(Mage::helper('auguria_sponsorship')->isASponsor($customer->getFirstItem()->getId())) {
75
+ return true;
76
+ }
77
+ }
78
+ else {
79
+ return true;
80
+ }
81
  }
82
+ return false;
83
  }
84
 
85
  public function processMail($post)
207
  //si sponsorship_id est envoyé : c'est un update
208
  if (isset ($mail['sponsorship_id']))
209
  {
210
+ $invit = mage::getModel("auguria_sponsorship/sponsorship")->load($mail["sponsorship_id"]);
211
  $data = $invit->getData();
212
  $data["datetime_boost"] = $mail['datetime_boost'];
213
  }
214
  else
215
  {
216
+ $invit = mage::getModel("auguria_sponsorship/sponsorship");
217
  $data["datetime"] = $mail['datetime'];
218
  }
219
  $data["parent_id"] = $mail["sender_id"];
248
  $recipient_email = $mail["recipient_email"];
249
  $recipient = $mail["recipient_firstname"]." ".$mail["recipient_lastname"];
250
 
251
+ $mailTemplate = Mage::getModel('auguria_sponsorship/Core_Email_Template');
252
 
253
  $postObject = new Varien_Object();
254
  $postObject->setData(Array ("sender_name" => $sender_name,
266
  ->setReplyTo($sender_email)
267
  ->setReturnPath($sender_email)
268
  ->sendTransactional(
269
+ Mage::getStoreConfig('auguria_sponsorship/invitation/template'),
270
  $sender,
271
  $recipient_email,
272
  $recipient,
app/code/community/Auguria/Sponsorship/Model/Adminhtml/System/Config/Backend/Sponsorship/Entier.php CHANGED
@@ -11,14 +11,14 @@ class Auguria_Sponsorship_Model_Adminhtml_System_Config_Backend_Sponsorship_Enti
11
  {
12
  $value = $this->getValue();
13
  if (!Zend_Validate::is($value, 'NotEmpty')) {
14
- Mage::throwException(Mage::helper('sponsorship')->__("A value is required."));
15
  }
16
  if (!Zend_Validate::is($value, 'Digits')) {
17
- Mage::throwException(Mage::helper('sponsorship')->__("'%s' is not an integer.", $value));
18
  }
19
  $validator = new Zend_Validate_GreaterThan(0);
20
  if (!$validator->isValid($value)) {
21
- Mage::throwException(Mage::helper('sponsorship')->__("'%s' is not greater than 0.", $value));
22
  }
23
  return $this;
24
  }
11
  {
12
  $value = $this->getValue();
13
  if (!Zend_Validate::is($value, 'NotEmpty')) {
14
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__("A value is required."));
15
  }
16
  if (!Zend_Validate::is($value, 'Digits')) {
17
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__("'%s' is not an integer.", $value));
18
  }
19
  $validator = new Zend_Validate_GreaterThan(0);
20
  if (!$validator->isValid($value)) {
21
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__("'%s' is not greater than 0.", $value));
22
  }
23
  return $this;
24
  }
app/code/community/Auguria/Sponsorship/Model/Adminhtml/System/Config/Backend/Sponsorship/Float.php CHANGED
@@ -11,15 +11,15 @@ class Auguria_Sponsorship_Model_Adminhtml_System_Config_Backend_Sponsorship_Floa
11
  {
12
  $value = $this->getValue();
13
  if (!Zend_Validate::is($value, 'NotEmpty')) {
14
- Mage::throwException(Mage::helper('sponsorship')->__("A value is required."));
15
  }
16
  $validator = new Zend_Validate_Regex('/^[-+]?[0-9]*\.?[0-9]{0,4}$/');
17
  if (!$validator->isValid($value)) {
18
- Mage::throwException(Mage::helper('sponsorship')->__("'%s' is not a valid number.", $value));
19
  }
20
  $validator = new Zend_Validate_GreaterThan(0);
21
  if (!$validator->isValid($value)) {
22
- Mage::throwException(Mage::helper('sponsorship')->__("'%s' is not greater than 0.", $value));
23
  }
24
  return $this;
25
  }
11
  {
12
  $value = $this->getValue();
13
  if (!Zend_Validate::is($value, 'NotEmpty')) {
14
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__("A value is required."));
15
  }
16
  $validator = new Zend_Validate_Regex('/^[-+]?[0-9]*\.?[0-9]{0,4}$/');
17
  if (!$validator->isValid($value)) {
18
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__("'%s' is not a valid number.", $value));
19
  }
20
  $validator = new Zend_Validate_GreaterThan(0);
21
  if (!$validator->isValid($value)) {
22
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__("'%s' is not greater than 0.", $value));
23
  }
24
  return $this;
25
  }
app/code/community/Auguria/Sponsorship/Model/Adminhtml/System/Config/Backend/Sponsorship/Mode.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Model_Adminhtml_System_Config_Backend_Sponsorship_Mode extends Mage_Core_Model_Config_Data
9
+ {
10
+ protected function _afterSave()
11
+ {
12
+ $value = $this->getValue();
13
+ $config = Mage::getModel('core/config');
14
+ if ($value=='accumulated') {
15
+ $config->saveConfig('auguria_sponsorship/accumulated/accumulated_enabled', 1);
16
+ $config->saveConfig('auguria_sponsorship/fidelity/fidelity_enabled', 0);
17
+ $config->saveConfig('auguria_sponsorship/sponsor/sponsor_enabled', 0);
18
+ }
19
+ elseif ($value=='fidelity') {
20
+ $config->saveConfig('auguria_sponsorship/accumulated/accumulated_enabled', 0);
21
+ $config->saveConfig('auguria_sponsorship/fidelity/fidelity_enabled', 1);
22
+ $config->saveConfig('auguria_sponsorship/sponsor/sponsor_enabled', 0);
23
+ }
24
+ elseif ($value=='sponsorship') {
25
+ $config->saveConfig('auguria_sponsorship/accumulated/accumulated_enabled', 0);
26
+ $config->saveConfig('auguria_sponsorship/fidelity/fidelity_enabled', 0);
27
+ $config->saveConfig('auguria_sponsorship/sponsor/sponsor_enabled', 1);
28
+ }
29
+ elseif ($value=='separated') {
30
+ $config->saveConfig('auguria_sponsorship/accumulated/accumulated_enabled', 0);
31
+ $config->saveConfig('auguria_sponsorship/fidelity/fidelity_enabled', 1);
32
+ $config->saveConfig('auguria_sponsorship/sponsor/sponsor_enabled', 1);
33
+ }
34
+ return $this;
35
+ }
36
+ }
app/code/community/Auguria/Sponsorship/Model/Adminhtml/System/Config/Backend/Sponsorship/NaturalNumber.php CHANGED
@@ -11,14 +11,14 @@ class Auguria_Sponsorship_Model_Adminhtml_System_Config_Backend_Sponsorship_Natu
11
  {
12
  $value = $this->getValue();
13
  if (!Zend_Validate::is($value, 'NotEmpty')) {
14
- Mage::throwException(Mage::helper('sponsorship')->__("A value is required."));
15
  }
16
  if (!Zend_Validate::is($value, 'Digits')) {
17
- Mage::throwException(Mage::helper('sponsorship')->__("'%s' is not a natural number.", $value));
18
  }
19
  $validator = new Zend_Validate_GreaterThan(-1);
20
  if (!$validator->isValid($value)) {
21
- Mage::throwException(Mage::helper('sponsorship')->__("'%s' is not a natural number.", $value));
22
  }
23
  return $this;
24
  }
11
  {
12
  $value = $this->getValue();
13
  if (!Zend_Validate::is($value, 'NotEmpty')) {
14
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__("A value is required."));
15
  }
16
  if (!Zend_Validate::is($value, 'Digits')) {
17
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__("'%s' is not a natural number.", $value));
18
  }
19
  $validator = new Zend_Validate_GreaterThan(-1);
20
  if (!$validator->isValid($value)) {
21
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__("'%s' is not a natural number.", $value));
22
  }
23
  return $this;
24
  }
app/code/community/Auguria/Sponsorship/Model/Adminhtml/System/Config/Source/Mode.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Model_Adminhtml_System_Config_Source_Mode
9
+ {
10
+
11
+ /**
12
+ * Options getter
13
+ *
14
+ * @return array
15
+ */
16
+ public function toOptionArray()
17
+ {
18
+ return array(
19
+ array('value' => 'fidelity', 'label'=>Mage::helper('auguria_sponsorship')->__('Fidelity')),
20
+ array('value' => 'sponsorship', 'label'=>Mage::helper('auguria_sponsorship')->__('Sponsorship')),
21
+ array('value' => 'separated', 'label'=>Mage::helper('auguria_sponsorship')->__('Fidelity and Sponsorship (separated)')),
22
+ array('value' => 'accumulated', 'label'=>Mage::helper('auguria_sponsorship')->__('Fidelity and Sponsorship (accumulated)')),
23
+ );
24
+ }
25
+
26
+ }
app/code/community/Auguria/Sponsorship/Model/ApplyValidity.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Model_ApplyValidity
9
+ {
10
+ public function process ()
11
+ {
12
+ $pointsTypes = Mage::helper('auguria_sponsorship/config')->getPointsTypes();
13
+ if (count($pointsTypes)>0) {
14
+
15
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
16
+ $validity = Mage::helper('auguria_sponsorship/config')->getPointsValidity();
17
+ $date = new Zend_Date();
18
+ $datetime = Mage::getModel('core/date')->gmtDate();
19
+ $date->subDay(1);
20
+ $tomorrow = $date->toString('YYYY-MM-dd');
21
+
22
+ foreach ($pointsTypes as $type) {
23
+ $pointsValidity = '';
24
+ $validityLabel = '';
25
+ if ($type=='accumulated') {
26
+ $validityLabel = 'points_validity';
27
+ $pointsValidity = $validity['accumulated'];
28
+ }
29
+ elseif($type=='sponsor') {
30
+ $validityLabel = 'sponsorship_points_validity';
31
+ $pointsValidity = $validity['sponsorship'];
32
+ }
33
+ elseif($type=='fidelity') {
34
+ $validityLabel = 'fidelity_points_validity';
35
+ $pointsValidity = $validity['fidelity'];
36
+ }
37
+ else {
38
+ continue;
39
+ }
40
+
41
+ if ($pointsValidity > 0) {
42
+ //select users with points and outdated validity
43
+ $customers = Mage::getResourceModel('customer/customer_collection')
44
+ ->addAttributeToFilter($type.'_points', array('gt' => 0))
45
+ ->addAttributeToFilter($validityLabel, array('to' => $tomorrow));
46
+
47
+ if ($customers->count() > 0) {
48
+ foreach ($customers as $customer) {
49
+ $points = $customer->getData($type.'_points');
50
+ $customer->setData($type.'_points', 0);
51
+ $customer->save();
52
+ //insert in log and change
53
+ $log = Mage::getModel('auguria_sponsorship/log');
54
+ $data = array(
55
+ 'customer_id' => $customer->getId(),
56
+ 'record_type' => 'validity',
57
+ 'datetime' => $datetime,
58
+ 'points' => -$points
59
+ );
60
+ $log->setData($data);
61
+ $log->save();
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
app/code/community/Auguria/Sponsorship/Model/AutoBoost.php CHANGED
@@ -15,17 +15,18 @@ class Auguria_Sponsorship_Model_AutoBoost
15
  */
16
  $resource = Mage::getSingleton('core/resource');
17
  $read = $resource->getConnection('core_read');
 
18
  $select = $read->select()
19
- ->from(Array("s"=>$resource->getTableName('sponsorship/sponsorship')),
20
  Array("*"=>"s.*"))
21
  ->where('isnull(datetime_boost)')
22
- ->where('TO_DAYS(NOW()) - TO_DAYS(datetime) >= ?', Mage::getStoreConfig('sponsorship/invitation/time_before_boost'))
23
- ->where('TO_DAYS(NOW()) - TO_DAYS(datetime) <= ?', Mage::getStoreConfig('sponsorship/invitation/sponsor_invitation_validity'));
24
 
25
  $resultats = $read->fetchAll($select);
26
  foreach ($resultats as $resultat)
27
  {
28
- $mailHelper = mage::helper("sponsorship/mail");
29
  $mail["sponsorship_id"] = $resultat["sponsorship_id"];
30
  $mail["subject"] = $resultat["subject"];
31
  $mail["html_message"] = $resultat["message"];
@@ -42,20 +43,20 @@ class Auguria_Sponsorship_Model_AutoBoost
42
  $mail["recipient_email"] = $resultat["child_mail"];
43
  $mail["recipient_firstname"] = $resultat["child_firstname"];
44
  $mail["recipient_lastname"] = $resultat["child_lastname"];
45
- $mail['datetime_boost'] = now();
46
 
47
  if ($mailHelper->sendMail($mail))
48
  {
49
  try
50
  {
51
- $sponsorship = mage::getModel("sponsorship/sponsorship")->load($mail["sponsorship_id"]);
52
  $sponsorship->setDatetimeBoost($mail['datetime_boost']);
53
  $sponsorship->save();
54
- mage::log("1 mail sent by autoboost");
55
  }
56
  catch (Exception $e)
57
  {
58
- mage::log($e);
59
  }
60
  }
61
  }
15
  */
16
  $resource = Mage::getSingleton('core/resource');
17
  $read = $resource->getConnection('core_read');
18
+ $datetime = Mage::getModel('core/date')->gmtDate();
19
  $select = $read->select()
20
+ ->from(Array("s"=>$resource->getTableName('auguria_sponsorship/sponsorship')),
21
  Array("*"=>"s.*"))
22
  ->where('isnull(datetime_boost)')
23
+ ->where('TO_DAYS("'.$datetime.'") - TO_DAYS(datetime) >= ?', Mage::getStoreConfig('auguria_sponsorship/invitation/time_before_boost'))
24
+ ->where('TO_DAYS("'.$datetime.'") - TO_DAYS(datetime) <= ?', Mage::getStoreConfig('auguria_sponsorship/invitation/sponsor_invitation_validity'));
25
 
26
  $resultats = $read->fetchAll($select);
27
  foreach ($resultats as $resultat)
28
  {
29
+ $mailHelper = Mage::helper("auguria_sponsorship/mail");
30
  $mail["sponsorship_id"] = $resultat["sponsorship_id"];
31
  $mail["subject"] = $resultat["subject"];
32
  $mail["html_message"] = $resultat["message"];
43
  $mail["recipient_email"] = $resultat["child_mail"];
44
  $mail["recipient_firstname"] = $resultat["child_firstname"];
45
  $mail["recipient_lastname"] = $resultat["child_lastname"];
46
+ $mail['datetime_boost'] = Mage::getModel('core/date')->gmtDate();
47
 
48
  if ($mailHelper->sendMail($mail))
49
  {
50
  try
51
  {
52
+ $sponsorship = Mage::getModel("auguria_sponsorship/sponsorship")->load($mail["sponsorship_id"]);
53
  $sponsorship->setDatetimeBoost($mail['datetime_boost']);
54
  $sponsorship->save();
55
+ Mage::log(Mage::helper('auguria_sponsorship')->__("An email has been sent by autoboost"));
56
  }
57
  catch (Exception $e)
58
  {
59
+ Mage::log(Mage::helper('auguria_sponsorship')->__("An error occured wile sending auto boost email %s",$e));
60
  }
61
  }
62
  }
app/code/community/Auguria/Sponsorship/Model/Change.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Change extends Mage_Core_Model_Abstract
10
  public function _construct()
11
  {
12
  parent::_construct();
13
- $this->_init('sponsorship/change');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  parent::_construct();
13
+ $this->_init('auguria_sponsorship/change');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Changestatut.php CHANGED
@@ -15,10 +15,10 @@ class Auguria_Sponsorship_Model_Changestatut extends Varien_Object
15
  static public function getOptionArray()
16
  {
17
  return array(
18
- self::STATUS_WAITING => Mage::helper('sponsorship')->__('Waiting'),
19
- self::STATUS_EXPORTED => Mage::helper('sponsorship')->__('Exported'),
20
- self::STATUS_SOLVED => Mage::helper('sponsorship')->__('Solved'),
21
- self::STATUS_CANCELED => Mage::helper('sponsorship')->__('Canceled')
22
  );
23
  }
24
  }
15
  static public function getOptionArray()
16
  {
17
  return array(
18
+ self::STATUS_WAITING => Mage::helper('auguria_sponsorship')->__('Waiting'),
19
+ self::STATUS_EXPORTED => Mage::helper('auguria_sponsorship')->__('Exported'),
20
+ self::STATUS_SOLVED => Mage::helper('auguria_sponsorship')->__('Solved'),
21
+ self::STATUS_CANCELED => Mage::helper('auguria_sponsorship')->__('Canceled')
22
  );
23
  }
24
  }
app/code/community/Auguria/Sponsorship/Model/Customer/Customer.php DELETED
@@ -1,112 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Auguria_Sponsorship_Model_Customer_Customer extends Mage_Customer_Model_Customer
9
- {
10
- public function validate()
11
- {
12
- $errors = array();
13
- if (Zend_Validate::is( trim($this->getIban()) , 'NotEmpty'))
14
- if (!Zend_Validate::is( trim($this->getIban()) , 'Iban')) {
15
- $errors[] = Mage::helper('sponsorship')->__('Invalid IBAN code "%s"', $this->getIban());
16
- }
17
- /*
18
- * Vérification du SIRET désactivé pour internationalisation
19
- if ($siret = $this->getSiret()) {
20
- if (!$this->isSiret(trim($siret))) {
21
- $errors[] = Mage::helper('customer')->__('Invalid SIRET code');
22
- }
23
- }
24
- *
25
- */
26
-
27
- if (!Zend_Validate::is( trim($this->getFirstname()) , 'NotEmpty')) {
28
- $errors[] = Mage::helper('customer')->__('First name can\'t be empty');
29
- }
30
-
31
- if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) {
32
- $errors[] = Mage::helper('customer')->__('Last name can\'t be empty');
33
- }
34
-
35
- if (!Zend_Validate::is($this->getEmail(), 'EmailAddress')) {
36
- $errors[] = Mage::helper('customer')->__('Invalid email address "%s"', $this->getEmail());
37
- }
38
-
39
- $password = $this->getPassword();
40
- if (!$this->getId() && !Zend_Validate::is($password , 'NotEmpty')) {
41
- $errors[] = Mage::helper('customer')->__('Password can\'t be empty');
42
- }
43
- if ($password && !Zend_Validate::is($password, 'StringLength', array(6))) {
44
- $errors[] = Mage::helper('customer')->__('Password minimal length must be more %s', 6);
45
- }
46
- $confirmation = $this->getConfirmation();
47
- if ($password != $confirmation) {
48
- $errors[] = Mage::helper('customer')->__('Please make sure your passwords match.');
49
- }
50
-
51
- if (('req' === Mage::helper('customer/address')->getConfig('dob_show'))
52
- && '' == trim($this->getDob())) {
53
- $errors[] = Mage::helper('customer')->__('Date of Birth is required.');
54
- }
55
- if (('req' === Mage::helper('customer/address')->getConfig('taxvat_show'))
56
- && '' == trim($this->getTaxvat())) {
57
- $errors[] = Mage::helper('customer')->__('TAX/VAT number is required.');
58
- }
59
-
60
- if (empty($errors)) {
61
- return true;
62
- }
63
- return $errors;
64
- }
65
- /*
66
- * Vérification du SIRET désactivé pour internationalisation
67
- public function isSiret ($siret)
68
- {
69
- $siret = str_replace ( ' ', '', $siret );
70
- if (strlen ( $siret ) != 14 || !is_numeric ( $siret )) {
71
- return false;
72
- }
73
- $siren = substr ( $siret, 0, 9 );
74
- if (! $this->isSiren ( $siren )) {
75
- return false;
76
- }
77
- $total = 0;
78
- for($i = 0; $i < 14; $i++) {
79
- $temp = substr ( $siret, $i, 1 );
80
- if ($i % 2 == 0) {
81
- $temp *= 2;
82
- if ($temp > 9) {
83
- $temp -= 9;
84
- }
85
- }
86
- $total += $temp;
87
- }
88
- return (($total % 10) == 0);
89
- }
90
-
91
- function isSiren($siren)
92
- {
93
- $siren = str_replace ( ' ', '', $siren );
94
- if (strlen ( $siren ) != 9 || !is_numeric ( $siren )) {
95
- return false;
96
- }
97
- $total = 0;
98
- for($i = 0; $i < 9; $i++) {
99
- $temp = substr ( $siren, $i, 1 );
100
- if ($i % 2 == 1) {
101
- $temp *= 2;
102
- if ($temp > 9) {
103
- $temp -= 9;
104
- }
105
- }
106
- $total += $temp;
107
- }
108
- return (($total % 10) == 0);
109
- }
110
- *
111
- */
112
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/Model/Eav/Entity/Setup.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Model_Eav_Entity_Setup extends Mage_Eav_Model_Entity_Setup
9
+ {
10
+ public function hasSponsorshipInstall()
11
+ {
12
+ if ($this->tableExists($this->getTable('sponsorship'))) {
13
+ $columns = $this->getConnection()->fetchCol("SHOW COLUMNS FROM `{$this->getTable('sponsorship')}`;");
14
+ if (in_array('sponsorship_id', $columns)
15
+ && in_array('parent_id', $columns)
16
+ && in_array('child_mail', $columns)
17
+ && in_array('child_firstname', $columns)
18
+ && in_array('child_lastname', $columns)) {
19
+ $this->setConfigData('auguria_sponsorship/has_old_revision', true);
20
+ }
21
+ }
22
+ $hasOldRevision = $this->getConnection()->fetchOne("SELECT `value` FROM `{$this->getTable('core_config_data')}` WHERE `path` = 'auguria_sponsorship/has_old_revision';");
23
+ if ($hasOldRevision == 1) {
24
+ $oldVersion = $this->getConnection()->fetchOne("SELECT `data_version` FROM `{$this->getTable('core_resource')}` WHERE `code` = 'sponsorship_setup';");
25
+ $newVersion = $this->getConnection()->fetchOne("SELECT `version` FROM `{$this->getTable('core_resource')}` WHERE `code` = 'auguria_sponsorship_setup';");
26
+ if (version_compare($oldVersion, $newVersion) > 0) {
27
+ return true;
28
+ }
29
+ }
30
+ return false;
31
+ }
32
+ }
app/code/community/Auguria/Sponsorship/Model/{Sponsorlog.php → Log.php} RENAMED
@@ -5,11 +5,11 @@
5
  * @author Auguria
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
- class Auguria_Sponsorship_Model_SponsorLog extends Mage_Core_Model_Abstract
9
  {
10
  public function _construct()
11
  {
12
  parent::_construct();
13
- $this->_init('sponsorship/sponsorlog');
14
  }
15
  }
5
  * @author Auguria
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
+ class Auguria_Sponsorship_Model_Log extends Mage_Core_Model_Abstract
9
  {
10
  public function _construct()
11
  {
12
  parent::_construct();
13
+ $this->_init('auguria_sponsorship/log');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Mysql4/CatalogFidelityPoint.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Mysql4_CatalogFidelityPoint extends Mage_Core_Mo
10
  public function _construct()
11
  {
12
  // Note that the sponsorship_id refers to the key field in your database table.
13
- $this->_init('sponsorship/catalogfidelitypoint', 'rule_product_fidelity_point_id');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  // Note that the sponsorship_id refers to the key field in your database table.
13
+ $this->_init('auguria_sponsorship/catalogfidelitypoint', 'rule_product_fidelity_point_id');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Mysql4/CatalogFidelityPoint/Collection.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Mysql4_CatalogFidelityPoint_Collection extends M
10
  public function _construct()
11
  {
12
  parent::_construct();
13
- $this->_init('sponsorship/catalogfidelitypoint');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  parent::_construct();
13
+ $this->_init('auguria_sponsorship/catalogfidelitypoint');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Mysql4/CatalogSponsorPoint.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Mysql4_CatalogSponsorPoint extends Mage_Core_Mod
10
  public function _construct()
11
  {
12
  // Note that the sponsorship_id refers to the key field in your database table.
13
- $this->_init('sponsorship/catalogsponsorpoint', 'rule_product_sponsor_point_id');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  // Note that the sponsorship_id refers to the key field in your database table.
13
+ $this->_init('auguria_sponsorship/catalogsponsorpoint', 'rule_product_sponsor_point_id');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Mysql4/CatalogSponsorPoint/Collection.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Mysql4_CatalogSponsorPoint_Collection extends Ma
10
  public function _construct()
11
  {
12
  parent::_construct();
13
- $this->_init('sponsorship/catalogsponsorpoint');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  parent::_construct();
13
+ $this->_init('auguria_sponsorship/catalogsponsorpoint');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Mysql4/Change.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Mysql4_Change extends Mage_Core_Model_Mysql4_Abs
10
  public function _construct()
11
  {
12
  // Note that the sponsorship_id refers to the key field in your database table.
13
- $this->_init('sponsorship/change', 'sponsorship_change_id');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  // Note that the sponsorship_id refers to the key field in your database table.
13
+ $this->_init('auguria_sponsorship/change', 'sponsorship_change_id');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Mysql4/Change/Collection.php CHANGED
@@ -10,7 +10,7 @@ class Auguria_Sponsorship_Model_Mysql4_Change_Collection extends Mage_Core_Model
10
  public function _construct()
11
  {
12
  parent::_construct();
13
- $this->_init('sponsorship/change');
14
  }
15
 
16
  public function addAttributeToFilter($nameField, $value)
10
  public function _construct()
11
  {
12
  parent::_construct();
13
+ $this->_init('auguria_sponsorship/change');
14
  }
15
 
16
  public function addAttributeToFilter($nameField, $value)
app/code/community/Auguria/Sponsorship/Model/Mysql4/FidelityLog/Collection.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Auguria_Sponsorship_Model_Mysql4_FidelityLog_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
9
- {
10
- public function _construct()
11
- {
12
- parent::_construct();
13
- $this->_init('sponsorship/fidelitylog');
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/Model/Mysql4/Fidelitylog.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Auguria_Sponsorship_Model_Mysql4_FidelityLog extends Mage_Core_Model_Mysql4_Abstract
9
- {
10
- public function _construct()
11
- {
12
- // Note that the sponsorship_id refers to the key field in your database table.
13
- $this->_init('sponsorship/fidelitylog', 'sponsorship_fidelity_log_id');
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/Model/Mysql4/{Sponsorlog/Collection.php → Log.php} RENAMED
@@ -1,15 +1,14 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Auguria_Sponsorship_Model_Mysql4_SponsorLog_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
9
- {
10
- public function _construct()
11
- {
12
- parent::_construct();
13
- $this->_init('sponsorship/sponsorlog');
14
- }
15
  }
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Model_Mysql4_Log extends Mage_Core_Model_Mysql4_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ $this->_init('auguria_sponsorship/log', 'sponsorship_log_id');
13
+ }
 
14
  }
app/code/community/Auguria/Sponsorship/Model/{Fidelitylog.php → Mysql4/Log/Collection.php} RENAMED
@@ -1,15 +1,15 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Auguria_Sponsorship_Model_FidelityLog extends Mage_Core_Model_Abstract
9
- {
10
- public function _construct()
11
- {
12
- parent::_construct();
13
- $this->_init('sponsorship/fidelitylog');
14
- }
15
  }
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Model_Mysql4_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
9
+ {
10
+ public function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->_init('auguria_sponsorship/log');
14
+ }
15
  }
app/code/community/Auguria/Sponsorship/Model/Mysql4/Rule.php CHANGED
@@ -64,6 +64,7 @@ class Auguria_Sponsorship_Model_Mysql4_Rule extends Mage_CatalogRule_Model_Mysql
64
  );
65
 
66
  $dayPrices = array();
 
67
  $dayFidelityPoints = array();
68
  $daySponsorPoints = array();
69
  $stopFlags = array();
@@ -314,7 +315,7 @@ class Auguria_Sponsorship_Model_Mysql4_Rule extends Mage_CatalogRule_Model_Mysql
314
  if (empty($arrData)) {
315
  return $this;
316
  }
317
- $header = 'replace into '.$this->getTable('sponsorship/catalog'.$type.'point').' (
318
  rule_date,
319
  website_id,
320
  customer_group_id,
@@ -363,24 +364,25 @@ class Auguria_Sponsorship_Model_Mysql4_Rule extends Mage_CatalogRule_Model_Mysql
363
  $write->delete($this->getTable('catalogrule/rule_product_price'), $conds);
364
 
365
  $selectFidelityPoint = $this->_getWriteAdapter()->select()
366
- ->from($this->getTable('sponsorship/catalogfidelitypoint'), 'product_id')
367
  ->where(implode(' AND ', $conds));
368
  $insertQuery = 'REPLACE INTO ' . $this->getTable('catalogrule/affected_product') . ' (product_id)' .$selectFidelityPoint->__toString();
369
  $this->_getWriteAdapter()->query($insertQuery);
370
- $write->delete($this->getTable('sponsorship/catalogfidelitypoint'), $conds);
371
 
372
  $selectSponsorPoint = $this->_getWriteAdapter()->select()
373
- ->from($this->getTable('sponsorship/catalogsponsorpoint'), 'product_id')
374
  ->where(implode(' AND ', $conds));
375
  $insertQuery = 'REPLACE INTO ' . $this->getTable('catalogrule/affected_product') . ' (product_id)' .$selectSponsorPoint->__toString();
376
  $this->_getWriteAdapter()->query($insertQuery);
377
- $write->delete($this->getTable('sponsorship/catalogsponsorpoint'), $conds);
378
 
379
  return $this;
380
  }
381
 
382
  public function deleteOldData($date, $productId=null)
383
  {
 
384
  $write = $this->_getWriteAdapter();
385
  $conds = array();
386
  $conds[] = $write->quoteInto('rule_date<?', $this->formatDate($date));
@@ -388,7 +390,7 @@ class Auguria_Sponsorship_Model_Mysql4_Rule extends Mage_CatalogRule_Model_Mysql
388
  $conds[] = $write->quoteInto('product_id=?', $productId);
389
  }
390
  $write->delete($this->getTable('catalogrule/rule_product_price'), $conds);
391
- $write->delete($this->getTable('sponsorship/catalogfidelitypoint'), $conds);
392
  return $this;
393
  }
394
  }
64
  );
65
 
66
  $dayPrices = array();
67
+
68
  $dayFidelityPoints = array();
69
  $daySponsorPoints = array();
70
  $stopFlags = array();
315
  if (empty($arrData)) {
316
  return $this;
317
  }
318
+ $header = 'replace into '.$this->getTable('auguria_sponsorship/catalog'.$type.'point').' (
319
  rule_date,
320
  website_id,
321
  customer_group_id,
364
  $write->delete($this->getTable('catalogrule/rule_product_price'), $conds);
365
 
366
  $selectFidelityPoint = $this->_getWriteAdapter()->select()
367
+ ->from($this->getTable('auguria_sponsorship/catalogfidelitypoint'), 'product_id')
368
  ->where(implode(' AND ', $conds));
369
  $insertQuery = 'REPLACE INTO ' . $this->getTable('catalogrule/affected_product') . ' (product_id)' .$selectFidelityPoint->__toString();
370
  $this->_getWriteAdapter()->query($insertQuery);
371
+ $write->delete($this->getTable('auguria_sponsorship/catalogfidelitypoint'), $conds);
372
 
373
  $selectSponsorPoint = $this->_getWriteAdapter()->select()
374
+ ->from($this->getTable('auguria_sponsorship/catalogsponsorpoint'), 'product_id')
375
  ->where(implode(' AND ', $conds));
376
  $insertQuery = 'REPLACE INTO ' . $this->getTable('catalogrule/affected_product') . ' (product_id)' .$selectSponsorPoint->__toString();
377
  $this->_getWriteAdapter()->query($insertQuery);
378
+ $write->delete($this->getTable('auguria_sponsorship/catalogsponsorpoint'), $conds);
379
 
380
  return $this;
381
  }
382
 
383
  public function deleteOldData($date, $productId=null)
384
  {
385
+ /*@TODO add sponsorship/catalogsponsopoint delete ?*/
386
  $write = $this->_getWriteAdapter();
387
  $conds = array();
388
  $conds[] = $write->quoteInto('rule_date<?', $this->formatDate($date));
390
  $conds[] = $write->quoteInto('product_id=?', $productId);
391
  }
392
  $write->delete($this->getTable('catalogrule/rule_product_price'), $conds);
393
+ $write->delete($this->getTable('auguria_sponsorship/catalogfidelitypoint'), $conds);
394
  return $this;
395
  }
396
  }
app/code/community/Auguria/Sponsorship/Model/Mysql4/Sponsorlog.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Auguria_Sponsorship_Model_Mysql4_SponsorLog extends Mage_Core_Model_Mysql4_Abstract
9
- {
10
- public function _construct()
11
- {
12
- // Note that the sponsorship_id refers to the key field in your database table.
13
- $this->_init('sponsorship/sponsorlog', 'sponsorship_sponsor_log_id');
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/Model/Mysql4/Sponsorship.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Mysql4_Sponsorship extends Mage_Core_Model_Mysql
10
  public function _construct()
11
  {
12
  // Note that the sponsorship_id refers to the key field in your database table.
13
- $this->_init('sponsorship/sponsorship', 'sponsorship_id');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  // Note that the sponsorship_id refers to the key field in your database table.
13
+ $this->_init('auguria_sponsorship/sponsorship', 'sponsorship_id');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Mysql4/Sponsorship/Collection.php CHANGED
@@ -10,7 +10,7 @@ class Auguria_Sponsorship_Model_Mysql4_Sponsorship_Collection extends Mage_Core_
10
  public function _construct()
11
  {
12
  parent::_construct();
13
- $this->_init('sponsorship/sponsorship');
14
  }
15
 
16
  public function addAttributeToFilter($nameField, $value)
10
  public function _construct()
11
  {
12
  parent::_construct();
13
+ $this->_init('auguria_sponsorship/sponsorship');
14
  }
15
 
16
  public function addAttributeToFilter($nameField, $value)
app/code/community/Auguria/Sponsorship/Model/Mysql4/Sponsorshipopeninviter.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Mysql4_Sponsorshipopeninviter extends Mage_Core_
10
  public function _construct()
11
  {
12
  // Note that the sponsorship_openinviter_id refers to the key field in your database table.
13
- $this->_init('sponsorship/sponsorshipopeninviter', 'sponsorship_openinviter_id');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  // Note that the sponsorship_openinviter_id refers to the key field in your database table.
13
+ $this->_init('auguria_sponsorship/sponsorshipopeninviter', 'sponsorship_openinviter_id');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Mysql4/Sponsorshipopeninviter/Collection.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Mysql4_Sponsorshipopeninviter_Collection extends
10
  public function _construct()
11
  {
12
  parent::_construct();
13
- $this->_init('sponsorship/sponsorshipopeninviter');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  parent::_construct();
13
+ $this->_init('auguria_sponsorship/sponsorshipopeninviter');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Observer.php CHANGED
@@ -6,137 +6,147 @@
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
  class Auguria_Sponsorship_Model_Observer
9
- {
 
 
 
 
10
  public function calcPoints($observer)
11
  {
 
 
 
12
  try {
13
- //récupération de la commande et des articles
14
- $order = $observer->getInvoice()->getOrder();
15
- $orderDate = $order->getUpdatedAt();
16
- $orderId = $order->getEntityId();
17
-
18
- //définition du client
19
- $cId = $order->getCustomerId();
20
-
21
- //definition du websiteid
22
- $wId = $order->getStore()->getWebsiteId();
23
-
24
- //definition du groupe du client
25
- $gId = Mage::getModel('customer/customer')->load($cId)->getGroupId();
26
-
27
- //definition du sponsor de premier niveau
28
- $sponsorId = $this->getSponsorId($cId);
29
- $sponsor = Mage::getModel('customer/customer')->load($sponsorId);
30
- $special_rate = $sponsor->getData('special_rate');
31
-
32
- //variable de points
33
- $tCatalogFidelityPoints=0;
34
- $tCatalogSponsorPoints=0;
35
- $tCartFidelityPoints=0;
36
- $tCartSponsorPoints=0;
37
-
38
-
39
- //modules actifs
40
- $moduleFidelity = Mage::getStoreConfig('sponsorship/fidelity/fidelity_enabled');
41
- $moduleSponsor = Mage::getStoreConfig('sponsorship/sponsor/sponsor_enabled');
42
-
43
- //calcul des points catalogue et mise à jour de lacommande pour chaque ligne
44
- foreach ($order->getAllItems() as $item)
45
- {
46
- $date = $item->getData('updated_at');
47
- $pId = $item->getData('product_id');
48
- $qte = $item->getData('qty_ordered');
49
- $data = $item->getData();
50
-
51
- if ($moduleFidelity)
52
- {
53
- if ($item->getData('price') > 0) //vérification pour bundle : ne pas ajouter des points si le prix de l'article est 0 : idéalement, il faudrait revoir les règles de prix pour les articles packagés
54
- {
55
- //récupération et affectation des points catalog pour chaque article commandé
56
- $catalogFidelityPoints = $this->getRulePoints($date, $wId, $gId, $pId,'fidelity');
57
- //multiplication des points par la quantité
58
- $catalogFidelityPoints = $catalogFidelityPoints*$qte;
59
-
60
- //ajout des points aux items de commande
61
- $data['catalog_fidelity_points'] = $catalogFidelityPoints;
62
-
63
- //calcul du total de points catalogue
64
- $tCatalogFidelityPoints = $tCatalogFidelityPoints+$catalogFidelityPoints;
65
- }
66
-
67
- //calcul du total de points panier
68
- $tCartFidelityPoints = $tCartFidelityPoints+$item->getCartFidelityPoints();
69
- }
70
-
71
- if ($moduleSponsor && $special_rate==null)
72
  {
73
- if ($item->getData('price') > 0) //vérification pour bundle : ne pas ajouter des points si le prix de l'article est 0 : idéalement, il faudrait revoir les règles de prix pour les articles packagés
74
- {
75
- //récupération et affectation des points catalog pour chaque article commandé
76
- $catalogSponsorPoints = $this->getRulePoints($date, $wId, $gId, $pId, 'sponsor');
77
-
78
- //multiplication des points par la quantité
79
- $catalogSponsorPoints = $catalogSponsorPoints*$qte;
80
-
81
- //ajout des points aux items de commande
82
- $data['catalog_sponsor_points'] = $catalogSponsorPoints;
83
- //calcul du total de points catalogue
84
- $tCatalogSponsorPoints = $tCatalogSponsorPoints+$catalogSponsorPoints;
85
- }
86
-
87
- //calcul du total de points panier
88
- $tCartSponsorPoints = $tCartSponsorPoints+$item->getCartSponsorPoints();
89
- }
90
- //si un taux spécial est défini pour le parrain direct
91
- elseif ($moduleSponsor && $special_rate!=null)
92
- {
93
- //Redéfinition du taux à appliquer dans la commande
94
- if ($item->getData('price') > 0) //vérification pour bundle : ne pas ajouter des points si le prix de l'article est 0 : idéalement, il faudrait revoir les règles de prix pour les articles packagés
95
- {
96
- //ajout des points aux items de commande
97
- $data['catalog_sponsor_points'] = 0;
98
- $specialratepoints = $item->getData('price')*$qte*$special_rate/100;
99
- $data['cart_sponsor_points'] = $specialratepoints;
100
- }
101
-
102
- }
103
-
104
- if ($moduleFidelity||$moduleSponsor)
105
- {
106
- $item->setData($data);
107
- $item->save();
108
- }
109
- }
110
-
111
- $order->save();
112
-
113
- //Ajout du total des points fidelite
114
- if ($tCatalogFidelityPoints != 0 || $tCartFidelityPoints != 0 ) {
115
- $this->addFidelityPoints($cId,$tCatalogFidelityPoints+$tCartFidelityPoints,$orderDate,$orderId);
116
- }
117
-
118
- //Ajout du total des points de parrainage si le parrain n'a pas de taux spécial
119
- if (($tCatalogSponsorPoints != 0 || $tCartSponsorPoints != 0) && $special_rate==null) {
120
- $this->addSponsorsPoints($cId,$tCatalogSponsorPoints+$tCartSponsorPoints,$orderDate,$orderId);
121
- }
122
- //Ajout des points à partir du taxu spécial au parrain direct uniquement
123
- elseif ($special_rate!=null && $moduleSponsor) {
124
- $this->addSponsorSpecialPoints($cId,$orderDate,$orderId,$order->subtotal, $special_rate);
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  return $this;
127
  }
128
  catch (Exception $e) {
129
- Mage::log("An error occured while saving points :".$e->getMessage());
130
  }
131
  }
132
-
 
 
 
 
 
 
 
 
133
  public function getRulePoints($date, $wId, $gId, $pId, $type)
134
  {
135
  $resource = Mage::getSingleton('core/resource');
136
  $read= $resource->getConnection('core_read');
137
- $userTable = $resource->getTableName('sponsorship/catalog'.$type.'point');
138
  $select = $read->select()
139
- ->from($resource->getTableName('sponsorship/catalog'.$type.'point'), 'rule_point')
140
  ->where('rule_date=?', $this->formatDate($date))
141
  ->where('website_id=?', $wId)
142
  ->where('customer_group_id=?', $gId)
@@ -150,181 +160,215 @@ class Auguria_Sponsorship_Model_Observer
150
  return date('Y-m-d', $date);
151
  }
152
 
153
- public function addFidelityPoints($cId,$tFPoints,$orderDate,$orderId)
 
 
 
 
 
 
 
 
154
  {
155
- //récupération des points fidélité existants
156
- $customer = Mage::getModel('customer/customer')->load($cId);
157
- $iFPoints = $customer->getData('fidelity_points');
158
-
159
- //ajout des points fidélité
160
- $customer->setFidelityPoints($tFPoints+$iFPoints);
161
- $customer->save();
162
-
163
  //enregistrement dans les logs
164
- $log = Mage::getModel('sponsorship/fidelitylog');
165
  $data = array(
166
- 'customer_id' => $cId,
167
- 'record_id' => $orderId,
168
- 'record_type' => 'order',
169
- 'datetime' => $orderDate,
170
- 'points' => $tFPoints
171
  );
172
- $log->setData($data);
173
- $log->save();
174
  }
175
 
176
  /**
177
  * Add sponsor points to sponsors
 
 
 
 
 
 
178
  */
179
- public function addSponsorsPoints($cId,$SPoints,$orderDate,$orderId)
180
  {
181
- $ratio = Mage::getStoreConfig('sponsorship/sponsor/sponsor_percent');
182
- $maxLevel = Mage::getStoreConfig('sponsorship/sponsor/sponsor_levels');
183
- $sponsorId = $this->getSponsorId($cId);
184
- $godsonId = $cId;
185
 
186
  //Ajout des points tant que le niveau maximum n'est pas atteint et qu'un parrain est défini
187
- for ($level = 0; $level<$maxLevel AND $sponsorId!=null AND round($SPoints,4)>0; $level++)
188
  {
189
  //définition du parrain
190
- $sponsor = Mage::getModel('customer/customer')->load($sponsorId);
 
 
 
 
 
 
191
 
192
  //si parrain a un taux special : on met fin à la boucle
193
- $special_rate = $sponsor->getData('special_rate');
194
- if ($special_rate)
195
  $SPoints = 0;//mise à 0 des points de parrainage pour arrêter la boucle
196
-
197
- $iSPoints = $sponsor->getData('sponsor_points');
198
-
199
- //ajout des points fidélité au parrain
200
- //si il y a un taux special et qu'on est au premier niveau
201
- $pointsToAdd = 0;
202
- if ($special_rate && $level == 0)
203
- {
204
- $pointsToAdd = $specialSponsorPoints;
205
  }
206
- //si il n'y a pas de taux special
207
- elseif (!$special_rate)
208
- {
209
- $pointsToAdd = $SPoints;
210
- }
211
- $tSPoints = $pointsToAdd+$iSPoints;
212
-
213
- if (!$special_rate||($special_rate && $level == 0))
214
- {
215
- $sponsor->setSponsorPoints($tSPoints);
216
- $sponsor->save();
217
-
218
- //enregistrement dans les logs
219
- $log = Mage::getModel('sponsorship/sponsorlog');
220
  $data = array(
221
  'godson_id' => $godsonId,
222
  'sponsor_id' => $sponsorId,
223
- 'record_id' => $orderId,
224
- 'record_type' => 'order',
225
- 'datetime' => $orderDate,
226
- 'points' => $pointsToAdd
227
  );
228
- // affecter les attributs au nouveau produit
229
- $log->setData($data);
230
- // sauver le nouveau produit (insère en base de données)
231
- $log->save();
232
- }
233
- if (!$special_rate)
234
- {
235
- //incrémentation des points à ajouter
236
  $SPoints = ($SPoints*$ratio)/100;
237
  //le parrain devient le filleul
238
  $godsonId = $sponsorId;
239
  //définition du parrain du parrain
240
- $sponsorId = $this->getSponsorId($sponsorId);
241
  }
242
  }
243
  }
244
-
245
- public function getSponsorId($cId)
 
 
 
 
246
  {
247
- $customer = Mage::getModel('customer/customer')->load($cId);
248
- $sponsorId = $customer->getSponsor();
249
- if ($sponsorId != null && $sponsorId != 0)
250
  {
251
- return $sponsorId;
 
 
 
 
 
252
  }
253
- else {
254
- return false;
 
255
  }
256
  }
257
-
258
- public function setSponsor($observer)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  {
260
  //checkout_type_onepage_save_order_after
261
  $quote = $observer['quote'];
262
  $order = $observer['order'];
263
-
264
- //si c'est un enregistrement (nouveau client)
265
- if ($quote->getData('checkout_method')==Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER)
266
- {
267
- //recherche d'un parrain éventuel
268
- $customerId = $order->getCustomerId();
269
- if ($customerId != '')
270
- {
271
- $customer = mage::getModel("customer/customer")->load($customerId);
272
- $sponsorId = mage::helper("sponsorship/data")->searchSponsorId($customer->getEmail());
273
- if ($sponsorId != '')
274
- {
275
- $customer->setData('sponsor',$sponsorId);
276
- $cookie = new Mage_Core_Model_Cookie;
277
- if ($cookie->get('sponsorship_id'))
278
- {
279
- $cookie->delete('sponsorship_id');
280
- $cookie->delete('sponsorship_email');
281
- $cookie->delete('sponsorship_firstname');
282
- $cookie->delete('sponsorship_lastname');
283
- }
284
- $customer->save();
285
- }
286
- }
287
  }
288
  }
289
 
290
  /**
291
  * Add sponsor points for a sponsor with special rate
292
  */
293
- public function addSponsorSpecialPoints($cId, $orderDate, $orderId, $orderTotal, $special_rate)
294
  {
295
  //recalcul de la commande & maj items de la commande
296
- try {
297
- $sponsorId = $this->getSponsorId($cId);
298
- $godsonId = $cId;
299
- //définition du parrain
300
- $sponsor = Mage::getModel('customer/customer')->load($sponsorId);
301
- $iSPoints = $sponsor->getData('sponsor_points');
302
- $pointsToAdd = $orderTotal*$special_rate/100;
303
- $tSPoints = $pointsToAdd+$iSPoints;
304
- $sponsor->setSponsorPoints($tSPoints);
305
- $sponsor->save();
306
-
307
- //enregistrement dans les logs
308
- $log = Mage::getModel('sponsorship/sponsorlog');
309
- $data = array(
310
- 'godson_id' => $godsonId,
311
- 'sponsor_id' => $sponsorId,
312
- 'record_id' => $orderId,
313
- 'record_type' => 'order',
314
- 'datetime' => $orderDate,
315
- 'points' => $pointsToAdd
316
- );
317
- // affecter les attributs au nouveau produit
318
- $log->setData($data);
319
- // sauver le nouveau produit (insère en base de données)
320
- $log->save();
321
  }
322
  catch (Exception $e) {
323
- Mage::log("An error occured while saving special points :".$e->getMessage());
324
  }
325
 
326
  }
327
 
 
 
 
 
328
  public function affiliate($observer)
329
  {
330
  $controller = $observer['controller_action'];
@@ -348,10 +392,10 @@ class Auguria_Sponsorship_Model_Observer
348
  $session->setData('email',$email);
349
 
350
  //stockage de l'id du parrain dans un cookie
351
- $sponsorInvitationValidity = Mage::getStoreConfig('sponsorship/sponsor/sponsor_invitation_validity');
352
  $period =3600*24*$sponsorInvitationValidity;
353
 
354
- $cookie = new Mage_Core_Model_Cookie;
355
  $cookie->set('sponsorship_id', $sponsorId, $period);
356
  $cookie->set('sponsorship_firstname', $prenom, $period);
357
  $cookie->set('sponsorship_lastname', $nom, $period);
@@ -370,9 +414,9 @@ class Auguria_Sponsorship_Model_Observer
370
  {
371
  try
372
  {
373
- $newsletterPoints = Mage::getStoreConfig('sponsorship/fidelity/newsletter_points');
374
  //Check if we must add points
375
- if (isset($newsletterPoints) && $newsletterPoints > 0)
376
  {
377
  //Check if it's an account creation
378
  $customer = $observer->getCustomer();
@@ -381,21 +425,14 @@ class Auguria_Sponsorship_Model_Observer
381
  //Check if he is subscribing to the newsletter
382
  if ($customer->getIsSubscribed() == 1)
383
  {
384
- $fidelityPoints = 0;
385
- $originalFidelityPoints = $customer->getFidelityPoints();
386
- if (isset($originalFidelityPoints))
387
- {
388
- $fidelityPoints = $originalFidelityPoints;
389
- }
390
- $fidelityPoints = $fidelityPoints + $newsletterPoints;
391
- $customer->setFidelityPoints($fidelityPoints);
392
  }
393
  }
394
  }
395
  }
396
  catch (Exception $e)
397
  {
398
- Mage::log("An error occured while adding news letter points :".$e->getMessage());
399
  }
400
  }
401
 
@@ -408,8 +445,8 @@ class Auguria_Sponsorship_Model_Observer
408
  {
409
  try
410
  {
411
- $godsonFirstOrderPoints = Mage::getStoreConfig('sponsorship/fidelity/first_order_points');
412
- $sponsorFirstOrderPoints = Mage::getStoreConfig('sponsorship/sponsor/godson_first_order_points');
413
 
414
  //Check if we have to add points on first order
415
  if ($godsonFirstOrderPoints>0 || $sponsorFirstOrderPoints>0)
@@ -432,27 +469,8 @@ class Auguria_Sponsorship_Model_Observer
432
  //Add fidelity points to customer
433
  if ($godsonFirstOrderPoints >0)
434
  {
435
- $fidelityPoints = 0;
436
- $originalFidelityPoints = $customer->getFidelityPoints();
437
- if (isset($originalFidelityPoints))
438
- {
439
- $fidelityPoints = $originalFidelityPoints;
440
- }
441
- $fidelityPoints = $fidelityPoints + $godsonFirstOrderPoints;
442
- $customer->setFidelityPoints($fidelityPoints);
443
- $customer->save();
444
-
445
- //enregistrement dans les logs
446
- $log = Mage::getModel('sponsorship/fidelitylog');
447
- $data = array(
448
- 'customer_id' => $customerId,
449
- 'record_id' => 0,
450
- 'record_type' => 'first',
451
- 'datetime' => Mage::getModel('core/date')->gmtDate(),
452
- 'points' => $godsonFirstOrderPoints
453
- );
454
- $log->setData($data);
455
- $log->save();
456
  }
457
 
458
  //Add sponsorship points
@@ -460,35 +478,511 @@ class Auguria_Sponsorship_Model_Observer
460
  if (isset($sponsorId) && $sponsorId>0 && $sponsorFirstOrderPoints>0)
461
  {
462
  $sponsor = Mage::getModel('customer/customer')->load($sponsorId);
463
- $sponsorPoints = 0;
464
- $originalSponsorPoints = $sponsor->getSponsorPoints();
465
- if (isset($originalSponsorPoints))
466
- {
467
- $sponsorPoints = $originalSponsorPoints;
468
- }
469
- $sponsorPoints = $sponsorPoints + $sponsorFirstOrderPoints;
470
- $sponsor->setSponsorPoints($sponsorPoints);
471
- $sponsor->save();
472
-
473
- //enregistrement dans les logs
474
- $log = Mage::getModel('sponsorship/sponsorlog');
475
- $data = array(
476
- 'godson_id' => $customerId,
477
- 'sponsor_id' => $sponsorId,
478
- 'record_id' => 0,
479
- 'record_type' => 'first',
480
- 'datetime' => Mage::getModel('core/date')->gmtDate(),
481
- 'points' => $sponsorFirstOrderPoints
482
- );
483
- $log->setData($data);
484
- $log->save();
485
  }
486
  }
487
  }
488
  }
489
  catch (Exception $e)
490
  {
491
- Mage::log("An error occured while adding first order points :".$e->getMessage());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
492
  }
493
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494
  }
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
  class Auguria_Sponsorship_Model_Observer
9
+ {
10
+ /**
11
+ * Calcul total order points on sales_order_payment_pay event
12
+ * @param Varien_Event_Observer $observer
13
+ */
14
  public function calcPoints($observer)
15
  {
16
+ /**
17
+ * @TODO : retrancher du total les points offerts
18
+ */
19
  try {
20
+ //modules actifs
21
+ $moduleFidelity = Mage::helper('auguria_sponsorship/config')->isFidelityEnabled();
22
+ $moduleSponsor = Mage::helper('auguria_sponsorship/config')->isSponsorshipEnabled();
23
+ $moduleAccumulated = Mage::helper('auguria_sponsorship/config')->isAccumulatedEnabled();
24
+
25
+ if ($moduleFidelity==1||$moduleSponsor==1||$moduleAccumulated==1)
26
+ {
27
+ //récupération de la commande et des articles
28
+ $order = $observer->getInvoice()->getOrder();
29
+ $orderDate = $order->getUpdatedAt();
30
+ $orderId = $order->getEntityId();
31
+
32
+ //définition du client
33
+ $cId = $order->getCustomerId();
34
+
35
+ //definition du websiteid
36
+ $wId = $order->getStore()->getWebsiteId();
37
+
38
+ //definition du groupe du client
39
+ $customer = Mage::getModel('customer/customer')->load($cId);
40
+ $gId = $customer->getGroupId();
41
+
42
+ //definition du sponsor de premier niveau
43
+ $sponsorId = (int)$customer->getSponsor();
44
+ $sponsor = Mage::getModel('customer/customer')->load($sponsorId);
45
+ $special_rate = (int)$sponsor->getData('special_rate');
46
+
47
+ //variable de points
48
+ $tCatalogFidelityPoints=0;
49
+ $tCatalogSponsorPoints=0;
50
+ $tCartFidelityPoints=0;
51
+ $tCartSponsorPoints=0;
52
+
53
+ //calcul des points catalogue et mise à jour de lacommande pour chaque ligne
54
+ foreach ($order->getAllItems() as $item)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  {
56
+ //Add points only if product have no parent
57
+ if (!$item->getParentItemId())
58
+ {
59
+ $date = $item->getData('updated_at');
60
+ $pId = $item->getData('product_id');
61
+ $qte = $item->getData('qty_ordered');
62
+ $data = $item->getData();
63
+
64
+ if ($moduleFidelity==1 || $moduleAccumulated==1)
65
+ {
66
+ //récupération et affectation des points catalog pour chaque article commandé
67
+ $catalogFidelityPoints = (float)$this->getRulePoints($date, $wId, $gId, $pId,'fidelity');
68
+ //multiplication des points par la quantité
69
+ $catalogFidelityPoints = $catalogFidelityPoints*$qte;
70
+ //ajout des points aux items de commande
71
+ $data['catalog_fidelity_points'] = $catalogFidelityPoints;
72
+
73
+ //calcul du total de points catalogue
74
+ $tCatalogFidelityPoints = $tCatalogFidelityPoints+$catalogFidelityPoints;
75
+
76
+ //calcul du total de points panier
77
+ $tCartFidelityPoints = $tCartFidelityPoints+(float)$item->getCartFidelityPoints();
78
+ }
79
+
80
+ if (($moduleAccumulated==1 || $moduleSponsor==1) && $special_rate==0)
81
+ {
82
+ //récupération et affectation des points catalog pour chaque article commandé
83
+ $catalogSponsorPoints = $this->getRulePoints($date, $wId, $gId, $pId, 'sponsor');
84
+
85
+ //multiplication des points par la quantité
86
+ $catalogSponsorPoints = $catalogSponsorPoints*$qte;
87
+
88
+ //ajout des points aux items de commande
89
+ $data['catalog_sponsor_points'] = $catalogSponsorPoints;
90
+ //calcul du total de points catalogue
91
+ $tCatalogSponsorPoints = $tCatalogSponsorPoints+$catalogSponsorPoints;
92
+
93
+ //calcul du total de points panier
94
+ $tCartSponsorPoints = $tCartSponsorPoints+$item->getCartSponsorPoints();
95
+ }
96
+ //si un taux spécial est défini pour le parrain direct
97
+ elseif (($moduleAccumulated==1 || $moduleSponsor==1) && $special_rate!=0)
98
+ {
99
+ //Redéfinition du taux à appliquer dans la commande
100
+ //ajout des points aux items de commande
101
+ $data['catalog_sponsor_points'] = 0;
102
+ $specialratepoints = $item->getData('price')*$qte*$special_rate/100;
103
+ $data['cart_sponsor_points'] = $specialratepoints;
104
+ }
105
+
106
+ $item->setData($data);
107
+ $item->save();
108
+ }
109
+ }
110
+
111
+ $order->save();
112
+
113
+ //Ajout du total des points fidelite
114
+ if ($tCatalogFidelityPoints != 0 || $tCartFidelityPoints != 0 ) {
115
+ $this->_addFidelityPoints($customer, $tCatalogFidelityPoints+$tCartFidelityPoints, 'order', $orderId, $orderDate);
116
+ $customer->save();
117
+ }
118
+
119
+ //Ajout du total des points de parrainage si le parrain n'a pas de taux spécial
120
+ if (($tCatalogSponsorPoints != 0 || $tCartSponsorPoints != 0) && $special_rate==0) {
121
+ $this->_addSponsorPoints($sponsor, $customer, $tCatalogSponsorPoints+$tCartSponsorPoints, 'order', $orderId, $orderDate);
122
+ }
123
+ //Ajout des points à partir du taux spécial au parrain direct uniquement
124
+ elseif ($special_rate!=null && ($moduleSponsor==1 || $moduleAccumulated==1)) {
125
+ $this->_addSponsorSpecialPoints($sponsor, $customer, $specialratepoints, 'order', $orderId, $orderDate);
126
+ }
127
+ }
128
  return $this;
129
  }
130
  catch (Exception $e) {
131
+ Mage::log(Mage::helper('auguria_sponsorship')->__("An error occured while saving points : %s",$e->getMessage()));
132
  }
133
  }
134
+
135
+ /**
136
+ * Get catalog fidelity or sponsor points depends on $type
137
+ * @param date $date
138
+ * @param integer $wId
139
+ * @param integer $gId
140
+ * @param integer $pId
141
+ * @param String $type
142
+ */
143
  public function getRulePoints($date, $wId, $gId, $pId, $type)
144
  {
145
  $resource = Mage::getSingleton('core/resource');
146
  $read= $resource->getConnection('core_read');
147
+ $userTable = $resource->getTableName('auguria_sponsorship/catalog'.$type.'point');
148
  $select = $read->select()
149
+ ->from($resource->getTableName('auguria_sponsorship/catalog'.$type.'point'), 'rule_point')
150
  ->where('rule_date=?', $this->formatDate($date))
151
  ->where('website_id=?', $wId)
152
  ->where('customer_group_id=?', $gId)
160
  return date('Y-m-d', $date);
161
  }
162
 
163
+ /**
164
+ * Add fidelity points to customer
165
+ * @param Mage_Customer_Model_Customer $customer
166
+ * @param float $tFPoints
167
+ * @param String $recordType
168
+ * @param Int $recordId
169
+ * @param Datetime $datetime
170
+ */
171
+ protected function _addFidelityPoints($customer, $fidelityPoints, $recordType='order', $recordId=0, $datetime=null)
172
  {
173
+ $customer = Mage::helper('auguria_sponsorship')->addFidelityPoints($customer, $fidelityPoints);
 
 
 
 
 
 
 
174
  //enregistrement dans les logs
 
175
  $data = array(
176
+ 'customer_id' => $customer->getId(),
177
+ 'record_id' => $recordId,
178
+ 'record_type' => $recordType,
179
+ 'datetime' => $datetime,
180
+ 'points' => $fidelityPoints
181
  );
182
+ $this->_addAuguriaSponsorshipLog($data);
 
183
  }
184
 
185
  /**
186
  * Add sponsor points to sponsors
187
+ * @param Mage_Customer_Model_Customer $sponsor
188
+ * @param Mage_Customer_Model_Customer $godson
189
+ * @param float $SPoints
190
+ * @param String $recordType
191
+ * @param Int $recordId
192
+ * @param Datetime $datetime
193
  */
194
+ protected function _addSponsorPoints($sponsor, $godson, $SPoints, $recordType='order', $recordId=0, $datetime=null)
195
  {
196
+ $ratio = Mage::helper('auguria_sponsorship/config')->getSponsorPercent();
197
+ $maxLevel = Mage::helper('auguria_sponsorship/config')->getSponsorLevels();
198
+ $sponsorId = -1;
199
+ $godsonId = $godson->getId();
200
 
201
  //Ajout des points tant que le niveau maximum n'est pas atteint et qu'un parrain est défini
202
+ for ($level = 0; $level<$maxLevel AND $sponsorId!=0 AND round($SPoints,4)>0; $level++)
203
  {
204
  //définition du parrain
205
+ if ($sponsorId>0) {
206
+ $sponsor = Mage::getModel('customer/customer')->load($sponsorId);
207
+ }
208
+ else {
209
+ $sponsorId = $sponsor->getId();
210
+ }
211
+ $special_rate = (int)$sponsor->getData('special_rate');
212
 
213
  //si parrain a un taux special : on met fin à la boucle
214
+ if ($special_rate != 0) {
 
215
  $SPoints = 0;//mise à 0 des points de parrainage pour arrêter la boucle
216
+ $sponsorId = 0;
 
 
 
 
 
 
 
 
217
  }
218
+ else {
219
+ $sponsor = Mage::helper('auguria_sponsorship')->addSponsorshipPoints($sponsor, $SPoints);
220
+ $sponsor->save();
221
+
222
+ //Save operation in logs table
 
 
 
 
 
 
 
 
 
223
  $data = array(
224
  'godson_id' => $godsonId,
225
  'sponsor_id' => $sponsorId,
226
+ 'record_id' => $recordId,
227
+ 'record_type' => $recordType,
228
+ 'datetime' => $datetime,
229
+ 'points' => $SPoints
230
  );
231
+ $this->_addAuguriaSponsorshipLog($data);
232
+
233
+ //Send notification
234
+ $this->_sendSponsorNotification($sponsor, $godsonId, $SPoints, Mage::helper('auguria_sponsorship')->getSponsorshipPoints($sponsor));
235
+
236
+ //incrémentation des points à ajouter
 
 
237
  $SPoints = ($SPoints*$ratio)/100;
238
  //le parrain devient le filleul
239
  $godsonId = $sponsorId;
240
  //définition du parrain du parrain
241
+ $sponsorId = (int)$sponsor->getSponsor();
242
  }
243
  }
244
  }
245
+
246
+ /**
247
+ * Link customer with his sponsor on customer_save_before
248
+ * @param Array $observer
249
+ */
250
+ public function setSponsorOnRegister($observer)
251
  {
252
+ try
 
 
253
  {
254
+ $customer = $observer->getCustomer();
255
+ //if no get id : it's a creation
256
+ if (!$customer->getId())
257
+ {
258
+ $this->_setSponsor($customer);
259
+ }
260
  }
261
+ catch (Exception $e)
262
+ {
263
+ Mage::log(Mage::helper('auguria_sponsorship')->__("An error occured while linking sponsor : %s",$e->getMessage()));
264
  }
265
  }
266
+
267
+ /**
268
+ * Link customer with his sponsor and update sponsor's sponsorship points validity
269
+ * @param Mage_Customer_Model_Customer $customer
270
+ */
271
+ protected function _setSponsor($customer)
272
+ {
273
+ $sponsorId = (int)Mage::helper("auguria_sponsorship")->searchSponsorId($customer->getEmail());
274
+ if ($sponsorId != 0)
275
+ {
276
+ //link
277
+ $customer->setData('sponsor',$sponsorId);
278
+ $cookie = Mage::getModel('core/cookie');
279
+ //remove cookie
280
+ if ($cookie->get('sponsorship_id'))
281
+ {
282
+ $cookie->delete('sponsorship_id');
283
+ $cookie->delete('sponsorship_email');
284
+ $cookie->delete('sponsorship_firstname');
285
+ $cookie->delete('sponsorship_lastname');
286
+ }
287
+
288
+ //update sponsor points validity
289
+ $sponsor = Mage::getModel('customer/customer')->load($sponsorId);
290
+ $validityType = '';
291
+ if (Mage::helper('auguria_sponsorship/config')->isAccumulatedEnabled()) {
292
+ $validityType = 'points_validity';
293
+ }
294
+ else {
295
+ $validityType = 'sponsor_points_validity';
296
+ }
297
+ $validity = Mage::helper('auguria_sponsorship')->getPointsValidity('sponsorship');
298
+ if(isset($validity['sponsorship'])) {
299
+ $sponsor->setData($validityType,$validity['sponsorship']);
300
+ $sponsor->save();
301
+ }
302
+ }
303
+ }
304
+
305
+ /**
306
+ * Link customer with his sponsor on checkout_submit_all_after
307
+ * @param Array $observer
308
+ */
309
+ public function setSponsorOnOrder($observer)
310
  {
311
  //checkout_type_onepage_save_order_after
312
  $quote = $observer['quote'];
313
  $order = $observer['order'];
314
+
315
+ if ($order) {
316
+ //if it's a new customer or if we allow to sponsor a registred user
317
+ if ($quote->getData('checkout_method') == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER
318
+ || Mage::helper('auguria_sponsorship/config')->isRegistredUsersInvitationAllowed() == 1) {
319
+
320
+ $customerId = $order->getCustomerId();
321
+ if ($customerId != '')
322
+ {
323
+ $customer = Mage::getModel("customer/customer")->load($customerId);
324
+ //check godchild has no order
325
+ //check godchild is not a sponsor
326
+ //check godchild has no sponsor
327
+ if (!Mage::helper('auguria_sponsorship')->haveOrder($customerId)
328
+ && !Mage::helper('auguria_sponsorship')->isASponsor($customerId)
329
+ && ((int)$customer->getSponsor()!=0)) {
330
+ $this->_setSponsor($customer);
331
+ $customer->save();
332
+ }
333
+ }
334
+ }
 
 
 
335
  }
336
  }
337
 
338
  /**
339
  * Add sponsor points for a sponsor with special rate
340
  */
341
+ protected function _addSponsorSpecialPoints($sponsor, $godson, $specialratepoints, $recordType='order', $recordId=0, $datetime=null)
342
  {
343
  //recalcul de la commande & maj items de la commande
344
+ try {
345
+ $sponsor = Mage::helper('auguria_sponsorship')->addSponsorshipPoints($sponsor, $specialratepoints);
346
+ $sponsor->save();
347
+
348
+ //save operation in logs
349
+ $data = array(
350
+ 'godson_id' => $godson->getId(),
351
+ 'sponsor_id' => $sponsor->getId(),
352
+ 'record_id' => $recordId,
353
+ 'record_type' => $recordType,
354
+ 'datetime' => $datetime,
355
+ 'points' => (float)$specialratepoints
356
+ );
357
+ $this->_addAuguriaSponsorshipLog($data);
358
+
359
+ //Send notification to sponsor
360
+ $this->_sendSponsorNotification($sponsor, $godsonId, $pointsToAdd, $tSPoints);
 
 
 
 
 
 
 
 
361
  }
362
  catch (Exception $e) {
363
+ Mage::log(Mage::helper('auguria_sponsorship')->__("An error occured while saving special points : %s",$e->getMessage()));
364
  }
365
 
366
  }
367
 
368
+ /**
369
+ * Create cookie to link customer with his sponsor
370
+ * @param Array() $observer
371
+ */
372
  public function affiliate($observer)
373
  {
374
  $controller = $observer['controller_action'];
392
  $session->setData('email',$email);
393
 
394
  //stockage de l'id du parrain dans un cookie
395
+ $sponsorInvitationValidity = Mage::helper('auguria_sponsorship/config')->getInvitationValidity();
396
  $period =3600*24*$sponsorInvitationValidity;
397
 
398
+ $cookie = Mage::getModel('core/cookie');
399
  $cookie->set('sponsorship_id', $sponsorId, $period);
400
  $cookie->set('sponsorship_firstname', $prenom, $period);
401
  $cookie->set('sponsorship_lastname', $nom, $period);
414
  {
415
  try
416
  {
417
+ $newsletterPoints = (int)Mage::helper('auguria_sponsorship/config')->getFidelityNewsletterPoints();
418
  //Check if we must add points
419
+ if ($newsletterPoints > 0)
420
  {
421
  //Check if it's an account creation
422
  $customer = $observer->getCustomer();
425
  //Check if he is subscribing to the newsletter
426
  if ($customer->getIsSubscribed() == 1)
427
  {
428
+ $this->_addFidelityPoints($customer, $newsletterPoints, 'newsletter');
 
 
 
 
 
 
 
429
  }
430
  }
431
  }
432
  }
433
  catch (Exception $e)
434
  {
435
+ Mage::log(Mage::helper('auguria_sponsorship')->__("An error occured while adding news letter points : %s",$e->getMessage()));
436
  }
437
  }
438
 
445
  {
446
  try
447
  {
448
+ $godsonFirstOrderPoints = Mage::helper('auguria_sponsorship/config')->getFidelityFirstOrderPoints();
449
+ $sponsorFirstOrderPoints = Mage::helper('auguria_sponsorship/config')->getGodsonFirstOrderPoints();
450
 
451
  //Check if we have to add points on first order
452
  if ($godsonFirstOrderPoints>0 || $sponsorFirstOrderPoints>0)
469
  //Add fidelity points to customer
470
  if ($godsonFirstOrderPoints >0)
471
  {
472
+ $this->_addFidelityPoints($customer, $godsonFirstOrderPoints, 'first', $invoice->getOrderId());
473
+ $customer->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
474
  }
475
 
476
  //Add sponsorship points
478
  if (isset($sponsorId) && $sponsorId>0 && $sponsorFirstOrderPoints>0)
479
  {
480
  $sponsor = Mage::getModel('customer/customer')->load($sponsorId);
481
+ $this->_addSponsorPoints($sponsor, $customer, $sponsorFirstOrderPoints, 'first', $invoice->getOrderId());
482
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
  }
484
  }
485
  }
486
  }
487
  catch (Exception $e)
488
  {
489
+ Mage::log(Mage::helper('auguria_sponsorship')->__("An error occured while adding first order points :".$e->getMessage()));
490
+ }
491
+ }
492
+
493
+ /**
494
+ * Update sponsorship tab customer fields from adminhtml customer form on customer_save_before
495
+ * @param Varien_Event_Observer $observer
496
+ */
497
+ public function adminUpdateSponsorshipFields($observer)
498
+ {
499
+ //@TODO check each parameters
500
+ $form = Mage::app()->getRequest()->getParam('sponsorship');
501
+ if (is_array($form) && !empty($form)) {
502
+ foreach ($form as $key=>$value) {
503
+ $observer->getCustomer()->setData($key, $value);
504
+ }
505
+ }
506
+ return $observer;
507
+ }
508
+
509
+ /**
510
+ * Insert log if points are modified on customer_save_after
511
+ * @param Varien_Event_Observer $observer
512
+ */
513
+ public function adminUpdatePoints($observer)
514
+ {
515
+ if (Mage::app()->getRequest()->getControllerName()=='customer') {
516
+ $customer = $observer->getCustomer();
517
+ if ($customer->hasDataChanges()) {
518
+ $keys = Array('accumulated_points','sponsor_points','fidelity_points');
519
+ foreach ($keys as $key) {
520
+ if ($customer->dataHasChangedFor($key)) {
521
+ $points = (float)$customer->getData($key) - (float)$customer->getOrigData($key);
522
+ $data = Array('points'=>$points,
523
+ 'customer_id'=>$customer->getId(),
524
+ 'record_type'=>'admin');
525
+ $this->_addAuguriaSponsorshipLog($data);
526
+ }
527
+ }
528
+ }
529
  }
530
  }
531
+
532
+ /**
533
+ * Update sponsorship fields from frontend customer form on customer_save_before
534
+ * @param Varien_Event_Observer $observer
535
+ */
536
+ public function frontUpdateSponsorshipFields($observer)
537
+ {
538
+ $iban = Mage::app()->getRequest()->getParam('iban');
539
+ $siret = Mage::app()->getRequest()->getParam('siret');
540
+ $customer = $observer->getCustomer();
541
+ /*Edit action*/
542
+ if ($customer->getId()) {
543
+ if (isset($iban)) {
544
+ $customerIban = str_replace(CHR(32),"",$iban);
545
+ $customerIban = str_replace("-","",$customerIban);
546
+ if (Zend_Validate::is( trim($iban) , 'NotEmpty')) {
547
+ if (!Zend_Validate::is( trim($iban) , 'Iban')) {
548
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__('Invalid IBAN code "%s"', $iban));
549
+ }
550
+ }
551
+ $customer->setData('iban', $customerIban);
552
+ }
553
+ if (isset($siret)) {
554
+ $customerSiret = str_replace(CHR(32),"",$siret);
555
+ $customerSiret = str_replace("-","",$customerSiret);
556
+ /*desactivated for internationalization
557
+ if (!Mage::helper('auguria_sponsorship')->isSiret(trim($siret))) {
558
+ Mage::throwException(Mage::helper('auguria_sponsorship')->__('Invalid SIRET code "%s"', $siret));
559
+ }
560
+ */
561
+ $customer->setData('siret', $customerSiret);
562
+ }
563
+ }
564
+ /*Create action*/
565
+ else {
566
+ if ($sponsorId = Mage::helper("auguria_sponsorship")->searchSponsorId($customer->getEmail())) {
567
+ $customer->setData('sponsor',$sponsorId);
568
+ $cookie = Mage::getSingleton('core/cookie');
569
+ if ($cookie->get('sponsorship_id')) {
570
+ $cookie->delete('sponsorship_id');
571
+ $cookie->delete('sponsorship_email');
572
+ $cookie->delete('sponsorship_firstname');
573
+ $cookie->delete('sponsorship_lastname');
574
+ }
575
+ }
576
+ }
577
+ return $observer;
578
+ }
579
+
580
+ /**
581
+ * Send notification to sponsor when godson make him earn points
582
+ * @param Mage_Customer_Model_Customer $sponsor
583
+ * @param Int $godchildId
584
+ * @param Float $addedPoints
585
+ * @param Float $totalPoints
586
+ */
587
+ protected function _sendSponsorNotification($sponsor, $godchildId, $addedPoints, $totalPoints)
588
+ {
589
+ if (Mage::helper('auguria_sponsorship/config')->isSponsorshipNotificationEnabled()==1) {
590
+ $godchild = Mage::getModel('customer/customer')->load($godchildId);
591
+ $mailTemplate = Mage::getModel('auguria_sponsorship/Core_Email_Template');
592
+
593
+ $sender_name = Mage::getStoreConfig('trans_email/ident_sales/name');
594
+ $sender_email = Mage::getStoreConfig('trans_email/ident_sales/email');
595
+
596
+ $subject = Mage::helper('auguria_sponsorship')->__('%s sponsor points', Mage::helper('auguria_sponsorship/mail')->getStoreName());
597
+
598
+ $sender = array("name"=>$sender_name, "email"=>$sender_email);
599
+ $recipient_email = $sponsor->getData('email');
600
+
601
+ $postObject = new Varien_Object();
602
+ $postObject->setData(Array ("sender_name" => $sender_name,
603
+ "sender_email" => $sender_email,
604
+ "recipient_firstname" => $sponsor->getFirstname(),
605
+ "recipient_lastname" => $sponsor->getLastname(),
606
+ "subject" => $subject,
607
+ "store_name" => Mage::helper('auguria_sponsorship/mail')->getStoreName(),
608
+ "godchild_firstname" =>$godchild->getFirstname(),
609
+ "godchild_lastname" =>$godchild->getLastname(),
610
+ "added_points" =>$addedPoints,
611
+ "total_points" =>$totalPoints
612
+ ));
613
+ $mailTemplate->setDesignConfig(array('area' => 'frontend'))
614
+ ->setReplyTo($sender_email)
615
+ ->sendTransactional(
616
+ Mage::helper('auguria_sponsorship/config')->getSponsorshipNotificationTemplate(),
617
+ $sender,
618
+ $recipient_email,
619
+ $sponsor->getFirstname().' '.$sponsor->getLastname(),
620
+ array('data' => $postObject));
621
+ if (!$mailTemplate->getSentSuccess())
622
+ {
623
+ Mage::log(Mage::helper('auguria_sponsorship')->__("An error occured while sending sponsor notification email."));
624
+ }
625
+ }
626
+ }
627
+
628
+ /**
629
+ * Remove points from customer account if auguria_sponsorship_discount is set
630
+ * on checkout_submit_all_after
631
+ * @param array $observer
632
+ */
633
+ public function cartPointsExchange($observer)
634
+ {
635
+ $order = $observer['order'];
636
+ if ($order) {
637
+ if ((float)$order->getAuguriaSponsorshipDiscountAmount()<0) {
638
+ $customerId = $order->getCustomerId();
639
+ if ($customerId != '')
640
+ {
641
+ $orderAccumulated = $order->getAuguriaSponsorshipAccumulatedPointsUsed();
642
+ $orderFidelity = $order->getAuguriaSponsorshipFidelityPointsUsed();
643
+ $orderSponsor = $order->getAuguriaSponsorshipSponsorPointsUsed();
644
+ $type = Array();
645
+ if ((float)$orderAccumulated > 0
646
+ ||(float)$orderSponsor > 0
647
+ ||(float)$orderFidelity > 0) {
648
+ $customer = Mage::getModel("customer/customer")->load($customerId);
649
+ $usedPoints = 0;
650
+ if ((float)$orderAccumulated > 0) {
651
+ $points = (float)$customer->getAccumulatedPoints();
652
+ $usedPoints += (float)$orderAccumulated;
653
+ $points = $points - $usedPoints;
654
+ $points = max(0,$points);
655
+ $customer->setAccumulatedPoints($points);
656
+ $type['accumulated'] = $usedPoints;
657
+ }
658
+ else {
659
+ if ((float)$orderSponsor > 0) {
660
+ $points = (float)$customer->getSponsorPoints();
661
+ $usedPoints += (float)$orderSponsor;
662
+ $points = $points - $usedPoints;
663
+ $points = max(0,$points);
664
+ $customer->setSponsorPoints($points);
665
+ $type['sponsor'] = $usedPoints;
666
+ }
667
+ if ((float)$orderFidelity > 0) {
668
+ $points = (float)$customer->getFidelityPoints();
669
+ $usedPoints += (float)$orderFidelity;
670
+ $points = $points - $usedPoints;
671
+ $points = max(0,$points);
672
+ $customer->setFidelityPoints($points);
673
+ $type['fidelity'] = $usedPoints;
674
+ }
675
+ }
676
+ $customer->save();
677
+
678
+ if ($usedPoints>0) {
679
+ $data = Array('points'=>-$usedPoints,
680
+ 'customer_id'=>$customerId,
681
+ 'record_type'=>'cart',
682
+ 'record_id'=>$order->getId(),
683
+ 'datetime'=>$order->getUpdatedAt());
684
+ $this->_addAuguriaSponsorshipLog($data);
685
+
686
+ if (count($type)>0) {
687
+ foreach($type as $key=>$points) {
688
+ $echange = Mage::getModel('auguria_sponsorship/change');
689
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
690
+ $type = Mage::helper('auguria_sponsorship/config')->getPointsTypes($mode);
691
+ $row = array(
692
+ 'customer_id' => $customerId,
693
+ 'type' => 'cart',
694
+ 'module' => $key,
695
+ 'statut' => 'waiting',
696
+ 'datetime' => Mage::getModel('core/date')->gmtDate(),
697
+ 'points' => $points,
698
+ 'value' => $order->getBaseAuguriaSponsorshipDiscountAmount()
699
+ );
700
+ $echange->setData($row);
701
+ $echange->save();
702
+ }
703
+ }
704
+ }
705
+ }
706
+ }
707
+ }
708
+ }
709
+ }
710
+
711
+ /**
712
+ * Insert data in points logs table
713
+ * @param array $data
714
+ * @return boolean
715
+ */
716
+ protected function _addAuguriaSponsorshipLog($data)
717
+ {
718
+ if (is_array($data) && isset($data['points'])) {
719
+ $log = Mage::getModel('auguria_sponsorship/log');
720
+ if (!isset($data['datetime'])) {
721
+ $data['datetime'] = Mage::getModel('core/date')->gmtDate();
722
+ }
723
+ $log->setData($data);
724
+ $log->save();
725
+ return true;
726
+ }
727
+ return false;
728
+ }
729
+
730
+ /**
731
+ * Add Auguria_Sponsorship points in quote according to defined rules on salesrule_validator_process event
732
+ * @param array(
733
+ 'rule' => $rule,
734
+ 'item' => $item,
735
+ 'address' => $address,
736
+ 'quote' => $quote,
737
+ 'qty' => $qty,
738
+ 'result' => $result,
739
+ ) $observer
740
+ */
741
+ public function validatorPointsCalculationProcess($observer)
742
+ {
743
+ $item = $observer['item'];
744
+ $rule = $observer['rule'];
745
+ $result = $observer['result'];
746
+ $address = $observer['address'];
747
+ $qty = $observer['qty'];
748
+
749
+ $rulePercent = min(100, $rule->getDiscountAmount());
750
+ $price = $item->getDiscountCalculationPrice();
751
+ $baseItemPrice = ($price !== null) ? $item->getBaseDiscountCalculationPrice() : $item->getBaseCalculationPrice();
752
+
753
+ $cartFidelityPoints = 0;
754
+ $cartSponsorPoints = 0;
755
+
756
+ switch ($rule->getSimpleAction()) {
757
+ case 'fidelity_points_by_fixed':
758
+ if ($step = $rule->getDiscountStep()) {
759
+ $qty = floor($qty/$step)*$step;
760
+ }
761
+ $cartFidelityPoints = $qty*$rule->getDiscountAmount();
762
+ break;
763
+
764
+ case 'fidelity_points_by_percent':
765
+ if ($step = $rule->getDiscountStep()) {
766
+ $qty = floor($qty/$step)*$step;
767
+ }
768
+ $cartFidelityPoints = ($qty*$baseItemPrice - $item->getBaseDiscountAmount()) * $rulePercent/100;
769
+ break;
770
+
771
+ case 'fidelity_points_cart_fixed':
772
+ /** @TODO : prevent applying whole cart discount for every shipping order, but only for first order */
773
+ $cartRules = $address->getCartFixedRules();
774
+ if (!isset($cartRules[$rule->getId()])) {
775
+ $cartRules[$rule->getId()] = $rule->getDiscountAmount();
776
+ }
777
+ if ($cartRules[$rule->getId()] > 0) {
778
+ $cartFidelityPoints = $rule->getDiscountAmount();
779
+ }
780
+ $address->setCartFixedRules($cartRules);
781
+ break;
782
+ //sponsor
783
+ case 'sponsor_points_by_fixed':
784
+ if ($step = $rule->getDiscountStep()) {
785
+ $qty = floor($qty/$step)*$step;
786
+ }
787
+ $cartSponsorPoints = $qty*$rule->getDiscountAmount();
788
+ break;
789
+
790
+ case 'sponsor_points_by_percent':
791
+ if ($step = $rule->getDiscountStep()) {
792
+ $qty = floor($qty/$step)*$step;
793
+ }
794
+ $cartSponsorPoints = ($qty*$baseItemPrice - $item->getBaseDiscountAmount()) * $rulePercent/100;
795
+ break;
796
+
797
+ case 'sponsor_points_cart_fixed':
798
+ /** @TODO : prevent applying whole cart discount for every shipping order, but only for first order */
799
+ $cartRules = $address->getCartFixedRules();
800
+ if (!isset($cartRules[$rule->getId()])) {
801
+ $cartRules[$rule->getId()] = $rule->getDiscountAmount();
802
+ }
803
+ if ($cartRules[$rule->getId()] > 0) {
804
+ $cartSponsorPoints = $rule->getDiscountAmount();
805
+ }
806
+ $address->setCartFixedRules($cartRules);
807
+ break;
808
+ }
809
+ $result->setData('cart_fidelity_points',$cartFidelityPoints);
810
+ $result->setData('cart_sponsor_points',$cartSponsorPoints);
811
+
812
+ $cartFidelityPoints = max((float)$item->getCartFidelityPoints(), (float)$cartFidelityPoints);
813
+ $cartSponsorPoints = max((float)$item->getCartSponsorPoints(), (float)$cartSponsorPoints);
814
+
815
+ $item->setCartFidelityPoints($cartFidelityPoints);
816
+ $item->setCartSponsorPoints($cartSponsorPoints);
817
+
818
+ return $this;
819
+ }
820
+
821
+ /**
822
+ * Cancel used and gained points while credit memo creation using sales_order_creditmemo_save_before event
823
+ * @param array $observer
824
+ */
825
+ public function cancelPointsOnCreditMemo($observer)
826
+ {
827
+ $creditmemo = $observer['creditmemo'];
828
+ //if it is a credit memo creation
829
+ if ((int)$creditmemo->getId()==0
830
+ && (Mage::helper('auguria_sponsorship/config')->cancelFidelityEarnedPointsOnCreditMemo()
831
+ || Mage::helper('auguria_sponsorship/config')->cancelSponsorshipEarnedPointsOnCreditMemo())
832
+ ) {
833
+ $order = $creditmemo->getOrder();
834
+
835
+ //Cancel used points
836
+ //@TODO check credit memo sold the order ?
837
+ $this->_cancelUsedPoints($order);
838
+
839
+ //Remove winning points
840
+ //calcul fidelity points to remove and ratio for sponsorship points
841
+ $earnedFidelityPoints = 0;
842
+ $backFidelityPoints = 0;
843
+ $earnedSponsorPoints = 0;
844
+ $backSponsorPoints = 0;
845
+ $ratio = 0;
846
+ $creditMemoItems = $creditmemo->getItemsCollection();
847
+ if ($creditMemoItems->count()>0) {
848
+ foreach ($creditMemoItems as $creditmemoItem) {
849
+ $orderItem = $creditmemoItem->getOrderItem();
850
+
851
+ //fidelity points
852
+ $earnedFidelityPoints += (float)$orderItem->getCatalogFidelityPoints()+(float)$orderItem->getCartFidelityPoints();
853
+ $tmpFidelityPoints = (float)$orderItem->getCatalogFidelityPoints()+(float)$orderItem->getCartFidelityPoints();
854
+ if($orderItem->getQtyInvoiced()!=0) {
855
+ $tmpFidelityPoints = ($tmpFidelityPoints*$creditmemoItem->getQty())/$orderItem->getQtyInvoiced();
856
+ }
857
+ $backFidelityPoints += $tmpFidelityPoints;
858
+
859
+ //sponsorship points
860
+ $earnedSponsorPoints += (float)$orderItem->getCatalogSponsorPoints()+(float)$orderItem->getCartSponsorPoints();
861
+ $tmpSponsorPoints = (float)$orderItem->getCatalogSponsorPoints()+(float)$orderItem->getCartSponsorPoints();
862
+ if($orderItem->getQtyInvoiced()!=0) {
863
+ $tmpSponsorPoints = ($tmpSponsorPoints*$creditmemoItem->getQty())/$orderItem->getQtyInvoiced();
864
+ }
865
+ $backSponsorPoints += $tmpSponsorPoints;
866
+ }
867
+ if ($earnedSponsorPoints>0) {
868
+ $ratio = $backSponsorPoints/$earnedSponsorPoints;
869
+ }
870
+ }
871
+
872
+ //remove fidelity points
873
+ if ($backFidelityPoints>0) {
874
+ if (Mage::helper('auguria_sponsorship/config')->cancelFidelityEarnedPointsOnCreditMemo()){
875
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
876
+ $points = Mage::helper('auguria_sponsorship')->getFidelityPoints($customer);
877
+ $points -= (float)$backFidelityPoints;
878
+ $points = max(0,$points);
879
+ Mage::helper('auguria_sponsorship')->setFidelityPoints($customer, $points);
880
+ $customer->save();
881
+ $data = array(
882
+ 'customer_id' => $order->getCustomerId(),
883
+ 'record_id' => $order->getId(),
884
+ 'record_type' => 'order',
885
+ 'points' => -$backFidelityPoints
886
+ );
887
+ $this->_addAuguriaSponsorshipLog($data);
888
+ }
889
+ }
890
+
891
+ //remove sponsorship points according to logs and applying ratio
892
+ if (Mage::helper('auguria_sponsorship/config')->cancelSponsorshipEarnedPointsOnCreditMemo()){
893
+ $collection = Mage::getResourceModel('auguria_sponsorship/log_collection')
894
+ ->addFieldToFilter('record_type', 'order')
895
+ ->addFieldToFilter('record_id', $order->getId());
896
+ if ($collection->count()>0){
897
+ foreach ($collection as $log) {
898
+ $points = 0;
899
+ if($log->getSponsorId()>0) {
900
+ $customer = Mage::getModel('customer/customer')->load($log->getSponsorId());
901
+ $points = Mage::helper('auguria_sponsorship')->getSponsorshipPoints($customer);
902
+ $points -= (float)$log->getPoints()*$ratio;
903
+ $points = max(0,$points);
904
+ Mage::helper('auguria_sponsorship')->setSponsorshipPoints($customer, $points);
905
+ $customer->save();
906
+ }
907
+
908
+ if ($points>0) {
909
+ $data = array(
910
+ 'godson_id' => $log->getGodsonId(),
911
+ 'sponsor_id' => $log->getSponsorId(),
912
+ 'record_id' => $order->getId(),
913
+ 'record_type' => 'order',
914
+ 'points' => -(float)$log->getPoints()*$ratio
915
+ );
916
+ $this->_addAuguriaSponsorshipLog($data);
917
+ }
918
+ }
919
+ }
920
+ }
921
+ }
922
+ }
923
+
924
+ /**
925
+ * Cancel used points while on order cancellation
926
+ * As there is no event on cancellation we use sales_order_save_before event and we check status
927
+ * @param array $observer
928
+ */
929
+ public function cancelPointsOnOrderCanceled($observer)
930
+ {
931
+ $order = $observer['order'];
932
+ //Check status passed from any to canceled
933
+ if ($order->getStatus()=='canceled'
934
+ && $order->getOrigData('status')!='canceled') {
935
+ $this->_cancelUsedPoints($order);
936
+ }
937
+ }
938
+
939
+ /**
940
+ * Add to customer used points in an order and log it
941
+ * @param Mage_Sales_Model_Order $order
942
+ */
943
+ protected function _cancelUsedPoints($order)
944
+ {
945
+ $customerId = $order->getCustomerId();
946
+ $customer = Mage::getModel('customer/customer')->load($customerId);
947
+
948
+ $usedPoints = Array();
949
+ $usedPoints['accumulated'] = $order->getAuguriaSponsorshipAccumulatedPointsUsed();
950
+ $usedPoints['sponsorship'] = $order->getAuguriaSponsorshipSponsorPointsUsed();
951
+ $usedPoints['fidelity'] = $order->getAuguriaSponsorshipFidelityPointsUsed();
952
+ $toAdd = 0;
953
+ //Add used points
954
+ foreach ($usedPoints as $type=>$points) {
955
+ if ($points>0) {
956
+ $haveUsedPoints = true;
957
+ if ($type=='accumulated') {
958
+ if (Mage::helper('auguria_sponsorship/config')->cancelUsedPointsOnCreditMemo($type)){
959
+ $toAdd += $points;
960
+ $customer->setAccumulatedPoints($customer->getAccumulatedPoints()+$points);
961
+ }
962
+ }
963
+ elseif ($type=='sponsorship') {
964
+ if (Mage::helper('auguria_sponsorship/config')->cancelUsedPointsOnCreditMemo($type)){
965
+ $toAdd += $points;
966
+ $customer->setSponsorPoints($customer->getSponsorPoints()+$points);
967
+ }
968
+ }
969
+ elseif ($type=='fidelity') {
970
+ if (Mage::helper('auguria_sponsorship/config')->cancelUsedPointsOnCreditMemo($type)){
971
+ $toAdd += $points;
972
+ $customer->setFidelityPoints($customer->getFidelityPoints()+$points);
973
+ }
974
+ }
975
+ }
976
+ }
977
+ if ($toAdd>0) {
978
+ $customer->save();
979
+ $data = array(
980
+ 'customer_id' => $customer->getId(),
981
+ 'record_id' => $order->getId(),
982
+ 'record_type' => 'cart',
983
+ 'points' => $toAdd
984
+ );
985
+ $this->_addAuguriaSponsorshipLog($data);
986
+ }
987
+ }
988
  }
app/code/community/Auguria/Sponsorship/Model/Openinviter.php CHANGED
@@ -65,7 +65,7 @@ class Auguria_Sponsorship_Model_Openinviter
65
  $name = $code;
66
  if (isset($plugin['name']))
67
  $name = $plugin['name'];
68
- $array[] = array('value'=>$code, 'label'=>Mage::helper('sponsorship')->__($name));
69
  }
70
  }
71
  */
@@ -76,7 +76,7 @@ class Auguria_Sponsorship_Model_Openinviter
76
  $name = $code;
77
  if (isset($plugin['name']))
78
  $name = $plugin['name'];
79
- $array[] = array('value'=>$code, 'label'=>Mage::helper('sponsorship')->__($name));
80
  }
81
  }
82
  return $array;
65
  $name = $code;
66
  if (isset($plugin['name']))
67
  $name = $plugin['name'];
68
+ $array[] = array('value'=>$code, 'label'=>Mage::helper('auguria_sponsorship')->__($name));
69
  }
70
  }
71
  */
76
  $name = $code;
77
  if (isset($plugin['name']))
78
  $name = $plugin['name'];
79
+ $array[] = array('value'=>$code, 'label'=>Mage::helper('auguria_sponsorship')->__($name));
80
  }
81
  }
82
  return $array;
app/code/community/Auguria/Sponsorship/Model/Sponsorship.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Sponsorship extends Mage_Core_Model_Abstract
10
  public function _construct()
11
  {
12
  parent::_construct();
13
- $this->_init('sponsorship/sponsorship');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  parent::_construct();
13
+ $this->_init('auguria_sponsorship/sponsorship');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Sponsorshipopeninviter.php CHANGED
@@ -10,6 +10,6 @@ class Auguria_Sponsorship_Model_Sponsorshipopeninviter extends Mage_Core_Model_A
10
  public function _construct()
11
  {
12
  parent::_construct();
13
- $this->_init('sponsorship/sponsorshipopeninviter');
14
  }
15
  }
10
  public function _construct()
11
  {
12
  parent::_construct();
13
+ $this->_init('auguria_sponsorship/sponsorshipopeninviter');
14
  }
15
  }
app/code/community/Auguria/Sponsorship/Model/Status.php CHANGED
@@ -13,8 +13,8 @@ class Auguria_Sponsorship_Model_Status extends Varien_Object
13
  static public function getOptionArray()
14
  {
15
  return array(
16
- self::STATUS_ENABLED => Mage::helper('sponsorship')->__('Enabled'),
17
- self::STATUS_DISABLED => Mage::helper('sponsorship')->__('Disabled')
18
  );
19
  }
20
  }
13
  static public function getOptionArray()
14
  {
15
  return array(
16
+ self::STATUS_ENABLED => Mage::helper('auguria_sponsorship')->__('Enabled'),
17
+ self::STATUS_DISABLED => Mage::helper('auguria_sponsorship')->__('Disabled')
18
  );
19
  }
20
  }
app/code/community/Auguria/Sponsorship/Model/Total/Creditmemo/Discount.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Model_Total_Creditmemo_Discount extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
9
+ {
10
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
11
+ {
12
+ $store = $creditmemo->getStore();
13
+ $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $creditmemo->getAuguriaSponsorshipDiscountAmount());
14
+ $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $creditmemo->getBaseAuguriaSponsorshipDiscountAmount());
15
+ return $this;
16
+ }
17
+ }
app/code/community/Auguria/Sponsorship/Model/Total/Invoice/Discount.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Model_Total_Invoice_Discount extends Mage_Sales_Model_Order_Invoice_Total_Abstract
9
+ {
10
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
11
+ {
12
+ $store = $invoice->getStore();
13
+ $invoice->setGrandTotal($invoice->getGrandTotal() + $invoice->getAuguriaSponsorshipDiscountAmount());
14
+ $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $invoice->getBaseAuguriaSponsorshipDiscountAmount());
15
+ return $this;
16
+ }
17
+ }
app/code/community/Auguria/Sponsorship/Model/Total/Quote/Discount.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_Model_Total_Quote_Discount extends Mage_Sales_Model_Quote_Address_Total_Abstract
9
+ {
10
+ protected $_mode;
11
+ protected $_activated;
12
+ protected $_amount;
13
+ protected $_store;
14
+
15
+ public function __construct()
16
+ {
17
+ $this->setCode('auguria_sponsorship_discount');
18
+ }
19
+
20
+ protected function _getMode() {
21
+ if (!isset($this->_mode)) {
22
+ $this->_mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
23
+ }
24
+ return $this->_mode;
25
+ }
26
+
27
+ protected function _getActivated()
28
+ {
29
+ if (!isset($this->_activated)) {
30
+ $this->_activated = Mage::helper('auguria_sponsorship/config')->getCartExchangeActivated($this->_getMode());
31
+ }
32
+ return $this->_activated;
33
+ }
34
+
35
+ /**
36
+ * Collect address discount amount
37
+ *
38
+ * @param Mage_Sales_Model_Quote_Address $address
39
+ * @return Auguria_Sponsorship_Model_Total_Quote_Discount
40
+ */
41
+ public function collect(Mage_Sales_Model_Quote_Address $address)
42
+ {
43
+ parent::collect($address);
44
+ $this->_store = $address->getQuote()->getStore();
45
+ if (!isset($this->_amount)
46
+ && $address->getSubtotal()>0) {
47
+ $discountApplyIncludedTax = Mage::getStoreConfig('tax/calculation/discount_tax');
48
+ $discountApplyBeforeTax = Mage::getStoreConfig('tax/calculation/apply_after_discount');
49
+
50
+ //Apply discount before tax
51
+ if ($discountApplyBeforeTax) {
52
+ $maxAmount = $address->getBaseSubtotalWithDiscount();
53
+ if ($maxAmount>0) {
54
+ $this->_getAmount($address, $maxAmount);
55
+ //recalcul tax amount with new amount
56
+ $amountForTaxCalculation = $maxAmount - $this->_amount;
57
+ $taxAmount = ($address->getBaseTaxAmount()*$amountForTaxCalculation)/$maxAmount;
58
+ //@TODO add shipping tax if needed
59
+ $address->setBaseTotalAmount('tax', $taxAmount);
60
+ $address->setTotalAmount('tax', $this->_store->convertPrice($taxAmount));
61
+
62
+ }
63
+ else {
64
+ $this->_amount = 0;
65
+ }
66
+
67
+ }
68
+ //Apply discount after tax
69
+ else {
70
+ $maxAmount = $address->getBaseSubtotalWithDiscount();
71
+ //Discount calculated included tax
72
+ if ($discountApplyIncludedTax) {
73
+ $maxAmount += $address->getBaseTaxAmount();
74
+ }
75
+ $this->_getAmount($address, $maxAmount);
76
+ }
77
+
78
+
79
+
80
+ if ($this->_amount > 0) {
81
+ $baseAuguriaSponsorshipDiscountAmount = $this->_amount*-1;
82
+ $auguriaSponsorshipDiscountAmount = $this->_store->convertPrice($baseAuguriaSponsorshipDiscountAmount);
83
+
84
+ $this->_setAmount($auguriaSponsorshipDiscountAmount);
85
+ $this->_setBaseAmount($baseAuguriaSponsorshipDiscountAmount);
86
+
87
+ //$address->setGrandTotal($address->getGrandTotal() + $address->getAuguriaSponsorshipDiscountAmount());
88
+ //$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseAuguriaSponsorshipDiscountAmount());
89
+ }
90
+ }
91
+ return $this;
92
+ }
93
+
94
+ protected function _getAmount($address, $maxValue)
95
+ {
96
+ $modes = Mage::helper('auguria_sponsorship')->getCash();
97
+ $this->_amount = 0;
98
+
99
+ if (count($modes)>0) {
100
+ $points = Mage::helper('auguria_sponsorship')->getPoints();
101
+ $activated = $this->_getActivated();
102
+ foreach ($modes as $mode=>$value) {
103
+ if (isset($activated[$mode])
104
+ && $activated[$mode]==true
105
+ && $maxValue>$this->_amount
106
+ && $value>0) {
107
+ $sold = $maxValue - $this->_amount - $value;
108
+ if ($sold >= 0) {
109
+ $this->_amount += $value;
110
+ }
111
+ else {
112
+ $value = $maxValue-$this->_amount;
113
+ $this->_amount += $value;
114
+ }
115
+
116
+ if ($mode == 'fidelity') {
117
+ $address->setAuguriaSponsorshipFidelityPointsUsed($value);
118
+ }
119
+ elseif ($mode == 'sponsorship') {
120
+ $address->setAuguriaSponsorshipSponsorPointsUsed($value);
121
+ }
122
+ elseif ($mode == 'accumulated') {
123
+ $address->setAuguriaSponsorshipAccumulatedPointsUsed($value);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ return $this->_amount;
129
+ }
130
+
131
+ /**
132
+ * Add discount total information to address
133
+ *
134
+ * @param Mage_Sales_Model_Quote_Address $address
135
+ * @return Auguria_Sponsorship_Model_Total_Quote_Discount
136
+ */
137
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
138
+ {
139
+ if ($this->_amount > 0) {
140
+ $address->addTotal(array(
141
+ 'code'=>$this->getCode(),
142
+ 'title'=>$this->getLabel(),
143
+ 'value'=>$address->getAuguriaSponsorshipDiscountAmount()
144
+ ));
145
+ }
146
+ return $this;
147
+ }
148
+
149
+ public function getLabel()
150
+ {
151
+ return Mage::helper('auguria_sponsorship')->__('Sponsorship and fidelity discount');
152
+ }
153
+
154
+ }
app/code/community/Auguria/Sponsorship/Model/Validator.php DELETED
@@ -1,253 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Auguria_Sponsorship_Model_Validator extends Mage_SalesRule_Model_Validator
9
- {
10
- protected function _construct()
11
- {
12
- Mage_Core_Model_Abstract::_construct();
13
- $this->_init('salesrule/validator');
14
- }
15
-
16
- public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
17
- {
18
- $item->setDiscountAmount(0);
19
- $item->setBaseDiscountAmount(0);
20
- $item->setDiscountPercent(0);
21
- $item->setCartFidelityPoints(0);
22
- $item->setCartSponsorPoints(0);
23
- $quote = $item->getQuote();
24
- $address = $this->_getAddress($item);
25
-
26
- //Clearing applied rule ids for quote and address
27
- if ($this->_isFirstTimeProcessRun !== true){
28
- $this->_isFirstTimeProcessRun = true;
29
- $quote->setAppliedRuleIds('');
30
- $address->setAppliedRuleIds('');
31
- }
32
-
33
- $itemPrice = $item->getDiscountCalculationPrice();
34
- if ($itemPrice !== null) {
35
- $baseItemPrice = $item->getBaseDiscountCalculationPrice();
36
- } else {
37
- $itemPrice = $item->getCalculationPrice();
38
- $baseItemPrice = $item->getBaseCalculationPrice();
39
- }
40
-
41
- $appliedRuleIds = array();
42
- foreach ($this->_getRules() as $rule) {
43
- /* @var $rule Mage_SalesRule_Model_Rule */
44
- if (!$this->_canProcessRule($rule, $address)) {
45
- continue;
46
- }
47
-
48
- if (!$rule->getActions()->validate($item)) {
49
- continue;
50
- }
51
- $qty = $item->getTotalQty();
52
- $qty = $rule->getDiscountQty() ? min($qty, $rule->getDiscountQty()) : $qty;
53
- $rulePercent = min(100, $rule->getDiscountAmount());
54
-
55
- $discountAmount = 0;
56
- $baseDiscountAmount = 0;
57
- $cartFidelityPoints = 0;
58
- $cartSponsorPoints = 0;
59
- switch ($rule->getSimpleAction()) {
60
- case 'to_percent':
61
- $rulePercent = max(0, 100-$rule->getDiscountAmount());
62
- //no break;
63
- case 'by_percent':
64
- $step = $rule->getDiscountStep();
65
- if ($step) {
66
- $qty = floor($qty/$step)*$step;
67
- }
68
- $discountAmount = ($qty*$itemPrice - $item->getDiscountAmount()) * $rulePercent/100;
69
- $baseDiscountAmount= ($qty*$baseItemPrice - $item->getBaseDiscountAmount()) * $rulePercent/100;
70
-
71
- if (!$rule->getDiscountQty() || $rule->getDiscountQty()>$qty) {
72
- $discountPercent = min(100, $item->getDiscountPercent()+$rulePercent);
73
- $item->setDiscountPercent($discountPercent);
74
- }
75
- break;
76
- case 'to_fixed':
77
- $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
78
- $discountAmount = $qty*($itemPrice-$quoteAmount);
79
- $baseDiscountAmount= $qty*($baseItemPrice-$rule->getDiscountAmount());
80
- break;
81
-
82
- case 'by_fixed':
83
- $step = $rule->getDiscountStep();
84
- if ($step) {
85
- $qty = floor($qty/$step)*$step;
86
- }
87
- $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
88
- $discountAmount = $qty*$quoteAmount;
89
- $baseDiscountAmount = $qty*$rule->getDiscountAmount();
90
- break;
91
-
92
- case 'cart_fixed':
93
- $cartRules = $address->getCartFixedRules();
94
- if (!isset($cartRules[$rule->getId()])) {
95
- $cartRules[$rule->getId()] = $rule->getDiscountAmount();
96
- }
97
- if ($cartRules[$rule->getId()] > 0) {
98
- $quoteAmount = $quote->getStore()->convertPrice($cartRules[$rule->getId()]);
99
- /**
100
- * We can't use row total here because row total not include tax
101
- */
102
- $discountAmount = min($itemPrice*$qty - $item->getDiscountAmount(), $quoteAmount);
103
- $baseDiscountAmount = min($baseItemPrice*$qty - $item->getBaseDiscountAmount(), $cartRules[$rule->getId()]);
104
- $cartRules[$rule->getId()] -= $baseDiscountAmount;
105
- }
106
- $address->setCartFixedRules($cartRules);
107
- break;
108
-
109
- case 'buy_x_get_y':
110
- $x = $rule->getDiscountStep();
111
- $y = $rule->getDiscountAmount();
112
- if (!$x || $y>=$x) {
113
- break;
114
- }
115
- $buy = 0; $free = 0;
116
- while ($buy+$free<$qty) {
117
- $buy += $x;
118
- if ($buy+$free>=$qty) {
119
- break;
120
- }
121
- $free += min($y, $qty-$buy-$free);
122
- if ($buy+$free>=$qty) {
123
- break;
124
- }
125
- }
126
- $discountAmount = $free*$itemPrice;
127
- $baseDiscountAmount= $free*$baseItemPrice;
128
- break;
129
-
130
- //début case perso-------------------------------------------------------------------
131
- //fielity
132
- case 'fidelity_points_by_fixed':
133
- if ($step = $rule->getDiscountStep()) {
134
- $qty = floor($qty/$step)*$step;
135
- }
136
- $cartFidelityPoints = $qty*$rule->getDiscountAmount();
137
- break;
138
-
139
- case 'fidelity_points_by_percent':
140
- if ($step = $rule->getDiscountStep()) {
141
- $qty = floor($qty/$step)*$step;
142
- }
143
- $cartFidelityPoints = ($qty * ($item->getBaseCalculationPrice() - $item->getBaseDiscountAmount())) * $rulePercent/100;
144
- break;
145
-
146
- case 'fidelity_points_cart_fixed':
147
- $cartRules = $address->getCartFixedRules();
148
- if (!isset($cartRules[$rule->getId()])) {
149
- $cartRules[$rule->getId()] = $rule->getDiscountAmount();
150
- }
151
- if ($cartRules[$rule->getId()] > 0) {
152
- $cartFidelityPoints = max($item->getCartFidelityPoints(), $cartRules[$rule->getId()]);
153
- $cartRules[$rule->getId()] -= $cartFidelityPoints;
154
- }
155
- $address->setCartFixedRules($cartRules);
156
- break;
157
- //sponsor
158
- case 'sponsor_points_by_fixed':
159
- if ($step = $rule->getDiscountStep()) {
160
- $qty = floor($qty/$step)*$step;
161
- }
162
- $cartSponsorPoints = $qty*$rule->getDiscountAmount();
163
- break;
164
-
165
- case 'sponsor_points_by_percent':
166
- if ($step = $rule->getDiscountStep()) {
167
- $qty = floor($qty/$step)*$step;
168
- }
169
- $cartSponsorPoints = ($qty * ($item->getBaseCalculationPrice() - $item->getBaseDiscountAmount())) * $rulePercent/100;
170
- break;
171
-
172
- case 'sponsor_points_cart_fixed':
173
- $cartRules = $address->getCartFixedRules();
174
- if (!isset($cartRules[$rule->getId()])) {
175
- $cartRules[$rule->getId()] = $rule->getDiscountAmount();
176
- }
177
- if ($cartRules[$rule->getId()] > 0) {
178
- $cartSponsorPoints = max($item->getCartFidelityPoints(), $cartRules[$rule->getId()]);
179
- $cartRules[$rule->getId()] -= $cartSponsorPoints;
180
- }
181
- $address->setCartFixedRules($cartRules);
182
- break;
183
- //fin case perso-------------------------------------------------------------------
184
- }
185
- $result = new Varien_Object(array(
186
- 'discount_amount' => $discountAmount,
187
- 'base_discount_amount' => $baseDiscountAmount,
188
- 'cart_fidelity_points' => $cartFidelityPoints,
189
- 'cart_sponsor_points' => $cartSponsorPoints,
190
- ));
191
- Mage::dispatchEvent('salesrule_validator_process', array(
192
- 'rule' => $rule,
193
- 'item' => $item,
194
- 'address' => $address,
195
- 'quote' => $quote,
196
- 'qty' => $qty,
197
- 'result' => $result,
198
- ));
199
-
200
- $discountAmount = $result->getDiscountAmount();
201
- $baseDiscountAmount = $result->getBaseDiscountAmount();
202
-
203
- //On garde uniquement la règle qui apporte leplus de points
204
- $cartFidelityPoints = max($item->getCartFidelityPoints(), $cartFidelityPoints);
205
- $cartSponsorPoints = max($item->getCartSponsorPoints(), $cartSponsorPoints);
206
-
207
- $percentKey = $item->getDiscountPercent();
208
- /**
209
- * Process "delta" rounding
210
- */
211
- if ($percentKey) {
212
- $delta = isset($this->_roundingDeltas[$percentKey]) ? $this->_roundingDeltas[$percentKey] : 0;
213
- $baseDelta = isset($this->_baseRoundingDeltas[$percentKey]) ? $this->_baseRoundingDeltas[$percentKey] : 0;
214
- $discountAmount+= $delta;
215
- $baseDiscountAmount+=$baseDelta;
216
-
217
- $this->_roundingDeltas[$percentKey] = $discountAmount - $quote->getStore()->roundPrice($discountAmount);
218
- $this->_baseRoundingDeltas[$percentKey] = $baseDiscountAmount - $quote->getStore()->roundPrice($baseDiscountAmount);
219
- $discountAmount = $quote->getStore()->roundPrice($discountAmount);
220
- $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
221
- } else {
222
- $discountAmount = $quote->getStore()->roundPrice($discountAmount);
223
- $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
224
- }
225
-
226
- /**
227
- * We can't use row total here because row total not include tax
228
- * Discount can be applied on price included tax
229
- */
230
- $discountAmount = min($item->getDiscountAmount()+$discountAmount, $itemPrice*$qty);
231
- $baseDiscountAmount = min($item->getBaseDiscountAmount()+$baseDiscountAmount, $baseItemPrice*$qty);
232
-
233
- $item->setDiscountAmount($discountAmount);
234
- $item->setBaseDiscountAmount($baseDiscountAmount);
235
- $item->setCartFidelityPoints($cartFidelityPoints);
236
- $item->setCartSponsorPoints($cartSponsorPoints);
237
-
238
- $appliedRuleIds[$rule->getRuleId()] = $rule->getRuleId();
239
-
240
- if ($rule->getCouponCode() && ( strtolower($rule->getCouponCode()) == strtolower($this->getCouponCode()))) {
241
- $address->setCouponCode($this->getCouponCode());
242
- }
243
- $this->_addDiscountDescription($address, $rule);
244
- if ($rule->getStopRulesProcessing()) {
245
- break;
246
- }
247
- }
248
- $item->setAppliedRuleIds(join(',',$appliedRuleIds));
249
- $address->setAppliedRuleIds($this->mergeIds($address->getAppliedRuleIds(), $appliedRuleIds));
250
- $quote->setAppliedRuleIds($this->mergeIds($quote->getAppliedRuleIds(), $appliedRuleIds));
251
- return $this;
252
- }
253
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/controllers/Adminhtml/ChangeController.php CHANGED
@@ -23,7 +23,7 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
23
 
24
  public function editAction() {
25
  $id = $this->getRequest()->getParam('id');
26
- $model = Mage::getModel('sponsorship/change')->load($id);
27
 
28
  if ($model->getId() || $id == 0) {
29
  $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
@@ -40,12 +40,12 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
40
 
41
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
42
 
43
- $this->_addContent($this->getLayout()->createBlock('sponsorship/adminhtml_change_edit'))
44
- ->_addLeft($this->getLayout()->createBlock('sponsorship/adminhtml_change_edit_tabs'));
45
 
46
  $this->renderLayout();
47
  } else {
48
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sponsorship')->__("This change doesn't exist"));
49
  $this->_redirect('*/*/');
50
  }
51
  }
@@ -87,13 +87,13 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
87
  $this->statusCanceled ($changeId,$cdata['statut']);
88
 
89
  //Enregistrement dans la table "change"
90
- $model = Mage::getModel('sponsorship/change');
91
  $model->setData($cdata)
92
  ->setId($this->getRequest()->getParam('id'));
93
  $model->save();
94
 
95
 
96
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sponsorship')->__("The change has been successfully recorded"));
97
  Mage::getSingleton('adminhtml/session')->setFormData(false);
98
 
99
  if ($this->getRequest()->getParam('back')) {
@@ -109,7 +109,7 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
109
  return;
110
  }
111
  }
112
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sponsorship')->__("Unable to find change to save"));
113
  $this->_redirect('*/*/');
114
  }
115
 
@@ -117,7 +117,7 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
117
  {
118
  $sponsorshipIds = $this->getRequest()->getParam('change');
119
  if(!is_array($sponsorshipIds)) {
120
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sponsorship')->__("Please select changes"));
121
  } else {
122
  try {
123
  foreach ($sponsorshipIds as $sponsorshipId) {
@@ -126,7 +126,7 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
126
  $this->statusCanceled ($sponsorshipId,$this->getRequest()->getParam('statut'));
127
 
128
  //Enregistrements dans change
129
- $sponsorship = Mage::getSingleton('sponsorship/change')
130
  ->load($sponsorshipId)
131
  ->setStatut($this->getRequest()->getParam('statut'))
132
  ->setIsMassupdate(true)
@@ -145,7 +145,7 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
145
  public function exportCsvAction()
146
  {
147
  $fileName = 'sponsorshipChange.csv';
148
- $content = $this->getLayout()->createBlock('sponsorship/adminhtml_change_grid')
149
  ->getCsv();
150
  $this->_sendUploadResponse($fileName, $content);
151
  }
@@ -153,7 +153,7 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
153
  public function exportXmlAction()
154
  {
155
  $fileName = 'sponsorshipChange.xml';
156
- $content = $this->getLayout()->createBlock('sponsorship/adminhtml_change_grid')
157
  ->getXml();
158
 
159
  $this->_sendUploadResponse($fileName, $content);
@@ -177,7 +177,7 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
177
 
178
  protected function statusCanceled ($changeId, $statut)
179
  {
180
- $model = Mage::getSingleton('sponsorship/change');
181
  $model->load($changeId);
182
 
183
  //si statut passe à annulé
@@ -200,29 +200,16 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
200
  $customer->save();
201
 
202
  //Mise à jour des logs
203
- $log = Mage::getModel('sponsorship/'.$module.'log');
204
- $dateTime = Mage::getModel('core/date')->date();
205
- if ($module == 'fidelity')
206
- {
207
- $data = array(
208
  'customer_id' => $cId,
209
  'record_id' => $changeId,
210
  'record_type' => 'admin',
211
  'datetime' => $dateTime,
212
  'points' => $points
213
- );
214
- }
215
- elseif ($module == 'sponsor')
216
- {
217
- $data = array(
218
- 'godson_id' => $cId,
219
- 'sponsor_id' => $cId,
220
- 'record_id' => $changeId,
221
- 'record_type' => 'admin',
222
- 'datetime' => $dateTime,
223
- 'points' => $points
224
- );
225
- }
226
  $log->setData($data);
227
  $log->save();
228
 
@@ -248,29 +235,15 @@ class Auguria_Sponsorship_Adminhtml_ChangeController extends Mage_Adminhtml_Cont
248
  $customer->save();
249
 
250
  //Mise à jour des logs
251
- $log = Mage::getModel('sponsorship/'.$module.'log');
252
- $dateTime = Mage::getModel('core/date')->date();
253
- if ($module == 'fidelity')
254
- {
255
- $data = array(
256
  'customer_id' => $cId,
257
  'record_id' => $changeId,
258
  'record_type' => 'admin',
259
  'datetime' => $dateTime,
260
  'points' => -$points
261
- );
262
- }
263
- elseif ($module == 'sponsor')
264
- {
265
- $data = array(
266
- 'godson_id' => $cId,
267
- 'sponsor_id' => $cId,
268
- 'record_id' => $changeId,
269
- 'record_type' => 'admin',
270
- 'datetime' => $dateTime,
271
- 'points' => -$points
272
- );
273
- }
274
  $log->setData($data);
275
  $log->save();
276
  }
23
 
24
  public function editAction() {
25
  $id = $this->getRequest()->getParam('id');
26
+ $model = Mage::getModel('auguria_sponsorship/change')->load($id);
27
 
28
  if ($model->getId() || $id == 0) {
29
  $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
40
 
41
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
42
 
43
+ $this->_addContent($this->getLayout()->createBlock('auguria_sponsorship/adminhtml_change_edit'))
44
+ ->_addLeft($this->getLayout()->createBlock('auguria_sponsorship/adminhtml_change_edit_tabs'));
45
 
46
  $this->renderLayout();
47
  } else {
48
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_sponsorship')->__("This change doesn't exist"));
49
  $this->_redirect('*/*/');
50
  }
51
  }
87
  $this->statusCanceled ($changeId,$cdata['statut']);
88
 
89
  //Enregistrement dans la table "change"
90
+ $model = Mage::getModel('auguria_sponsorship/change');
91
  $model->setData($cdata)
92
  ->setId($this->getRequest()->getParam('id'));
93
  $model->save();
94
 
95
 
96
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('auguria_sponsorship')->__("The change has been successfully recorded"));
97
  Mage::getSingleton('adminhtml/session')->setFormData(false);
98
 
99
  if ($this->getRequest()->getParam('back')) {
109
  return;
110
  }
111
  }
112
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_sponsorship')->__("Unable to find change to save"));
113
  $this->_redirect('*/*/');
114
  }
115
 
117
  {
118
  $sponsorshipIds = $this->getRequest()->getParam('change');
119
  if(!is_array($sponsorshipIds)) {
120
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_sponsorship')->__("Please select changes"));
121
  } else {
122
  try {
123
  foreach ($sponsorshipIds as $sponsorshipId) {
126
  $this->statusCanceled ($sponsorshipId,$this->getRequest()->getParam('statut'));
127
 
128
  //Enregistrements dans change
129
+ $sponsorship = Mage::getSingleton('auguria_sponsorship/change')
130
  ->load($sponsorshipId)
131
  ->setStatut($this->getRequest()->getParam('statut'))
132
  ->setIsMassupdate(true)
145
  public function exportCsvAction()
146
  {
147
  $fileName = 'sponsorshipChange.csv';
148
+ $content = $this->getLayout()->createBlock('auguria_sponsorship/adminhtml_change_grid')
149
  ->getCsv();
150
  $this->_sendUploadResponse($fileName, $content);
151
  }
153
  public function exportXmlAction()
154
  {
155
  $fileName = 'sponsorshipChange.xml';
156
+ $content = $this->getLayout()->createBlock('auguria_sponsorship/adminhtml_change_grid')
157
  ->getXml();
158
 
159
  $this->_sendUploadResponse($fileName, $content);
177
 
178
  protected function statusCanceled ($changeId, $statut)
179
  {
180
+ $model = Mage::getSingleton('auguria_sponsorship/change');
181
  $model->load($changeId);
182
 
183
  //si statut passe à annulé
200
  $customer->save();
201
 
202
  //Mise à jour des logs
203
+ $log = Mage::getModel('auguria_sponsorship/log');
204
+ $dateTime = Mage::getModel('core/date')->gmtDate();
205
+
206
+ $data = array(
 
207
  'customer_id' => $cId,
208
  'record_id' => $changeId,
209
  'record_type' => 'admin',
210
  'datetime' => $dateTime,
211
  'points' => $points
212
+ );
 
 
 
 
 
 
 
 
 
 
 
 
213
  $log->setData($data);
214
  $log->save();
215
 
235
  $customer->save();
236
 
237
  //Mise à jour des logs
238
+ $log = Mage::getModel('auguria_sponsorship/log');
239
+ $dateTime = Mage::getModel('core/date')->gmtDate();
240
+ $data = array(
 
 
241
  'customer_id' => $cId,
242
  'record_id' => $changeId,
243
  'record_type' => 'admin',
244
  'datetime' => $dateTime,
245
  'points' => -$points
246
+ );
 
 
 
 
 
 
 
 
 
 
 
 
247
  $log->setData($data);
248
  $log->save();
249
  }
app/code/community/Auguria/Sponsorship/controllers/Adminhtml/LinkController.php CHANGED
@@ -9,12 +9,9 @@ class Auguria_Sponsorship_Adminhtml_LinkController extends Mage_Adminhtml_Contro
9
  {
10
 
11
  protected function _initAction() {
12
- Mage::log('before load layout');
13
  $layout = $this->loadLayout();
14
- Mage::log('after load layout');
15
  $layout->_setActiveMenu('link/items');
16
  $layout->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
17
- Mage::log('after add breadrcrumb');
18
  return $this;
19
  }
20
 
@@ -43,12 +40,12 @@ class Auguria_Sponsorship_Adminhtml_LinkController extends Mage_Adminhtml_Contro
43
 
44
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
45
 
46
- $this->_addContent($this->getLayout()->createBlock('sponsorship/adminhtml_link_edit'))
47
- ->_addLeft($this->getLayout()->createBlock('sponsorship/adminhtml_link_edit_tabs'));
48
 
49
  $this->renderLayout();
50
  } else {
51
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sponsorship')->__("This sponsorship doesn't exist"));
52
  $this->_redirect('*/*/');
53
  }
54
  }
@@ -61,7 +58,7 @@ class Auguria_Sponsorship_Adminhtml_LinkController extends Mage_Adminhtml_Contro
61
  $model = Mage::getModel('customer/customer')->load($this->getRequest()->getParam('entity_id'));
62
  $model->setSponsor($this->getRequest()->getParam('sponsor'));
63
  $model->save();
64
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sponsorship')->__('Sponsorship was successfully saved'));
65
  Mage::getSingleton('adminhtml/session')->setFormData(false);
66
 
67
  if ($this->getRequest()->getParam('back')) {
@@ -79,13 +76,13 @@ class Auguria_Sponsorship_Adminhtml_LinkController extends Mage_Adminhtml_Contro
79
  $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
80
  return;
81
  }
82
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sponsorship')->__('Unable to find sponsorship to save'));
83
  $this->_redirect('*/*/');
84
  }
85
  public function exportCsvAction()
86
  {
87
  $fileName = 'sponsorship.csv';
88
- $content = $this->getLayout()->createBlock('sponsorship/adminhtml_link_grid')
89
  ->getCsv();
90
 
91
  $this->_sendUploadResponse($fileName, $content);
@@ -94,7 +91,7 @@ class Auguria_Sponsorship_Adminhtml_LinkController extends Mage_Adminhtml_Contro
94
  public function exportXmlAction()
95
  {
96
  $fileName = 'sponsorship.xml';
97
- $content = $this->getLayout()->createBlock('sponsorship/adminhtml_link_grid')
98
  ->getXml();
99
 
100
  $this->_sendUploadResponse($fileName, $content);
9
  {
10
 
11
  protected function _initAction() {
 
12
  $layout = $this->loadLayout();
 
13
  $layout->_setActiveMenu('link/items');
14
  $layout->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
 
15
  return $this;
16
  }
17
 
40
 
41
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
42
 
43
+ $this->_addContent($this->getLayout()->createBlock('auguria_sponsorship/adminhtml_link_edit'))
44
+ ->_addLeft($this->getLayout()->createBlock('auguria_sponsorship/adminhtml_link_edit_tabs'));
45
 
46
  $this->renderLayout();
47
  } else {
48
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_sponsorship')->__("This sponsorship doesn't exist"));
49
  $this->_redirect('*/*/');
50
  }
51
  }
58
  $model = Mage::getModel('customer/customer')->load($this->getRequest()->getParam('entity_id'));
59
  $model->setSponsor($this->getRequest()->getParam('sponsor'));
60
  $model->save();
61
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('auguria_sponsorship')->__('Sponsorship was successfully saved'));
62
  Mage::getSingleton('adminhtml/session')->setFormData(false);
63
 
64
  if ($this->getRequest()->getParam('back')) {
76
  $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
77
  return;
78
  }
79
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_sponsorship')->__('Unable to find sponsorship to save'));
80
  $this->_redirect('*/*/');
81
  }
82
  public function exportCsvAction()
83
  {
84
  $fileName = 'sponsorship.csv';
85
+ $content = $this->getLayout()->createBlock('auguria_sponsorship/adminhtml_link_grid')
86
  ->getCsv();
87
 
88
  $this->_sendUploadResponse($fileName, $content);
91
  public function exportXmlAction()
92
  {
93
  $fileName = 'sponsorship.xml';
94
+ $content = $this->getLayout()->createBlock('auguria_sponsorship/adminhtml_link_grid')
95
  ->getXml();
96
 
97
  $this->_sendUploadResponse($fileName, $content);
app/code/community/Auguria/Sponsorship/controllers/Adminhtml/OpeninviterController.php CHANGED
@@ -10,7 +10,7 @@ class Auguria_Sponsorship_Adminhtml_OpeninviterController extends Mage_Adminhtml
10
 
11
  protected function _initAction() {
12
  $this->loadLayout()
13
- ->_setActiveMenu('sponsorship/openinviter')
14
  ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
15
 
16
  return $this;
@@ -29,7 +29,7 @@ class Auguria_Sponsorship_Adminhtml_OpeninviterController extends Mage_Adminhtml
29
 
30
  public function editAction() {
31
  $id = $this->getRequest()->getParam('id');
32
- $model = Mage::getModel('sponsorship/sponsorshipopeninviter')->load($id);
33
 
34
  if ($model->getId() || $id == 0) {
35
  $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
@@ -40,19 +40,19 @@ class Auguria_Sponsorship_Adminhtml_OpeninviterController extends Mage_Adminhtml
40
  Mage::register('openinviter_data', $model);
41
 
42
  $this->loadLayout();
43
- $this->_setActiveMenu('sponsorship/openinviter');
44
 
45
  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
46
  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
47
 
48
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
49
 
50
- $this->_addContent($this->getLayout()->createBlock('sponsorship/adminhtml_openinviter_edit'))
51
- ->_addLeft($this->getLayout()->createBlock('sponsorship/adminhtml_openinviter_edit_tabs'));
52
 
53
  $this->renderLayout();
54
  } else {
55
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sponsorship')->__('Invitation does not exist'));
56
  $this->_redirect('*/*/');
57
  }
58
  }
@@ -85,13 +85,13 @@ class Auguria_Sponsorship_Adminhtml_OpeninviterController extends Mage_Adminhtml
85
 
86
  if(isset($data['openinviterimage']['delete'])) $data['image'] = '';
87
 
88
- $model = Mage::getModel('sponsorship/sponsorshipopeninviter');
89
  $model->setData($data)
90
  ->setId($this->getRequest()->getParam('id'));
91
 
92
  try {
93
  $model->save();
94
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sponsorship')->__('Provider was successfully saved'));
95
  Mage::getSingleton('adminhtml/session')->setFormData(false);
96
 
97
  if ($this->getRequest()->getParam('back')) {
@@ -107,7 +107,7 @@ class Auguria_Sponsorship_Adminhtml_OpeninviterController extends Mage_Adminhtml
107
  return;
108
  }
109
  }
110
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sponsorship')->__('Unable to find provider to save'));
111
  $this->_redirect('*/*/');
112
  }
113
 
@@ -117,10 +117,10 @@ class Auguria_Sponsorship_Adminhtml_OpeninviterController extends Mage_Adminhtml
117
  {
118
  try
119
  {
120
- $model = Mage::getModel('sponsorship/sponsorshipopeninviter');
121
  $model->setId($this->getRequest()->getParam('id'))->delete();
122
 
123
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sponsorship')->__('Provider was successfully deleted'));
124
  $this->_redirect('*/*/');
125
  }
126
  catch (Exception $e)
@@ -137,7 +137,7 @@ class Auguria_Sponsorship_Adminhtml_OpeninviterController extends Mage_Adminhtml
137
  $providersIds = $this->getRequest()->getParam('openinviter');
138
  if (!is_array($providersIds))
139
  {
140
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sponsorship')->__('Please select provider(s)'));
141
  }
142
  else
143
  {
@@ -145,7 +145,7 @@ class Auguria_Sponsorship_Adminhtml_OpeninviterController extends Mage_Adminhtml
145
  {
146
  foreach ($providersIds as $providerId)
147
  {
148
- $provider = Mage::getModel('sponsorship/sponsorshipopeninviter')->load($providerId);
149
  $provider->delete();
150
  }
151
  Mage::getSingleton('adminhtml/session')->addSuccess(
@@ -175,7 +175,7 @@ class Auguria_Sponsorship_Adminhtml_OpeninviterController extends Mage_Adminhtml
175
  {
176
  foreach ($providersIds as $providerId)
177
  {
178
- $provider = Mage::getModel('sponsorship/sponsorshipopeninviter')->load($providerId)
179
  ->load($providerId)
180
  ->setStatus($this->getRequest()->getParam('status'))
181
  ->setIsMassupdate(true)
10
 
11
  protected function _initAction() {
12
  $this->loadLayout()
13
+ ->_setActiveMenu('auguria_sponsorship/openinviter')
14
  ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
15
 
16
  return $this;
29
 
30
  public function editAction() {
31
  $id = $this->getRequest()->getParam('id');
32
+ $model = Mage::getModel('auguria_sponsorship/sponsorshipopeninviter')->load($id);
33
 
34
  if ($model->getId() || $id == 0) {
35
  $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
40
  Mage::register('openinviter_data', $model);
41
 
42
  $this->loadLayout();
43
+ $this->_setActiveMenu('auguria_sponsorship/openinviter');
44
 
45
  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
46
  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
47
 
48
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
49
 
50
+ $this->_addContent($this->getLayout()->createBlock('auguria_sponsorship/adminhtml_openinviter_edit'))
51
+ ->_addLeft($this->getLayout()->createBlock('auguria_sponsorship/adminhtml_openinviter_edit_tabs'));
52
 
53
  $this->renderLayout();
54
  } else {
55
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_sponsorship')->__('Invitation does not exist'));
56
  $this->_redirect('*/*/');
57
  }
58
  }
85
 
86
  if(isset($data['openinviterimage']['delete'])) $data['image'] = '';
87
 
88
+ $model = Mage::getModel('auguria_sponsorship/sponsorshipopeninviter');
89
  $model->setData($data)
90
  ->setId($this->getRequest()->getParam('id'));
91
 
92
  try {
93
  $model->save();
94
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('auguria_sponsorship')->__('Provider was successfully saved'));
95
  Mage::getSingleton('adminhtml/session')->setFormData(false);
96
 
97
  if ($this->getRequest()->getParam('back')) {
107
  return;
108
  }
109
  }
110
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_sponsorship')->__('Unable to find provider to save'));
111
  $this->_redirect('*/*/');
112
  }
113
 
117
  {
118
  try
119
  {
120
+ $model = Mage::getModel('auguria_sponsorship/sponsorshipopeninviter');
121
  $model->setId($this->getRequest()->getParam('id'))->delete();
122
 
123
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('auguria_sponsorship')->__('Provider was successfully deleted'));
124
  $this->_redirect('*/*/');
125
  }
126
  catch (Exception $e)
137
  $providersIds = $this->getRequest()->getParam('openinviter');
138
  if (!is_array($providersIds))
139
  {
140
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_sponsorship')->__('Please select provider(s)'));
141
  }
142
  else
143
  {
145
  {
146
  foreach ($providersIds as $providerId)
147
  {
148
+ $provider = Mage::getModel('auguria_sponsorship/sponsorshipopeninviter')->load($providerId);
149
  $provider->delete();
150
  }
151
  Mage::getSingleton('adminhtml/session')->addSuccess(
175
  {
176
  foreach ($providersIds as $providerId)
177
  {
178
+ $provider = Mage::getModel('auguria_sponsorship/sponsorshipopeninviter')->load($providerId)
179
  ->load($providerId)
180
  ->setStatus($this->getRequest()->getParam('status'))
181
  ->setIsMassupdate(true)
app/code/community/Auguria/Sponsorship/controllers/Adminhtml/SponsorshipController.php CHANGED
@@ -10,7 +10,7 @@ class Auguria_Sponsorship_Adminhtml_SponsorshipController extends Mage_Adminhtml
10
 
11
  protected function _initAction() {
12
  $this->loadLayout()
13
- ->_setActiveMenu('sponsorship/items')
14
  ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
15
 
16
  return $this;
@@ -23,7 +23,7 @@ class Auguria_Sponsorship_Adminhtml_SponsorshipController extends Mage_Adminhtml
23
 
24
  public function editAction() {
25
  $id = $this->getRequest()->getParam('id');
26
- $model = Mage::getModel('sponsorship/sponsorship')->load($id);
27
 
28
  if ($model->getId() || $id == 0) {
29
  $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
@@ -34,19 +34,19 @@ class Auguria_Sponsorship_Adminhtml_SponsorshipController extends Mage_Adminhtml
34
  Mage::register('sponsorship_data', $model);
35
 
36
  $this->loadLayout();
37
- $this->_setActiveMenu('sponsorship/items');
38
 
39
  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
40
  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
41
 
42
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
43
 
44
- $this->_addContent($this->getLayout()->createBlock('sponsorship/adminhtml_sponsorship_edit'))
45
- ->_addLeft($this->getLayout()->createBlock('sponsorship/adminhtml_sponsorship_edit_tabs'));
46
 
47
  $this->renderLayout();
48
  } else {
49
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sponsorship')->__('Invitation does not exist'));
50
  $this->_redirect('*/*/');
51
  }
52
  }
@@ -82,13 +82,13 @@ class Auguria_Sponsorship_Adminhtml_SponsorshipController extends Mage_Adminhtml
82
  }
83
 
84
 
85
- $model = Mage::getModel('sponsorship/sponsorship');
86
  $model->setData($data)
87
  ->setId($this->getRequest()->getParam('id'));
88
 
89
  try {
90
  $model->save();
91
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sponsorship')->__('Invitation was successfully saved'));
92
  Mage::getSingleton('adminhtml/session')->setFormData(false);
93
 
94
  if ($this->getRequest()->getParam('back')) {
@@ -104,14 +104,14 @@ class Auguria_Sponsorship_Adminhtml_SponsorshipController extends Mage_Adminhtml
104
  return;
105
  }
106
  }
107
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sponsorship')->__('Unable to find invitation to save'));
108
  $this->_redirect('*/*/');
109
  }
110
 
111
  public function exportCsvAction()
112
  {
113
  $fileName = 'sponsorship.csv';
114
- $content = $this->getLayout()->createBlock('sponsorship/adminhtml_sponsorship_grid')
115
  ->getCsv();
116
 
117
  $this->_sendUploadResponse($fileName, $content);
@@ -120,7 +120,7 @@ class Auguria_Sponsorship_Adminhtml_SponsorshipController extends Mage_Adminhtml
120
  public function exportXmlAction()
121
  {
122
  $fileName = 'sponsorship.xml';
123
- $content = $this->getLayout()->createBlock('sponsorship/adminhtml_sponsorship_grid')
124
  ->getXml();
125
 
126
  $this->_sendUploadResponse($fileName, $content);
10
 
11
  protected function _initAction() {
12
  $this->loadLayout()
13
+ ->_setActiveMenu('auguria_sponsorship/items')
14
  ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
15
 
16
  return $this;
23
 
24
  public function editAction() {
25
  $id = $this->getRequest()->getParam('id');
26
+ $model = Mage::getModel('auguria_sponsorship/sponsorship')->load($id);
27
 
28
  if ($model->getId() || $id == 0) {
29
  $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
34
  Mage::register('sponsorship_data', $model);
35
 
36
  $this->loadLayout();
37
+ $this->_setActiveMenu('auguria_sponsorship/items');
38
 
39
  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
40
  $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
41
 
42
  $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
43
 
44
+ $this->_addContent($this->getLayout()->createBlock('auguria_sponsorship/adminhtml_sponsorship_edit'))
45
+ ->_addLeft($this->getLayout()->createBlock('auguria_sponsorship/adminhtml_sponsorship_edit_tabs'));
46
 
47
  $this->renderLayout();
48
  } else {
49
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_sponsorship')->__('Invitation does not exist'));
50
  $this->_redirect('*/*/');
51
  }
52
  }
82
  }
83
 
84
 
85
+ $model = Mage::getModel('auguria_sponsorship/sponsorship');
86
  $model->setData($data)
87
  ->setId($this->getRequest()->getParam('id'));
88
 
89
  try {
90
  $model->save();
91
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('auguria_sponsorship')->__('Invitation was successfully saved'));
92
  Mage::getSingleton('adminhtml/session')->setFormData(false);
93
 
94
  if ($this->getRequest()->getParam('back')) {
104
  return;
105
  }
106
  }
107
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_sponsorship')->__('Unable to find invitation to save'));
108
  $this->_redirect('*/*/');
109
  }
110
 
111
  public function exportCsvAction()
112
  {
113
  $fileName = 'sponsorship.csv';
114
+ $content = $this->getLayout()->createBlock('auguria_sponsorship/adminhtml_sponsorship_grid')
115
  ->getCsv();
116
 
117
  $this->_sendUploadResponse($fileName, $content);
120
  public function exportXmlAction()
121
  {
122
  $fileName = 'sponsorship.xml';
123
+ $content = $this->getLayout()->createBlock('auguria_sponsorship/adminhtml_sponsorship_grid')
124
  ->getXml();
125
 
126
  $this->_sendUploadResponse($fileName, $content);
app/code/community/Auguria/Sponsorship/controllers/BoostController.php CHANGED
@@ -31,7 +31,7 @@ class Auguria_Sponsorship_BoostController extends Mage_Core_Controller_Front_Act
31
  {
32
  $translate = Mage::getSingleton('core/translate');
33
  $translate->setTranslateInline(false);
34
- $mail = Mage::helper('sponsorship/mail');
35
  $mails = $mail->processMail($post);
36
  $validation = $mail->validateMail($mails);
37
 
@@ -42,18 +42,18 @@ class Auguria_Sponsorship_BoostController extends Mage_Core_Controller_Front_Act
42
  if ($isCustomer == true)
43
  {
44
  Mage::getSingleton('customer/session')->addError($this->__("%s is already an email to our customers",$mails[0]["recipient_email"]));
45
- $this->_redirect("*/sponsorpoints/");
46
  }
47
  else
48
  {
49
  if ($mail->sendMail($mails[0]))
50
  {
51
- Mage::getSingleton('customer/session')->addSuccess(Mage::helper('sponsorship')->__("Your email has been successfully sent."));
52
  if (!$mail->saveMail($mails[0]))
53
  {
54
  Mage::getSingleton('customer/session')->addError($this->__("But it could not be saved."));
55
  }
56
- $this->_redirect("*/sponsorpoints/");
57
  }
58
  else
59
  {
@@ -72,7 +72,7 @@ class Auguria_Sponsorship_BoostController extends Mage_Core_Controller_Front_Act
72
  }
73
  else
74
  {
75
- $this->_redirect("*/sponsorpoints/");
76
  }
77
  }
78
  }
31
  {
32
  $translate = Mage::getSingleton('core/translate');
33
  $translate->setTranslateInline(false);
34
+ $mail = Mage::helper('auguria_sponsorship/mail');
35
  $mails = $mail->processMail($post);
36
  $validation = $mail->validateMail($mails);
37
 
42
  if ($isCustomer == true)
43
  {
44
  Mage::getSingleton('customer/session')->addError($this->__("%s is already an email to our customers",$mails[0]["recipient_email"]));
45
+ $this->_redirect("*/points/");
46
  }
47
  else
48
  {
49
  if ($mail->sendMail($mails[0]))
50
  {
51
+ Mage::getSingleton('customer/session')->addSuccess(Mage::helper('auguria_sponsorship')->__("Your email has been successfully sent."));
52
  if (!$mail->saveMail($mails[0]))
53
  {
54
  Mage::getSingleton('customer/session')->addError($this->__("But it could not be saved."));
55
  }
56
+ $this->_redirect("*/points/");
57
  }
58
  else
59
  {
72
  }
73
  else
74
  {
75
+ $this->_redirect("*/points/");
76
  }
77
  }
78
  }
app/code/community/Auguria/Sponsorship/controllers/Customer/AccountController.php DELETED
@@ -1,226 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- require_once 'Mage/Customer/controllers/AccountController.php';
9
- class Auguria_Sponsorship_Customer_AccountController extends Mage_Customer_AccountController
10
- {
11
- public function createPostAction()
12
- {
13
- if ($this->_getSession()->isLoggedIn()) {
14
- $this->_redirect('*/*/');
15
- return;
16
- }
17
- if ($this->getRequest()->isPost()) {
18
- $errors = array();
19
-
20
- if (!$customer = Mage::registry('current_customer')) {
21
- $customer = Mage::getModel('customer/customer')->setId(null);
22
- }
23
-
24
- $data = $this->_filterPostData($this->getRequest()->getPost());
25
- foreach (Mage::getConfig()->getFieldset('customer_account') as $code=>$node) {
26
- if ($node->is('create') && isset($data[$code])) {
27
- if ($code == 'email') {
28
- $data[$code] = trim($data[$code]);
29
- }
30
- $customer->setData($code, $data[$code]);
31
- }
32
- }
33
-
34
- if ($this->getRequest()->getParam('is_subscribed', false)) {
35
- $customer->setIsSubscribed(1);
36
- }
37
-
38
- /**
39
- * Initialize customer group id
40
- */
41
- $customer->getGroupId();
42
-
43
- if ($this->getRequest()->getPost('create_address')) {
44
- $address = Mage::getModel('customer/address')
45
- ->setData($this->getRequest()->getPost())
46
- ->setIsDefaultBilling($this->getRequest()->getParam('default_billing', false))
47
- ->setIsDefaultShipping($this->getRequest()->getParam('default_shipping', false))
48
- ->setId(null);
49
- $customer->addAddress($address);
50
-
51
- $errors = $address->validate();
52
- if (!is_array($errors)) {
53
- $errors = array();
54
- }
55
- }
56
- //Début modification createPostAction()
57
- if ($sponsorId = mage::helper("sponsorship/data")->searchSponsorId($customer->getEmail())) {
58
- $customer->setData('sponsor',$sponsorId);
59
- $cookie = new Mage_Core_Model_Cookie;
60
- if ($cookie->get('sponsorship_id')) {
61
- $cookie->delete('sponsorship_id');
62
- $cookie->delete('sponsorship_email');
63
- $cookie->delete('sponsorship_firstname');
64
- $cookie->delete('sponsorship_lastname');
65
- }
66
- }
67
-
68
- //Fin modification createPostAction()
69
-
70
- try {
71
- $validationCustomer = $customer->validate();
72
- if (is_array($validationCustomer)) {
73
- $errors = array_merge($validationCustomer, $errors);
74
- }
75
- $validationResult = count($errors) == 0;
76
-
77
- if (true === $validationResult) {
78
- $customer->save();
79
-
80
- if ($customer->isConfirmationRequired()) {
81
- $customer->sendNewAccountEmail('confirmation', $this->_getSession()->getBeforeAuthUrl());
82
- $this->_getSession()->addSuccess($this->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%s">click here</a>.',
83
- Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail())
84
- ));
85
- $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true)));
86
- return;
87
- }
88
- else {
89
- $this->_getSession()->setCustomerAsLoggedIn($customer);
90
- $url = $this->_welcomeCustomer($customer);
91
- $this->_redirectSuccess($url);
92
- return;
93
- }
94
- } else {
95
- $this->_getSession()->setCustomerFormData($this->getRequest()->getPost());
96
- if (is_array($errors)) {
97
- foreach ($errors as $errorMessage) {
98
- $this->_getSession()->addError($errorMessage);
99
- }
100
- }
101
- else {
102
- $this->_getSession()->addError($this->__('Invalid customer data'));
103
- }
104
- }
105
- }
106
- catch (Mage_Core_Exception $e) {
107
- $this->_getSession()->addError($e->getMessage())
108
- ->setCustomerFormData($this->getRequest()->getPost());
109
- }
110
- catch (Exception $e) {
111
- $this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
112
- ->addException($e, $this->__('Can\'t save customer'));
113
- }
114
- }
115
-
116
- $this->_redirectError(Mage::getUrl('*/*/create', array('_secure'=>true)));
117
- }
118
-
119
- public function editPostAction()
120
- {
121
- if (!$this->_validateFormKey()) {
122
- return $this->_redirect('*/*/edit');
123
- }
124
-
125
- if ($this->getRequest()->isPost()) {
126
- $customer = Mage::getModel('customer/customer')
127
- ->setId($this->_getSession()->getCustomerId())
128
- ->setWebsiteId($this->_getSession()->getCustomer()->getWebsiteId());
129
-
130
- $fields = Mage::getConfig()->getFieldset('customer_account');
131
- $data = $this->_filterPostData($this->getRequest()->getPost());
132
-
133
- foreach ($fields as $code=>$node) {
134
- if ($node->is('update') && isset($data[$code])) {
135
- $customer->setData($code, $data[$code]);
136
- }
137
- }
138
-
139
- /*
140
- * Ajout des champs iban et siret
141
- */
142
-
143
- if ($this->getRequest()->getParam('iban')) {
144
- $customerIban = $this->getRequest()->getPost('iban');
145
- $customerIban = str_replace(CHR(32),"",$customerIban);
146
- $customerIban = str_replace("-","",$customerIban);
147
- $customer->setData('iban', $customerIban);
148
- }
149
-
150
- if ($this->getRequest()->getParam('siret')) {
151
- $customerSiret = $this->getRequest()->getPost('siret');
152
- $customerSiret = str_replace(CHR(32),"",$customerSiret);
153
- $customerSiret = str_replace("-","",$customerSiret);
154
- $customer->setData('siret', $customerSiret);
155
- }
156
-
157
- $errors = $customer->validate();
158
- if (!is_array($errors)) {
159
- $errors = array();
160
- }
161
-
162
- /**
163
- * we would like to preserver the existing group id
164
- */
165
- if ($this->_getSession()->getCustomerGroupId()) {
166
- $customer->setGroupId($this->_getSession()->getCustomerGroupId());
167
- }
168
- if ($this->getRequest()->getParam('change_password')) {
169
- $currPass = $this->getRequest()->getPost('current_password');
170
- $newPass = $this->getRequest()->getPost('password');
171
- $confPass = $this->getRequest()->getPost('confirmation');
172
-
173
- if (empty($currPass) || empty($newPass) || empty($confPass)) {
174
- $errors[] = $this->__('Password fields can\'t be empty.');
175
- }
176
-
177
- if ($newPass != $confPass) {
178
- $errors[] = $this->__('Please make sure your passwords match.');
179
- }
180
-
181
- $oldPass = $this->_getSession()->getCustomer()->getPasswordHash();
182
- if (strpos($oldPass, ':')) {
183
- list($_salt, $salt) = explode(':', $oldPass);
184
- } else {
185
- $salt = false;
186
- }
187
-
188
- if ($customer->hashPassword($currPass, $salt) == $oldPass) {
189
- $customer->setPassword($newPass);
190
- } else {
191
- $errors[] = $this->__('Invalid current password');
192
- }
193
- }
194
-
195
- if (!empty($errors)) {
196
- $this->_getSession()->setCustomerFormData($this->getRequest()->getPost());
197
- foreach ($errors as $message) {
198
- $this->_getSession()->addError($message);
199
- }
200
- $this->_redirect('*/*/edit');
201
- return $this;
202
- }
203
-
204
-
205
- try {
206
- $customer->save();
207
- $this->_getSession()->setCustomer($customer)
208
- ->addSuccess($this->__('Account information was successfully saved'));
209
-
210
- $this->_redirect('customer/account');
211
- return;
212
- }
213
- catch (Mage_Core_Exception $e) {
214
- $this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
215
- ->addError($e->getMessage());
216
- }
217
- catch (Exception $e) {
218
- $this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
219
- ->addException($e, $this->__('Can\'t save customer'));
220
- }
221
- }
222
-
223
- $this->_redirect('*/*/edit');
224
- }
225
- }
226
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/controllers/FidelitypointsController.php DELETED
@@ -1,353 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Auguria_Sponsorship_FidelitypointsController extends Mage_Core_Controller_Front_Action
9
- {
10
- public function preDispatch()
11
- {
12
- parent::preDispatch();
13
- if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
14
- $this->_redirectUrl(Mage::helper('customer')->getAccountUrl());
15
- }
16
- }
17
-
18
- public function indexAction()
19
- {
20
- $this->loadLayout();
21
- $this->getLayout()->getBlock('customer');
22
- $this->_initLayoutMessages('customer/session');
23
- $this->_initLayoutMessages('catalog/session');
24
- $this->renderLayout();
25
- }
26
-
27
- public function changeAction()
28
- {
29
- $module = $this->getRequest()->getParam('module');
30
- $type = $this->getRequest()->getParam('type');
31
- $resultValidate = $this->validateChange($module, $type);
32
- if ($resultValidate == 'valide' )
33
- {
34
- $this->loadLayout();
35
- $this->getLayout()
36
- ->getBlock('customer');
37
- $this->_initLayoutMessages('customer/session');
38
- $this->_initLayoutMessages('catalog/session');
39
- $this->renderLayout();
40
- }
41
- elseif ($resultValidate == 'inactif' )
42
- {
43
- $this->_redirect('*/*/');
44
- }
45
- elseif ($resultValidate == 'account' )
46
- {
47
- $this->_redirectUrl(Mage::helper('customer')->getAccountUrl().'edit');
48
- }
49
- }
50
-
51
- public function saveAction()
52
- {
53
- if (!$this->_validateFormKey()) {
54
- return $this->_redirect('*/*');
55
- }
56
- else
57
- {
58
- $module = $this->getRequest()->getPost('module');
59
- $type = $this->getRequest()->getPost('type');
60
- $points = $this->getRequest()->getPost('points');
61
- $resultValidate = $this->validateChange($module, $type, $points);
62
- $value = $this->getValue($points, $type, $module);
63
-
64
- if ($resultValidate == 'valide' )
65
- {
66
- try
67
- {
68
- $customerId = Mage::getSingleton('customer/session')->getId();
69
- $customer = Mage::getModel("customer/customer")->load($customerId);
70
-
71
- //récupération des points clients
72
- $getdatapoints = 'get'.ucfirst($module).'Points';
73
- $cPoints = $customer->$getdatapoints();
74
- //décrémentation des points du client
75
- $setdatapoints = 'set'.ucfirst($module).'Points';
76
- $newPoints = $cPoints - $points;
77
- $customer->$setdatapoints($newPoints);
78
- $customer->save();
79
-
80
- $dateTime = Mage::getModel('core/date')->date();
81
- $statut = "waiting";
82
-
83
- //inscription de l'opération dans la table des echanges
84
- $echange = Mage::getModel('sponsorship/change');
85
- $row = array(
86
- 'customer_id' => $customerId,
87
- 'type' => $type,
88
- 'module' => $module,
89
- 'statut' => $statut,
90
- 'datetime' => $dateTime,
91
- 'points' => $points,
92
- 'value' => $value
93
- );
94
- $echange->setData($row);
95
- $echange->save();
96
- $echangeId = $echange->getId();
97
-
98
- //inscription dans les logs
99
- $log = Mage::getModel('sponsorship/'.$module.'log');
100
- if ($module == 'fidelity')
101
- {
102
- $data = array(
103
- 'customer_id' => $customerId,
104
- 'record_id' => $echangeId,
105
- 'record_type' => $type,
106
- 'datetime' => $dateTime,
107
- 'points' => -$points
108
- );
109
- }
110
- elseif ($module == 'sponsor')
111
- {
112
- $data = array(
113
- 'godson_id' => $customerId,
114
- 'sponsor_id' => $customerId,
115
- 'record_id' => $echangeId,
116
- 'record_type' => $type,
117
- 'datetime' => $dateTime,
118
- 'points' => -$points
119
- );
120
- }
121
- $log->setData($data);
122
- $log->save();
123
-
124
- Mage::getSingleton('customer/session')->addSuccess(Mage::helper('sponsorship')->__('Your request has been submitted, you will soon receive an email confirmation.'));
125
- $this->_redirect('*/*/');
126
- }
127
-
128
- catch (Exception $e) {
129
- Mage::log($e->getMessage());
130
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("An error occurred while saving your request."));
131
- $this->_redirect('*/*/');
132
- }
133
- }
134
- elseif ($resultValidate == 'inactif' )
135
- {
136
- $this->_redirect('*/*/');
137
- }
138
- elseif ($resultValidate == 'account' )
139
- {
140
- $this->_redirectUrl(Mage::helper('customer')->getAccountUrl().'edit');
141
- }
142
- elseif ($resultValidate == 'points' )
143
- {
144
- $this->_redirect('*/*/change', Array('module'=>$module, 'type'=>$type));
145
- }
146
- elseif ($resultValidate == 'mail' )
147
- {
148
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("An error occurred while sending mail."));
149
- $this->_redirect('*/*/change', Array('module'=>$module, 'type'=>$type));
150
- }
151
- }
152
- }
153
-
154
- protected function validateChange($module, $type, $points='')
155
- {
156
- $options = Mage::getBlockSingleton('sponsorship/customer_account_pointsDetail');
157
- $session = Mage::getSingleton('customer/session');
158
-
159
- $Module = ucfirst($module);
160
- $Type = ucfirst($type);
161
-
162
- $changeEnabled = 'get'.$Module.$Type.'Config';
163
- $moduleEnabled = 'get'.$Module.'EnabledConfig';
164
-
165
- if (($options->$moduleEnabled()==1 && $options->$changeEnabled()==1))
166
- {
167
- $validate = 'validate'.$Type;
168
- return $this->$validate($module,$points);
169
- }
170
- else
171
- {
172
- $session->addError(Mage::helper('sponsorship')->__('The exchange of %s points in %s is disabled.',$this->__($module),$this->__($type)));
173
- return 'inactif';
174
- }
175
- }
176
- protected function validateCoupon ($module, $points='')
177
- {
178
- $validate = 'valide';
179
- $customerId = Mage::getSingleton('customer/session')->getId();
180
- $customer = Mage::getModel("customer/customer")->load($customerId);
181
-
182
- //vérification que les points à changer sonts inférieurs aux points du client
183
- if ($points != '')
184
- {
185
- $data = 'get'.ucfirst($module).'Points';
186
- $cPoints = $customer->$data();
187
- if ($points>$cPoints)
188
- {
189
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("You do not have as many points."));
190
- $validate = 'points';
191
- }
192
- else
193
- {
194
- //création de la règle panier---------------------------------------------------
195
- $options = Mage::getBlockSingleton('sponsorship/customer_account_pointsDetail');
196
- $srModel = Mage::getModel('salesrule/rule');
197
- $date = now();
198
- $chars = array("-", ":", " ");
199
- $simpledate = str_replace($chars, "", $date);
200
- $couponCode = $customerId."-".$points.$simpledate;//idClient-date-module-somme
201
- $name = $this->__("%s points exchange for customer (%s)", $this->__($module), $customerId);
202
- $description = $name;
203
- $customerGroupId = $customer->getGroupId();
204
- $discountAmount = $this->getValue ($points, "coupon", $module);
205
- $websiteId = $customer->getWebsiteId();
206
- $data = array
207
- (
208
- "name" => $name,
209
- "description" => $description,
210
- "from_date" => $date,
211
- "coupon_code" => $couponCode,
212
- "coupon_type" => 2,
213
- "uses_per_coupon" => 1,
214
- //"uses_per_customer" => 1,
215
- "customer_group_ids" => Array(0 => $customerGroupId),//get customer group
216
- "is_active" => 1,
217
- "conditions_serialized" => 'a:6:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}',
218
- "actions_serialized" => 'a:6:{s:4:"type";s:40:"salesrule/rule_condition_product_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}',
219
- "stop_rules_processing" => 0,
220
- "is_advanced" => 1,
221
- "sort_order" => 0,
222
- "simple_action" => "cart_fixed",
223
- "discount_amount" => $discountAmount,
224
- "discount_qty" => 1.0000,
225
- "discount_step" => 0,
226
- "simple_free_shipping" => 0,
227
- "times_used" => 0,
228
- "is_rss" => 1,
229
- "website_ids" => Array(0 => $websiteId)//get website id
230
- );
231
- $srModel->setData($data);
232
- $srModel->save();
233
- //envoi du mail--------------------------------------------------------------
234
- //construction du message
235
- $mailTemplate = Mage::getModel('sponsorship/Core_Email_Template');
236
-
237
- $sender_name = Mage::getStoreConfig('trans_email/ident_sales/name');
238
- $sender_email = Mage::getStoreConfig('trans_email/ident_sales/email');
239
-
240
- $subject = $this->__('%s vouchers points exchange', Mage::helper('sponsorship/mail')->getStoreName());
241
-
242
- $sender = array("name"=>$sender_name, "email"=>$sender_email);
243
- $recipient_email = $customer->getData('email');
244
-
245
- $postObject = new Varien_Object();
246
- $postObject->setData(Array ("sender_name" => $sender_name,
247
- "sender_email" => $sender_email,
248
- "recipient_firstname" => $customer->getFirstname(),
249
- "recipient_lastname" => $customer->getLastname(),
250
- "discount_amount" => $discountAmount,
251
- "subject" => $subject,
252
- "coupon_code" => $couponCode,
253
- "store_name" => Mage::helper('sponsorship/mail')->getStoreName()
254
- ));
255
-
256
- $mailTemplate->setDesignConfig(array('area' => 'frontend'))
257
- ->setReplyTo($sender_email)
258
- //->setReturnPath($sender_email)
259
- ->sendTransactional(
260
- Mage::getStoreConfig('sponsorship/coupon/template'),
261
- $sender,
262
- $recipient_email,
263
- $customer->getFirstname().' '.$customer->getLastname(),
264
- array('data' => $postObject)
265
- );
266
- if (!$mailTemplate->getSentSuccess())
267
- {
268
- $validate = "mail";
269
- }
270
-
271
- }
272
- }
273
- return $validate;
274
- }
275
-
276
- protected function validateGift ($module, $points='')
277
- {
278
- return 'valide';
279
- }
280
-
281
- protected function validateCash ($module, $points=0)
282
- {
283
- $validate = 'valide';
284
- $customerId = Mage::getSingleton('customer/session')->getId();
285
- $maxCash = "";
286
- $options = Mage::getBlockSingleton('sponsorship/customer_account_pointsDetail');
287
-
288
- //Validation qu'un Iban est renseigné
289
- $customer = Mage::getModel("customer/customer")->load($customerId);
290
-
291
- if (!$customer->getIban()) {
292
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__('To change your points into cash, you must indicate your IBAN.'));
293
- $validate = 'account';
294
- }
295
-
296
- //Validation qu'un Siret est renseigné si le max de cash pour un particulier est atteint
297
- if ($module=='sponsor') {
298
- $maxCash = $options->getSponsorMaxCashConfig ();
299
- $timeMaxCash = $options->getSponsorTimeMaxCashConfig ();
300
- }
301
- elseif ($module=='fidelity') {
302
- $maxCash = $options->getFidelityMaxCashConfig ();
303
- $timeMaxCash = $options->getFidelityTimeMaxCashConfig ();
304
- }
305
- $resource = Mage::getSingleton('core/resource');
306
- $read = $resource->getConnection('core_read');
307
- $select = $read->select()
308
- ->from($resource->getTableName('sponsorship/change'), 'SUM(points)')
309
- ->where('customer_id=?', $customerId)
310
- ->where('module=?', $module)
311
- ->where('type=?', 'cash')
312
- ->where('statut!=?', 'canceled')
313
- ->where('TO_DAYS(NOW()) - TO_DAYS(datetime) <=?', $timeMaxCash);
314
-
315
- $cashPoints = $read->fetchOne($select);
316
-
317
- //Addition des points déjà changés avec les points demandés
318
- $cashPoints = $points+$cashPoints;
319
-
320
- //vérification que le total ne dépasse pas le maximum autorisé
321
- if ($cashPoints >= $maxCash) {
322
- if (!$customer->getSiret())
323
- {
324
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__('To change more cash, you must specify a company number.'));
325
- $validate = 'account';
326
- }
327
- }
328
-
329
- //vérification que les points à changer sonts inférieurs aux points du client
330
- if ($points != '')
331
- {
332
- $data = 'get'.ucfirst($module).'Points';
333
- $cPoints = $customer->$data();
334
- if ($points>$cPoints)
335
- {
336
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("You do not have as many points."));
337
- $validate = 'points';
338
- }
339
- }
340
- return $validate;
341
- }
342
-
343
- protected function getValue ($points, $type, $module)
344
- {
345
- //if ($type == 'cash')
346
- //recuperation du taux de conversion
347
- $options = Mage::getBlockSingleton('sponsorship/customer_account_pointsDetail');
348
- $getPointsToCash = 'get'.ucfirst($module).'PointsToCashConfig';
349
- $PointsToCash = $options->$getPointsToCash();
350
- $value = round($points*$PointsToCash,2);
351
- return $value;
352
- }
353
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/controllers/IndexController.php CHANGED
@@ -11,36 +11,34 @@ class Auguria_Sponsorship_IndexController extends Mage_Core_Controller_Front_Act
11
  {
12
  parent::preDispatch();
13
  //verification que le module de parrainage est activé
14
- if( !Mage::getStoreConfig('sponsorship/sponsor/sponsor_enabled')) {
 
15
  $this->_redirect('');
16
  }
17
  //verification que l'utilisateur est logué
18
  elseif (!Mage::getSingleton('customer/session')->isLoggedIn()) {
19
  $this->_redirectUrl(Mage::helper('customer')->getAccountUrl());
20
  }
21
- //verification que l'envoie de mail est autorisé sans commande
22
- elseif (!Mage::getStoreConfig('sponsorship/sponsor/sponsor_optional_order') &&
23
- !Mage::helper('sponsorship/data')->haveOrder()) {
24
- //vérification qu'une commande a été passée
25
- if (!Mage::helper('sponsorship/data')->haveOrder()) {
26
- $this->_redirecturl(Mage::helper('customer')->getAccountUrl());
27
- }
28
  }
29
  }
30
 
31
  public function indexAction()
32
  {
33
  $this->loadLayout();
34
- $this->getLayout()->getBlock('sponsorship');
35
  // ->setFormAction( Mage::getUrl('sponsorship/index/post') );
36
  $this->_initLayoutMessages('customer/session');
37
  $this->_initLayoutMessages('catalog/session');
38
  $this->renderLayout();
39
 
40
  //Ajout d'un message d'erreur si l'envoie de mail n'est pas autorisé sans commande et que le client n'a pas commandé
41
- if (!Mage::getStoreConfig('sponsorship/sponsor/sponsor_optional_order')) {
42
- if (!Mage::helper('sponsorship/data')->haveOrder()) {
43
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__('You must already have purchased to sponsor.'));
44
  }
45
  }
46
  }
@@ -54,7 +52,7 @@ class Auguria_Sponsorship_IndexController extends Mage_Core_Controller_Front_Act
54
  {
55
  $translate = Mage::getSingleton('core/translate');
56
  $translate->setTranslateInline(false);
57
- $mail = Mage::helper('sponsorship/mail');
58
  $mails = $mail->processMail($post);
59
  $validation = $mail->validateMail($mails);
60
  $checksend = false;
@@ -63,38 +61,44 @@ class Auguria_Sponsorship_IndexController extends Mage_Core_Controller_Front_Act
63
  {
64
  foreach ($mails as $email)
65
  {
66
- $isCustomer = $mail->recipientMailIsCustomer($email["recipient_email"]);
67
- if ($isCustomer == true)
68
- {
69
- Mage::getSingleton('customer/session')->addError($this->__("%s is already an email to our customers",$email["recipient_email"]));
70
- }
71
- else
72
- {
73
- if ($mail->sendMail($email))
74
- {
75
- if ($checksend == false)
76
- {
77
- Mage::getSingleton('customer/session')->addSuccess(Mage::helper('sponsorship')->__("Your email has been successfully sent."));
78
- //remove recipient from session
79
- $form = Mage::getSingleton('customer/session')->getData('sponsorship_form');
80
- $form['recipient']=array();
81
- $session->setData('sponsorship_form', $form);
82
- $checksend = true;
83
- }
84
- if (!$mail->saveMail($email))
85
- {
86
- if ($checksave == false)
87
- {
88
- Mage::getSingleton('customer/session')->addError($this->__("But it could not be saved."));
89
- $checksave = true;
90
- }
91
- }
92
- }
93
- else
94
- {
95
- Mage::getSingleton('customer/session')->addError($this->__("An error occurred, the mail to %s could not be delivred.",$email["recipient_email"]));
96
- }
97
- }
 
 
 
 
 
 
98
  }
99
  }
100
  else
11
  {
12
  parent::preDispatch();
13
  //verification que le module de parrainage est activé
14
+ $config = Mage::helper('auguria_sponsorship/config');
15
+ if( !$config->isAccumulatedEnabled() && !$config->isSponsorshipEnabled()) {
16
  $this->_redirect('');
17
  }
18
  //verification que l'utilisateur est logué
19
  elseif (!Mage::getSingleton('customer/session')->isLoggedIn()) {
20
  $this->_redirectUrl(Mage::helper('customer')->getAccountUrl());
21
  }
22
+ //verification que l'envoie de mail est autorisé sans commande et qu'une commande a été passée
23
+ elseif (!Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_optional_order') &&
24
+ !Mage::helper('auguria_sponsorship')->haveOrder()) {
25
+ $this->_redirecturl(Mage::helper('customer')->getAccountUrl());
 
 
 
26
  }
27
  }
28
 
29
  public function indexAction()
30
  {
31
  $this->loadLayout();
32
+ $this->getLayout()->getBlock('auguria_sponsorship');
33
  // ->setFormAction( Mage::getUrl('sponsorship/index/post') );
34
  $this->_initLayoutMessages('customer/session');
35
  $this->_initLayoutMessages('catalog/session');
36
  $this->renderLayout();
37
 
38
  //Ajout d'un message d'erreur si l'envoie de mail n'est pas autorisé sans commande et que le client n'a pas commandé
39
+ if (!Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_optional_order')) {
40
+ if (!Mage::helper('auguria_sponsorship/data')->haveOrder()) {
41
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__('You must already have purchased to sponsor.'));
42
  }
43
  }
44
  }
52
  {
53
  $translate = Mage::getSingleton('core/translate');
54
  $translate->setTranslateInline(false);
55
+ $mail = Mage::helper('auguria_sponsorship/mail');
56
  $mails = $mail->processMail($post);
57
  $validation = $mail->validateMail($mails);
58
  $checksend = false;
61
  {
62
  foreach ($mails as $email)
63
  {
64
+ if ($email["recipient_email"] != Mage::getSingleton('customer/session')->getCustomer()->getEmail()) {
65
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
66
+ $isCustomer = $mail->recipientMailIsCustomer($email["recipient_email"]);
67
+ if ($isCustomer == true)
68
+ {
69
+ Mage::getSingleton('customer/session')->addError($this->__("%s is already an email to our customers",$email["recipient_email"]));
70
+ }
71
+ else
72
+ {
73
+ if ($mail->sendMail($email))
74
+ {
75
+ if ($checksend == false)
76
+ {
77
+ Mage::getSingleton('customer/session')->addSuccess(Mage::helper('auguria_sponsorship')->__("Your email has been successfully sent."));
78
+ //remove recipient from session
79
+ $form = Mage::getSingleton('customer/session')->getData('sponsorship_form');
80
+ $form['recipient']=array();
81
+ $session->setData('sponsorship_form', $form);
82
+ $checksend = true;
83
+ }
84
+ if (!$mail->saveMail($email))
85
+ {
86
+ if ($checksave == false)
87
+ {
88
+ Mage::getSingleton('customer/session')->addError($this->__("But it could not be saved."));
89
+ $checksave = true;
90
+ }
91
+ }
92
+ }
93
+ else
94
+ {
95
+ Mage::getSingleton('customer/session')->addError($this->__("An error occurred, the mail to %s could not be delivred.",$email["recipient_email"]));
96
+ }
97
+ }
98
+ }
99
+ else {
100
+ Mage::getSingleton('customer/session')->addError($this->__("You can't send an invitation to yourself"));
101
+ }
102
  }
103
  }
104
  else
app/code/community/Auguria/Sponsorship/controllers/OpeninviterController.php CHANGED
@@ -11,7 +11,7 @@ class Auguria_Sponsorship_OpeninviterController extends Mage_Core_Controller_Fro
11
  {
12
  parent::preDispatch();
13
  //verification que le module de parrainage est activé
14
- if( !Mage::getStoreConfig('sponsorship/sponsor/sponsor_enabled')) {
15
  $this->_redirect('');
16
  }
17
  //verification que l'utilisateur est logué
@@ -19,10 +19,10 @@ class Auguria_Sponsorship_OpeninviterController extends Mage_Core_Controller_Fro
19
  $this->_redirectUrl(Mage::helper('customer')->getAccountUrl());
20
  }
21
  //verification que l'envoie de mail est autorisé sans commande
22
- elseif (!Mage::getStoreConfig('sponsorship/sponsor/sponsor_optional_order') &&
23
- !Mage::helper('sponsorship/data')->haveOrder()) {
24
  //vérification qu'une commande a été passée
25
- if (!Mage::helper('sponsorship/data')->haveOrder()) {
26
  $this->_redirecturl(Mage::helper('customer')->getAccountUrl());
27
  }
28
  }
@@ -30,7 +30,7 @@ class Auguria_Sponsorship_OpeninviterController extends Mage_Core_Controller_Fro
30
 
31
  public function indexAction()
32
  {
33
- $inviter = Mage::getModel('sponsorship/openinviter');
34
  $session = Mage::getSingleton('customer/session');
35
  $old_form = Mage::getSingleton('customer/session')->getData('openinviter_form');
36
 
@@ -52,15 +52,15 @@ class Auguria_Sponsorship_OpeninviterController extends Mage_Core_Controller_Fro
52
  $session->setData('openinviter_form', $form);
53
 
54
  $this->loadLayout();
55
- $this->getLayout()->getBlock('sponsorship/openinviter');
56
  $this->_initLayoutMessages('customer/session');
57
  $this->_initLayoutMessages('catalog/session');
58
  $this->renderLayout();
59
 
60
  //Ajout d'un message d'erreur si l'envoie de mail n'est pas autorisé sans commande et que le client n'a pas commandé
61
- if (!Mage::getStoreConfig('sponsorship/sponsor/sponsor_optional_order')) {
62
- if (!Mage::helper('sponsorship/data')->haveOrder()) {
63
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__('You must already have purchased to sponsor.'));
64
  }
65
  }
66
  }
@@ -75,18 +75,18 @@ class Auguria_Sponsorship_OpeninviterController extends Mage_Core_Controller_Fro
75
  if ( $post )
76
  {
77
  if (empty($post['email_box']))
78
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("Email missing !"));
79
  if (empty($post['password_box']))
80
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("Password missing !"));
81
  if (empty($post['provider_box']))
82
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("Provider missing !"));
83
 
84
  $messages = Mage::getSingleton('customer/session')->getMessages();
85
  $errors = $messages->getErrors();
86
  $form['step']= 'get_contacts';
87
  if (!count($errors))
88
  {
89
- $inviter = Mage::getModel('sponsorship/openinviter');
90
  $inviter->getOpenIniviterPlugins();
91
  include_once (Mage::getModuleDir('', 'Auguria_Sponsorship').'/Lib/OpenInviter/plugins/'.$post['provider_box'].'.plg.php');
92
  $result = $inviter->startPlugin($post['provider_box']);
@@ -94,17 +94,17 @@ class Auguria_Sponsorship_OpeninviterController extends Mage_Core_Controller_Fro
94
 
95
  $internal = $inviter->getInternalError();
96
  if ($internal)
97
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__($internal));
98
 
99
  elseif (!$inviter->login($post['email_box'],$post['password_box']))
100
  {
101
  $internal=$inviter->getInternalError();
102
  $message = ($internal ? $internal : "Login failed. Please check the email and password you have provided and try again later !");
103
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__($message));
104
  }
105
  elseif (false===$contacts=$inviter->getMyContacts())
106
  {
107
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("Unable to get contacts !"));
108
  }
109
  else
110
  {
@@ -120,7 +120,7 @@ class Auguria_Sponsorship_OpeninviterController extends Mage_Core_Controller_Fro
120
  if ($form['step']=='send_invites')
121
  {
122
  $this->loadLayout();
123
- $this->getLayout()->getBlock('sponsorship/openinviter');
124
  $this->_initLayoutMessages('customer/session');
125
  $this->_initLayoutMessages('catalog/session');
126
  $this->renderLayout();
@@ -135,7 +135,7 @@ class Auguria_Sponsorship_OpeninviterController extends Mage_Core_Controller_Fro
135
  }
136
  catch (Exception $e)
137
  {
138
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("An exception occured !"));
139
  $this->_redirect("*/*/");
140
  }
141
  }
11
  {
12
  parent::preDispatch();
13
  //verification que le module de parrainage est activé
14
+ if( !Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_enabled')) {
15
  $this->_redirect('');
16
  }
17
  //verification que l'utilisateur est logué
19
  $this->_redirectUrl(Mage::helper('customer')->getAccountUrl());
20
  }
21
  //verification que l'envoie de mail est autorisé sans commande
22
+ elseif (!Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_optional_order') &&
23
+ !Mage::getSingleton('auguria_sponsorship/data')->haveOrder()) {
24
  //vérification qu'une commande a été passée
25
+ if (!Mage::getSingleton('auguria_sponsorship/data')->haveOrder()) {
26
  $this->_redirecturl(Mage::helper('customer')->getAccountUrl());
27
  }
28
  }
30
 
31
  public function indexAction()
32
  {
33
+ $inviter = Mage::getModel('auguria_sponsorship/openinviter');
34
  $session = Mage::getSingleton('customer/session');
35
  $old_form = Mage::getSingleton('customer/session')->getData('openinviter_form');
36
 
52
  $session->setData('openinviter_form', $form);
53
 
54
  $this->loadLayout();
55
+ $this->getLayout()->getBlock('auguria_sponsorship/openinviter');
56
  $this->_initLayoutMessages('customer/session');
57
  $this->_initLayoutMessages('catalog/session');
58
  $this->renderLayout();
59
 
60
  //Ajout d'un message d'erreur si l'envoie de mail n'est pas autorisé sans commande et que le client n'a pas commandé
61
+ if (!Mage::getStoreConfig('auguria_sponsorship/sponsor/sponsor_optional_order')) {
62
+ if (!Mage::getSingleton('auguria_sponsorship/data')->haveOrder()) {
63
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__('You must already have purchased to sponsor.'));
64
  }
65
  }
66
  }
75
  if ( $post )
76
  {
77
  if (empty($post['email_box']))
78
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__("Email missing !"));
79
  if (empty($post['password_box']))
80
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__("Password missing !"));
81
  if (empty($post['provider_box']))
82
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__("Provider missing !"));
83
 
84
  $messages = Mage::getSingleton('customer/session')->getMessages();
85
  $errors = $messages->getErrors();
86
  $form['step']= 'get_contacts';
87
  if (!count($errors))
88
  {
89
+ $inviter = Mage::getModel('auguria_sponsorship/openinviter');
90
  $inviter->getOpenIniviterPlugins();
91
  include_once (Mage::getModuleDir('', 'Auguria_Sponsorship').'/Lib/OpenInviter/plugins/'.$post['provider_box'].'.plg.php');
92
  $result = $inviter->startPlugin($post['provider_box']);
94
 
95
  $internal = $inviter->getInternalError();
96
  if ($internal)
97
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__($internal));
98
 
99
  elseif (!$inviter->login($post['email_box'],$post['password_box']))
100
  {
101
  $internal=$inviter->getInternalError();
102
  $message = ($internal ? $internal : "Login failed. Please check the email and password you have provided and try again later !");
103
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__($message));
104
  }
105
  elseif (false===$contacts=$inviter->getMyContacts())
106
  {
107
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__("Unable to get contacts !"));
108
  }
109
  else
110
  {
120
  if ($form['step']=='send_invites')
121
  {
122
  $this->loadLayout();
123
+ $this->getLayout()->getBlock('auguria_sponsorship/openinviter');
124
  $this->_initLayoutMessages('customer/session');
125
  $this->_initLayoutMessages('catalog/session');
126
  $this->renderLayout();
135
  }
136
  catch (Exception $e)
137
  {
138
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__("An exception occured !"));
139
  $this->_redirect("*/*/");
140
  }
141
  }
app/code/community/Auguria/Sponsorship/controllers/PointsController.php ADDED
@@ -0,0 +1,391 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Auguria_Sponsorship_PointsController extends Mage_Core_Controller_Front_Action
9
+ {
10
+ public function preDispatch()
11
+ {
12
+ parent::preDispatch();
13
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
14
+ $this->_redirectUrl(Mage::helper('customer')->getAccountUrl());
15
+ }
16
+ }
17
+
18
+
19
+ public function indexAction()
20
+ {
21
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
22
+ if ($mode=='accumulated') {
23
+ $this->_redirect('*/*/accumulated');
24
+ }
25
+ elseif ($mode=='separated') {
26
+ $this->_redirect('*/*/sponsorship');
27
+ }
28
+ elseif ($mode=='sponsorship') {
29
+ $this->_redirect('*/*/sponsorship');
30
+ }
31
+ elseif ($mode=='fidelity') {
32
+ $this->_redirect('*/*/fidelity');
33
+ }
34
+ else {
35
+ $this->_redirectUrl(Mage::helper('customer')->getAccountUrl());
36
+ }
37
+ }
38
+
39
+ public function accumulatedAction()
40
+ {
41
+ $this->loadLayout();
42
+ $this->getLayout()->getBlock('customer');
43
+ $this->_initLayoutMessages('customer/session');
44
+ $this->_initLayoutMessages('catalog/session');
45
+ $this->renderLayout();
46
+ }
47
+
48
+ public function sponsorshipAction()
49
+ {
50
+ $this->loadLayout();
51
+ $this->getLayout()->getBlock('customer');
52
+ $this->_initLayoutMessages('customer/session');
53
+ $this->_initLayoutMessages('catalog/session');
54
+ $this->renderLayout();
55
+ }
56
+
57
+ public function fidelityAction()
58
+ {
59
+ $this->loadLayout();
60
+ $this->getLayout()->getBlock('customer');
61
+ $this->_initLayoutMessages('customer/session');
62
+ $this->_initLayoutMessages('catalog/session');
63
+ $this->renderLayout();
64
+ }
65
+
66
+ /**
67
+ * @TODO changeAccumulated + changeFidelityAction + changeSponsorshipAction
68
+ *
69
+ */
70
+
71
+ public function changeAction()
72
+ {
73
+ $module = $this->getRequest()->getParam('module');
74
+ $type = $this->getRequest()->getParam('type');
75
+ $resultValidate = $this->_validateChange($module, $type);
76
+ if ($resultValidate == 'valide' )
77
+ {
78
+ $this->loadLayout();
79
+ $this->getLayout()
80
+ ->getBlock('customer');
81
+ $this->_initLayoutMessages('customer/session');
82
+ $this->_initLayoutMessages('catalog/session');
83
+ $this->renderLayout();
84
+ }
85
+ elseif ($resultValidate == 'inactif' )
86
+ {
87
+ $this->_redirect('*/*/');
88
+ }
89
+ elseif ($resultValidate == 'account' )
90
+ {
91
+ $this->_redirectUrl(Mage::helper('customer')->getAccountUrl().'edit');
92
+ }
93
+ }
94
+
95
+ public function saveAction()
96
+ {
97
+ if (!$this->_validateFormKey()) {
98
+ return $this->_redirect('*/*');
99
+ }
100
+ else
101
+ {
102
+ $module = $this->getRequest()->getPost('module');
103
+ $type = $this->getRequest()->getPost('type');
104
+ $points = $this->getRequest()->getPost('points');
105
+ $resultValidate = $this->_validateChange($module, $type, $points);
106
+ $value = $this->_getValue($points, $type, $module);
107
+
108
+ if ($resultValidate == 'valide' )
109
+ {
110
+ try
111
+ {
112
+ $customerId = Mage::getSingleton('customer/session')->getId();
113
+ $customer = Mage::getModel("customer/customer")->load($customerId);
114
+
115
+ //récupération des points clients
116
+ $getdatapoints = 'get'.ucfirst($module).'Points';
117
+ $cPoints = $customer->$getdatapoints();
118
+ //décrémentation des points du client
119
+ $setdatapoints = 'set'.ucfirst($module).'Points';
120
+ $newPoints = $cPoints - $points;
121
+ $customer->$setdatapoints($newPoints);
122
+ $customer->save();
123
+
124
+ $dateTime = Mage::getModel('core/date')->gmtDate();
125
+ $statut = "waiting";
126
+
127
+ //inscription de l'opération dans la table des echanges
128
+ $echange = Mage::getModel('auguria_sponsorship/change');
129
+ $row = array(
130
+ 'customer_id' => $customerId,
131
+ 'type' => $type,
132
+ 'module' => $module,
133
+ 'statut' => $statut,
134
+ 'datetime' => $dateTime,
135
+ 'points' => $points,
136
+ 'value' => $value
137
+ );
138
+ $echange->setData($row);
139
+ $echange->save();
140
+ $echangeId = $echange->getId();
141
+
142
+ //inscription dans les logs
143
+ $log = Mage::getModel('auguria_sponsorship/log');
144
+ $data = array(
145
+ 'customer_id' => $customerId,
146
+ 'record_id' => $echangeId,
147
+ 'record_type' => $type,
148
+ 'datetime' => $dateTime,
149
+ 'points' => -$points
150
+ );
151
+ $log->setData($data);
152
+ $log->save();
153
+
154
+ Mage::getSingleton('customer/session')->addSuccess(Mage::helper('auguria_sponsorship')->__('Your request has been submitted, you will soon receive an email confirmation.'));
155
+ if ($module=='sponsor') {
156
+ $module = 'sponsorship';
157
+ }
158
+ $this->_redirect('*/*/'.$module);
159
+ }
160
+
161
+ catch (Exception $e) {
162
+ Mage::log($e->getMessage());
163
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__("An error occurred while saving your request."));
164
+ $this->_redirect('*/*/');
165
+ }
166
+ }
167
+ elseif ($resultValidate == 'inactif' )
168
+ {
169
+ $this->_redirect('*/*/');
170
+ }
171
+ elseif ($resultValidate == 'account' )
172
+ {
173
+ $this->_redirectUrl(Mage::helper('customer')->getAccountUrl().'edit');
174
+ }
175
+ elseif ($resultValidate == 'points' )
176
+ {
177
+ $this->_redirect('*/*/change', Array('module'=>$module, 'type'=>$type));
178
+ }
179
+ elseif ($resultValidate == 'mail' )
180
+ {
181
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__("An error occurred while sending mail."));
182
+ $this->_redirect('*/*/change', Array('module'=>$module, 'type'=>$type));
183
+ }
184
+ }
185
+ }
186
+
187
+ protected function _validateChange($module, $type, $points='')
188
+ {
189
+ $options = Mage::getBlockSingleton('auguria_sponsorship/customer_account_pointsDetail');
190
+ $session = Mage::getSingleton('customer/session');
191
+
192
+ $Module = ucfirst($module);
193
+ $Type = ucfirst($type);
194
+
195
+ $changeEnabled = 'get'.$Module.$Type.'Config';
196
+ $moduleEnabled = 'get'.$Module.'EnabledConfig';
197
+
198
+ if (($options->$moduleEnabled()==1 && $options->$changeEnabled()==1))
199
+ {
200
+ $validate = '_validate'.$Type;
201
+ return $this->$validate($module,$points);
202
+ }
203
+ else
204
+ {
205
+ $session->addError(Mage::helper('auguria_sponsorship')->__('The exchange of %s points in %s is disabled.',$this->__($module),$this->__($type)));
206
+ return 'inactif';
207
+ }
208
+ }
209
+ protected function _validateCoupon ($module, $points='')
210
+ {
211
+ $validate = 'valide';
212
+ $customerId = Mage::getSingleton('customer/session')->getId();
213
+ $customer = Mage::getModel("customer/customer")->load($customerId);
214
+
215
+ //vérification que les points à changer sonts inférieurs aux points du client
216
+ if ($points != '')
217
+ {
218
+ $data = 'get'.ucfirst($module).'Points';
219
+ $cPoints = $customer->$data();
220
+ if ($points>$cPoints)
221
+ {
222
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__("You do not have as many points."));
223
+ $validate = 'points';
224
+ }
225
+ else
226
+ {
227
+ //création de la règle panier---------------------------------------------------
228
+ $options = Mage::getBlockSingleton('auguria_sponsorship/customer_account_pointsDetail');
229
+ $srModel = Mage::getModel('salesrule/rule');
230
+ $date = Mage::getModel('core/date')->gmtDate();
231
+ $chars = array("-", ":", " ");
232
+ $simpledate = str_replace($chars, "", $date);
233
+ $couponCode = $customerId."-".$points.$simpledate;//idClient-date-module-somme
234
+ $name = $this->__("%s points exchange for customer (%s)", $this->__($module), $customerId);
235
+ $description = $name;
236
+ $customerGroupId = $customer->getGroupId();
237
+ $discountAmount = $this->_getValue ($points, "coupon", $module);
238
+ $websiteId = $customer->getWebsiteId();
239
+ $data = array
240
+ (
241
+ "name" => $name,
242
+ "description" => $description,
243
+ "from_date" => $date,
244
+ "coupon_code" => $couponCode,
245
+ "coupon_type" => 2,
246
+ "uses_per_coupon" => 1,
247
+ //"uses_per_customer" => 1,
248
+ "customer_group_ids" => Array(0 => $customerGroupId),//get customer group
249
+ "is_active" => 1,
250
+ "conditions_serialized" => 'a:6:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}',
251
+ "actions_serialized" => 'a:6:{s:4:"type";s:40:"salesrule/rule_condition_product_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}',
252
+ "stop_rules_processing" => 0,
253
+ "is_advanced" => 1,
254
+ "sort_order" => 0,
255
+ "simple_action" => "cart_fixed",
256
+ "discount_amount" => $discountAmount,
257
+ "discount_qty" => 1.0000,
258
+ "discount_step" => 0,
259
+ "simple_free_shipping" => 0,
260
+ "times_used" => 0,
261
+ "is_rss" => 1,
262
+ "website_ids" => Array(0 => $websiteId)//get website id
263
+ );
264
+ $srModel->setData($data);
265
+ $srModel->save();
266
+ //envoi du mail--------------------------------------------------------------
267
+ //construction du message
268
+ $mailTemplate = Mage::getModel('auguria_sponsorship/Core_Email_Template');
269
+
270
+ $sender_name = Mage::getStoreConfig('trans_email/ident_sales/name');
271
+ $sender_email = Mage::getStoreConfig('trans_email/ident_sales/email');
272
+
273
+ $subject = $this->__('%s vouchers points exchange', Mage::helper('auguria_sponsorship/mail')->getStoreName());
274
+
275
+ $sender = array("name"=>$sender_name, "email"=>$sender_email);
276
+ $recipient_email = $customer->getData('email');
277
+
278
+ $postObject = new Varien_Object();
279
+ $postObject->setData(Array ("sender_name" => $sender_name,
280
+ "sender_email" => $sender_email,
281
+ "recipient_firstname" => $customer->getFirstname(),
282
+ "recipient_lastname" => $customer->getLastname(),
283
+ "discount_amount" => $discountAmount,
284
+ "subject" => $subject,
285
+ "coupon_code" => $couponCode,
286
+ "store_name" => Mage::helper('auguria_sponsorship/mail')->getStoreName()
287
+ ));
288
+
289
+ $mailTemplate->setDesignConfig(array('area' => 'frontend'))
290
+ ->setReplyTo($sender_email)
291
+ //->setReturnPath($sender_email)
292
+ ->sendTransactional(
293
+ Mage::getStoreConfig('auguria_sponsorship/coupon/template'),
294
+ $sender,
295
+ $recipient_email,
296
+ $customer->getFirstname().' '.$customer->getLastname(),
297
+ array('data' => $postObject)
298
+ );
299
+ if (!$mailTemplate->getSentSuccess())
300
+ {
301
+ $validate = "mail";
302
+ }
303
+
304
+ }
305
+ }
306
+ return $validate;
307
+ }
308
+
309
+ protected function _validateGift ($module, $points='')
310
+ {
311
+ return 'valide';
312
+ }
313
+
314
+ protected function _validateCash ($module, $points=0)
315
+ {
316
+ $validate = 'valide';
317
+ $customerId = Mage::getSingleton('customer/session')->getId();
318
+ $maxCash = "";
319
+ $options = Mage::getBlockSingleton('auguria_sponsorship/customer_account_pointsDetail');
320
+
321
+ //Validation qu'un Iban est renseigné
322
+ $customer = Mage::getModel("customer/customer")->load($customerId);
323
+
324
+ if (!$customer->getIban()) {
325
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__('To change your points into cash, you must indicate your IBAN.'));
326
+ $validate = 'account';
327
+ }
328
+
329
+ //Validation qu'un Siret est renseigné si le max de cash pour un particulier est atteint
330
+ if ($module=='sponsor') {
331
+ $maxCash = $options->getSponsorMaxCashConfig ();
332
+ $timeMaxCash = $options->getSponsorTimeMaxCashConfig ();
333
+ }
334
+ elseif ($module=='fidelity') {
335
+ $maxCash = $options->getFidelityMaxCashConfig ();
336
+ $timeMaxCash = $options->getFidelityTimeMaxCashConfig ();
337
+ }
338
+ elseif ($module=='accumulated') {
339
+ $maxCash = $options->getAccumulatedMaxCashConfig ();
340
+ $timeMaxCash = $options->getAccumulatedTimeMaxCashConfig ();
341
+ }
342
+ $resource = Mage::getSingleton('core/resource');
343
+ $read = $resource->getConnection('core_read');
344
+ $datetime = Mage::getModel('core/date')->gmtDate();
345
+ $select = $read->select()
346
+ ->from($resource->getTableName('auguria_sponsorship/change'), 'SUM(points)')
347
+ ->where('customer_id=?', $customerId)
348
+ ->where('module=?', $module)
349
+ ->where('type=?', 'cash')
350
+ ->where('statut!=?', 'canceled')
351
+ ->where('TO_DAYS("'.$datetime.'") - TO_DAYS(datetime) <=?', $timeMaxCash);
352
+
353
+ $cashPoints = $read->fetchOne($select);
354
+
355
+ //Addition des points déjà changés avec les points demandés
356
+ $cashPoints = $points+$cashPoints;
357
+
358
+ //vérification que le total ne dépasse pas le maximum autorisé
359
+ if ($cashPoints >= $maxCash) {
360
+ if (!$customer->getSiret())
361
+ {
362
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__('To change more cash, you must specify a company number.'));
363
+ $validate = 'account';
364
+ }
365
+ }
366
+
367
+ //vérification que les points à changer sonts inférieurs aux points du client
368
+ if ($points != '')
369
+ {
370
+ $data = 'get'.ucfirst($module).'Points';
371
+ $cPoints = $customer->$data();
372
+ if ($points>$cPoints)
373
+ {
374
+ Mage::getSingleton('customer/session')->addError(Mage::helper('auguria_sponsorship')->__("You do not have as many points."));
375
+ $validate = 'points';
376
+ }
377
+ }
378
+ return $validate;
379
+ }
380
+
381
+ protected function _getValue ($points, $type, $module)
382
+ {
383
+ //if ($type == 'cash')
384
+ //recuperation du taux de conversion
385
+ $options = Mage::getBlockSingleton('auguria_sponsorship/customer_account_pointsDetail');
386
+ $getPointsToCash = 'get'.ucfirst($module).'PointsToCashConfig';
387
+ $PointsToCash = $options->$getPointsToCash();
388
+ $value = round($points*$PointsToCash,2);
389
+ return $value;
390
+ }
391
+ }
app/code/community/Auguria/Sponsorship/controllers/SponsorpointsController.php DELETED
@@ -1,353 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- class Auguria_Sponsorship_SponsorpointsController extends Mage_Core_Controller_Front_Action
9
- {
10
- public function preDispatch()
11
- {
12
- parent::preDispatch();
13
- if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
14
- $this->_redirectUrl(Mage::helper('customer')->getAccountUrl());
15
- }
16
- }
17
-
18
- public function indexAction()
19
- {
20
- $this->loadLayout();
21
- $this->getLayout()->getBlock('customer');
22
- $this->_initLayoutMessages('customer/session');
23
- $this->_initLayoutMessages('catalog/session');
24
- $this->renderLayout();
25
- }
26
-
27
- public function changeAction()
28
- {
29
- $module = $this->getRequest()->getParam('module');
30
- $type = $this->getRequest()->getParam('type');
31
- $resultValidate = $this->validateChange($module, $type);
32
- if ($resultValidate == 'valide' )
33
- {
34
- $this->loadLayout();
35
- $this->getLayout()
36
- ->getBlock('customer');
37
- $this->_initLayoutMessages('customer/session');
38
- $this->_initLayoutMessages('catalog/session');
39
- $this->renderLayout();
40
- }
41
- elseif ($resultValidate == 'inactif' )
42
- {
43
- $this->_redirect('*/*/');
44
- }
45
- elseif ($resultValidate == 'account' )
46
- {
47
- $this->_redirectUrl(Mage::helper('customer')->getAccountUrl().'edit');
48
- }
49
- }
50
-
51
- public function saveAction()
52
- {
53
- if (!$this->_validateFormKey()) {
54
- return $this->_redirect('*/*');
55
- }
56
- else
57
- {
58
- $module = $this->getRequest()->getPost('module');
59
- $type = $this->getRequest()->getPost('type');
60
- $points = $this->getRequest()->getPost('points');
61
- $resultValidate = $this->validateChange($module, $type, $points);
62
- $value = $this->getValue($points, $type, $module);
63
-
64
- if ($resultValidate == 'valide' )
65
- {
66
- try
67
- {
68
- $customerId = Mage::getSingleton('customer/session')->getId();
69
- $customer = Mage::getModel("customer/customer")->load($customerId);
70
-
71
- //récupération des points clients
72
- $getdatapoints = 'get'.ucfirst($module).'Points';
73
- $cPoints = $customer->$getdatapoints();
74
- //décrémentation des points du client
75
- $setdatapoints = 'set'.ucfirst($module).'Points';
76
- $newPoints = $cPoints - $points;
77
- $customer->$setdatapoints($newPoints);
78
- $customer->save();
79
-
80
- $dateTime = Mage::getModel('core/date')->date();
81
- $statut = "waiting";
82
-
83
- //inscription de l'opération dans la table des echanges
84
- $echange = Mage::getModel('sponsorship/change');
85
- $row = array(
86
- 'customer_id' => $customerId,
87
- 'type' => $type,
88
- 'module' => $module,
89
- 'statut' => $statut,
90
- 'datetime' => $dateTime,
91
- 'points' => $points,
92
- 'value' => $value
93
- );
94
- $echange->setData($row);
95
- $echange->save();
96
- $echangeId = $echange->getId();
97
-
98
- //inscription dans les logs
99
- $log = Mage::getModel('sponsorship/'.$module.'log');
100
- if ($module == 'fidelity')
101
- {
102
- $data = array(
103
- 'customer_id' => $customerId,
104
- 'record_id' => $echangeId,
105
- 'record_type' => $type,
106
- 'datetime' => $dateTime,
107
- 'points' => -$points
108
- );
109
- }
110
- elseif ($module == 'sponsor')
111
- {
112
- $data = array(
113
- 'godson_id' => $customerId,
114
- 'sponsor_id' => $customerId,
115
- 'record_id' => $echangeId,
116
- 'record_type' => $type,
117
- 'datetime' => $dateTime,
118
- 'points' => -$points
119
- );
120
- }
121
- $log->setData($data);
122
- $log->save();
123
-
124
- Mage::getSingleton('customer/session')->addSuccess(Mage::helper('sponsorship')->__('Your request has been submitted, you will soon receive an email confirmation.'));
125
- $this->_redirect('*/*/');
126
- }
127
-
128
- catch (Exception $e) {
129
- Mage::log($e->getMessage());
130
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("An error occurred while saving your request."));
131
- $this->_redirect('*/*/');
132
- }
133
- }
134
- elseif ($resultValidate == 'inactif' )
135
- {
136
- $this->_redirect('*/*/');
137
- }
138
- elseif ($resultValidate == 'account' )
139
- {
140
- $this->_redirectUrl(Mage::helper('customer')->getAccountUrl().'edit');
141
- }
142
- elseif ($resultValidate == 'points' )
143
- {
144
- $this->_redirect('*/*/change', Array('module'=>$module, 'type'=>$type));
145
- }
146
- elseif ($resultValidate == 'mail' )
147
- {
148
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("An error occurred while sending mail."));
149
- $this->_redirect('*/*/change', Array('module'=>$module, 'type'=>$type));
150
- }
151
- }
152
- }
153
-
154
- protected function validateChange($module, $type, $points='')
155
- {
156
- $options = Mage::getBlockSingleton('sponsorship/customer_account_pointsDetail');
157
- $session = Mage::getSingleton('customer/session');
158
-
159
- $Module = ucfirst($module);
160
- $Type = ucfirst($type);
161
-
162
- $changeEnabled = 'get'.$Module.$Type.'Config';
163
- $moduleEnabled = 'get'.$Module.'EnabledConfig';
164
-
165
- if (($options->$moduleEnabled()==1 && $options->$changeEnabled()==1))
166
- {
167
- $validate = 'validate'.$Type;
168
- return $this->$validate($module,$points);
169
- }
170
- else
171
- {
172
- $session->addError(Mage::helper('sponsorship')->__('The exchange of %s points in %s is disabled.',$this->__($module),$this->__($type)));
173
- return 'inactif';
174
- }
175
- }
176
- protected function validateCoupon ($module, $points='')
177
- {
178
- $validate = 'valide';
179
- $customerId = Mage::getSingleton('customer/session')->getId();
180
- $customer = Mage::getModel("customer/customer")->load($customerId);
181
-
182
- //vérification que les points à changer sonts inférieurs aux points du client
183
- if ($points != '')
184
- {
185
- $data = 'get'.ucfirst($module).'Points';
186
- $cPoints = $customer->$data();
187
- if ($points>$cPoints)
188
- {
189
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("You do not have as many points."));
190
- $validate = 'points';
191
- }
192
- else
193
- {
194
- //création de la règle panier---------------------------------------------------
195
- $options = Mage::getBlockSingleton('sponsorship/customer_account_pointsDetail');
196
- $srModel = Mage::getModel('salesrule/rule');
197
- $date = now();
198
- $chars = array("-", ":", " ");
199
- $simpledate = str_replace($chars, "", $date);
200
- $couponCode = $customerId."-".$points.$simpledate;//idClient-date-module-somme
201
- $name = $this->__("%s points exchange for customer (%s)", $this->__($module), $customerId);
202
- $description = $name;
203
- $customerGroupId = $customer->getGroupId();
204
- $discountAmount = $this->getValue ($points, "coupon", $module);
205
- $websiteId = $customer->getWebsiteId();
206
- $data = array
207
- (
208
- "name" => $name,
209
- "description" => $description,
210
- "from_date" => $date,
211
- "coupon_code" => $couponCode,
212
- "coupon_type" => 2,
213
- "uses_per_coupon" => 1,
214
- //"uses_per_customer" => 1,
215
- "customer_group_ids" => Array(0 => $customerGroupId),//get customer group
216
- "is_active" => 1,
217
- "conditions_serialized" => 'a:6:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}',
218
- "actions_serialized" => 'a:6:{s:4:"type";s:40:"salesrule/rule_condition_product_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}',
219
- "stop_rules_processing" => 0,
220
- "is_advanced" => 1,
221
- "sort_order" => 0,
222
- "simple_action" => "cart_fixed",
223
- "discount_amount" => $discountAmount,
224
- "discount_qty" => 1.0000,
225
- "discount_step" => 0,
226
- "simple_free_shipping" => 0,
227
- "times_used" => 0,
228
- "is_rss" => 1,
229
- "website_ids" => Array(0 => $websiteId)//get website id
230
- );
231
- $srModel->setData($data);
232
- $srModel->save();
233
- //envoi du mail--------------------------------------------------------------
234
- //construction du message
235
- $mailTemplate = Mage::getModel('sponsorship/Core_Email_Template');
236
-
237
- $sender_name = Mage::getStoreConfig('trans_email/ident_sales/name');
238
- $sender_email = Mage::getStoreConfig('trans_email/ident_sales/email');
239
-
240
- $subject = $this->__('%s vouchers points exchange', Mage::helper('sponsorship/mail')->getStoreName());
241
-
242
- $sender = array("name"=>$sender_name, "email"=>$sender_email);
243
- $recipient_email = $customer->getData('email');
244
-
245
- $postObject = new Varien_Object();
246
- $postObject->setData(Array ("sender_name" => $sender_name,
247
- "sender_email" => $sender_email,
248
- "recipient_firstname" => $customer->getFirstname(),
249
- "recipient_lastname" => $customer->getLastname(),
250
- "discount_amount" => $discountAmount,
251
- "subject" => $subject,
252
- "coupon_code" => $couponCode,
253
- "store_name" => Mage::helper('sponsorship/mail')->getStoreName()
254
- ));
255
-
256
- $mailTemplate->setDesignConfig(array('area' => 'frontend'))
257
- ->setReplyTo($sender_email)
258
- //->setReturnPath($sender_email)
259
- ->sendTransactional(
260
- Mage::getStoreConfig('sponsorship/coupon/template'),
261
- $sender,
262
- $recipient_email,
263
- $customer->getFirstname().' '.$customer->getLastname(),
264
- array('data' => $postObject)
265
- );
266
- if (!$mailTemplate->getSentSuccess())
267
- {
268
- $validate = "mail";
269
- }
270
-
271
- }
272
- }
273
- return $validate;
274
- }
275
-
276
- protected function validateGift ($module, $points='')
277
- {
278
- return 'valide';
279
- }
280
-
281
- protected function validateCash ($module, $points=0)
282
- {
283
- $validate = 'valide';
284
- $customerId = Mage::getSingleton('customer/session')->getId();
285
- $maxCash = "";
286
- $options = Mage::getBlockSingleton('sponsorship/customer_account_pointsDetail');
287
-
288
- //Validation qu'un Iban est renseigné
289
- $customer = Mage::getModel("customer/customer")->load($customerId);
290
-
291
- if (!$customer->getIban()) {
292
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__('To change your points into cash, you must indicate your IBAN.'));
293
- $validate = 'account';
294
- }
295
-
296
- //Validation qu'un Siret est renseigné si le max de cash pour un particulier est atteint
297
- if ($module=='sponsor') {
298
- $maxCash = $options->getSponsorMaxCashConfig ();
299
- $timeMaxCash = $options->getSponsorTimeMaxCashConfig ();
300
- }
301
- elseif ($module=='fidelity') {
302
- $maxCash = $options->getFidelityMaxCashConfig ();
303
- $timeMaxCash = $options->getFidelityTimeMaxCashConfig ();
304
- }
305
- $resource = Mage::getSingleton('core/resource');
306
- $read = $resource->getConnection('core_read');
307
- $select = $read->select()
308
- ->from($resource->getTableName('sponsorship/change'), 'SUM(points)')
309
- ->where('customer_id=?', $customerId)
310
- ->where('module=?', $module)
311
- ->where('type=?', 'cash')
312
- ->where('statut!=?', 'canceled')
313
- ->where('TO_DAYS(NOW()) - TO_DAYS(datetime) <=?', $timeMaxCash);
314
-
315
- $cashPoints = $read->fetchOne($select);
316
-
317
- //Addition des points déjà changés avec les points demandés
318
- $cashPoints = $points+$cashPoints;
319
-
320
- //vérification que le total ne dépasse pas le maximum autorisé
321
- if ($cashPoints >= $maxCash) {
322
- if (!$customer->getSiret())
323
- {
324
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__('To change more cash, you must specify a company number.'));
325
- $validate = 'account';
326
- }
327
- }
328
-
329
- //vérification que les points à changer sonts inférieurs aux points du client
330
- if ($points != '')
331
- {
332
- $data = 'get'.ucfirst($module).'Points';
333
- $cPoints = $customer->$data();
334
- if ($points>$cPoints)
335
- {
336
- Mage::getSingleton('customer/session')->addError(Mage::helper('sponsorship')->__("You do not have as many points."));
337
- $validate = 'points';
338
- }
339
- }
340
- return $validate;
341
- }
342
-
343
- protected function getValue ($points, $type, $module)
344
- {
345
- //if ($type == 'cash')
346
- //recuperation du taux de conversion
347
- $options = Mage::getBlockSingleton('sponsorship/customer_account_pointsDetail');
348
- $getPointsToCash = 'get'.ucfirst($module).'PointsToCashConfig';
349
- $PointsToCash = $options->$getPointsToCash();
350
- $value = round($points*$PointsToCash,2);
351
- return $value;
352
- }
353
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/etc/config.xml CHANGED
@@ -10,7 +10,7 @@
10
  <config>
11
  <modules>
12
  <Auguria_Sponsorship>
13
- <version>1.0.10</version>
14
  </Auguria_Sponsorship>
15
  </modules>
16
  <frontend>
@@ -21,19 +21,19 @@
21
  <sponsorship_openinviter>/sponsorship/openinviter/</sponsorship_openinviter>
22
  </secure_url>
23
  <routers>
24
- <sponsorship>
25
  <use>standard</use>
26
  <args>
27
  <module>Auguria_Sponsorship</module>
28
  <frontName>sponsorship</frontName>
29
  </args>
30
- </sponsorship>
31
  </routers>
32
  <layout>
33
  <updates>
34
- <sponsorship>
35
- <file>sponsorship.xml</file>
36
- </sponsorship>
37
  </updates>
38
  </layout>
39
  <translate>
@@ -45,46 +45,97 @@
45
  </Auguria_Sponsorship>
46
  </modules>
47
  </translate>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  </frontend>
49
  <admin>
50
  <routers>
51
- <sponsorship>
52
  <use>admin</use>
53
  <args>
54
  <module>Auguria_Sponsorship</module>
55
  <frontName>sponsorship</frontName>
56
  </args>
57
- </sponsorship>
58
  </routers>
59
  </admin>
60
  <adminhtml>
61
  <menu>
62
- <sponsorship module="sponsorship">
63
  <title>Fidelity and Sponsorship</title>
64
  <sort_order>71</sort_order>
65
  <children>
66
- <invitations module="sponsorship">
67
  <title>Invitations list</title>
68
  <sort_order>0</sort_order>
69
- <action>sponsorship/adminhtml_sponsorship</action>
70
  </invitations>
71
- <parrainages module="sponsorship">
72
  <title>Sponsorships list</title>
73
  <sort_order>1</sort_order>
74
- <action>sponsorship/adminhtml_link</action>
75
  </parrainages>
76
- <echanges module="sponsorship">
77
  <title>Points exchanges list</title>
78
  <sort_order>2</sort_order>
79
- <action>sponsorship/adminhtml_change</action>
80
  </echanges>
81
- <openinviter module="sponsorship">
82
  <title>Open inviter providers</title>
83
  <sort_order>3</sort_order>
84
- <action>sponsorship/adminhtml_openinviter</action>
85
  </openinviter>
86
  </children>
87
- </sponsorship>
88
  </menu>
89
  <acl>
90
  <resources>
@@ -97,42 +148,80 @@
97
  <children>
98
  <config>
99
  <children>
100
- <sponsorship translate="title" module="sponsorship">
101
  <title>Module Sponsorship</title>
102
- </sponsorship>
103
  </children>
104
  </config>
105
  </children>
106
  </system>
107
- <sponsorship module="sponsorship">
108
  <title>Sponsorship</title>
109
  <sort_order>80</sort_order>
110
  <children>
111
- <invitations module="sponsorship">
112
  <title>Invitations list</title>
113
  </invitations>
114
- <parrainages module="sponsorship">
115
  <title>Sponsorships list</title>
116
  </parrainages>
117
- <echanges module="sponsorship">
118
  <title>Points exchanges list</title>
119
  </echanges>
120
- <openinviter module="sponsorship">
121
  <title>Open inviter providers</title>
122
  </openinviter>
123
  </children>
124
- </sponsorship>
125
  </children>
126
  </admin>
127
  </resources>
128
  </acl>
129
  <layout>
130
  <updates>
131
- <sponsorship>
132
- <file>sponsorship.xml</file>
133
- </sponsorship>
134
  </updates>
135
  </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  <translate>
137
  <modules>
138
  <Auguria_Sponsorship>
@@ -144,27 +233,7 @@
144
  </translate>
145
  </adminhtml>
146
  <global>
147
- <events>
148
- <!-- Création éventuelle du lien de parrainage lors de la commande -->
149
- <checkout_type_onepage_save_order_after>
150
- <observers>
151
- <set_sponsorship>
152
- <type>singleton</type>
153
- <class>Auguria_Sponsorship_Model_Observer</class>
154
- <method>setSponsor</method>
155
- </set_sponsorship>
156
- </observers>
157
- </checkout_type_onepage_save_order_after>
158
- <!-- Affiliation sur toutes les pages -->
159
- <controller_action_predispatch>
160
- <observers>
161
- <affiliate>
162
- <type>singleton</type>
163
- <class>Auguria_Sponsorship_Model_Observer</class>
164
- <method>affiliate</method>
165
- </affiliate>
166
- </observers>
167
- </controller_action_predispatch>
168
  <sales_order_payment_pay>
169
  <observers>
170
  <!-- Incrémentation des points lors du paiement -->
@@ -181,18 +250,18 @@
181
  </auguria_sponsorship_first_order>
182
  </observers>
183
  </sales_order_payment_pay>
184
- <!-- Add points while customer register -->
185
- <customer_save_before>
186
  <observers>
187
- <auguria_sponsorship_register_newsletter>
188
  <type>singleton</type>
189
  <class>Auguria_Sponsorship_Model_Observer</class>
190
- <method>addNewsletterPoints</method>
191
- </auguria_sponsorship_register_newsletter>
192
- </observers>
193
- </customer_save_before>
194
  </events>
195
  <fieldsets>
 
196
  <sales_convert_quote_item>
197
  <cart_fidelity_points>
198
  <to_order_item>*</to_order_item>
@@ -201,71 +270,83 @@
201
  <to_order_item>*</to_order_item>
202
  </cart_sponsor_points>
203
  </sales_convert_quote_item>
204
- <sales_convert_order_item>
205
- <cart_fidelity_points>
206
- <to_quote_item>*</to_quote_item>
207
- </cart_fidelity_points>
208
- <cart_sponsor_points>
209
- <to_quote_item>*</to_quote_item>
210
- </cart_sponsor_points>
211
- </sales_convert_order_item>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  </fieldsets>
213
- <rewrite>
214
- <auguria_sponsorship_customer_account>
215
- <from><![CDATA[#^/customer/account/#]]></from><!-- si index à la place de account : ne pas mettre index -->
216
- <to>/sponsorship/customer_account/</to>
217
- </auguria_sponsorship_customer_account>
218
- </rewrite>
219
  <models>
220
  <catalogrule_mysql4>
221
  <rewrite>
222
  <rule>Auguria_Sponsorship_Model_Mysql4_Rule</rule>
223
  </rewrite>
224
  </catalogrule_mysql4>
225
- <salesrule>
226
- <rewrite>
227
- <validator>Auguria_Sponsorship_Model_Validator</validator>
228
- </rewrite>
229
- </salesrule>
230
- <customer>
231
- <rewrite>
232
- <customer>Auguria_Sponsorship_Model_Customer_Customer</customer>
233
- </rewrite>
234
- </customer>
235
- <sponsorship>
236
  <class>Auguria_Sponsorship_Model</class>
237
- <resourceModel>sponsorship_mysql4</resourceModel>
238
- </sponsorship>
239
- <sponsorship_mysql4>
240
  <class>Auguria_Sponsorship_Model_Mysql4</class>
241
  <entities>
242
  <sponsorship>
243
- <table>sponsorship</table>
244
  </sponsorship>
245
  <catalogfidelitypoint>
246
- <table>catalogrule_product_fidelity_point</table>
247
  </catalogfidelitypoint>
248
  <catalogsponsorpoint>
249
- <table>catalogrule_product_sponsor_point</table>
250
  </catalogsponsorpoint>
251
- <fidelitylog>
252
- <table>sponsorship_fidelity_log</table>
253
- </fidelitylog>
254
- <sponsorlog>
255
- <table>sponsorship_sponsor_log</table>
256
- </sponsorlog>
257
  <change>
258
- <table>sponsorship_change</table>
259
  </change>
260
- <link>
261
- <table>sponsorship_change</table>
262
- </link>
263
  <sponsorshipopeninviter>
264
- <table>sponsorship_openinviter</table>
265
  </sponsorshipopeninviter>
266
  </entities>
267
- </sponsorship_mysql4>
268
- <!-- rewrite socialbookmarking url -->
269
  <socialbookmarking>
270
  <rewrite>
271
  <urls>Auguria_Sponsorship_Model_SocialBookmarking_Urls</urls>
@@ -273,115 +354,212 @@
273
  </socialbookmarking>
274
  </models>
275
  <resources>
276
- <sponsorship_setup>
277
  <setup>
278
  <module>Auguria_Sponsorship</module>
 
279
  </setup>
280
  <connection>
281
  <use>core_setup</use>
282
  </connection>
283
- </sponsorship_setup>
284
- <sponsorship_write>
285
  <connection>
286
  <use>core_write</use>
287
  </connection>
288
- </sponsorship_write>
289
- <sponsorship_read>
290
  <connection>
291
  <use>core_read</use>
292
  </connection>
293
- </sponsorship_read>
294
  </resources>
295
  <blocks>
296
- <sponsorship>
297
  <class>Auguria_Sponsorship_Block</class>
298
- </sponsorship>
299
- <adminhtml>
300
- <rewrite>
301
- <promo_catalog_edit_tab_actions>Auguria_Sponsorship_Block_Promo_Catalog_Edit_Tab_Actions</promo_catalog_edit_tab_actions>
302
- <promo_quote_edit_tab_actions>Auguria_Sponsorship_Block_Promo_Quote_Edit_Tab_Actions</promo_quote_edit_tab_actions>
303
- </rewrite>
304
- </adminhtml>
305
- <customer>
 
 
 
 
306
  <rewrite>
307
  <widget_name>Auguria_Sponsorship_Block_Customer_Widget_Name</widget_name>
308
  </rewrite>
309
- </customer>
 
 
 
 
 
 
310
  </blocks>
311
  <helpers>
312
- <sponsorship>
313
  <class>Auguria_Sponsorship_Helper</class>
314
- </sponsorship>
315
  </helpers>
316
  <template>
317
  <email>
318
- <sponsorship_coupon_template translate="label" module="sponsorship">
319
  <label>Sponsorship coupon</label>
320
- <file>sponsorship_coupon.html</file>
321
  <type>html</type>
322
- </sponsorship_coupon_template>
323
- <sponsorship_invitation_template translate="label" module="sponsorship">
324
  <label>Sponsorship invitation</label>
325
- <file>sponsorship_invitation.html</file>
 
 
 
 
 
 
 
 
 
 
326
  <type>html</type>
327
- </sponsorship_invitation_template>
328
  </email>
329
  </template>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  </global>
331
 
332
  <default>
333
- <sponsorship>
334
- <invitation>
335
- <template>sponsorship_invitation_template</template>
336
- <sponsor_invitation_validity>365</sponsor_invitation_validity>
337
- <time_before_boost>7</time_before_boost>
338
- <max_recipients>20</max_recipients>
339
- </invitation>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  <sponsor>
341
- <sponsor_enabled>1</sponsor_enabled>
 
342
  <sponsor_cash>1</sponsor_cash>
343
  <sponsor_coupon>1</sponsor_coupon>
 
344
  <sponsor_gift>0</sponsor_gift>
345
  <sponsor_max_cash>350</sponsor_max_cash>
346
  <sponsor_time_max_cash>90</sponsor_time_max_cash>
347
  <sponsor_points_to_cash>1</sponsor_points_to_cash>
348
  <sponsor_optional_order>1</sponsor_optional_order>
 
349
  <sponsor_link_validity>365</sponsor_link_validity>
350
  <sponsor_levels>100</sponsor_levels>
351
  <sponsor_percent>50</sponsor_percent>
352
  <godson_first_order_points>0</godson_first_order_points>
 
 
 
 
353
  </sponsor>
354
  <fidelity>
355
- <fidelity_enabled>1</fidelity_enabled>
 
356
  <fidelity_cash>1</fidelity_cash>
357
  <fidelity_coupon>1</fidelity_coupon>
 
358
  <fidelity_gift>0</fidelity_gift>
359
  <fidelity_max_cash>350</fidelity_max_cash>
360
  <fidelity_time_max_cash>90</fidelity_time_max_cash>
361
  <fidelity_points_to_cash>1</fidelity_points_to_cash>
362
  <newsletter_points>0</newsletter_points>
363
  <first_order_points>0</first_order_points>
 
 
364
  </fidelity>
 
 
 
 
 
 
365
  <coupon>
366
- <template>sponsorship_coupon_template</template>
367
  </coupon>
368
  <open_inviter>
369
  <open_inviter_enabled>0</open_inviter_enabled>
370
  <username></username>
371
  <private_key></private_key>
372
  </open_inviter>
373
- </sponsorship>
374
  </default>
375
  <crontab>
376
  <jobs>
377
- <sponsorship_boost>
 
 
 
 
 
 
 
 
378
  <schedule>
379
- <cron_expr>0 */1 * * *</cron_expr>
380
  </schedule>
381
  <run>
382
- <model>sponsorship/autoBoost::process</model>
383
  </run>
384
- </sponsorship_boost>
385
  </jobs>
386
  </crontab>
387
  </config>
10
  <config>
11
  <modules>
12
  <Auguria_Sponsorship>
13
+ <version>1.2.2</version>
14
  </Auguria_Sponsorship>
15
  </modules>
16
  <frontend>
21
  <sponsorship_openinviter>/sponsorship/openinviter/</sponsorship_openinviter>
22
  </secure_url>
23
  <routers>
24
+ <auguria_sponsorship>
25
  <use>standard</use>
26
  <args>
27
  <module>Auguria_Sponsorship</module>
28
  <frontName>sponsorship</frontName>
29
  </args>
30
+ </auguria_sponsorship>
31
  </routers>
32
  <layout>
33
  <updates>
34
+ <auguria_sponsorship>
35
+ <file>auguria/sponsorship.xml</file>
36
+ </auguria_sponsorship>
37
  </updates>
38
  </layout>
39
  <translate>
45
  </Auguria_Sponsorship>
46
  </modules>
47
  </translate>
48
+ <events>
49
+ <checkout_submit_all_after>
50
+ <observers>
51
+ <!-- Création éventuelle du lien de parrainage lors de la commande -->
52
+ <auguria_sponsorship_set_sponsorship>
53
+ <type>singleton</type>
54
+ <class>Auguria_Sponsorship_Model_Observer</class>
55
+ <method>setSponsorOnOrder</method>
56
+ </auguria_sponsorship_set_sponsorship>
57
+ <!-- Remove points in customer accounts if auguria_sponsorship_discount is set, log and insert in change -->
58
+ <auguria_sponsorship_remove_cart_points_exchange>
59
+ <type>singleton</type>
60
+ <class>Auguria_Sponsorship_Model_Observer</class>
61
+ <method>cartPointsExchange</method>
62
+ </auguria_sponsorship_remove_cart_points_exchange>
63
+ </observers>
64
+ </checkout_submit_all_after>
65
+ <!-- Affiliation sur toutes les pages -->
66
+ <controller_action_predispatch>
67
+ <observers>
68
+ <auguria_sponsorship_affiliate>
69
+ <type>singleton</type>
70
+ <class>Auguria_Sponsorship_Model_Observer</class>
71
+ <method>affiliate</method>
72
+ </auguria_sponsorship_affiliate>
73
+ </observers>
74
+ </controller_action_predispatch>
75
+
76
+ <customer_save_before>
77
+ <observers>
78
+ <!-- Add newsletter points while customer register -->
79
+ <auguria_sponsorship_register_newsletter>
80
+ <type>singleton</type>
81
+ <class>Auguria_Sponsorship_Model_Observer</class>
82
+ <method>addNewsletterPoints</method>
83
+ </auguria_sponsorship_register_newsletter>
84
+ <!-- Set sponsor while customer register -->
85
+ <auguria_sponsorship_register_customer>
86
+ <type>singleton</type>
87
+ <class>Auguria_Sponsorship_Model_Observer</class>
88
+ <method>setSponsorOnRegister</method>
89
+ </auguria_sponsorship_register_customer>
90
+ <!-- Add specific fields to customer -->
91
+ <auguria_sponsorship_update_frontend_fields>
92
+ <type>singleton</type>
93
+ <class>Auguria_Sponsorship_Model_Observer</class>
94
+ <method>frontUpdateSponsorshipFields</method>
95
+ </auguria_sponsorship_update_frontend_fields>
96
+ </observers>
97
+ </customer_save_before>
98
+ </events>
99
  </frontend>
100
  <admin>
101
  <routers>
102
+ <auguria_sponsorship>
103
  <use>admin</use>
104
  <args>
105
  <module>Auguria_Sponsorship</module>
106
  <frontName>sponsorship</frontName>
107
  </args>
108
+ </auguria_sponsorship>
109
  </routers>
110
  </admin>
111
  <adminhtml>
112
  <menu>
113
+ <auguria_sponsorship module="auguria_sponsorship">
114
  <title>Fidelity and Sponsorship</title>
115
  <sort_order>71</sort_order>
116
  <children>
117
+ <invitations module="auguria_sponsorship">
118
  <title>Invitations list</title>
119
  <sort_order>0</sort_order>
120
+ <action>auguria_sponsorship/adminhtml_sponsorship</action>
121
  </invitations>
122
+ <parrainages module="auguria_sponsorship">
123
  <title>Sponsorships list</title>
124
  <sort_order>1</sort_order>
125
+ <action>auguria_sponsorship/adminhtml_link</action>
126
  </parrainages>
127
+ <echanges module="auguria_sponsorship">
128
  <title>Points exchanges list</title>
129
  <sort_order>2</sort_order>
130
+ <action>auguria_sponsorship/adminhtml_change</action>
131
  </echanges>
132
+ <openinviter module="auguria_sponsorship">
133
  <title>Open inviter providers</title>
134
  <sort_order>3</sort_order>
135
+ <action>auguria_sponsorship/adminhtml_openinviter</action>
136
  </openinviter>
137
  </children>
138
+ </auguria_sponsorship>
139
  </menu>
140
  <acl>
141
  <resources>
148
  <children>
149
  <config>
150
  <children>
151
+ <auguria_sponsorship translate="title" module="auguria_sponsorship">
152
  <title>Module Sponsorship</title>
153
+ </auguria_sponsorship>
154
  </children>
155
  </config>
156
  </children>
157
  </system>
158
+ <auguria_sponsorship module="auguria_sponsorship">
159
  <title>Sponsorship</title>
160
  <sort_order>80</sort_order>
161
  <children>
162
+ <invitations module="auguria_sponsorship">
163
  <title>Invitations list</title>
164
  </invitations>
165
+ <parrainages module="auguria_sponsorship">
166
  <title>Sponsorships list</title>
167
  </parrainages>
168
+ <echanges module="auguria_sponsorship">
169
  <title>Points exchanges list</title>
170
  </echanges>
171
+ <openinviter module="auguria_sponsorship">
172
  <title>Open inviter providers</title>
173
  </openinviter>
174
  </children>
175
+ </auguria_sponsorship>
176
  </children>
177
  </admin>
178
  </resources>
179
  </acl>
180
  <layout>
181
  <updates>
182
+ <auguria_sponsorship>
183
+ <file>auguria/sponsorship.xml</file>
184
+ </auguria_sponsorship>
185
  </updates>
186
  </layout>
187
+ <events>
188
+ <customer_save_before>
189
+ <observers>
190
+ <auguria_sponsorship_update_admin_fields>
191
+ <type>singleton</type>
192
+ <class>Auguria_Sponsorship_Model_Observer</class>
193
+ <method>adminUpdateSponsorshipFields</method>
194
+ </auguria_sponsorship_update_admin_fields>
195
+ </observers>
196
+ </customer_save_before>
197
+ <customer_save_after>
198
+ <observers>
199
+ <auguria_sponsorship_update_admin_points>
200
+ <type>singleton</type>
201
+ <class>Auguria_Sponsorship_Model_Observer</class>
202
+ <method>adminUpdatePoints</method>
203
+ </auguria_sponsorship_update_admin_points>
204
+ </observers>
205
+ </customer_save_after>
206
+ <sales_order_creditmemo_save_before>
207
+ <observers>
208
+ <auguria_sponsorship_create_creditmemo>
209
+ <type>singleton</type>
210
+ <class>Auguria_Sponsorship_Model_Observer</class>
211
+ <method>cancelPointsOnCreditMemo</method>
212
+ </auguria_sponsorship_create_creditmemo>
213
+ </observers>
214
+ </sales_order_creditmemo_save_before>
215
+ <sales_order_save_before>
216
+ <observers>
217
+ <auguria_sponsorship_cancel_order>
218
+ <type>singleton</type>
219
+ <class>Auguria_Sponsorship_Model_Observer</class>
220
+ <method>cancelPointsOnOrderCanceled</method>
221
+ </auguria_sponsorship_cancel_order>
222
+ </observers>
223
+ </sales_order_save_before>
224
+ </events>
225
  <translate>
226
  <modules>
227
  <Auguria_Sponsorship>
233
  </translate>
234
  </adminhtml>
235
  <global>
236
+ <events>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  <sales_order_payment_pay>
238
  <observers>
239
  <!-- Incrémentation des points lors du paiement -->
250
  </auguria_sponsorship_first_order>
251
  </observers>
252
  </sales_order_payment_pay>
253
+ <salesrule_validator_process>
 
254
  <observers>
255
+ <auguria_sponsorship_points_calculation_process>
256
  <type>singleton</type>
257
  <class>Auguria_Sponsorship_Model_Observer</class>
258
+ <method>validatorPointsCalculationProcess</method>
259
+ </auguria_sponsorship_points_calculation_process>
260
+ </observers>
261
+ </salesrule_validator_process>
262
  </events>
263
  <fieldsets>
264
+ <!-- copies winning points from quote items to order items -->
265
  <sales_convert_quote_item>
266
  <cart_fidelity_points>
267
  <to_order_item>*</to_order_item>
270
  <to_order_item>*</to_order_item>
271
  </cart_sponsor_points>
272
  </sales_convert_quote_item>
273
+
274
+ <!-- inutile <sales_convert_order_item> -->
275
+ <!-- <cart_fidelity_points> -->
276
+ <!-- <to_quote_item>*</to_quote_item> -->
277
+ <!-- </cart_fidelity_points> -->
278
+ <!-- <cart_sponsor_points> -->
279
+ <!-- <to_quote_item>*</to_quote_item> -->
280
+ <!-- </cart_sponsor_points> -->
281
+ <!-- </sales_convert_order_item> -->
282
+
283
+ <sales_convert_quote_address>
284
+ <!-- copies discount amounts from quote address to order -->
285
+ <base_auguria_sponsorship_discount_amount>
286
+ <to_order>*</to_order>
287
+ </base_auguria_sponsorship_discount_amount>
288
+ <auguria_sponsorship_discount_amount>
289
+ <to_order>*</to_order>
290
+ </auguria_sponsorship_discount_amount>
291
+ <!-- copies discount points from quote address to order -->
292
+ <auguria_sponsorship_fidelity_points_used>
293
+ <to_order>*</to_order>
294
+ </auguria_sponsorship_fidelity_points_used>
295
+ <auguria_sponsorship_sponsor_points_used>
296
+ <to_order>*</to_order>
297
+ </auguria_sponsorship_sponsor_points_used>
298
+ <auguria_sponsorship_accumulated_points_used>
299
+ <to_order>*</to_order>
300
+ </auguria_sponsorship_accumulated_points_used>
301
+ </sales_convert_quote_address>
302
+ <!-- copies discount amounts from order to invoice/shipment/creditmemo -->
303
+ <sales_convert_order>
304
+ <base_auguria_sponsorship_discount_amount>
305
+ <to_invoice>*</to_invoice>
306
+ <to_shipment>*</to_shipment>
307
+ <to_cm>*</to_cm>
308
+ </base_auguria_sponsorship_discount_amount>
309
+ <auguria_sponsorship_discount_amount>
310
+ <to_invoice>*</to_invoice>
311
+ <to_shipment>*</to_shipment>
312
+ <to_cm>*</to_cm>
313
+ </auguria_sponsorship_discount_amount>
314
+ </sales_convert_order>
315
  </fieldsets>
 
 
 
 
 
 
316
  <models>
317
  <catalogrule_mysql4>
318
  <rewrite>
319
  <rule>Auguria_Sponsorship_Model_Mysql4_Rule</rule>
320
  </rewrite>
321
  </catalogrule_mysql4>
322
+ <auguria_sponsorship>
 
 
 
 
 
 
 
 
 
 
323
  <class>Auguria_Sponsorship_Model</class>
324
+ <resourceModel>auguria_sponsorship_mysql4</resourceModel>
325
+ </auguria_sponsorship>
326
+ <auguria_sponsorship_mysql4>
327
  <class>Auguria_Sponsorship_Model_Mysql4</class>
328
  <entities>
329
  <sponsorship>
330
+ <table>auguria_sponsorship</table>
331
  </sponsorship>
332
  <catalogfidelitypoint>
333
+ <table>auguria_catalogrule_product_fidelity_point</table>
334
  </catalogfidelitypoint>
335
  <catalogsponsorpoint>
336
+ <table>auguria_catalogrule_product_sponsor_point</table>
337
  </catalogsponsorpoint>
338
+ <log>
339
+ <table>auguria_sponsorship_log</table>
340
+ </log>
 
 
 
341
  <change>
342
+ <table>auguria_sponsorship_change</table>
343
  </change>
 
 
 
344
  <sponsorshipopeninviter>
345
+ <table>auguria_sponsorship_openinviter</table>
346
  </sponsorshipopeninviter>
347
  </entities>
348
+ </auguria_sponsorship_mysql4>
349
+ <!-- rewrite socialbookmarking url @todo:update-->
350
  <socialbookmarking>
351
  <rewrite>
352
  <urls>Auguria_Sponsorship_Model_SocialBookmarking_Urls</urls>
354
  </socialbookmarking>
355
  </models>
356
  <resources>
357
+ <auguria_sponsorship_setup>
358
  <setup>
359
  <module>Auguria_Sponsorship</module>
360
+ <class>Auguria_Sponsorship_Model_Eav_Entity_Setup</class>
361
  </setup>
362
  <connection>
363
  <use>core_setup</use>
364
  </connection>
365
+ </auguria_sponsorship_setup>
366
+ <auguria_sponsorship__write>
367
  <connection>
368
  <use>core_write</use>
369
  </connection>
370
+ </auguria_sponsorship__write>
371
+ <auguria_sponsorship__read>
372
  <connection>
373
  <use>core_read</use>
374
  </connection>
375
+ </auguria_sponsorship__read>
376
  </resources>
377
  <blocks>
378
+ <auguria_sponsorship>
379
  <class>Auguria_Sponsorship_Block</class>
380
+ </auguria_sponsorship>
381
+ <adminhtml>
382
+ <rewrite>
383
+ <!-- Rewrite action to allow choosing auguria sponsorship actions -->
384
+ <promo_catalog_edit_tab_actions>Auguria_Sponsorship_Block_Promo_Catalog_Edit_Tab_Actions</promo_catalog_edit_tab_actions>
385
+ <promo_quote_edit_tab_actions>Auguria_Sponsorship_Block_Promo_Quote_Edit_Tab_Actions</promo_quote_edit_tab_actions>
386
+ <!-- Rewrite Mage_Adminhtml_Block_Sales_Totals to display auguria sponsorship discount -->
387
+ <sales_order_totals>Auguria_Sponsorship_Block_Adminhtml_Sales_Order_Totals</sales_order_totals>
388
+ <sales_order_invoice_totals>Auguria_Sponsorship_Block_Adminhtml_Sales_Order_Invoice_Totals</sales_order_invoice_totals>
389
+ </rewrite>
390
+ </adminhtml>
391
+ <customer>
392
  <rewrite>
393
  <widget_name>Auguria_Sponsorship_Block_Customer_Widget_Name</widget_name>
394
  </rewrite>
395
+ </customer>
396
+ <!-- Rewrite Mage_Sales_Block_Order_Totals to display auguria sponsorship discount -->
397
+ <sales>
398
+ <rewrite>
399
+ <order_totals>Auguria_Sponsorship_Block_Sales_Order_Totals</order_totals>
400
+ </rewrite>
401
+ </sales>
402
  </blocks>
403
  <helpers>
404
+ <auguria_sponsorship>
405
  <class>Auguria_Sponsorship_Helper</class>
406
+ </auguria_sponsorship>
407
  </helpers>
408
  <template>
409
  <email>
410
+ <auguria_sponsorship_coupon_template translate="label" module="auguria_sponsorship">
411
  <label>Sponsorship coupon</label>
412
+ <file>auguria/sponsorship/sponsorship_coupon.html</file>
413
  <type>html</type>
414
+ </auguria_sponsorship_coupon_template>
415
+ <auguria_sponsorship_invitation_template translate="label" module="auguria_sponsorship">
416
  <label>Sponsorship invitation</label>
417
+ <file>auguria/sponsorship/sponsorship_invitation.html</file>
418
+ <type>html</type>
419
+ </auguria_sponsorship_invitation_template>
420
+ <auguria_sponsorship_sponsor_notification translate="label" module="auguria_sponsorship">
421
+ <label>Sponsorship notification</label>
422
+ <file>auguria/sponsorship/sponsorship_notification.html</file>
423
+ <type>html</type>
424
+ </auguria_sponsorship_sponsor_notification>
425
+ <auguria_sponsorship_accumulated_notification translate="label" module="auguria_sponsorship">
426
+ <label>Sponsorship notification(accumulated)</label>
427
+ <file>auguria/sponsorship/sponsorship_notification.html</file>
428
  <type>html</type>
429
+ </auguria_sponsorship_accumulated_notification>
430
  </email>
431
  </template>
432
+ <sales>
433
+ <quote>
434
+ <totals>
435
+ <auguria_sponsorship_discount>
436
+ <class>auguria_sponsorship/total_quote_discount</class>
437
+ <after>tax,discount,shipping</after>
438
+ </auguria_sponsorship_discount>
439
+ </totals>
440
+ </quote>
441
+ <order_invoice>
442
+ <totals>
443
+ <auguria_sponsorship_discount>
444
+ <class>auguria_sponsorship/total_invoice_discount</class>
445
+ <after>tax,discount,shipping</after>
446
+ </auguria_sponsorship_discount>
447
+ </totals>
448
+ </order_invoice>
449
+ <order_creditmemo>
450
+ <totals>
451
+ <auguria_sponsorship_discount>
452
+ <class>auguria_sponsorship/total_creditmemo_discount</class>
453
+ <after>tax,discount,shipping</after>
454
+ </auguria_sponsorship_discount>
455
+ </totals>
456
+ </order_creditmemo>
457
+ </sales>
458
  </global>
459
 
460
  <default>
461
+ <sales>
462
+ <totals_sort>
463
+ <auguria_sponsorship_discount>25</auguria_sponsorship_discount>
464
+ </totals_sort>
465
+ </sales>
466
+ <auguria_sponsorship>
467
+ <general>
468
+ <module_mode>separated</module_mode>
469
+ </general>
470
+ <accumulated>
471
+ <accumulated_enabled>0</accumulated_enabled>
472
+ <points_validity>0</points_validity>
473
+ <cash>1</cash>
474
+ <coupon>1</coupon>
475
+ <cart>0</cart>
476
+ <gift>0</gift>
477
+ <max_cash>350</max_cash>
478
+ <time_max_cash>90</time_max_cash>
479
+ <points_to_cash>1</points_to_cash>
480
+ <optional_order>1</optional_order>
481
+ <allow_invit_registred_users>1</allow_invit_registred_users>
482
+ <sponsor_link_validity>365</sponsor_link_validity>
483
+ <sponsor_levels>100</sponsor_levels>
484
+ <sponsor_percent>50</sponsor_percent>
485
+ <newsletter_points>0</newsletter_points>
486
+ <first_order_points>0</first_order_points>
487
+ <godson_first_order_points>0</godson_first_order_points>
488
+ <notification_enabled>1</notification_enabled>
489
+ <notification>auguria_sponsorship_accumulated_notification</notification>
490
+ <cancel_earned_points>0</cancel_earned_points>
491
+ <cancel_cart_points>0</cancel_cart_points>
492
+ </accumulated>
493
  <sponsor>
494
+ <sponsor_enabled>0</sponsor_enabled>
495
+ <points_validity>0</points_validity>
496
  <sponsor_cash>1</sponsor_cash>
497
  <sponsor_coupon>1</sponsor_coupon>
498
+ <sponsor_cart>0</sponsor_cart>
499
  <sponsor_gift>0</sponsor_gift>
500
  <sponsor_max_cash>350</sponsor_max_cash>
501
  <sponsor_time_max_cash>90</sponsor_time_max_cash>
502
  <sponsor_points_to_cash>1</sponsor_points_to_cash>
503
  <sponsor_optional_order>1</sponsor_optional_order>
504
+ <allow_invit_registred_users>1</allow_invit_registred_users>
505
  <sponsor_link_validity>365</sponsor_link_validity>
506
  <sponsor_levels>100</sponsor_levels>
507
  <sponsor_percent>50</sponsor_percent>
508
  <godson_first_order_points>0</godson_first_order_points>
509
+ <notification_enabled>1</notification_enabled>
510
+ <notification>auguria_sponsorship_sponsor_notification</notification>
511
+ <cancel_earned_points>0</cancel_earned_points>
512
+ <cancel_cart_points>0</cancel_cart_points>
513
  </sponsor>
514
  <fidelity>
515
+ <fidelity_enabled>0</fidelity_enabled>
516
+ <points_validity>0</points_validity>
517
  <fidelity_cash>1</fidelity_cash>
518
  <fidelity_coupon>1</fidelity_coupon>
519
+ <fidelity_cart>0</fidelity_cart>
520
  <fidelity_gift>0</fidelity_gift>
521
  <fidelity_max_cash>350</fidelity_max_cash>
522
  <fidelity_time_max_cash>90</fidelity_time_max_cash>
523
  <fidelity_points_to_cash>1</fidelity_points_to_cash>
524
  <newsletter_points>0</newsletter_points>
525
  <first_order_points>0</first_order_points>
526
+ <cancel_earned_points>0</cancel_earned_points>
527
+ <cancel_cart_points>0</cancel_cart_points>
528
  </fidelity>
529
+ <invitation>
530
+ <template>auguria_sponsorship_invitation_template</template>
531
+ <sponsor_invitation_validity>365</sponsor_invitation_validity>
532
+ <time_before_boost>7</time_before_boost>
533
+ <max_recipients>20</max_recipients>
534
+ </invitation>
535
  <coupon>
536
+ <template>auguria_sponsorship_coupon_template</template>
537
  </coupon>
538
  <open_inviter>
539
  <open_inviter_enabled>0</open_inviter_enabled>
540
  <username></username>
541
  <private_key></private_key>
542
  </open_inviter>
543
+ </auguria_sponsorship>
544
  </default>
545
  <crontab>
546
  <jobs>
547
+ <auguria_sponsorship_auto_boost>
548
+ <schedule>
549
+ <cron_expr>0 0 * * *</cron_expr>
550
+ </schedule>
551
+ <run>
552
+ <model>auguria_sponsorship/autoBoost::process</model>
553
+ </run>
554
+ </auguria_sponsorship_auto_boost>
555
+ <auguria_sponsorship_apply_validity>
556
  <schedule>
557
+ <cron_expr>0 0 * * *</cron_expr>
558
  </schedule>
559
  <run>
560
+ <model>auguria_sponsorship/applyValidity::process</model>
561
  </run>
562
+ </auguria_sponsorship_apply_validity>
563
  </jobs>
564
  </crontab>
565
  </config>
app/code/community/Auguria/Sponsorship/etc/system.xml CHANGED
@@ -8,7 +8,7 @@
8
  -->
9
  <config>
10
  <sections>
11
- <sponsorship translate="label" module="sponsorship">
12
  <label>Fidelity and Sponsorship</label>
13
  <tab>general</tab>
14
  <frontend_type>text</frontend_type>
@@ -17,55 +17,362 @@
17
  <show_in_website>1</show_in_website>
18
  <show_in_store>1</show_in_store>
19
  <groups>
20
- <sponsor translate="label">
21
- <label>Sponsorship options</label>
22
  <frontend_type>text</frontend_type>
23
  <sort_order>1</sort_order>
24
  <show_in_default>1</show_in_default>
25
  <show_in_website>1</show_in_website>
26
  <show_in_store>1</show_in_store>
27
  <fields>
28
- <sponsor_enabled translate="label">
29
- <label>Sponsorship module activated</label>
30
  <frontend_type>select</frontend_type>
31
- <source_model>adminhtml/system_config_source_yesno</source_model>
 
32
  <sort_order>1</sort_order>
33
  <show_in_default>1</show_in_default>
34
  <show_in_website>1</show_in_website>
35
  <show_in_store>1</show_in_store>
36
- </sponsor_enabled>
37
- <sponsor_cash translate="label">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  <label>Cash exchange enabled</label>
39
  <frontend_type>select</frontend_type>
40
  <source_model>adminhtml/system_config_source_yesno</source_model>
41
- <sort_order>2</sort_order>
42
  <show_in_default>1</show_in_default>
43
  <show_in_website>1</show_in_website>
44
  <show_in_store>1</show_in_store>
45
- </sponsor_cash>
46
- <sponsor_coupon translate="label">
47
  <label>Voucher exchange enabled</label>
48
  <frontend_type>select</frontend_type>
49
  <source_model>adminhtml/system_config_source_yesno</source_model>
50
- <sort_order>3</sort_order>
51
  <show_in_default>1</show_in_default>
52
  <show_in_website>1</show_in_website>
53
  <show_in_store>1</show_in_store>
54
- </sponsor_coupon>
55
- <sponsor_gift translate="label">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  <label>Gift exchange enabled</label>
57
  <frontend_type>select</frontend_type>
58
  <source_model>adminhtml/system_config_source_yesno</source_model>
59
- <sort_order>4</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
- </sponsor_gift>
64
  <sponsor_max_cash translate="label">
65
  <label>Maximum amount permitted without company number</label>
66
  <frontend_type>text</frontend_type>
67
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
68
- <sort_order>5</sort_order>
69
  <show_in_default>1</show_in_default>
70
  <show_in_website>1</show_in_website>
71
  <show_in_store>1</show_in_store>
@@ -73,8 +380,8 @@
73
  <sponsor_time_max_cash translate="label">
74
  <label>Calculation period of the maximum allowed for an individual (days)</label>
75
  <frontend_type>text</frontend_type>
76
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
77
- <sort_order>6</sort_order>
78
  <show_in_default>1</show_in_default>
79
  <show_in_website>1</show_in_website>
80
  <show_in_store>1</show_in_store>
@@ -82,26 +389,35 @@
82
  <sponsor_points_to_cash translate="label">
83
  <label>Conversion rate of points in currency</label>
84
  <frontend_type>text</frontend_type>
85
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
86
- <sort_order>7</sort_order>
87
  <show_in_default>1</show_in_default>
88
  <show_in_website>1</show_in_website>
89
  <show_in_store>1</show_in_store>
90
  </sponsor_points_to_cash>
91
  <sponsor_optional_order translate="label">
92
- <label>Allow to send invitations to customers who have never ordered</label>
93
  <frontend_type>select</frontend_type>
94
  <source_model>adminhtml/system_config_source_yesno</source_model>
95
- <sort_order>8</sort_order>
96
  <show_in_default>1</show_in_default>
97
  <show_in_website>1</show_in_website>
98
  <show_in_store>1</show_in_store>
99
  </sponsor_optional_order>
 
 
 
 
 
 
 
 
 
100
  <sponsor_link_validity translate="label">
101
  <label>Inactivity time before removal of the sponsorship link (days)</label>
102
  <frontend_type>text</frontend_type>
103
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
104
- <sort_order>10</sort_order>
105
  <show_in_default>1</show_in_default>
106
  <show_in_website>1</show_in_website>
107
  <show_in_store>1</show_in_store>
@@ -109,8 +425,8 @@
109
  <sponsor_levels translate="label">
110
  <label>Maximum levels of sponsorship</label>
111
  <frontend_type>text</frontend_type>
112
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
113
- <sort_order>11</sort_order>
114
  <show_in_default>1</show_in_default>
115
  <show_in_website>1</show_in_website>
116
  <show_in_store>1</show_in_store>
@@ -118,8 +434,8 @@
118
  <sponsor_percent translate="label">
119
  <label>Ratio applied from level 2 to calculate the points of the sponsor (in percentage)</label>
120
  <frontend_type>text</frontend_type>
121
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
122
- <sort_order>12</sort_order>
123
  <show_in_default>1</show_in_default>
124
  <show_in_website>1</show_in_website>
125
  <show_in_store>1</show_in_store>
@@ -127,36 +443,63 @@
127
  <godson_first_order_points>
128
  <label>Amount of winning points for the first godson order</label>
129
  <frontend_type>text</frontend_type>
130
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
131
- <sort_order>13</sort_order>
132
  <show_in_default>1</show_in_default>
133
  <show_in_website>1</show_in_website>
134
  <show_in_store>1</show_in_store>
135
  </godson_first_order_points>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  </fields>
137
  </sponsor>
138
  <fidelity translate="label">
139
- <label>Fidelity options</label>
140
  <frontend_type>text</frontend_type>
141
- <sort_order>2</sort_order>
142
  <show_in_default>1</show_in_default>
143
  <show_in_website>1</show_in_website>
144
  <show_in_store>1</show_in_store>
145
  <fields>
146
- <fidelity_enabled translate="label">
147
- <label>Fidelity module activated</label>
 
 
 
 
 
 
 
 
 
148
  <frontend_type>select</frontend_type>
149
  <source_model>adminhtml/system_config_source_yesno</source_model>
150
- <sort_order>1</sort_order>
151
  <show_in_default>1</show_in_default>
152
  <show_in_website>1</show_in_website>
153
  <show_in_store>1</show_in_store>
154
- </fidelity_enabled>
155
  <fidelity_cash translate="label">
156
  <label>Cash exchange enabled</label>
157
  <frontend_type>select</frontend_type>
158
  <source_model>adminhtml/system_config_source_yesno</source_model>
159
- <sort_order>2</sort_order>
160
  <show_in_default>1</show_in_default>
161
  <show_in_website>1</show_in_website>
162
  <show_in_store>1</show_in_store>
@@ -165,16 +508,34 @@
165
  <label>Voucher exchange enabled</label>
166
  <frontend_type>select</frontend_type>
167
  <source_model>adminhtml/system_config_source_yesno</source_model>
168
- <sort_order>3</sort_order>
169
  <show_in_default>1</show_in_default>
170
  <show_in_website>1</show_in_website>
171
  <show_in_store>1</show_in_store>
172
  </fidelity_coupon>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  <fidelity_gift translate="label">
174
  <label>Gift exchange enabled</label>
175
  <frontend_type>select</frontend_type>
176
  <source_model>adminhtml/system_config_source_yesno</source_model>
177
- <sort_order>4</sort_order>
178
  <show_in_default>1</show_in_default>
179
  <show_in_website>1</show_in_website>
180
  <show_in_store>1</show_in_store>
@@ -182,8 +543,8 @@
182
  <fidelity_max_cash>
183
  <label>Maximum amount permitted without company number</label>
184
  <frontend_type>text</frontend_type>
185
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
186
- <sort_order>5</sort_order>
187
  <show_in_default>1</show_in_default>
188
  <show_in_website>1</show_in_website>
189
  <show_in_store>1</show_in_store>
@@ -191,8 +552,8 @@
191
  <fidelity_time_max_cash>
192
  <label>Calculation period of the maximum allowed for an individual (days)</label>
193
  <frontend_type>text</frontend_type>
194
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
195
- <sort_order>6</sort_order>
196
  <show_in_default>1</show_in_default>
197
  <show_in_website>1</show_in_website>
198
  <show_in_store>1</show_in_store>
@@ -200,8 +561,8 @@
200
  <fidelity_points_to_cash>
201
  <label>Conversion rate of points in currency</label>
202
  <frontend_type>text</frontend_type>
203
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
204
- <sort_order>7</sort_order>
205
  <show_in_default>1</show_in_default>
206
  <show_in_website>1</show_in_website>
207
  <show_in_store>1</show_in_store>
@@ -209,8 +570,8 @@
209
  <newsletter_points>
210
  <label>Amount of winning points when subscribe to newsletter on account creation</label>
211
  <frontend_type>text</frontend_type>
212
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
213
- <sort_order>8</sort_order>
214
  <show_in_default>1</show_in_default>
215
  <show_in_website>1</show_in_website>
216
  <show_in_store>1</show_in_store>
@@ -218,8 +579,8 @@
218
  <first_order_points>
219
  <label>Amount of winning points for first order</label>
220
  <frontend_type>text</frontend_type>
221
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
222
- <sort_order>9</sort_order>
223
  <show_in_default>1</show_in_default>
224
  <show_in_website>1</show_in_website>
225
  <show_in_store>1</show_in_store>
@@ -229,7 +590,7 @@
229
  <invitation translate="label">
230
  <label>Sponsorship mail options</label>
231
  <frontend_type>text</frontend_type>
232
- <sort_order>3</sort_order>
233
  <show_in_default>1</show_in_default>
234
  <show_in_website>1</show_in_website>
235
  <show_in_store>1</show_in_store>
@@ -237,7 +598,7 @@
237
  <sponsor_invitation_validity translate="label">
238
  <label>Time validity invitations (days)</label>
239
  <frontend_type>text</frontend_type>
240
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
241
  <sort_order>1</sort_order>
242
  <show_in_default>1</show_in_default>
243
  <show_in_website>1</show_in_website>
@@ -246,7 +607,7 @@
246
  <time_before_boost translate="label">
247
  <label>Time to send it automatically (days)</label>
248
  <frontend_type>text</frontend_type>
249
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
250
  <sort_order>5</sort_order>
251
  <show_in_default>1</show_in_default>
252
  <show_in_website>1</show_in_website>
@@ -255,14 +616,14 @@
255
  <max_recipients translate="label">
256
  <label>Max invitations</label>
257
  <frontend_type>text</frontend_type>
258
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
259
  <sort_order>10</sort_order>
260
  <show_in_default>1</show_in_default>
261
  <show_in_website>1</show_in_website>
262
  <show_in_store>1</show_in_store>
263
  </max_recipients>
264
  <template translate="label">
265
- <label>Email Template</label>
266
  <frontend_type>select</frontend_type>
267
  <source_model>adminhtml/system_config_source_email_template</source_model>
268
  <sort_order>20</sort_order>
@@ -275,13 +636,13 @@
275
  <coupon translate="label">
276
  <label>Voucher exchange mail options</label>
277
  <frontend_type>text</frontend_type>
278
- <sort_order>4</sort_order>
279
  <show_in_default>1</show_in_default>
280
  <show_in_website>1</show_in_website>
281
  <show_in_store>1</show_in_store>
282
  <fields>
283
  <template translate="label">
284
- <label>Email Template</label>
285
  <frontend_type>select</frontend_type>
286
  <source_model>adminhtml/system_config_source_email_template</source_model>
287
  <sort_order>1</sort_order>
@@ -293,7 +654,7 @@
293
  </coupon>
294
  <open_inviter translate="label comment">
295
  <label>Open Inviter options</label>
296
- <sort_order>5</sort_order>
297
  <show_in_default>1</show_in_default>
298
  <show_in_website>1</show_in_website>
299
  <show_in_store>1</show_in_store>
@@ -311,7 +672,7 @@
311
  <username>
312
  <label>Username</label>
313
  <frontend_type>text</frontend_type>
314
- <backend_model>sponsorship/adminhtml_system_config_backend_sponsorship_openinviter</backend_model>
315
  <sort_order>2</sort_order>
316
  <show_in_default>1</show_in_default>
317
  <show_in_website>1</show_in_website>
@@ -328,6 +689,6 @@
328
  </fields>
329
  </open_inviter>
330
  </groups>
331
- </sponsorship>
332
  </sections>
333
  </config>
8
  -->
9
  <config>
10
  <sections>
11
+ <auguria_sponsorship translate="label" module="auguria_sponsorship">
12
  <label>Fidelity and Sponsorship</label>
13
  <tab>general</tab>
14
  <frontend_type>text</frontend_type>
17
  <show_in_website>1</show_in_website>
18
  <show_in_store>1</show_in_store>
19
  <groups>
20
+ <general translate="label">
21
+ <label>General options</label>
22
  <frontend_type>text</frontend_type>
23
  <sort_order>1</sort_order>
24
  <show_in_default>1</show_in_default>
25
  <show_in_website>1</show_in_website>
26
  <show_in_store>1</show_in_store>
27
  <fields>
28
+ <module_mode translate="label">
29
+ <label>Mode of the module</label>
30
  <frontend_type>select</frontend_type>
31
+ <source_model>auguria_sponsorship/adminhtml_system_config_source_mode</source_model>
32
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_mode</backend_model>
33
  <sort_order>1</sort_order>
34
  <show_in_default>1</show_in_default>
35
  <show_in_website>1</show_in_website>
36
  <show_in_store>1</show_in_store>
37
+ </module_mode>
38
+ </fields>
39
+ </general>
40
+ <accumulated translate="label">
41
+ <label>Accumulated mode options</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>2</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <fields>
48
+ <heading_calculation translate="label">
49
+ <label>Points calculation</label>
50
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
51
+ <sort_order>100</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ </heading_calculation>
56
+ <points_validity>
57
+ <label>Points validity in days(0 for unlimited)</label>
58
+ <frontend_type>text</frontend_type>
59
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
60
+ <sort_order>101</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </points_validity>
65
+ <cancel_earned_points>
66
+ <label>Cancel earned points on credit memo creation</label>
67
+ <frontend_type>select</frontend_type>
68
+ <source_model>adminhtml/system_config_source_yesno</source_model>
69
+ <sort_order>104</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
+ </cancel_earned_points>
74
+ <points_to_cash>
75
+ <label>Conversion rate of points in currency</label>
76
+ <frontend_type>text</frontend_type>
77
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
78
+ <sort_order>107</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ </points_to_cash>
83
+ <newsletter_points>
84
+ <label>Amount of winning points when subscribe to newsletter on account creation</label>
85
+ <frontend_type>text</frontend_type>
86
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
87
+ <sort_order>108</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ </newsletter_points>
92
+ <first_order_points>
93
+ <label>Amount of winning points for first order</label>
94
+ <frontend_type>text</frontend_type>
95
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
96
+ <sort_order>109</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ </first_order_points>
101
+
102
+
103
+
104
+
105
+
106
+ <heading_cash translate="label">
107
+ <label>Cash exchange</label>
108
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
109
+ <sort_order>200</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ </heading_cash>
113
+ <cash>
114
+ <label>Cash exchange enabled</label>
115
+ <frontend_type>select</frontend_type>
116
+ <source_model>adminhtml/system_config_source_yesno</source_model>
117
+ <sort_order>201</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ </cash>
122
+ <max_cash>
123
+ <label>Maximum amount permitted without company number</label>
124
+ <frontend_type>text</frontend_type>
125
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
126
+ <sort_order>205</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ </max_cash>
131
+ <time_max_cash>
132
+ <label>Calculation period of the maximum allowed for an individual (days)</label>
133
+ <frontend_type>text</frontend_type>
134
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
135
+ <sort_order>206</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
+ <show_in_store>1</show_in_store>
139
+ </time_max_cash>
140
+
141
+
142
+
143
+
144
+ <heading_coupon translate="label">
145
+ <label>Coupon exchange</label>
146
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
147
+ <sort_order>300</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ </heading_coupon>
151
+ <coupon>
152
+ <label>Voucher exchange enabled</label>
153
+ <frontend_type>select</frontend_type>
154
+ <source_model>adminhtml/system_config_source_yesno</source_model>
155
+ <sort_order>301</sort_order>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>1</show_in_website>
158
+ <show_in_store>1</show_in_store>
159
+ </coupon>
160
+
161
+
162
+
163
+
164
+
165
+
166
+ <heading_cart translate="label">
167
+ <label>Cart exchange</label>
168
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
169
+ <sort_order>400</sort_order>
170
+ <show_in_default>1</show_in_default>
171
+ <show_in_website>1</show_in_website>
172
+ <show_in_store>1</show_in_store>
173
+ </heading_cart>
174
+ <cart>
175
+ <label>Automatic discount in cart</label>
176
+ <frontend_type>select</frontend_type>
177
+ <source_model>adminhtml/system_config_source_yesno</source_model>
178
+ <sort_order>401</sort_order>
179
+ <show_in_default>1</show_in_default>
180
+ <show_in_website>1</show_in_website>
181
+ <show_in_store>1</show_in_store>
182
+ </cart>
183
+ <cancel_cart_points>
184
+ <label>Cancel the use of points on credit memo creation</label>
185
+ <frontend_type>select</frontend_type>
186
+ <source_model>adminhtml/system_config_source_yesno</source_model>
187
+ <sort_order>411</sort_order>
188
+ <show_in_default>1</show_in_default>
189
+ <show_in_website>1</show_in_website>
190
+ <show_in_store>1</show_in_store>
191
+ </cancel_cart_points>
192
+
193
+
194
+
195
+
196
+ <heading_gift translate="label">
197
+ <label>Gift exchange</label>
198
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
199
+ <sort_order>500</sort_order>
200
+ <show_in_default>1</show_in_default>
201
+ <show_in_website>1</show_in_website>
202
+ <show_in_store>1</show_in_store>
203
+ </heading_gift>
204
+ <gift>
205
+ <label>Gift exchange enabled</label>
206
+ <frontend_type>select</frontend_type>
207
+ <source_model>adminhtml/system_config_source_yesno</source_model>
208
+ <sort_order>501</sort_order>
209
+ <show_in_default>1</show_in_default>
210
+ <show_in_website>1</show_in_website>
211
+ <show_in_store>1</show_in_store>
212
+ </gift>
213
+
214
+
215
+
216
+ <heading_sponsorship translate="label">
217
+ <label>Sponsorship</label>
218
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
219
+ <sort_order>600</sort_order>
220
+ <show_in_default>1</show_in_default>
221
+ <show_in_website>1</show_in_website>
222
+ <show_in_store>1</show_in_store>
223
+ </heading_sponsorship>
224
+ <optional_order>
225
+ <label>Allow customers who have never ordered to send sponsorship invitations</label>
226
+ <frontend_type>select</frontend_type>
227
+ <source_model>adminhtml/system_config_source_yesno</source_model>
228
+ <sort_order>601</sort_order>
229
+ <show_in_default>1</show_in_default>
230
+ <show_in_website>1</show_in_website>
231
+ <show_in_store>1</show_in_store>
232
+ </optional_order>
233
+ <allow_invit_registred_users>
234
+ <label>Allow to sponsor registred customers (but never ordered)</label>
235
+ <frontend_type>select</frontend_type>
236
+ <source_model>adminhtml/system_config_source_yesno</source_model>
237
+ <sort_order>602</sort_order>
238
+ <show_in_default>1</show_in_default>
239
+ <show_in_website>1</show_in_website>
240
+ <show_in_store>1</show_in_store>
241
+ </allow_invit_registred_users>
242
+ <notification_enabled>
243
+ <label>Send notification to sponsor when godchild make him earn points</label>
244
+ <frontend_type>select</frontend_type>
245
+ <source_model>adminhtml/system_config_source_yesno</source_model>
246
+ <sort_order>615</sort_order>
247
+ <show_in_default>1</show_in_default>
248
+ <show_in_website>1</show_in_website>
249
+ <show_in_store>1</show_in_store>
250
+ </notification_enabled>
251
+ <notification>
252
+ <label>Notification Email Template</label>
253
+ <frontend_type>select</frontend_type>
254
+ <source_model>adminhtml/system_config_source_email_template</source_model>
255
+ <sort_order>630</sort_order>
256
+ <show_in_default>1</show_in_default>
257
+ <show_in_website>1</show_in_website>
258
+ <show_in_store>1</show_in_store>
259
+ </notification>
260
+
261
+ <sponsor_link_validity>
262
+ <label>Inactivity time before removal of the sponsorship link (days)</label>
263
+ <frontend_type>text</frontend_type>
264
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
265
+ <comment>Needs to active cron jobs.</comment>
266
+ <sort_order>610</sort_order>
267
+ <show_in_default>1</show_in_default>
268
+ <show_in_website>1</show_in_website>
269
+ <show_in_store>1</show_in_store>
270
+ </sponsor_link_validity>
271
+ <sponsor_levels>
272
+ <label>Maximum levels of sponsorship</label>
273
+ <frontend_type>text</frontend_type>
274
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
275
+ <sort_order>611</sort_order>
276
+ <show_in_default>1</show_in_default>
277
+ <show_in_website>1</show_in_website>
278
+ <show_in_store>1</show_in_store>
279
+ </sponsor_levels>
280
+ <sponsor_percent>
281
+ <label>Ratio applied from level 2 to calculate the points of the sponsor (in percentage)</label>
282
+ <frontend_type>text</frontend_type>
283
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
284
+ <sort_order>612</sort_order>
285
+ <show_in_default>1</show_in_default>
286
+ <show_in_website>1</show_in_website>
287
+ <show_in_store>1</show_in_store>
288
+ </sponsor_percent>
289
+ <godson_first_order_points>
290
+ <label>Amount of winning points for the first godson order</label>
291
+ <frontend_type>text</frontend_type>
292
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
293
+ <sort_order>613</sort_order>
294
+ <show_in_default>1</show_in_default>
295
+ <show_in_website>1</show_in_website>
296
+ <show_in_store>1</show_in_store>
297
+ </godson_first_order_points>
298
+ </fields>
299
+ </accumulated>
300
+ <sponsor translate="label">
301
+ <label>Sponsorship and separated mode options</label>
302
+ <frontend_type>text</frontend_type>
303
+ <sort_order>3</sort_order>
304
+ <show_in_default>1</show_in_default>
305
+ <show_in_website>1</show_in_website>
306
+ <show_in_store>1</show_in_store>
307
+ <fields>
308
+ <points_validity>
309
+ <label>Points validity in days(0 for unlimited)</label>
310
+ <frontend_type>text</frontend_type>
311
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
312
+ <sort_order>0</sort_order>
313
+ <show_in_default>1</show_in_default>
314
+ <show_in_website>1</show_in_website>
315
+ <show_in_store>1</show_in_store>
316
+ </points_validity>
317
+ <cancel_earned_points>
318
+ <label>Cancel earned points on credit memo creation</label>
319
+ <frontend_type>select</frontend_type>
320
+ <source_model>adminhtml/system_config_source_yesno</source_model>
321
+ <sort_order>10</sort_order>
322
+ <show_in_default>1</show_in_default>
323
+ <show_in_website>1</show_in_website>
324
+ <show_in_store>1</show_in_store>
325
+ </cancel_earned_points>
326
+ <sponsor_cash translate="label">
327
  <label>Cash exchange enabled</label>
328
  <frontend_type>select</frontend_type>
329
  <source_model>adminhtml/system_config_source_yesno</source_model>
330
+ <sort_order>20</sort_order>
331
  <show_in_default>1</show_in_default>
332
  <show_in_website>1</show_in_website>
333
  <show_in_store>1</show_in_store>
334
+ </sponsor_cash>
335
+ <sponsor_coupon translate="label">
336
  <label>Voucher exchange enabled</label>
337
  <frontend_type>select</frontend_type>
338
  <source_model>adminhtml/system_config_source_yesno</source_model>
339
+ <sort_order>30</sort_order>
340
  <show_in_default>1</show_in_default>
341
  <show_in_website>1</show_in_website>
342
  <show_in_store>1</show_in_store>
343
+ </sponsor_coupon>
344
+ <sponsor_cart>
345
+ <label>Automatic discount in cart</label>
346
+ <frontend_type>select</frontend_type>
347
+ <source_model>adminhtml/system_config_source_yesno</source_model>
348
+ <sort_order>40</sort_order>
349
+ <show_in_default>1</show_in_default>
350
+ <show_in_website>1</show_in_website>
351
+ <show_in_store>1</show_in_store>
352
+ </sponsor_cart>
353
+ <cancel_cart_points>
354
+ <label>Cancel the use of points on credit memo creation</label>
355
+ <frontend_type>select</frontend_type>
356
+ <source_model>adminhtml/system_config_source_yesno</source_model>
357
+ <sort_order>45</sort_order>
358
+ <show_in_default>1</show_in_default>
359
+ <show_in_website>1</show_in_website>
360
+ <show_in_store>1</show_in_store>
361
+ </cancel_cart_points>
362
+ <sponsor_gift translate="label">
363
  <label>Gift exchange enabled</label>
364
  <frontend_type>select</frontend_type>
365
  <source_model>adminhtml/system_config_source_yesno</source_model>
366
+ <sort_order>50</sort_order>
367
  <show_in_default>1</show_in_default>
368
  <show_in_website>1</show_in_website>
369
  <show_in_store>1</show_in_store>
370
+ </sponsor_gift>
371
  <sponsor_max_cash translate="label">
372
  <label>Maximum amount permitted without company number</label>
373
  <frontend_type>text</frontend_type>
374
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
375
+ <sort_order>60</sort_order>
376
  <show_in_default>1</show_in_default>
377
  <show_in_website>1</show_in_website>
378
  <show_in_store>1</show_in_store>
380
  <sponsor_time_max_cash translate="label">
381
  <label>Calculation period of the maximum allowed for an individual (days)</label>
382
  <frontend_type>text</frontend_type>
383
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
384
+ <sort_order>70</sort_order>
385
  <show_in_default>1</show_in_default>
386
  <show_in_website>1</show_in_website>
387
  <show_in_store>1</show_in_store>
389
  <sponsor_points_to_cash translate="label">
390
  <label>Conversion rate of points in currency</label>
391
  <frontend_type>text</frontend_type>
392
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
393
+ <sort_order>80</sort_order>
394
  <show_in_default>1</show_in_default>
395
  <show_in_website>1</show_in_website>
396
  <show_in_store>1</show_in_store>
397
  </sponsor_points_to_cash>
398
  <sponsor_optional_order translate="label">
399
+ <label>Allow customers who have never ordered to send invitations</label>
400
  <frontend_type>select</frontend_type>
401
  <source_model>adminhtml/system_config_source_yesno</source_model>
402
+ <sort_order>90</sort_order>
403
  <show_in_default>1</show_in_default>
404
  <show_in_website>1</show_in_website>
405
  <show_in_store>1</show_in_store>
406
  </sponsor_optional_order>
407
+ <allow_invit_registred_users translate="label">
408
+ <label>Allow to sponsor registred customers (but never ordered)</label>
409
+ <frontend_type>select</frontend_type>
410
+ <source_model>adminhtml/system_config_source_yesno</source_model>
411
+ <sort_order>100</sort_order>
412
+ <show_in_default>1</show_in_default>
413
+ <show_in_website>1</show_in_website>
414
+ <show_in_store>1</show_in_store>
415
+ </allow_invit_registred_users>
416
  <sponsor_link_validity translate="label">
417
  <label>Inactivity time before removal of the sponsorship link (days)</label>
418
  <frontend_type>text</frontend_type>
419
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
420
+ <sort_order>110</sort_order>
421
  <show_in_default>1</show_in_default>
422
  <show_in_website>1</show_in_website>
423
  <show_in_store>1</show_in_store>
425
  <sponsor_levels translate="label">
426
  <label>Maximum levels of sponsorship</label>
427
  <frontend_type>text</frontend_type>
428
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
429
+ <sort_order>120</sort_order>
430
  <show_in_default>1</show_in_default>
431
  <show_in_website>1</show_in_website>
432
  <show_in_store>1</show_in_store>
434
  <sponsor_percent translate="label">
435
  <label>Ratio applied from level 2 to calculate the points of the sponsor (in percentage)</label>
436
  <frontend_type>text</frontend_type>
437
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
438
+ <sort_order>130</sort_order>
439
  <show_in_default>1</show_in_default>
440
  <show_in_website>1</show_in_website>
441
  <show_in_store>1</show_in_store>
443
  <godson_first_order_points>
444
  <label>Amount of winning points for the first godson order</label>
445
  <frontend_type>text</frontend_type>
446
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
447
+ <sort_order>140</sort_order>
448
  <show_in_default>1</show_in_default>
449
  <show_in_website>1</show_in_website>
450
  <show_in_store>1</show_in_store>
451
  </godson_first_order_points>
452
+ <notification_enabled>
453
+ <label>Send notification to sponsor when godchild make him earn points</label>
454
+ <frontend_type>select</frontend_type>
455
+ <source_model>adminhtml/system_config_source_yesno</source_model>
456
+ <sort_order>150</sort_order>
457
+ <show_in_default>1</show_in_default>
458
+ <show_in_website>1</show_in_website>
459
+ <show_in_store>1</show_in_store>
460
+ </notification_enabled>
461
+ <notification translate="label">
462
+ <label>Notification Email Template</label>
463
+ <frontend_type>select</frontend_type>
464
+ <source_model>adminhtml/system_config_source_email_template</source_model>
465
+ <sort_order>160</sort_order>
466
+ <show_in_default>1</show_in_default>
467
+ <show_in_website>1</show_in_website>
468
+ <show_in_store>1</show_in_store>
469
+ </notification>
470
  </fields>
471
  </sponsor>
472
  <fidelity translate="label">
473
+ <label>Fidelity and separated mode options</label>
474
  <frontend_type>text</frontend_type>
475
+ <sort_order>4</sort_order>
476
  <show_in_default>1</show_in_default>
477
  <show_in_website>1</show_in_website>
478
  <show_in_store>1</show_in_store>
479
  <fields>
480
+ <points_validity>
481
+ <label>Points validity in days(0 for unlimited)</label>
482
+ <frontend_type>text</frontend_type>
483
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
484
+ <sort_order>0</sort_order>
485
+ <show_in_default>1</show_in_default>
486
+ <show_in_website>1</show_in_website>
487
+ <show_in_store>1</show_in_store>
488
+ </points_validity>
489
+ <cancel_earned_points>
490
+ <label>Cancel earned points on credit memo creation</label>
491
  <frontend_type>select</frontend_type>
492
  <source_model>adminhtml/system_config_source_yesno</source_model>
493
+ <sort_order>10</sort_order>
494
  <show_in_default>1</show_in_default>
495
  <show_in_website>1</show_in_website>
496
  <show_in_store>1</show_in_store>
497
+ </cancel_earned_points>
498
  <fidelity_cash translate="label">
499
  <label>Cash exchange enabled</label>
500
  <frontend_type>select</frontend_type>
501
  <source_model>adminhtml/system_config_source_yesno</source_model>
502
+ <sort_order>20</sort_order>
503
  <show_in_default>1</show_in_default>
504
  <show_in_website>1</show_in_website>
505
  <show_in_store>1</show_in_store>
508
  <label>Voucher exchange enabled</label>
509
  <frontend_type>select</frontend_type>
510
  <source_model>adminhtml/system_config_source_yesno</source_model>
511
+ <sort_order>30</sort_order>
512
  <show_in_default>1</show_in_default>
513
  <show_in_website>1</show_in_website>
514
  <show_in_store>1</show_in_store>
515
  </fidelity_coupon>
516
+ <fidelity_cart>
517
+ <label>Automatic discount in cart</label>
518
+ <frontend_type>select</frontend_type>
519
+ <source_model>adminhtml/system_config_source_yesno</source_model>
520
+ <sort_order>40</sort_order>
521
+ <show_in_default>1</show_in_default>
522
+ <show_in_website>1</show_in_website>
523
+ <show_in_store>1</show_in_store>
524
+ </fidelity_cart>
525
+ <cancel_cart_points>
526
+ <label>Cancel the use of points on credit memo creation</label>
527
+ <frontend_type>select</frontend_type>
528
+ <source_model>adminhtml/system_config_source_yesno</source_model>
529
+ <sort_order>45</sort_order>
530
+ <show_in_default>1</show_in_default>
531
+ <show_in_website>1</show_in_website>
532
+ <show_in_store>1</show_in_store>
533
+ </cancel_cart_points>
534
  <fidelity_gift translate="label">
535
  <label>Gift exchange enabled</label>
536
  <frontend_type>select</frontend_type>
537
  <source_model>adminhtml/system_config_source_yesno</source_model>
538
+ <sort_order>50</sort_order>
539
  <show_in_default>1</show_in_default>
540
  <show_in_website>1</show_in_website>
541
  <show_in_store>1</show_in_store>
543
  <fidelity_max_cash>
544
  <label>Maximum amount permitted without company number</label>
545
  <frontend_type>text</frontend_type>
546
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
547
+ <sort_order>60</sort_order>
548
  <show_in_default>1</show_in_default>
549
  <show_in_website>1</show_in_website>
550
  <show_in_store>1</show_in_store>
552
  <fidelity_time_max_cash>
553
  <label>Calculation period of the maximum allowed for an individual (days)</label>
554
  <frontend_type>text</frontend_type>
555
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
556
+ <sort_order>70</sort_order>
557
  <show_in_default>1</show_in_default>
558
  <show_in_website>1</show_in_website>
559
  <show_in_store>1</show_in_store>
561
  <fidelity_points_to_cash>
562
  <label>Conversion rate of points in currency</label>
563
  <frontend_type>text</frontend_type>
564
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_float</backend_model>
565
+ <sort_order>80</sort_order>
566
  <show_in_default>1</show_in_default>
567
  <show_in_website>1</show_in_website>
568
  <show_in_store>1</show_in_store>
570
  <newsletter_points>
571
  <label>Amount of winning points when subscribe to newsletter on account creation</label>
572
  <frontend_type>text</frontend_type>
573
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
574
+ <sort_order>90</sort_order>
575
  <show_in_default>1</show_in_default>
576
  <show_in_website>1</show_in_website>
577
  <show_in_store>1</show_in_store>
579
  <first_order_points>
580
  <label>Amount of winning points for first order</label>
581
  <frontend_type>text</frontend_type>
582
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_naturalNumber</backend_model>
583
+ <sort_order>100</sort_order>
584
  <show_in_default>1</show_in_default>
585
  <show_in_website>1</show_in_website>
586
  <show_in_store>1</show_in_store>
590
  <invitation translate="label">
591
  <label>Sponsorship mail options</label>
592
  <frontend_type>text</frontend_type>
593
+ <sort_order>5</sort_order>
594
  <show_in_default>1</show_in_default>
595
  <show_in_website>1</show_in_website>
596
  <show_in_store>1</show_in_store>
598
  <sponsor_invitation_validity translate="label">
599
  <label>Time validity invitations (days)</label>
600
  <frontend_type>text</frontend_type>
601
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
602
  <sort_order>1</sort_order>
603
  <show_in_default>1</show_in_default>
604
  <show_in_website>1</show_in_website>
607
  <time_before_boost translate="label">
608
  <label>Time to send it automatically (days)</label>
609
  <frontend_type>text</frontend_type>
610
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
611
  <sort_order>5</sort_order>
612
  <show_in_default>1</show_in_default>
613
  <show_in_website>1</show_in_website>
616
  <max_recipients translate="label">
617
  <label>Max invitations</label>
618
  <frontend_type>text</frontend_type>
619
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_entier</backend_model>
620
  <sort_order>10</sort_order>
621
  <show_in_default>1</show_in_default>
622
  <show_in_website>1</show_in_website>
623
  <show_in_store>1</show_in_store>
624
  </max_recipients>
625
  <template translate="label">
626
+ <label>Invitation Email Template</label>
627
  <frontend_type>select</frontend_type>
628
  <source_model>adminhtml/system_config_source_email_template</source_model>
629
  <sort_order>20</sort_order>
636
  <coupon translate="label">
637
  <label>Voucher exchange mail options</label>
638
  <frontend_type>text</frontend_type>
639
+ <sort_order>6</sort_order>
640
  <show_in_default>1</show_in_default>
641
  <show_in_website>1</show_in_website>
642
  <show_in_store>1</show_in_store>
643
  <fields>
644
  <template translate="label">
645
+ <label>Coupon Email Template</label>
646
  <frontend_type>select</frontend_type>
647
  <source_model>adminhtml/system_config_source_email_template</source_model>
648
  <sort_order>1</sort_order>
654
  </coupon>
655
  <open_inviter translate="label comment">
656
  <label>Open Inviter options</label>
657
+ <sort_order>7</sort_order>
658
  <show_in_default>1</show_in_default>
659
  <show_in_website>1</show_in_website>
660
  <show_in_store>1</show_in_store>
672
  <username>
673
  <label>Username</label>
674
  <frontend_type>text</frontend_type>
675
+ <backend_model>auguria_sponsorship/adminhtml_system_config_backend_sponsorship_openinviter</backend_model>
676
  <sort_order>2</sort_order>
677
  <show_in_default>1</show_in_default>
678
  <show_in_website>1</show_in_website>
689
  </fields>
690
  </open_inviter>
691
  </groups>
692
+ </auguria_sponsorship>
693
  </sections>
694
  </config>
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $installer = $this;
9
+ $installer->startSetup();
10
+
11
+ if ($installer->hasSponsorshipInstall()) {
12
+ $installer->run("ALTER TABLE `{$this->getTable('sponsorship')}` RENAME `{$this->getTable('auguria_sponsorship/sponsorship')}`;");
13
+ }
14
+ else {
15
+ $date = now();
16
+ $storeId = Mage::app()->getStore()->getId();
17
+ $installer->run("
18
+
19
+ CREATE TABLE IF NOT EXISTS {$this->getTable('auguria_sponsorship/sponsorship')} (
20
+ `sponsorship_id` int(11) unsigned NOT NULL auto_increment,
21
+ `parent_id` int(10) unsigned NOT NULL,
22
+ `child_mail` varchar(255) NOT NULL default '',
23
+ `child_firstname` varchar(255) NOT NULL default '',
24
+ `child_lastname` varchar(255) NOT NULL default '',
25
+ `status` smallint(6) NOT NULL default '0',
26
+ `created_time` datetime NULL,
27
+ `update_time` datetime NULL,
28
+ PRIMARY KEY (`sponsorship_id`)
29
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
30
+
31
+ INSERT INTO `{$this->getTable('cms_page')}`
32
+ (`title`, `root_template`, `meta_keywords`, `meta_description`, `identifier`, `content_heading`, `content`, `creation_time`,
33
+ `update_time`, `is_active`, `sort_order`, `layout_update_xml`, `custom_theme`, `custom_theme_from`,
34
+ `custom_theme_to`)
35
+ VALUES (
36
+ 'Sample of sponsorship principles', 'two_columns_right', 'Sponsorship', 'Information on sponsorship', 'sponsorship_info',
37
+ 'Sample of sponsorship principles',
38
+ '<p>By sponsoring friends you can earn:</p>\r\n<ul class=\"disc\">\r\n<li>Cash</li>\r\n<li>Vouchers</li>\r\n</ul>\r\n<p>Every time one of your godson order, you win 5% of its order !</p>\r\n<p>But that\'s not all, if your godson sponsors too, you earn 50% of what your godson has won...</p>\r\n<p>For example,</p>\r\n<ul class=\"disc\">\r\n<li>your godson place an order of 100 euros (you win 5 points)</li>\r\n<li>your godson sponsors 2 friends who order 100 euros each (you win 5 points)</li>\r\n<li>the godchildren of your godson each sponsor 2 people who order 100 euros each (you win 5 points)...</li>\r\n</ul>\r\n<p>Then you can exchange your points into cash or vouchers.</p>\r\n<p style=\"text-align:right;\"><a href=\"../sponsorship\">Yes I want sponsors friends to earn cash or vouchers !</a></p>',
39
+ '$date', '$date', 1, 0, '', '', NULL , NULL
40
+ );
41
+
42
+ INSERT INTO `{$this->getTable('cms/page_store')}` (`page_id`, `store_id`) VALUES
43
+ (LAST_INSERT_ID(), $storeId);
44
+ ");
45
+ }
46
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $setup = $this;
9
+ $setup->startSetup();
10
+
11
+ if (!$setup->hasSponsorshipInstall()) {
12
+ $setup->addAttribute('customer', 'sponsor', array(
13
+ 'type' => 'int',
14
+ 'backend' => '',
15
+ 'frontend' => '',
16
+ 'label' => 'Parrain',
17
+ 'input' => 'text',
18
+ 'class' => '',
19
+ 'source' => '',
20
+ 'visible' => true,
21
+ 'required' => false,
22
+ 'user_defined' => false,
23
+ 'default' => '',
24
+ 'searchable' => false,
25
+ 'filterable' => false,
26
+ 'comparable' => false,
27
+ 'visible_on_front' => false,
28
+ 'unique' => false,
29
+ ));
30
+
31
+ $setup->addAttribute('customer', 'fidelity_points', array(
32
+ 'type' => 'decimal',
33
+ 'backend' => '',
34
+ 'frontend' => '',
35
+ 'label' => 'Points Fidélité',
36
+ 'input' => 'text',
37
+ 'class' => '',
38
+ 'source' => '',
39
+ 'visible' => true,
40
+ 'required' => false,
41
+ 'user_defined' => false,
42
+ 'default' => 0,
43
+ 'searchable' => false,
44
+ 'filterable' => false,
45
+ 'comparable' => false,
46
+ 'visible_on_front' => false,
47
+ 'unique' => false,
48
+ ));
49
+
50
+ $setup->addAttribute('customer', 'sponsor_points', array(
51
+ 'type' => 'decimal',
52
+ 'backend' => '',
53
+ 'frontend' => '',
54
+ 'label' => 'Points de Parrainage',
55
+ 'input' => 'text',
56
+ 'class' => '',
57
+ 'source' => '',
58
+ 'visible' => true,
59
+ 'required' => false,
60
+ 'user_defined' => false,
61
+ 'default' => 0,
62
+ 'searchable' => false,
63
+ 'filterable' => false,
64
+ 'comparable' => false,
65
+ 'visible_on_front' => false,
66
+ 'unique' => false,
67
+ ));
68
+ }
69
+ $setup->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $installer = $this;
9
+
10
+ $installer->startSetup();
11
+ if ($installer->hasSponsorshipInstall()) {
12
+ $installer->run("
13
+ ALTER TABLE `{$this->getTable('catalogrule_product_fidelity_point')}` RENAME `{$this->getTable('auguria_sponsorship/catalogfidelitypoint')}`;
14
+ ALTER TABLE `{$this->getTable('catalogrule_product_sponsor_point')}` RENAME `{$this->getTable('auguria_sponsorship/catalogsponsorpoint')}`;
15
+ ");
16
+ }
17
+ else {
18
+ $installer->run("
19
+ ALTER TABLE {$this->getTable('catalogrule_product')} CHANGE `action_operator` `action_operator`
20
+ ENUM( 'to_fixed', 'to_percent', 'by_fixed', 'by_percent', 'fidelity_points_to_percent', 'fidelity_points_to_fixed', 'sponsor_points_to_percent', 'sponsor_points_to_fixed' )
21
+ CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'to_fixed';
22
+
23
+ CREATE TABLE IF NOT EXISTS {$this->getTable('auguria_sponsorship/catalogfidelitypoint')} (
24
+ `rule_product_fidelity_point_id` int(10) unsigned NOT NULL auto_increment,
25
+ `rule_date` date NOT NULL default '0000-00-00',
26
+ `customer_group_id` smallint(5) unsigned NOT NULL default '0',
27
+ `product_id` int(10) unsigned NOT NULL default '0',
28
+ `rule_point` decimal(12,4) NOT NULL default '0.0000',
29
+ `website_id` smallint(5) unsigned NOT NULL,
30
+ `latest_start_date` date default NULL,
31
+ `earliest_end_date` date default NULL,
32
+ PRIMARY KEY (`rule_product_fidelity_point_id`),
33
+ UNIQUE KEY `rule_date` (`rule_date`,`website_id`,`customer_group_id`,`product_id`),
34
+ KEY `FK_catalogrule_product_fidelity_point_customergroup` (`customer_group_id`),
35
+ KEY `FK_catalogrule_product_fidelity_point_website` (`website_id`),
36
+ KEY `FK_CATALOGRULE_PRODUCT_FIDELITY_POINT_PRODUCT` (`product_id`)
37
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
38
+
39
+ CREATE TABLE IF NOT EXISTS {$this->getTable('auguria_sponsorship/catalogsponsorpoint')} (
40
+ `rule_product_sponsor_point_id` int(10) unsigned NOT NULL auto_increment,
41
+ `rule_date` date NOT NULL default '0000-00-00',
42
+ `customer_group_id` smallint(5) unsigned NOT NULL default '0',
43
+ `product_id` int(10) unsigned NOT NULL default '0',
44
+ `rule_point` decimal(12,4) NOT NULL default '0.0000',
45
+ `website_id` smallint(5) unsigned NOT NULL,
46
+ `latest_start_date` date default NULL,
47
+ `earliest_end_date` date default NULL,
48
+ PRIMARY KEY (`rule_product_sponsor_point_id`),
49
+ UNIQUE KEY `rule_date` (`rule_date`,`website_id`,`customer_group_id`,`product_id`),
50
+ KEY `FK_catalogrule_product_sponsor_point_customergroup` (`customer_group_id`),
51
+ KEY `FK_catalogrule_product_sponsor_point_website` (`website_id`),
52
+ KEY `FK_CATALOGRULE_PRODUCT_SPONSOR_POINT_PRODUCT` (`product_id`)
53
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
54
+
55
+ ");
56
+ }
57
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.10-0.1.11.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $setup = $this;
9
+ $setup->startSetup();
10
+ if (!$setup->hasSponsorshipInstall()) {
11
+ $setup->addAttribute('customer', 'special_rate', array(
12
+ 'type' => 'int',
13
+ 'backend' => '',
14
+ 'frontend' => '',
15
+ 'label' => 'Special Rate',
16
+ 'input' => 'text',
17
+ 'class' => '',
18
+ 'source' => '',
19
+ 'visible' => true,
20
+ 'required' => false,
21
+ 'user_defined' => false,
22
+ 'default' => '',
23
+ 'searchable' => false,
24
+ 'filterable' => false,
25
+ 'comparable' => false,
26
+ 'visible_on_front' => false,
27
+ 'unique' => false,
28
+ ));
29
+ }
30
+ $setup->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.2-0.1.3.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
9
+ $setup->startSetup();
10
+ if (!$this->hasSponsorshipInstall()) {
11
+ $setup->addAttribute('order_item', 'catalog_fidelity_points', array(
12
+ 'type' => 'decimal',
13
+ 'backend' => '',
14
+ 'frontend' => '',
15
+ 'label' => 'Points Fidélité',
16
+ 'input' => 'text',
17
+ 'class' => '',
18
+ 'source' => '',
19
+ 'visible' => true,
20
+ 'required' => false,
21
+ 'user_defined' => false,
22
+ 'default' => '',
23
+ 'searchable' => false,
24
+ 'filterable' => false,
25
+ 'comparable' => false,
26
+ 'visible_on_front' => false,
27
+ 'unique' => false,
28
+ ));
29
+
30
+ $setup->addAttribute('order_item', 'catalog_sponsor_points', array(
31
+ 'type' => 'decimal',
32
+ 'backend' => '',
33
+ 'frontend' => '',
34
+ 'label' => 'Points Parrainage',
35
+ 'input' => 'text',
36
+ 'class' => '',
37
+ 'source' => '',
38
+ 'visible' => true,
39
+ 'required' => false,
40
+ 'user_defined' => false,
41
+ 'default' => '',
42
+ 'searchable' => false,
43
+ 'filterable' => false,
44
+ 'comparable' => false,
45
+ 'visible_on_front' => false,
46
+ 'unique' => false,
47
+ ));
48
+
49
+ $setup->addAttribute('order_item', 'cart_fidelity_points', array(
50
+ 'type' => 'decimal',
51
+ 'backend' => '',
52
+ 'frontend' => '',
53
+ 'label' => 'Points Fidélité',
54
+ 'input' => 'text',
55
+ 'class' => '',
56
+ 'source' => '',
57
+ 'visible' => true,
58
+ 'required' => false,
59
+ 'user_defined' => false,
60
+ 'default' => '',
61
+ 'searchable' => false,
62
+ 'filterable' => false,
63
+ 'comparable' => false,
64
+ 'visible_on_front' => false,
65
+ 'unique' => false,
66
+ ));
67
+
68
+ $setup->addAttribute('order_item', 'cart_sponsor_points', array(
69
+ 'type' => 'decimal',
70
+ 'backend' => '',
71
+ 'frontend' => '',
72
+ 'label' => 'Points Parrainage',
73
+ 'input' => 'text',
74
+ 'class' => '',
75
+ 'source' => '',
76
+ 'visible' => true,
77
+ 'required' => false,
78
+ 'user_defined' => false,
79
+ 'default' => '',
80
+ 'searchable' => false,
81
+ 'filterable' => false,
82
+ 'comparable' => false,
83
+ 'visible_on_front' => false,
84
+ 'unique' => false,
85
+ ));
86
+ }
87
+ $setup->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.3-0.1.4.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $installer = $this;
9
+
10
+ $installer->startSetup();
11
+ if (!$installer->hasSponsorshipInstall()) {
12
+ $installer->run("
13
+ CREATE TABLE IF NOT EXISTS {$this->getTable('sponsorship_fidelity_log')} (
14
+ `sponsorship_fidelity_log_id` int(11) unsigned NOT NULL auto_increment,
15
+ `customer_id` int(10) unsigned NOT NULL,
16
+ `record_id` int(10) unsigned NOT NULL,
17
+ `record_type` enum('order', 'gift', 'coupon_code', 'cash', 'admin') NOT NULL,
18
+ `datetime` datetime NOT NULL,
19
+ `points` decimal(12,4) NOT NULL default '0.0000',
20
+ PRIMARY KEY (`sponsorship_fidelity_log_id`),
21
+ KEY `INDEX_FIDELITY_LOG_CUSTOMER_ID` (`customer_id`),
22
+ KEY `INDEX_FIDELITY_LOG_RECORD_ID` (`record_id`)
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
24
+
25
+ CREATE TABLE IF NOT EXISTS {$this->getTable('sponsorship_sponsor_log')} (
26
+ `sponsorship_sponsor_log_id` int(10) unsigned NOT NULL auto_increment,
27
+ `godson_id` int(10) unsigned NOT NULL,
28
+ `sponsor_id` int(10) unsigned NOT NULL,
29
+ `record_id` int(10) unsigned NOT NULL,
30
+ `record_type` enum('order', 'gift', 'coupon_code', 'cash', 'admin') NOT NULL,
31
+ `datetime` datetime NOT NULL,
32
+ `points` decimal(12,4) NOT NULL default '0.0000',
33
+ PRIMARY KEY (`sponsorship_sponsor_log_id`),
34
+ KEY `INDEX_SPONSOR_LOG_GODSON_ID` (`godson_id`),
35
+ KEY `INDEX_SPONSOR_LOG_SPONSOR_ID` (`sponsor_id`)
36
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
37
+ ");
38
+ }
39
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/{sponsorship_setup → auguria_sponsorship_setup}/mysql4-upgrade-0.1.4-0.1.5.php RENAMED
@@ -5,10 +5,11 @@
5
  * @author Auguria
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
- $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
9
  $setup->startSetup();
10
 
11
- $setup->addAttribute('customer', 'iban', array(
 
12
  'type' => 'varchar',
13
  'backend' => '',
14
  'frontend' => '',
@@ -45,5 +46,5 @@ $setup->addAttribute('customer', 'iban', array(
45
  'visible_on_front' => true,
46
  'unique' => false,
47
  ));
48
-
49
  $setup->endSetup();
5
  * @author Auguria
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
+ $setup = $this;
9
  $setup->startSetup();
10
 
11
+ if (!$setup->hasSponsorshipInstall()) {
12
+ $setup->addAttribute('customer', 'iban', array(
13
  'type' => 'varchar',
14
  'backend' => '',
15
  'frontend' => '',
46
  'visible_on_front' => true,
47
  'unique' => false,
48
  ));
49
+ }
50
  $setup->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.5-0.1.6.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $installer = $this;
9
+
10
+ $installer->startSetup();
11
+ if ($installer->hasSponsorshipInstall()) {
12
+ $installer->run("
13
+ ALTER TABLE `{$this->getTable('sponsorship_change')}` RENAME `{$this->getTable('auguria_sponsorship/change')}`;
14
+ ");
15
+ }
16
+ else {
17
+ $installer->run("
18
+ CREATE TABLE IF NOT EXISTS {$this->getTable('auguria_sponsorship/change')} (
19
+ `sponsorship_change_id` int(11) unsigned NOT NULL auto_increment,
20
+ `customer_id` int(10) unsigned NOT NULL,
21
+ `type` enum('gift', 'coupon', 'cash') NOT NULL,
22
+ `module` enum('fidelity', 'sponsor') NOT NULL,
23
+ `statut` enum('waiting', 'exported', 'solved', 'canceled') NOT NULL,
24
+ `datetime` datetime NOT NULL,
25
+ `points` decimal(12,4) NOT NULL default '0.0000',
26
+ `value` varchar(250) NOT NULL,
27
+ PRIMARY KEY (`sponsorship_change_id`),
28
+ KEY `INDEX_CHANGE_CUSTOMER_ID` (`customer_id`),
29
+ KEY `INDEX_CHANGE_TYPE` (`type`),
30
+ KEY `INDEX_CHANGE_MODULE` (`module`),
31
+ KEY `INDEX_CHANGE_STATUT` (`statut`)
32
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
33
+ ");
34
+
35
+ $installer->getConnection()->changeColumn($this->getTable('sponsorship_sponsor_log'),
36
+ 'record_type', 'record_type',
37
+ 'enum("order","gift","coupon","cash","admin") CHARACTER SET utf8 NOT NULL'
38
+ );
39
+ $installer->getConnection()->changeColumn($this->getTable('sponsorship_fidelity_log'),
40
+ 'record_type', 'record_type',
41
+ 'enum("order","gift","coupon","cash","admin") CHARACTER SET utf8 NOT NULL'
42
+ );
43
+ }
44
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.6-0.1.7.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $installer = $this;
9
+
10
+ $installer->startSetup();
11
+ if (!$installer->hasSponsorshipInstall()) {
12
+ $installer->run("
13
+ ALTER TABLE {$this->getTable('auguria_sponsorship/sponsorship')} DROP COLUMN `status`;
14
+ ALTER TABLE {$this->getTable('auguria_sponsorship/sponsorship')} DROP COLUMN `created_time`;
15
+ ALTER TABLE {$this->getTable('auguria_sponsorship/sponsorship')} CHANGE `update_time` `datetime` datetime NULL;
16
+ ");
17
+ }
18
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.7-0.1.8.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
9
+ $setup->startSetup();
10
+ if (!$this->hasSponsorshipInstall()) {
11
+ $setup->addAttribute('quote_item', 'cart_fidelity_points', array(
12
+ 'type' => 'decimal',
13
+ 'backend' => '',
14
+ 'frontend' => '',
15
+ 'label' => 'Points Fidélité',
16
+ 'input' => 'text',
17
+ 'class' => '',
18
+ 'source' => '',
19
+ 'visible' => true,
20
+ 'required' => false,
21
+ 'user_defined' => false,
22
+ 'default' => '',
23
+ 'searchable' => false,
24
+ 'filterable' => false,
25
+ 'comparable' => false,
26
+ 'visible_on_front' => false,
27
+ 'unique' => false,
28
+ ));
29
+
30
+ $setup->addAttribute('quote_item', 'cart_sponsor_points', array(
31
+ 'type' => 'decimal',
32
+ 'backend' => '',
33
+ 'frontend' => '',
34
+ 'label' => 'Points Parrainage',
35
+ 'input' => 'text',
36
+ 'class' => '',
37
+ 'source' => '',
38
+ 'visible' => true,
39
+ 'required' => false,
40
+ 'user_defined' => false,
41
+ 'default' => '',
42
+ 'searchable' => false,
43
+ 'filterable' => false,
44
+ 'comparable' => false,
45
+ 'visible_on_front' => false,
46
+ 'unique' => false,
47
+ ));
48
+ }
49
+ $setup->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-0.1.8-0.1.9.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $installer = $this;
9
+
10
+ $installer->startSetup();
11
+ if (!$installer->hasSponsorshipInstall()) {
12
+ $installer->run("
13
+ ALTER TABLE {$this->getTable('auguria_sponsorship/sponsorship')} ADD COLUMN `message` text;
14
+ ALTER TABLE {$this->getTable('auguria_sponsorship/sponsorship')} ADD COLUMN `parent_mail` varchar(255);
15
+ ALTER TABLE {$this->getTable('auguria_sponsorship/sponsorship')} ADD COLUMN `parent_name` varchar(255);
16
+ ALTER TABLE {$this->getTable('auguria_sponsorship/sponsorship')} ADD COLUMN `subject` varchar(255);
17
+ ALTER TABLE {$this->getTable('auguria_sponsorship/sponsorship')} ADD COLUMN `datetime_boost` datetime;
18
+
19
+ UPDATE {$this->getTable('auguria_sponsorship')} SET `datetime_boost` = `datetime` WHERE ISNULL(`datetime_boost`);
20
+ ");
21
+ }
22
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.0.10-1.1.0.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Remove fields from adminhtml account form because we add a sponsorship tab
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $installer->startSetup();
12
+ if (!$setup->hasSponsorshipInstall()) {
13
+ Mage::getSingleton( 'eav/config' )
14
+ ->getAttribute( 'customer', 'sponsor' )
15
+ ->setData( 'used_in_forms', array() )
16
+ ->save();
17
+
18
+ Mage::getSingleton( 'eav/config' )
19
+ ->getAttribute( 'customer', 'special_rate' )
20
+ ->setData( 'used_in_forms', array() )
21
+ ->save();
22
+
23
+ Mage::getSingleton( 'eav/config' )
24
+ ->getAttribute( 'customer', 'fidelity_points' )
25
+ ->setData( 'used_in_forms', array() )
26
+ ->save();
27
+
28
+ Mage::getSingleton( 'eav/config' )
29
+ ->getAttribute( 'customer', 'sponsor_points' )
30
+ ->setData( 'used_in_forms', array() )
31
+ ->save();
32
+
33
+ Mage::getSingleton( 'eav/config' )
34
+ ->getAttribute( 'customer', 'iban' )
35
+ ->setData( 'used_in_forms', array() )
36
+ ->save();
37
+
38
+ Mage::getSingleton( 'eav/config' )
39
+ ->getAttribute( 'customer', 'siret' )
40
+ ->setData( 'used_in_forms', array() )
41
+ ->save();
42
+
43
+ $installer->updateAttribute('customer', 'sponsor', 'group', 'Sponsorship');
44
+ $installer->updateAttribute('customer', 'special_rate', 'group', 'Sponsorship');
45
+ $installer->updateAttribute('customer', 'fidelity_points', 'group', 'Sponsorship');
46
+ $installer->updateAttribute('customer', 'sponsor_points', 'group', 'Sponsorship');
47
+ $installer->updateAttribute('customer', 'iban', 'group', 'Sponsorship');
48
+ $installer->updateAttribute('customer', 'siret', 'group', 'Sponsorship');
49
+ }
50
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.0.3-1.0.4.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ $installer = $this;
9
+
10
+ $installer->startSetup();
11
+ if ($installer->hasSponsorshipInstall()) {
12
+ $installer->run("ALTER TABLE `{$this->getTable('sponsorship_openinviter')}` RENAME `{$this->getTable('auguria_sponsorship/sponsorshipopeninviter')}`;");
13
+ }
14
+ else {
15
+ $installer->run("
16
+ CREATE TABLE IF NOT EXISTS {$this->getTable('auguria_sponsorship/sponsorshipopeninviter')} (
17
+ `sponsorship_openinviter_id` int(11) unsigned NOT NULL auto_increment,
18
+ `code` varchar(255) NOT NULL,
19
+ `image` varchar(255) default NULL,
20
+ `name` varchar(255) default NULL,
21
+ `status` smallint(6) NOT NULL default '0',
22
+ PRIMARY KEY (`sponsorship_openinviter_id`)
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
24
+ ");
25
+ }
26
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.0.7-1.0.8.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add record type 'first' for first order points in sponsor and fidelity logs
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $installer->startSetup();
12
+
13
+ if (!$setup->hasSponsorshipInstall()) {
14
+ $installer->run("
15
+ ALTER TABLE {$this->getTable('sponsorship_fidelity_log')} CHANGE `record_type` `record_type`
16
+ ENUM('order', 'gift', 'coupon_code', 'cash', 'admin', 'first') NOT NULL;
17
+ ALTER TABLE {$this->getTable('sponsorship_sponsor_log')} CHANGE `record_type` `record_type`
18
+ ENUM('order', 'gift', 'coupon_code', 'cash', 'admin', 'first') NOT NULL;
19
+ ");
20
+ }
21
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.0.8-1.0.9.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Resolve bug to display customer eav attribute in admin form
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $installer->startSetup();
12
+
13
+ if (!$setup->hasSponsorshipInstall()) {
14
+ Mage::getSingleton( 'eav/config' )
15
+ ->getAttribute( 'customer', 'sponsor' )
16
+ ->setData( 'used_in_forms', array( 'adminhtml_customer' ) )
17
+ ->save();
18
+
19
+ Mage::getSingleton( 'eav/config' )
20
+ ->getAttribute( 'customer', 'fidelity_points' )
21
+ ->setData( 'used_in_forms', array( 'adminhtml_customer' ) )
22
+ ->save();
23
+
24
+ Mage::getSingleton( 'eav/config' )
25
+ ->getAttribute( 'customer', 'sponsor_points' )
26
+ ->setData( 'used_in_forms', array( 'adminhtml_customer' ) )
27
+ ->save();
28
+
29
+ $installer->updateAttribute('customer', 'sponsor', 'group', 'Default');
30
+ $installer->updateAttribute('customer', 'fidelity_points', 'group', 'Default');
31
+ $installer->updateAttribute('customer', 'sponsor_points', 'group', 'Default');
32
+
33
+ $installer->updateAttribute('customer', 'sponsor', 'sort_order', 250);
34
+ $installer->updateAttribute('customer', 'fidelity_points', 'sort_order', 251);
35
+ $installer->updateAttribute('customer', 'sponsor_points', 'sort_order', 252);
36
+ }
37
+
38
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.0-1.1.1.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Create fields to allow apply auguria_sponsorship_discount in quote
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
10
+
11
+ $installer->addAttribute('quote_address', 'base_auguria_sponsorship_discount_amount', array(
12
+ 'type' => 'decimal',
13
+ 'backend' => '',
14
+ 'frontend' => '',
15
+ 'label' => 'Base discount',
16
+ 'input' => 'text',
17
+ 'class' => '',
18
+ 'source' => '',
19
+ 'visible' => true,
20
+ 'required' => false,
21
+ 'user_defined' => false,
22
+ 'default' => '',
23
+ 'searchable' => false,
24
+ 'filterable' => false,
25
+ 'comparable' => false,
26
+ 'visible_on_front' => false,
27
+ 'unique' => false,
28
+ ));
29
+ $installer->addAttribute('quote_address', 'auguria_sponsorship_discount_amount', array(
30
+ 'type' => 'decimal',
31
+ 'backend' => '',
32
+ 'frontend' => '',
33
+ 'label' => 'Discount',
34
+ 'input' => 'text',
35
+ 'class' => '',
36
+ 'source' => '',
37
+ 'visible' => true,
38
+ 'required' => false,
39
+ 'user_defined' => false,
40
+ 'default' => '',
41
+ 'searchable' => false,
42
+ 'filterable' => false,
43
+ 'comparable' => false,
44
+ 'visible_on_front' => false,
45
+ 'unique' => false,
46
+ ));
47
+
48
+ $installer->addAttribute('order', 'base_auguria_sponsorship_discount_amount', array(
49
+ 'type' => 'decimal',
50
+ 'backend' => '',
51
+ 'frontend' => '',
52
+ 'label' => 'Base discount',
53
+ 'input' => 'text',
54
+ 'class' => '',
55
+ 'source' => '',
56
+ 'visible' => true,
57
+ 'required' => false,
58
+ 'user_defined' => false,
59
+ 'default' => '',
60
+ 'searchable' => false,
61
+ 'filterable' => false,
62
+ 'comparable' => false,
63
+ 'visible_on_front' => false,
64
+ 'unique' => false,
65
+ ));
66
+ $installer->addAttribute('order', 'auguria_sponsorship_discount_amount', array(
67
+ 'type' => 'decimal',
68
+ 'backend' => '',
69
+ 'frontend' => '',
70
+ 'label' => 'Discount',
71
+ 'input' => 'text',
72
+ 'class' => '',
73
+ 'source' => '',
74
+ 'visible' => true,
75
+ 'required' => false,
76
+ 'user_defined' => false,
77
+ 'default' => '',
78
+ 'searchable' => false,
79
+ 'filterable' => false,
80
+ 'comparable' => false,
81
+ 'visible_on_front' => false,
82
+ 'unique' => false,
83
+ ));
84
+
85
+ $installer->addAttribute('invoice', 'base_auguria_sponsorship_discount_amount', array(
86
+ 'type' => 'decimal',
87
+ 'backend' => '',
88
+ 'frontend' => '',
89
+ 'label' => 'Base discount',
90
+ 'input' => 'text',
91
+ 'class' => '',
92
+ 'source' => '',
93
+ 'visible' => true,
94
+ 'required' => false,
95
+ 'user_defined' => false,
96
+ 'default' => '',
97
+ 'searchable' => false,
98
+ 'filterable' => false,
99
+ 'comparable' => false,
100
+ 'visible_on_front' => false,
101
+ 'unique' => false,
102
+ ));
103
+ $installer->addAttribute('invoice', 'auguria_sponsorship_discount_amount', array(
104
+ 'type' => 'decimal',
105
+ 'backend' => '',
106
+ 'frontend' => '',
107
+ 'label' => 'Discount',
108
+ 'input' => 'text',
109
+ 'class' => '',
110
+ 'source' => '',
111
+ 'visible' => true,
112
+ 'required' => false,
113
+ 'user_defined' => false,
114
+ 'default' => '',
115
+ 'searchable' => false,
116
+ 'filterable' => false,
117
+ 'comparable' => false,
118
+ 'visible_on_front' => false,
119
+ 'unique' => false,
120
+ ));
121
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.1-1.1.2.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Set mode according to configuration
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $sponsorship = $installer->getConnection()->fetchOne("SELECT `value` FROM `{$this->getTable('core_config_data')}` WHERE `path` = 'auguria_sponsorship/sponsor/sponsor_enabled';");
12
+ $fidelity = $installer->getConnection()->fetchOne("SELECT `value` FROM `{$this->getTable('core_config_data')}` WHERE `path` = 'auguria_sponsorship/fidelity/fidelity_enabled';");
13
+
14
+ if ($sponsorship && $fidelity) {
15
+ $installer->setConfigData('auguria_sponsorship/general/module_mode','separated');
16
+ }
17
+ elseif($sponsorship) {
18
+ $installer->setConfigData('auguria_sponsorship/general/module_mode','sponsorship');
19
+ }
20
+ elseif($fidelity) {
21
+ $installer->setConfigData('auguria_sponsorship/general/module_mode','fidelity');
22
+ }
23
+ else {
24
+ $installer->setConfigData('auguria_sponsorship/general/module_mode','separated');
25
+ }
26
+
27
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.2-1.1.3.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add customer attributes to manage points validity
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $installer->addAttribute('customer', 'points_validity', array(
12
+ 'type' => 'datetime',
13
+ 'backend' => 'eav/entity_attribute_backend_datetime',
14
+ 'frontend' => 'eav/entity_attribute_frontend_datetime',
15
+ 'label' => 'Points validity',
16
+ 'input' => 'date',
17
+ 'class' => '',
18
+ 'source' => '',
19
+ 'visible' => true,
20
+ 'required' => false,
21
+ 'user_defined' => false,
22
+ 'default' => '',
23
+ 'searchable' => false,
24
+ 'filterable' => false,
25
+ 'comparable' => false,
26
+ 'visible_on_front' => false,
27
+ 'unique' => false,
28
+ 'used_in_forms' => array('adminhtml_customer'),
29
+ 'group' => 'Default',
30
+ 'sort_order' => 200
31
+ ));
32
+
33
+ $installer->addAttribute('customer', 'sponsorship_points_validity', array(
34
+ 'type' => 'datetime',
35
+ 'backend' => 'eav/entity_attribute_backend_datetime',
36
+ 'frontend' => 'eav/entity_attribute_frontend_datetime',
37
+ 'label' => 'Sponsorship points validity',
38
+ 'input' => 'date',
39
+ 'class' => '',
40
+ 'source' => '',
41
+ 'visible' => true,
42
+ 'required' => false,
43
+ 'user_defined' => false,
44
+ 'default' => '',
45
+ 'searchable' => false,
46
+ 'filterable' => false,
47
+ 'comparable' => false,
48
+ 'visible_on_front' => false,
49
+ 'unique' => false,
50
+ 'used_in_forms' => array('adminhtml_customer'),
51
+ 'group' => 'Default',
52
+ 'sort_order' => 200
53
+ ));
54
+
55
+ $installer->addAttribute('customer', 'fidelity_points_validity', array(
56
+ 'type' => 'datetime',
57
+ 'backend' => 'eav/entity_attribute_backend_datetime',
58
+ 'frontend' => 'eav/entity_attribute_frontend_datetime',
59
+ 'label' => 'Fidelity points validity',
60
+ 'input' => 'date',
61
+ 'class' => '',
62
+ 'source' => '',
63
+ 'visible' => true,
64
+ 'required' => false,
65
+ 'user_defined' => false,
66
+ 'default' => '',
67
+ 'searchable' => false,
68
+ 'filterable' => false,
69
+ 'comparable' => false,
70
+ 'visible_on_front' => false,
71
+ 'unique' => false,
72
+ 'used_in_forms' => array('adminhtml_customer'),
73
+ 'group' => 'Default',
74
+ 'sort_order' => 200
75
+ ));
76
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.3-1.1.4.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Update log tables and change table to add cart type
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $installer->getConnection()->changeColumn($this->getTable('sponsorship_sponsor_log'),
12
+ "record_type", "record_type",
13
+ "enum('order', 'gift', 'coupon_code', 'cash', 'admin', 'first', 'cart') NOT NULL"
14
+ );
15
+ $installer->getConnection()->changeColumn($this->getTable('sponsorship_fidelity_log'),
16
+ "record_type", "record_type",
17
+ "enum('order', 'gift', 'coupon_code', 'cash', 'admin', 'first', 'cart') NOT NULL"
18
+ );
19
+ $installer->getConnection()->changeColumn($this->getTable("auguria_sponsorship/change"),
20
+ "type", "type",
21
+ "enum('gift', 'coupon', 'cash', 'cart') NOT NULL"
22
+ );
23
+
24
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.4-1.1.5.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add fields points used to remove points from customer
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
10
+
11
+ $installer->addAttribute('quote_address', 'auguria_sponsorship_fidelity_points_used', array(
12
+ 'type' => 'decimal',
13
+ 'backend' => '',
14
+ 'frontend' => '',
15
+ 'label' => 'Fidelity points used',
16
+ 'input' => 'text',
17
+ 'class' => '',
18
+ 'source' => '',
19
+ 'visible' => true,
20
+ 'required' => false,
21
+ 'user_defined' => false,
22
+ 'default' => '',
23
+ 'searchable' => false,
24
+ 'filterable' => false,
25
+ 'comparable' => false,
26
+ 'visible_on_front' => false,
27
+ 'unique' => false,
28
+ ));
29
+
30
+ $installer->addAttribute('quote_address', 'auguria_sponsorship_sponsor_points_used', array(
31
+ 'type' => 'decimal',
32
+ 'backend' => '',
33
+ 'frontend' => '',
34
+ 'label' => 'Sponsorship points used',
35
+ 'input' => 'text',
36
+ 'class' => '',
37
+ 'source' => '',
38
+ 'visible' => true,
39
+ 'required' => false,
40
+ 'user_defined' => false,
41
+ 'default' => '',
42
+ 'searchable' => false,
43
+ 'filterable' => false,
44
+ 'comparable' => false,
45
+ 'visible_on_front' => false,
46
+ 'unique' => false,
47
+ ));
48
+
49
+ $installer->addAttribute('quote_address', 'auguria_sponsorship_accumulated_points_used', array(
50
+ 'type' => 'decimal',
51
+ 'backend' => '',
52
+ 'frontend' => '',
53
+ 'label' => 'Sponsorship and fidelity points used',
54
+ 'input' => 'text',
55
+ 'class' => '',
56
+ 'source' => '',
57
+ 'visible' => true,
58
+ 'required' => false,
59
+ 'user_defined' => false,
60
+ 'default' => '',
61
+ 'searchable' => false,
62
+ 'filterable' => false,
63
+ 'comparable' => false,
64
+ 'visible_on_front' => false,
65
+ 'unique' => false,
66
+ ));
67
+
68
+
69
+ $installer->addAttribute('order', 'auguria_sponsorship_fidelity_points_used', array(
70
+ 'type' => 'decimal',
71
+ 'backend' => '',
72
+ 'frontend' => '',
73
+ 'label' => 'Fidelity points used',
74
+ 'input' => 'text',
75
+ 'class' => '',
76
+ 'source' => '',
77
+ 'visible' => true,
78
+ 'required' => false,
79
+ 'user_defined' => false,
80
+ 'default' => '',
81
+ 'searchable' => false,
82
+ 'filterable' => false,
83
+ 'comparable' => false,
84
+ 'visible_on_front' => false,
85
+ 'unique' => false,
86
+ ));
87
+
88
+ $installer->addAttribute('order', 'auguria_sponsorship_sponsor_points_used', array(
89
+ 'type' => 'decimal',
90
+ 'backend' => '',
91
+ 'frontend' => '',
92
+ 'label' => 'Sponsorship points used',
93
+ 'input' => 'text',
94
+ 'class' => '',
95
+ 'source' => '',
96
+ 'visible' => true,
97
+ 'required' => false,
98
+ 'user_defined' => false,
99
+ 'default' => '',
100
+ 'searchable' => false,
101
+ 'filterable' => false,
102
+ 'comparable' => false,
103
+ 'visible_on_front' => false,
104
+ 'unique' => false,
105
+ ));
106
+
107
+ $installer->addAttribute('order', 'auguria_sponsorship_accumulated_points_used', array(
108
+ 'type' => 'decimal',
109
+ 'backend' => '',
110
+ 'frontend' => '',
111
+ 'label' => 'Sponsorship and fidelity points used',
112
+ 'input' => 'text',
113
+ 'class' => '',
114
+ 'source' => '',
115
+ 'visible' => true,
116
+ 'required' => false,
117
+ 'user_defined' => false,
118
+ 'default' => '',
119
+ 'searchable' => false,
120
+ 'filterable' => false,
121
+ 'comparable' => false,
122
+ 'visible_on_front' => false,
123
+ 'unique' => false,
124
+ ));
125
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.5-1.1.6.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add accumulated field to customer
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $installer->addAttribute('customer', 'accumulated_points', array(
12
+ 'type' => 'decimal',
13
+ 'backend' => '',
14
+ 'frontend' => '',
15
+ 'label' => 'Points',
16
+ 'input' => 'text',
17
+ 'class' => '',
18
+ 'source' => '',
19
+ 'visible' => true,
20
+ 'required' => false,
21
+ 'user_defined' => false,
22
+ 'default' => 0,
23
+ 'searchable' => false,
24
+ 'filterable' => false,
25
+ 'comparable' => false,
26
+ 'visible_on_front' => false,
27
+ 'unique' => false,
28
+ 'used_in_forms' => array('adminhtml_customer'),
29
+ 'group' => 'Default',
30
+ 'sort_order' => 200
31
+ ));
32
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.6-1.1.7.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Update change table to add module accumulated
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $installer->getConnection()->changeColumn($this->getTable("auguria_sponsorship/change"),
12
+ "module", "module",
13
+ "enum('fidelity', 'sponsor', 'accumulated') NOT NULL"
14
+ );
15
+
16
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.7-1.1.8.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Include log tables in one
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+ $installer->startSetup();
11
+
12
+ $installer->run("
13
+ ALTER TABLE `{$this->getTable('sponsorship_sponsor_log')}` RENAME TO `{$this->getTable('auguria_sponsorship/log')}`;
14
+ ALTER TABLE `{$this->getTable('auguria_sponsorship/log')}` ADD COLUMN `customer_id` int(10) unsigned NULL;
15
+ ALTER TABLE `{$this->getTable('auguria_sponsorship/log')}` CHANGE COLUMN `sponsorship_sponsor_log_id` `sponsorship_log_id` int(10) unsigned NOT NULL auto_increment;
16
+
17
+ ALTER TABLE `{$this->getTable('auguria_sponsorship/log')}` MODIFY COLUMN `godson_id` int(10) unsigned NULL;
18
+ ALTER TABLE `{$this->getTable('auguria_sponsorship/log')}` MODIFY COLUMN `sponsor_id` int(10) unsigned NULL;
19
+
20
+ ALTER TABLE `{$this->getTable('auguria_sponsorship/log')}` ADD INDEX `INDEX_LOG_CUSTOMER_ID` (`customer_id`);
21
+ ALTER TABLE `{$this->getTable('auguria_sponsorship/log')}` ADD INDEX `INDEX_LOG_RECORD_ID` (`record_id`);
22
+ ");
23
+
24
+ $fidelityLogs = $installer->getConnection()->fetchAll("SELECT * FROM `{$installer->getTable('sponsorship_fidelity_log')}`;");
25
+ if (count($fidelityLogs)>0) {
26
+ foreach ($fidelityLogs as $fidelityLog) {
27
+ $log = Mage::getModel('auguria_sponsorship/log');
28
+ $log->setData($fidelityLog);
29
+ $log->save();
30
+ }
31
+ }
32
+
33
+ $installer->run("
34
+ DROP TABLE `{$this->getTable('sponsorship_fidelity_log')}`;
35
+ ");
36
+
37
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.8-1.1.9.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add enum type "validty" to log table
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $installer->getConnection()->changeColumn($this->getTable("auguria_sponsorship/log"),
12
+ "record_type", "record_type",
13
+ "enum('order', 'gift', 'coupon_code', 'cash', 'admin', 'first', 'cart', 'validity') NOT NULL"
14
+ );
15
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/auguria_sponsorship_setup/mysql4-upgrade-1.1.9-1.2.0.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add enum type "newsletter" to log table
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ $installer = $this;
10
+
11
+ $installer->getConnection()->changeColumn($this->getTable("auguria_sponsorship/log"),
12
+ "record_type", "record_type",
13
+ "enum('order', 'gift', 'coupon_code', 'cash', 'admin', 'first', 'cart', 'validity', 'newsletter') NOT NULL"
14
+ );
15
+ $installer->endSetup();
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-install-0.1.0.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $installer = $this;
9
- $installer->startSetup();
10
- $date = now();
11
- $storeId = Mage::app()->getStore()->getId();
12
- $installer->run("
13
-
14
- CREATE TABLE IF NOT EXISTS {$this->getTable('sponsorship')} (
15
- `sponsorship_id` int(11) unsigned NOT NULL auto_increment,
16
- `parent_id` int(10) unsigned NOT NULL,
17
- `child_mail` varchar(255) NOT NULL default '',
18
- `child_firstname` varchar(255) NOT NULL default '',
19
- `child_lastname` varchar(255) NOT NULL default '',
20
- `status` smallint(6) NOT NULL default '0',
21
- `created_time` datetime NULL,
22
- `update_time` datetime NULL,
23
- PRIMARY KEY (`sponsorship_id`)
24
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
25
-
26
- INSERT INTO `{$this->getTable('cms_page')}`
27
- (`title`, `root_template`, `meta_keywords`, `meta_description`, `identifier`, `content_heading`, `content`, `creation_time`,
28
- `update_time`, `is_active`, `sort_order`, `layout_update_xml`, `custom_theme`, `custom_theme_from`,
29
- `custom_theme_to`)
30
- VALUES (
31
- 'Sample of sponsorship principles', 'two_columns_right', 'Sponsorship', 'Information on sponsorship', 'sponsorship_info',
32
- 'Sample of sponsorship principles',
33
- '<p>By sponsoring friends you can earn:</p>\r\n<ul class=\"disc\">\r\n<li>Cash</li>\r\n<li>Vouchers</li>\r\n</ul>\r\n<p>Every time one of your godson order, you win 5% of its order !</p>\r\n<p>But that\'s not all, if your godson sponsors too, you earn 50% of what your godson has won...</p>\r\n<p>For example,</p>\r\n<ul class=\"disc\">\r\n<li>your godson place an order of 100 euros (you win 5 points)</li>\r\n<li>your godson sponsors 2 friends who order 100 euros each (you win 5 points)</li>\r\n<li>the godchildren of your godson each sponsor 2 people who order 100 euros each (you win 5 points)...</li>\r\n</ul>\r\n<p>Then you can exchange your points into cash or vouchers.</p>\r\n<p style=\"text-align:right;\"><a href=\"../sponsorship\">Yes I want sponsors friends to earn cash or vouchers !</a></p>',
34
- '$date', '$date', 1, 0, '', '', NULL , NULL
35
- );
36
-
37
- INSERT INTO `{$this->getTable('cms/page_store')}` (`page_id`, `store_id`) VALUES
38
- (LAST_INSERT_ID(), $storeId);
39
- ");
40
-
41
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.0-0.1.1.php DELETED
@@ -1,68 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
9
- $setup->startSetup();
10
-
11
- $setup->addAttribute('customer', 'sponsor', array(
12
- 'type' => 'int',
13
- 'backend' => '',
14
- 'frontend' => '',
15
- 'label' => 'Parrain',
16
- 'input' => 'text',
17
- 'class' => '',
18
- 'source' => '',
19
- 'visible' => true,
20
- 'required' => false,
21
- 'user_defined' => false,
22
- 'default' => '',
23
- 'searchable' => false,
24
- 'filterable' => false,
25
- 'comparable' => false,
26
- 'visible_on_front' => false,
27
- 'unique' => false,
28
- ));
29
-
30
- $setup->addAttribute('customer', 'fidelity_points', array(
31
- 'type' => 'decimal',
32
- 'backend' => '',
33
- 'frontend' => '',
34
- 'label' => 'Points Fidélité',
35
- 'input' => 'text',
36
- 'class' => '',
37
- 'source' => '',
38
- 'visible' => true,
39
- 'required' => false,
40
- 'user_defined' => false,
41
- 'default' => 0,
42
- 'searchable' => false,
43
- 'filterable' => false,
44
- 'comparable' => false,
45
- 'visible_on_front' => false,
46
- 'unique' => false,
47
- ));
48
-
49
- $setup->addAttribute('customer', 'sponsor_points', array(
50
- 'type' => 'decimal',
51
- 'backend' => '',
52
- 'frontend' => '',
53
- 'label' => 'Points de Parrainage',
54
- 'input' => 'text',
55
- 'class' => '',
56
- 'source' => '',
57
- 'visible' => true,
58
- 'required' => false,
59
- 'user_defined' => false,
60
- 'default' => 0,
61
- 'searchable' => false,
62
- 'filterable' => false,
63
- 'comparable' => false,
64
- 'visible_on_front' => false,
65
- 'unique' => false,
66
- ));
67
-
68
- $setup->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.1-0.1.2.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $installer = $this;
9
-
10
- $installer->startSetup();
11
-
12
- $installer->run("
13
-
14
- ALTER TABLE {$this->getTable('catalogrule_product')} CHANGE `action_operator` `action_operator`
15
- ENUM( 'to_fixed', 'to_percent', 'by_fixed', 'by_percent', 'fidelity_points_to_percent', 'fidelity_points_to_fixed', 'sponsor_points_to_percent', 'sponsor_points_to_fixed' )
16
- CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'to_fixed';
17
-
18
- CREATE TABLE IF NOT EXISTS {$this->getTable('catalogrule_product_fidelity_point')} (
19
- `rule_product_fidelity_point_id` int(10) unsigned NOT NULL auto_increment,
20
- `rule_date` date NOT NULL default '0000-00-00',
21
- `customer_group_id` smallint(5) unsigned NOT NULL default '0',
22
- `product_id` int(10) unsigned NOT NULL default '0',
23
- `rule_point` decimal(12,4) NOT NULL default '0.0000',
24
- `website_id` smallint(5) unsigned NOT NULL,
25
- `latest_start_date` date default NULL,
26
- `earliest_end_date` date default NULL,
27
- PRIMARY KEY (`rule_product_fidelity_point_id`),
28
- UNIQUE KEY `rule_date` (`rule_date`,`website_id`,`customer_group_id`,`product_id`),
29
- KEY `FK_catalogrule_product_fidelity_point_customergroup` (`customer_group_id`),
30
- KEY `FK_catalogrule_product_fidelity_point_website` (`website_id`),
31
- KEY `FK_CATALOGRULE_PRODUCT_FIDELITY_POINT_PRODUCT` (`product_id`)
32
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
33
-
34
- CREATE TABLE IF NOT EXISTS {$this->getTable('catalogrule_product_sponsor_point')} (
35
- `rule_product_sponsor_point_id` int(10) unsigned NOT NULL auto_increment,
36
- `rule_date` date NOT NULL default '0000-00-00',
37
- `customer_group_id` smallint(5) unsigned NOT NULL default '0',
38
- `product_id` int(10) unsigned NOT NULL default '0',
39
- `rule_point` decimal(12,4) NOT NULL default '0.0000',
40
- `website_id` smallint(5) unsigned NOT NULL,
41
- `latest_start_date` date default NULL,
42
- `earliest_end_date` date default NULL,
43
- PRIMARY KEY (`rule_product_sponsor_point_id`),
44
- UNIQUE KEY `rule_date` (`rule_date`,`website_id`,`customer_group_id`,`product_id`),
45
- KEY `FK_catalogrule_product_sponsor_point_customergroup` (`customer_group_id`),
46
- KEY `FK_catalogrule_product_sponsor_point_website` (`website_id`),
47
- KEY `FK_CATALOGRULE_PRODUCT_SPONSOR_POINT_PRODUCT` (`product_id`)
48
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
49
-
50
- ");
51
-
52
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.10-0.1.11.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
9
- $setup->startSetup();
10
-
11
- $setup->addAttribute('customer', 'special_rate', array(
12
- 'type' => 'int',
13
- 'backend' => '',
14
- 'frontend' => '',
15
- 'label' => 'Special Rate',
16
- 'input' => 'text',
17
- 'class' => '',
18
- 'source' => '',
19
- 'visible' => true,
20
- 'required' => false,
21
- 'user_defined' => false,
22
- 'default' => '',
23
- 'searchable' => false,
24
- 'filterable' => false,
25
- 'comparable' => false,
26
- 'visible_on_front' => false,
27
- 'unique' => false,
28
- ));
29
-
30
- $setup->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.2-0.1.3.php DELETED
@@ -1,87 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
9
- $setup->startSetup();
10
-
11
- $setup->addAttribute('order_item', 'catalog_fidelity_points', array(
12
- 'type' => 'decimal',
13
- 'backend' => '',
14
- 'frontend' => '',
15
- 'label' => 'Points Fidélité',
16
- 'input' => 'text',
17
- 'class' => '',
18
- 'source' => '',
19
- 'visible' => true,
20
- 'required' => false,
21
- 'user_defined' => false,
22
- 'default' => '',
23
- 'searchable' => false,
24
- 'filterable' => false,
25
- 'comparable' => false,
26
- 'visible_on_front' => false,
27
- 'unique' => false,
28
- ));
29
-
30
- $setup->addAttribute('order_item', 'catalog_sponsor_points', array(
31
- 'type' => 'decimal',
32
- 'backend' => '',
33
- 'frontend' => '',
34
- 'label' => 'Points Parrainage',
35
- 'input' => 'text',
36
- 'class' => '',
37
- 'source' => '',
38
- 'visible' => true,
39
- 'required' => false,
40
- 'user_defined' => false,
41
- 'default' => '',
42
- 'searchable' => false,
43
- 'filterable' => false,
44
- 'comparable' => false,
45
- 'visible_on_front' => false,
46
- 'unique' => false,
47
- ));
48
-
49
- $setup->addAttribute('order_item', 'cart_fidelity_points', array(
50
- 'type' => 'decimal',
51
- 'backend' => '',
52
- 'frontend' => '',
53
- 'label' => 'Points Fidélité',
54
- 'input' => 'text',
55
- 'class' => '',
56
- 'source' => '',
57
- 'visible' => true,
58
- 'required' => false,
59
- 'user_defined' => false,
60
- 'default' => '',
61
- 'searchable' => false,
62
- 'filterable' => false,
63
- 'comparable' => false,
64
- 'visible_on_front' => false,
65
- 'unique' => false,
66
- ));
67
-
68
- $setup->addAttribute('order_item', 'cart_sponsor_points', array(
69
- 'type' => 'decimal',
70
- 'backend' => '',
71
- 'frontend' => '',
72
- 'label' => 'Points Parrainage',
73
- 'input' => 'text',
74
- 'class' => '',
75
- 'source' => '',
76
- 'visible' => true,
77
- 'required' => false,
78
- 'user_defined' => false,
79
- 'default' => '',
80
- 'searchable' => false,
81
- 'filterable' => false,
82
- 'comparable' => false,
83
- 'visible_on_front' => false,
84
- 'unique' => false,
85
- ));
86
-
87
- $setup->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.3-0.1.4.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $installer = $this;
9
-
10
- $installer->startSetup();
11
-
12
- $installer->run("
13
-
14
- CREATE TABLE IF NOT EXISTS {$this->getTable('sponsorship_fidelity_log')} (
15
- `sponsorship_fidelity_log_id` int(11) unsigned NOT NULL auto_increment,
16
- `customer_id` int(10) unsigned NOT NULL,
17
- `record_id` int(10) unsigned NOT NULL,
18
- `record_type` enum('order', 'gift', 'coupon_code', 'cash', 'admin') NOT NULL,
19
- `datetime` datetime NOT NULL,
20
- `points` decimal(12,4) NOT NULL default '0.0000',
21
- PRIMARY KEY (`sponsorship_fidelity_log_id`),
22
- KEY `INDEX_FIDELITY_LOG_CUSTOMER_ID` (`customer_id`),
23
- KEY `INDEX_FIDELITY_LOG_RECORD_ID` (`record_id`)
24
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
25
-
26
- CREATE TABLE IF NOT EXISTS {$this->getTable('sponsorship_sponsor_log')} (
27
- `sponsorship_sponsor_log_id` int(10) unsigned NOT NULL auto_increment,
28
- `godson_id` int(10) unsigned NOT NULL,
29
- `sponsor_id` int(10) unsigned NOT NULL,
30
- `record_id` int(10) unsigned NOT NULL,
31
- `record_type` enum('order', 'gift', 'coupon_code', 'cash', 'admin') NOT NULL,
32
- `datetime` datetime NOT NULL,
33
- `points` decimal(12,4) NOT NULL default '0.0000',
34
- PRIMARY KEY (`sponsorship_sponsor_log_id`),
35
- KEY `INDEX_SPONSOR_LOG_GODSON_ID` (`godson_id`),
36
- KEY `INDEX_SPONSOR_LOG_SPONSOR_ID` (`sponsor_id`)
37
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
38
- ");
39
-
40
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.5-0.1.6.php DELETED
@@ -1,39 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $installer = $this;
9
-
10
- $installer->startSetup();
11
-
12
- $installer->run("
13
- CREATE TABLE IF NOT EXISTS {$this->getTable('sponsorship_change')} (
14
- `sponsorship_change_id` int(11) unsigned NOT NULL auto_increment,
15
- `customer_id` int(10) unsigned NOT NULL,
16
- `type` enum('gift', 'coupon', 'cash') NOT NULL,
17
- `module` enum('fidelity', 'sponsor') NOT NULL,
18
- `statut` enum('waiting', 'exported', 'solved', 'canceled') NOT NULL,
19
- `datetime` datetime NOT NULL,
20
- `points` decimal(12,4) NOT NULL default '0.0000',
21
- `value` varchar(250) NOT NULL,
22
- PRIMARY KEY (`sponsorship_change_id`),
23
- KEY `INDEX_CHANGE_CUSTOMER_ID` (`customer_id`),
24
- KEY `INDEX_CHANGE_TYPE` (`type`),
25
- KEY `INDEX_CHANGE_MODULE` (`module`),
26
- KEY `INDEX_CHANGE_STATUT` (`statut`)
27
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
28
- ");
29
-
30
- $installer->getConnection()->changeColumn($this->getTable('sponsorship_sponsor_log'),
31
- 'record_type', 'record_type',
32
- 'enum("order","gift","coupon","cash","admin") CHARACTER SET utf8 NOT NULL'
33
- );
34
- $installer->getConnection()->changeColumn($this->getTable('sponsorship_fidelity_log'),
35
- 'record_type', 'record_type',
36
- 'enum("order","gift","coupon","cash","admin") CHARACTER SET utf8 NOT NULL'
37
- );
38
-
39
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.6-0.1.7.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $installer = $this;
9
-
10
- $installer->startSetup();
11
-
12
- $installer->run("
13
- ALTER TABLE {$this->getTable('sponsorship')} DROP COLUMN `status`;
14
- ALTER TABLE {$this->getTable('sponsorship')} DROP COLUMN `created_time`;
15
- ALTER TABLE {$this->getTable('sponsorship')} CHANGE `update_time` `datetime` datetime NULL;
16
- ");
17
-
18
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.7-0.1.8.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
9
- $setup->startSetup();
10
-
11
- $setup->addAttribute('quote_item', 'cart_fidelity_points', array(
12
- 'type' => 'decimal',
13
- 'backend' => '',
14
- 'frontend' => '',
15
- 'label' => 'Points Fidélité',
16
- 'input' => 'text',
17
- 'class' => '',
18
- 'source' => '',
19
- 'visible' => true,
20
- 'required' => false,
21
- 'user_defined' => false,
22
- 'default' => '',
23
- 'searchable' => false,
24
- 'filterable' => false,
25
- 'comparable' => false,
26
- 'visible_on_front' => false,
27
- 'unique' => false,
28
- ));
29
-
30
- $setup->addAttribute('quote_item', 'cart_sponsor_points', array(
31
- 'type' => 'decimal',
32
- 'backend' => '',
33
- 'frontend' => '',
34
- 'label' => 'Points Parrainage',
35
- 'input' => 'text',
36
- 'class' => '',
37
- 'source' => '',
38
- 'visible' => true,
39
- 'required' => false,
40
- 'user_defined' => false,
41
- 'default' => '',
42
- 'searchable' => false,
43
- 'filterable' => false,
44
- 'comparable' => false,
45
- 'visible_on_front' => false,
46
- 'unique' => false,
47
- ));
48
-
49
- $setup->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-0.1.8-0.1.9.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $installer = $this;
9
-
10
- $installer->startSetup();
11
-
12
- $installer->run("
13
- ALTER TABLE {$this->getTable('sponsorship')} ADD COLUMN `message` text;
14
- ALTER TABLE {$this->getTable('sponsorship')} ADD COLUMN `parent_mail` varchar(255);
15
- ALTER TABLE {$this->getTable('sponsorship')} ADD COLUMN `parent_name` varchar(255);
16
- ALTER TABLE {$this->getTable('sponsorship')} ADD COLUMN `subject` varchar(255);
17
- ALTER TABLE {$this->getTable('sponsorship')} ADD COLUMN `datetime_boost` datetime;
18
-
19
- UPDATE {$this->getTable('sponsorship')} SET `datetime_boost` = `datetime` WHERE ISNULL(`datetime_boost`);
20
- ");
21
-
22
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-1.0.3-1.0.4.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- $installer = $this;
9
-
10
- $installer->startSetup();
11
-
12
- $installer->run("
13
-
14
- CREATE TABLE IF NOT EXISTS {$this->getTable('sponsorship_openinviter')} (
15
- `sponsorship_openinviter_id` int(11) unsigned NOT NULL auto_increment,
16
- `code` varchar(255) NOT NULL,
17
- `image` varchar(255) default NULL,
18
- `name` varchar(255) default NULL,
19
- `status` smallint(6) NOT NULL default '0',
20
- PRIMARY KEY (`sponsorship_openinviter_id`)
21
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
22
- ");
23
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-1.0.7-1.0.8.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- /**
3
- * Add record type 'first' for first order points in sponsor and fidelity logs
4
- * @category Auguria
5
- * @package Auguria_Sponsorship
6
- * @author Auguria
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
- $installer = $this;
10
-
11
- $installer->startSetup();
12
-
13
- $installer->run("
14
-
15
- ALTER TABLE {$this->getTable('sponsorship_fidelity_log')} CHANGE `record_type` `record_type`
16
- ENUM('order', 'gift', 'coupon_code', 'cash', 'admin', 'first') NOT NULL;
17
- ALTER TABLE {$this->getTable('sponsorship_sponsor_log')} CHANGE `record_type` `record_type`
18
- ENUM('order', 'gift', 'coupon_code', 'cash', 'admin', 'first') NOT NULL;
19
-
20
- ");
21
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Auguria/Sponsorship/sql/sponsorship_setup/mysql4-upgrade-1.0.8-1.0.9.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- /**
3
- * Resolve bug to display customer eav attribute in admin form
4
- * @category Auguria
5
- * @package Auguria_Sponsorship
6
- * @author Auguria
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
- $installer = new Mage_Eav_Model_Entity_Setup('core_setup');
10
-
11
- $installer->startSetup();
12
-
13
- Mage::getSingleton( 'eav/config' )
14
- ->getAttribute( 'customer', 'sponsor' )
15
- ->setData( 'used_in_forms', array( 'adminhtml_customer' ) )
16
- ->save();
17
-
18
- Mage::getSingleton( 'eav/config' )
19
- ->getAttribute( 'customer', 'fidelity_points' )
20
- ->setData( 'used_in_forms', array( 'adminhtml_customer' ) )
21
- ->save();
22
-
23
- Mage::getSingleton( 'eav/config' )
24
- ->getAttribute( 'customer', 'sponsor_points' )
25
- ->setData( 'used_in_forms', array( 'adminhtml_customer' ) )
26
- ->save();
27
-
28
- $installer->updateAttribute('customer', 'sponsor', 'group', 'Default');
29
- $installer->updateAttribute('customer', 'fidelity_points', 'group', 'Default');
30
- $installer->updateAttribute('customer', 'sponsor_points', 'group', 'Default');
31
-
32
- $installer->updateAttribute('customer', 'sponsor', 'sort_order', 250);
33
- $installer->updateAttribute('customer', 'fidelity_points', 'sort_order', 251);
34
- $installer->updateAttribute('customer', 'sponsor_points', 'sort_order', 252);
35
-
36
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/auguria/sponsorship.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <layout version="0.1.0">
11
+ <auguria_sponsorship_adminhtml_sponsorship_index>
12
+ <reference name="content">
13
+ <block type="auguria_sponsorship/adminhtml_sponsorship" name="sponsorship" />
14
+ </reference>
15
+ </auguria_sponsorship_adminhtml_sponsorship_index>
16
+ <auguria_sponsorship_adminhtml_link_index>
17
+ <reference name="content">
18
+ <block type="auguria_sponsorship/adminhtml_link" name="link" />
19
+ </reference>
20
+ </auguria_sponsorship_adminhtml_link_index>
21
+ <auguria_sponsorship_adminhtml_change_index>
22
+ <reference name="content">
23
+ <block type="auguria_sponsorship/adminhtml_change" name="change" />
24
+ </reference>
25
+ </auguria_sponsorship_adminhtml_change_index>
26
+ <auguria_sponsorship_adminhtml_openinviter_index>
27
+ <reference name="content">
28
+ <block type="auguria_sponsorship/adminhtml_openinviter" name="openinviter" />
29
+ </reference>
30
+ </auguria_sponsorship_adminhtml_openinviter_index>
31
+
32
+ <adminhtml_customer_edit>
33
+ <update handle="customer_edit_tabs"/>
34
+ <reference name="customer_edit_tabs">
35
+ <action method="addTab"><name>customer_edit_tab_sponsorship</name><block>auguria_sponsorship/adminhtml_customer_tabs_sponsorship</block></action>
36
+ </reference>
37
+ </adminhtml_customer_edit>
38
+ </layout>
app/design/adminhtml/default/default/layout/sponsorship.xml DELETED
@@ -1,31 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * @category Auguria
5
- * @package Auguria_Sponsorship
6
- * @author Auguria
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
- -->
10
- <layout version="0.1.0">
11
- <sponsorship_adminhtml_sponsorship_index>
12
- <reference name="content">
13
- <block type="sponsorship/adminhtml_sponsorship" name="sponsorship" />
14
- </reference>
15
- </sponsorship_adminhtml_sponsorship_index>
16
- <sponsorship_adminhtml_link_index>
17
- <reference name="content">
18
- <block type="sponsorship/adminhtml_link" name="link" />
19
- </reference>
20
- </sponsorship_adminhtml_link_index>
21
- <sponsorship_adminhtml_change_index>
22
- <reference name="content">
23
- <block type="sponsorship/adminhtml_change" name="change" />
24
- </reference>
25
- </sponsorship_adminhtml_change_index>
26
- <sponsorship_adminhtml_openinviter_index>
27
- <reference name="content">
28
- <block type="sponsorship/adminhtml_openinviter" name="openinviter" />
29
- </reference>
30
- </sponsorship_adminhtml_openinviter_index>
31
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/auguria/sponsorship/customer/tabs/sponsorship.phtml ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ ?>
9
+ <div class="entry-edit">
10
+ <div class="entry-edit-head">
11
+ <h4 class="icon-head head-edit-form fieldset-legend">
12
+ <?php echo $this->__('Fidelity and Sponsorship'); ?>
13
+ </h4>
14
+ </div>
15
+ <div id="_sponsorship_fieldset" class="fieldset">
16
+ <div class="hor-scroll">
17
+ <table class="form-list" cellspacing="0">
18
+ <tbody>
19
+ <tr>
20
+ <td class="label">
21
+ <?php echo $this->__('Sponsor'); ?>
22
+ </td>
23
+ <td class="value"><input id="sponsorship_sponsor"
24
+ class=" input-text" type="text"
25
+ value="<?php echo $this->getCustomer()->getSponsor(); ?>"
26
+ name="sponsorship[sponsor]"/>
27
+ <p class="note">
28
+ <span><?php echo $this->__('This is customer id of sponsor.')?>
29
+ </span>
30
+ </p>
31
+ </td>
32
+ </tr>
33
+ <tr>
34
+ <td class="label"><?php echo $this->__('Special rate'); ?>
35
+ </td>
36
+ <td class="value"><input id="sponsorship_special_rate"
37
+ class=" input-text" type="text"
38
+ value="<?php echo $this->getCustomer()->getSpecialRate(); ?>"
39
+ name="sponsorship[special_rate]"/>
40
+ <p class="note">
41
+ <span><?php echo $this->__('If special rate is indicated, sponsor points will be calculated with it. But customer will gain points only on direct sponsorship.')?>
42
+ </span>
43
+ </p>
44
+ </td>
45
+ </tr>
46
+
47
+ <?php
48
+ if (Mage::getStoreConfig('auguria_sponsorship/general/module_mode')=='fidelity'
49
+ || Mage::getStoreConfig('auguria_sponsorship/general/module_mode')=='separated'
50
+ ):
51
+ ?>
52
+ <tr>
53
+ <td class="label"><?php echo $this->__('Fidelity points'); ?>
54
+ </td>
55
+ <td class="value"><input id="sponsorship_fidelity_points"
56
+ class=" input-text" type="text"
57
+ value="<?php echo $this->getCustomer()->getFidelityPoints(); ?>"
58
+ name="sponsorship[fidelity_points]"/>
59
+ <p class="note">
60
+ <span><?php echo $this->__('Sold fidelity points.')?> </span>
61
+ </p>
62
+ </td>
63
+ </tr>
64
+ <tr>
65
+ <td class="label">
66
+ <?php echo $this->__('Validity fidelity points'); ?>
67
+ </td>
68
+ <td class="value">
69
+ <input id="sponsorship_fidelity_points_validity"
70
+ class=" input-text" type="date"
71
+ value="<?php echo $this->formatDate($this->getCustomer()->getFidelityPointsValidity()); ?>"
72
+ name="sponsorship[fidelity_points_validity]"
73
+ style="width:5em"/>
74
+ <img
75
+ title="<?php echo $this->__('Select date'); ?>" alt=""
76
+ src="<?php echo $this->getSkinUrl('images/fam_calendar.gif'); ?>"
77
+ id="sponsorship_fidelity_points_validity_trig">
78
+ </td>
79
+ </tr>
80
+ <?php
81
+ endif;
82
+ if (Mage::getStoreConfig('auguria_sponsorship/general/module_mode')=='sponsorship'
83
+ || Mage::getStoreConfig('auguria_sponsorship/general/module_mode')=='separated'
84
+ ):
85
+ ?>
86
+ <tr>
87
+ <td class="label"><?php echo $this->__('Sponsor points'); ?>
88
+ </td>
89
+ <td class="value">
90
+ <input id="sponsorship_sponsor_points"
91
+ class=" input-text" type="text"
92
+ value="<?php echo $this->getCustomer()->getSponsorPoints(); ?>"
93
+ name="sponsorship[sponsor_points]"/>
94
+ <p class="note">
95
+ <span><?php echo $this->__('Sold sponsor points.')?> </span>
96
+ </p>
97
+ </td>
98
+ </tr>
99
+ <tr>
100
+ <td class="label">
101
+ <?php echo $this->__('Validity sponsorship points'); ?>
102
+ </td>
103
+ <td class="value">
104
+ <input id="sponsorship_sponsorship_points_validity"
105
+ class=" input-text" type="date"
106
+ value="<?php echo $this->formatDate($this->getCustomer()->getSponsorshipPointsValidity()); ?>"
107
+ name="sponsorship[sponsorship_points_validity]"
108
+ style="width:5em"/>
109
+ <img
110
+ title="<?php echo $this->__('Select date'); ?>" alt=""
111
+ src="<?php echo $this->getSkinUrl('images/fam_calendar.gif'); ?>"
112
+ id="sponsorship_sponsorship_points_validity_trig">
113
+ </td>
114
+ </tr>
115
+ <?php
116
+ endif;
117
+ if (Mage::getStoreConfig('auguria_sponsorship/general/module_mode')=='accumulated'):
118
+ ?>
119
+ <tr>
120
+ <td class="label"><?php echo $this->__('Points'); ?>
121
+ </td>
122
+ <td class="value">
123
+ <input id="sponsorship_accumulated_points"
124
+ class=" input-text" type="text"
125
+ value="<?php echo $this->getCustomer()->getAccumulatedPoints(); ?>"
126
+ name="sponsorship[accumulated_points]"/>
127
+ <p class="note">
128
+ <span><?php echo $this->__('Sold points.')?> </span>
129
+ </p>
130
+ </td>
131
+ </tr>
132
+ <tr>
133
+ <td class="label">
134
+ <?php echo $this->__('Validity points'); ?>
135
+ </td>
136
+ <td class="value">
137
+ <input id="sponsorship_points_validity"
138
+ class=" input-text" type="date"
139
+ value="<?php echo $this->formatDate($this->getCustomer()->getPointsValidity()); ?>"
140
+ name="sponsorship[points_validity]"
141
+ style="width:5em"/>
142
+ <img
143
+ title="<?php echo $this->__('Select date'); ?>" alt=""
144
+ src="<?php echo $this->getSkinUrl('images/fam_calendar.gif'); ?>"
145
+ id="sponsorship_points_validity_trig">
146
+ </td>
147
+ </tr>
148
+ <?php
149
+ endif;
150
+ ?>
151
+ <tr>
152
+ <td class="label"><?php echo $this->__('IBAN'); ?>
153
+ </td>
154
+ <td class="value">
155
+ <input id="sponsorship_iban" class=" input-text"
156
+ type="text"
157
+ value="<?php echo $this->getCustomer()->getIban(); ?>"
158
+ name="sponsorship[iban]"/>
159
+ </td>
160
+ <td class="scope-label"><span class="nobr"></span>
161
+ </td>
162
+ </tr>
163
+ <tr>
164
+ <td class="label"><?php echo $this->__('SIRET'); ?>
165
+ </td>
166
+ <td class="value">
167
+ <input id="sponsorship_siret"
168
+ class=" input-text" type="text"
169
+ value="<?php echo $this->getCustomer()->getSiret(); ?>"
170
+ name="sponsorship[siret]"/>
171
+ </td>
172
+ <td class="scope-label"><span class="nobr"></span>
173
+ </td>
174
+ </tr>
175
+ </tbody>
176
+ </table>
177
+ </div>
178
+ </div>
179
+ <script type="text/javascript">
180
+ //<![CDATA[
181
+ <?php
182
+ if (Mage::getStoreConfig('auguria_sponsorship/general/module_mode')=='fidelity'
183
+ || Mage::getStoreConfig('auguria_sponsorship/general/module_mode')=='separated'
184
+ ):
185
+ ?>
186
+ Calendar.setup({
187
+ inputField: "sponsorship_fidelity_points_validity",
188
+ ifFormat: "<?php echo Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); ?>",
189
+ showsTime: false,
190
+ button: "sponsorship_fidelity_points_validity_trig",
191
+ align: "B1",
192
+ singleClick: true
193
+ });
194
+ <?php
195
+ endif;
196
+ if (Mage::getStoreConfig('auguria_sponsorship/general/module_mode')=='sponsorship'
197
+ || Mage::getStoreConfig('auguria_sponsorship/general/module_mode')=='separated'
198
+ ):
199
+ ?>
200
+
201
+ Calendar.setup({
202
+ inputField: "sponsorship_sponsorship_points_validity",
203
+ ifFormat: "<?php echo Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); ?>",
204
+ showsTime: false,
205
+ button: "sponsorship_sponsorship_points_validity_trig",
206
+ align: "B1",
207
+ singleClick: true
208
+ });
209
+ <?php
210
+ endif;
211
+ if (Mage::getStoreConfig('auguria_sponsorship/general/module_mode')=='accumulated'):
212
+ ?>
213
+ Calendar.setup({
214
+ inputField: "sponsorship_points_validity",
215
+ ifFormat: "<?php echo Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); ?>",
216
+ showsTime: false,
217
+ button: "sponsorship_points_validity_trig",
218
+ align: "B1",
219
+ singleClick: true
220
+ });
221
+ <?php endif; ?>
222
+ //]]>
223
+ </script>
224
+ </div>
app/design/frontend/base/default/layout/auguria/sponsorship.xml ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Auguria
5
+ * @package Auguria_Sponsorship
6
+ * @author Auguria
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <layout version="0.1.0">
11
+ <!-- Déclaration du template de l'index -->
12
+ <auguria_sponsorship_index_index>
13
+ <update handle="customer_account"/>
14
+ <reference name="content">
15
+ <block type="auguria_sponsorship/sponsorship" name="sponsorship" template="auguria/sponsorship/sponsorship.phtml" />
16
+ </reference>
17
+ </auguria_sponsorship_index_index>
18
+
19
+ <!-- Déclaration du template OpenInviter -->
20
+ <auguria_sponsorship_openinviter_index>
21
+ <reference name="root">
22
+ <action method="setTemplate"><template>page/empty.phtml</template></action>
23
+ </reference>
24
+ <reference name="content">
25
+ <block type="auguria_sponsorship/openinviter" name="openinviter" template="auguria/sponsorship/openinviter.phtml" />
26
+ </reference>
27
+ </auguria_sponsorship_openinviter_index>
28
+ <auguria_sponsorship_openinviter_import>
29
+ <reference name="root">
30
+ <action method="setTemplate"><template>page/empty.phtml</template></action>
31
+ </reference>
32
+ <reference name="content">
33
+ <block type="auguria_sponsorship/openinviter" name="openinviter" template="auguria/sponsorship/openinviterimport.phtml" />
34
+ </reference>
35
+ </auguria_sponsorship_openinviter_import>
36
+
37
+ <!-- Déclaration du block détail des points fidelité -->
38
+ <auguria_sponsorship_points_fidelity>
39
+ <update handle="customer_account"/>
40
+ <reference name="head">
41
+ <action method="addCss">
42
+ <link>css/auguria/sponsorship/tableorderer.css</link>
43
+ </action>
44
+ <action method="addJs">
45
+ <link>auguria/sponsorship/table_orderer.js</link>
46
+ </action>
47
+ </reference>
48
+ <reference name="content">
49
+ <block type="auguria_sponsorship/customer_account_pointsDetail" name="fidelity_customer_pointsdetail" template="auguria/sponsorship/customer/account/fidelitypointsdetail.phtml"/>
50
+ </reference>
51
+ </auguria_sponsorship_points_fidelity>
52
+ <!-- Déclaration du block détail des points parrainage -->
53
+ <auguria_sponsorship_points_sponsorship>
54
+ <update handle="customer_account"/>
55
+ <reference name="head">
56
+ <action method="addCss">
57
+ <link>css/auguria/sponsorship/tableorderer.css</link>
58
+ </action>
59
+ <action method="addJs">
60
+ <link>auguria/sponsorship/table_orderer.js</link>
61
+ </action>
62
+ </reference>
63
+ <reference name="content">
64
+ <block type="auguria_sponsorship/customer_account_pointsDetail" name="sponsorship_customer_pointsdetail" template="auguria/sponsorship/customer/account/sponsorpointsdetail.phtml"/>
65
+ </reference>
66
+ </auguria_sponsorship_points_sponsorship>
67
+ <!-- Déclaration du block détail des points accumulated -->
68
+ <auguria_sponsorship_points_accumulated>
69
+ <update handle="customer_account"/>
70
+ <reference name="head">
71
+ <action method="addCss">
72
+ <link>css/auguria/sponsorship/tableorderer.css</link>
73
+ </action>
74
+ <action method="addJs">
75
+ <link>auguria/sponsorship/table_orderer.js</link>
76
+ </action>
77
+ </reference>
78
+ <reference name="content">
79
+ <block type="auguria_sponsorship/customer_account_pointsDetail" name="accumulated_customer_pointsdetail" template="auguria/sponsorship/customer/account/accumulatedpointsdetail.phtml"/>
80
+ </reference>
81
+ </auguria_sponsorship_points_accumulated>
82
+
83
+ <!-- Déclaration du block pour la relance des filleuls -->
84
+ <auguria_sponsorship_boost_index>
85
+ <update handle="customer_account"/>
86
+ <reference name="content">
87
+ <block type="auguria_sponsorship/customer_form_boost" name="sponsorship_customer_boost" template="auguria/sponsorship/customer/form/boost.phtml"/>
88
+ </reference>
89
+ </auguria_sponsorship_boost_index>
90
+
91
+ <!-- Déclaration du block d'échange des points -->
92
+ <auguria_sponsorship_points_change>
93
+ <update handle="customer_account"/>
94
+ <reference name="content">
95
+ <block type="auguria_sponsorship/customer_form_pointsChange" name="customer_pointschange" template="auguria/sponsorship/customer/form/pointschange.phtml">
96
+ <block type="auguria_sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange_cash" as="cash" template="auguria/sponsorship/customer/form/pointschange/pointschange_cash.phtml"/>
97
+ <block type="auguria_sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange_coupon" as="coupon" template="auguria/sponsorship/customer/form/pointschange/pointschange_coupon.phtml"/>
98
+ <block type="auguria_sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange_gift" as="gift" template="auguria/sponsorship/customer/form/pointschange/pointschange_gift.phtml"/>
99
+ </block>>
100
+ </reference>
101
+ </auguria_sponsorship_points_change>
102
+
103
+ <!-- Add auguria sponsorship account point block into dashboard as info1 -->
104
+ <customer_account_index>
105
+ <reference name="customer_account_dashboard">
106
+ <block type="auguria_sponsorship/customer_account_pointsDetail" name="customer_account_points" as="info1" template="auguria/sponsorship/customer/account/dashboard/points.phtml">
107
+ <block type="auguria_sponsorship/customer_account_pointsDetail" name="customer_account_fidelity_points" as="customer_account_fidelity_points" template="auguria/sponsorship/customer/account/dashboard/fidelity_points.phtml"/>
108
+ <block type="auguria_sponsorship/customer_account_pointsDetail" name="customer_account_sponsor_points" as="customer_account_sponsor_points" template="auguria/sponsorship/customer/account/dashboard/sponsor_points.phtml"/>
109
+ <block type="auguria_sponsorship/customer_account_pointsDetail" name="customer_account_accumulated_points" as="customer_account_accumulated_points" template="auguria/sponsorship/customer/account/dashboard/accumulated_points.phtml"/>
110
+ </block>
111
+ </reference>
112
+ </customer_account_index>
113
+
114
+ <!-- Remplacement de edit.phtml pour ajout champ Iban dans les informations du compte -->
115
+ <customer_account_edit>
116
+ <reference name="customer_edit">
117
+ <action method="setTemplate">
118
+ <template>auguria/sponsorship/customer/form/edit.phtml</template>
119
+ </action>
120
+ </reference>
121
+ </customer_account_edit>
122
+
123
+ <!-- Ajout d'un lien vers le détail des points -->
124
+ <customer_account>
125
+ <reference name="customer_account_navigation">
126
+ <action ifconfig="auguria_sponsorship/fidelity/fidelity_enabled" method="addLink" translate="label" module="auguria_sponsorship"><name>fidelity_points</name><path>auguria_sponsorship/points/fidelity</path><label>Fidelity points management</label></action>
127
+ <action ifconfig="auguria_sponsorship/sponsor/sponsor_enabled" method="addLink" translate="label" module="auguria_sponsorship"><name>sponsor_points</name><path>auguria_sponsorship/points/sponsorship</path><label>Sponsorship management</label></action>
128
+ <action ifconfig="auguria_sponsorship/accumulated/accumulated_enabled" method="addLink" translate="label" module="auguria_sponsorship"><name>accumulated_points</name><path>auguria_sponsorship/points/accumulated</path><label>Fidelity points and sponsorship management</label></action>
129
+ </reference>
130
+ </customer_account>
131
+
132
+ <!-- Remplacement de register.phtml pour afficher email de la session -->
133
+ <customer_account_create>
134
+ <reference name="customer_form_register">
135
+ <action method="setTemplate">
136
+ <template>auguria/sponsorship/customer/form/register.phtml</template>
137
+ </action>
138
+ </reference>
139
+ </customer_account_create>
140
+ </layout>
app/design/frontend/base/default/template/auguria/sponsorship/customer/account/accumulatedpointsdetail.phtml ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ -->
9
+ <?php
10
+ //initialisation des intitulés pour table orderer
11
+ $msgs = "{loading: '".$this->__("loading")
12
+ ."',emptyResults: '".$this->__("emptyResults")
13
+ ."',errorURL: '".$this->__("errorURL")
14
+ ."',errorData: '".$this->__("errorData")
15
+ ."',searchLabel: '".$this->__("searchLabel")
16
+ ."',filterLabel: '".$this->__("filterLabel")
17
+ ."',paginationOf: '".$this->__("paginationOf")
18
+ ."',paginationPages: '".$this->__("paginationPages")
19
+ ."',paginationFirst: '".$this->__("paginationFirst")
20
+ ."',paginationPrev: '".$this->__("paginationPrev")
21
+ ."',paginationNext: '".$this->__("paginationNext")
22
+ ."',paginationLast: '".$this->__("paginationLast")."'}";
23
+ ?>
24
+ <div class="std">
25
+ <div class="page-title">
26
+ <h1>
27
+ <?php echo $this->__('Fidelity and sponsorship points'); ?>
28
+ </h1>
29
+ </div>
30
+ <?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>
31
+
32
+ <p>
33
+ <a href="<?php echo $this->getUrl('sponsorship_info') ?>"><?php echo $this->__('Principles of Sponsorship')?></a>
34
+ </p>
35
+ <p>
36
+ <a href="<?php echo $this->getUrl('sponsorship') ?>"><?php echo $this->__('Sponsor friends')?></a>
37
+ </p>
38
+ <?php if (Mage::helper('auguria_sponsorship/config')->getModuleMode()=='accumulated'):
39
+
40
+ /****************************************************************
41
+ *
42
+ * Invitations
43
+ *
44
+ ****************************************************************/
45
+ ?>
46
+ <br/>
47
+ <h2 class="title"><?php echo $this->__('Your invitations') ?></h2>
48
+ <?php //si l'utilisateur a des invitations en cours
49
+ $invits = $this->getInvits();
50
+ if ($invits):
51
+ ?>
52
+
53
+
54
+ <div id="invit-table"></div>
55
+
56
+ <script type="text/javascript">
57
+ //<![CDATA[
58
+ invitsCols = ['<?php echo $this->__("Guest name");
59
+ ?>','<?php echo $this->__("Guest mail");
60
+ ?>','<?php echo $this->__("Date first invitation");
61
+ ?>','<?php echo $this->__("Date last mail");
62
+ ?>','<?php echo $this->__("Recall");
63
+ ?>'];
64
+ invits = new Array(
65
+ <?php
66
+ $nb = count($invits);
67
+ $i = 1;
68
+ foreach ($invits as $invit):
69
+ echo $this->__('{"invits_name": "%s",',htmlentities($invit["child_firstname"])." ".htmlentities($invit["child_lastname"]));
70
+ echo $this->__('"invits_email": "%s",',$invit["child_mail"]);
71
+ echo $this->__('"invits_first_date": "%s",',$this->formatDate($invit["datetime"]));
72
+ echo $this->__('"invits_last_mail": "%s",',$this->formatDate($invit["datetime_boost"]));
73
+ echo $this->__('"relance":"%s"}',"<a href='".$this->getUrl("sponsorship/boost",array("sponsorship_id"=>$invit["sponsorship_id"]))."'>".$this->__("Recall")."</a>");
74
+ if ($i != $nb)
75
+ {
76
+ echo ",
77
+ ";
78
+ }
79
+ $i++;
80
+ endforeach;
81
+ ?>
82
+ );
83
+ <?php if ($this->isIe8() == true): ?>
84
+ invitsTable = new TableOrderer('invit-table',{data : invits, cols : invitsCols},<?php echo $this->__($msgs); ?>);
85
+ <?php else: ?>
86
+ invitsTable = new TableOrderer('invit-table',{data : invits, cols : invitsCols, filter:'bottom', paginate:'top', pageCount:5, unsortedColumn:['relance']},<?php echo $this->__($msgs); ?>);
87
+ <?php endif; ?>
88
+
89
+ //]]>
90
+ </script>
91
+ <?php else : ?>
92
+ <div>
93
+ <?php echo $this->__("You do not have yet send invit."); ?>
94
+ </div>
95
+ <?php endif; //fin de vérifivcation invitations en cours?>
96
+
97
+ <?php
98
+ /****************************************************************
99
+ *
100
+ * Sponsorships
101
+ *
102
+ ****************************************************************/
103
+ ?>
104
+ <br/>
105
+ <h2 class="title"><?php echo $this->__('Your godsons') ?></h2>
106
+ <?php $_parrainages = $this->getParrainages();
107
+ if ($_parrainages): //si l'utilisateur a déjà parrainé?>
108
+
109
+
110
+ <div id="sponsor-table"></div>
111
+
112
+ <script type="text/javascript">
113
+ sponsorshipsCols = ['<?php echo $this->__("Godson name");
114
+ ?>','<?php echo $this->__("Sponsorship date");
115
+ ?>','<?php echo $this->__("Last order date");
116
+ ?>','<?php echo $this->__("Winning");
117
+ ?>','<?php echo $this->__("Number of sponsorships");
118
+ ?>'];
119
+ sponsorships = new Array(
120
+ <?php
121
+ $nb = count($_parrainages);
122
+ $i = 1;
123
+ foreach ($_parrainages as $_parrainage):
124
+ $dateFDC ="";
125
+ if ($dateDernCde = $this->getDateDernCde ($_parrainage['entity_id'])) {
126
+ $dateFDC = $this->formatDate($dateDernCde);
127
+ }
128
+ else {
129
+ $dateFDC = "-";
130
+ }
131
+ echo $this->__('{"nom": "%s",',htmlentities($_parrainage['name']));
132
+ echo $this->__('"sponsorship_date": "%s",',$this->formatDate($_parrainage['created_at']));
133
+ echo $this->__('"last_order_date": "%s",',$dateFDC);
134
+ echo $this->__('"points": "%.4f",',$this->getBranchPoints ($_parrainage['entity_id']));
135
+ echo $this->__('"sponsorship_count":"%s"}',$this->getNbParrainages ($_parrainage['entity_id']));
136
+ if ($i != $nb)
137
+ {
138
+ echo ",
139
+ ";
140
+ }
141
+ $i++;
142
+ endforeach;
143
+ ?>
144
+ );
145
+ <?php if ($this->isIe8() == true): ?>
146
+ sponsorshipsTable = new TableOrderer('sponsor-table',{data : sponsorships, cols : sponsorshipsCols},<?php echo $this->__($msgs); ?>);
147
+ <?php else: ?>
148
+ sponsorshipsTable = new TableOrderer('sponsor-table',{data : sponsorships, cols : sponsorshipsCols, filter:'bottom', paginate:'top', pageCount:5},<?php echo $this->__($msgs); ?>);
149
+ <?php endif; ?>
150
+ </script>
151
+ <br/>
152
+ <?php else: //si il n'a jamais parrainé déjà parrainé ?>
153
+ <div>
154
+ <?php echo $this->__("You do not have active godson."); ?>
155
+ </div>
156
+ <?php endif; //fin verificatio si il a parrainé ?>
157
+
158
+ <?php
159
+ /****************************************************************
160
+ *
161
+ * Points
162
+ *
163
+ ****************************************************************/
164
+ ?>
165
+ <br/>
166
+ <h2>
167
+ <?php echo $this->__('Use of your points') ?>
168
+ </h2>
169
+ <div class='points'>
170
+ <?php
171
+ $sPoints = $this->getAccumulatedPoints();
172
+ $cash = floor($this->getAccumulatedPointsValue($sPoints));
173
+ $sPoints = floor($sPoints);
174
+ echo $this->__('Points balance:');
175
+ ?>
176
+ <span class='points'><?php echo $this->__('%s points', $sPoints); ?></span>
177
+ <span class='cash'><?php echo $this->__('worth %s', Mage::app()->getStore()->formatPrice($cash)); ?></span>
178
+ </div>
179
+ <?php
180
+ if ($this->isAccumulatedValidityEnabled()):
181
+ ?>
182
+ <div class='validity'>
183
+ <span class='date'><?php echo $this->__('Your points are valid until the %s',$this->getAccumulatedValidity()); ?></span>
184
+ </div>
185
+ <?php
186
+
187
+ endif;
188
+ ?>
189
+ <!--Liste des mouvements de points-->
190
+ <div>
191
+ <?php
192
+ $movements = $this->getPointsMovement();
193
+ $nb = $movements->count();
194
+ if ($nb>0):
195
+ echo $this->__("Your points exchanges:");
196
+
197
+ ?>
198
+
199
+ <div id="sponsor-change-table"></div>
200
+
201
+ <script type="text/javascript">
202
+ sponsorshipChangesCols = ['<?php echo $this->__("Date");
203
+ ?>','<?php echo $this->__("Points");
204
+ ?>','<?php echo $this->__("Value");
205
+ ?>'];
206
+ sponsorshipChanges = new Array(
207
+ <?php
208
+
209
+ $i = 1;
210
+ foreach ($movements as $movement):
211
+
212
+ //echo $this->__('{"type": "%s",',$change->getType());
213
+ echo $this->__('{"date": "%s (%s)",', $this->formatDate($movement->getDatetime(),Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM), $this->getAccumulatedMovementType($movement));
214
+ echo $this->__('"points": "%d",', $movement->getPoints());
215
+ echo $this->__('"valeur": "%s"}', addslashes(Mage::app()->getStore()->formatPrice($this->getAccumulatedPointsValue($movement->getPoints()))));
216
+ if ($i != $nb)
217
+ {
218
+ echo ",
219
+ ";
220
+ }
221
+ $i++;
222
+ endforeach;
223
+ ?>
224
+ );
225
+ <?php if ($this->isIe8() == true): ?>
226
+ new TableOrderer('sponsor-change-table',{data : sponsorshipChanges, cols : sponsorshipChangesCols},<?php echo $this->__($msgs); ?>);
227
+ <?php else: ?>
228
+ new TableOrderer('sponsor-change-table',{data : sponsorshipChanges, cols : sponsorshipChangesCols, filter:'bottom', paginate:'top', pageCount:5},<?php echo $this->__($msgs); ?>);
229
+ <?php endif; ?>
230
+ </script>
231
+ <?php
232
+ endif;
233
+ ?>
234
+ </div>
235
+ <!--Liste des échanges réalisés-->
236
+ <?php if ($sPoints>0): //vérification du solde des points ?>
237
+ <?php if ($this->isAccumulatedChangeEnabled()): //verification change actif?>
238
+ <div>
239
+ <?php echo $this->__('Change your points into:');?>
240
+ <ul class="disc">
241
+ <?php if ($this->getAccumulatedCashConfig()):?>
242
+ <li>
243
+ <a href="<?php echo Mage::getUrl('*/*/change', Array('module'=>'accumulated','type'=>'cash')) ?>"><?php echo $this->__('Cash') ?></a>
244
+ </li>
245
+ <?php endif;?>
246
+ <?php if ($this->getAccumulatedCouponConfig()):?>
247
+ <li>
248
+ <a href="<?php echo Mage::getUrl('*/*/change', Array('module'=>'accumulated','type'=>'coupon')) ?>"><?php echo $this->__('Vouchers') ?></a>
249
+ <?php echo $this->__(':You will receive an email with the discount code you can use on your next order.') ?>
250
+ </li>
251
+ <?php endif;?>
252
+ <?php if ($this->getAccumulatedGiftConfig()):?>
253
+ <li>
254
+ <a href="<?php echo Mage::getUrl('*/*/change', Array('module'=>'accumulated','type'=>'gift')) ?>"><?php echo $this->__('Gifts') ?></a>
255
+ </li>
256
+ <?php endif;?>
257
+ </ul>
258
+ </div>
259
+ <?php endif; //change actif?>
260
+ <?php else: //si il n'a pas de points?>
261
+ <?php if ($this->isAccumulatedChangeEnabled()):?>
262
+ <div>
263
+ <?php echo $this->__('Once you will have points, you can change them into:');?>
264
+ </div>
265
+ <ul class="disc">
266
+ <?php if ($this->getAccumulatedCashConfig()):?>
267
+ <li>
268
+ <?php echo $this->__('Cash') ?>
269
+ </li>
270
+ <?php endif;?>
271
+ <?php if ($this->getAccumulatedCouponConfig()):?>
272
+ <li>
273
+ <?php echo $this->__('Vouchers') ?>
274
+ <?php echo $this->__(':You will receive an email with the discount code you can use on your next order.') ?>
275
+ </li>
276
+ <?php endif;?>
277
+ <?php if ($this->getAccumulatedGiftConfig()):?>
278
+ <li>
279
+ <?php echo $this->__('Gifts') ?>
280
+ </li>
281
+ <?php endif;?>
282
+ </ul>
283
+ <?php endif;//change enable ?>
284
+ <?php endif; //fin de vérification solde des points ?>
285
+ <?php endif; //fin module parrainage enable ?>
286
+ <div class="buttons-set">
287
+ <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
288
+ </div>
289
+ </div>
app/design/frontend/base/default/template/auguria/sponsorship/customer/account/dashboard/accumulated_points.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ -->
9
+ <?php
10
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
11
+ if ($mode=='accumulated'):
12
+ $customerId = $this->getUserId();
13
+ $customer = Mage::getModel('customer/customer')->load($customerId);
14
+ $nbSponsor = $this->getNbParrainages ($customerId);
15
+ ?>
16
+ <div class="box-account box-fidelity-sponsorship">
17
+ <div class="box-head">
18
+ <h2><?php echo $this->__('Fidelity and sponsorship'); ?></h2>
19
+ <a href="<?php echo $this->getUrl('sponsorship/accumulatedpoints') ?>"><?php echo $this->__('Details')?></a>
20
+ </div>
21
+ <div class="col1-set">
22
+ <?php echo $this->__('Fidelity and sponsorship points:') ?> <?php echo floor($customer->getAccumulatedPoints()); ?>
23
+ <br/>
24
+ <?php echo $this->__('Active godsons:') ?> <?php echo $nbSponsor; ?>
25
+ <br/>
26
+ <a href="<?php echo $this->getUrl('sponsorship_info') ?>"><?php echo $this->__('Principles of Sponsorship')?></a>
27
+ <br/>
28
+ <a href="<?php echo $this->getUrl('sponsorship') ?>"><?php echo $this->__('Sponsor friends')?></a>
29
+ <br/>
30
+ </div>
31
+ </div>
32
+ <?php endif;?>
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/account/dashboard/fidelity_points.phtml RENAMED
@@ -6,11 +6,15 @@
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
  -->
9
- <?php if (Mage::getStoreConfig('sponsorship/fidelity/fidelity_enabled')):?>
 
 
 
 
10
  <div class="box-account box-fidelity">
11
  <div class="box-head">
12
  <h2><?php echo $this->__('Fidelity'); ?></h2>
13
- <a href="<?php echo $this->getUrl('sponsorship/fidelitypoints') ?>"><?php echo $this->__('Details')?></a>
14
  </div>
15
  <?php
16
  $customerId = $this->getUserId();
6
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
  */
8
  -->
9
+ <?php
10
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
11
+ if ($mode=='fidelity'
12
+ || $mode=='separated'):
13
+ ?>
14
  <div class="box-account box-fidelity">
15
  <div class="box-head">
16
  <h2><?php echo $this->__('Fidelity'); ?></h2>
17
+ <a href="<?php echo $this->getUrl('sponsorship/points/fidelity') ?>"><?php echo $this->__('Details')?></a>
18
  </div>
19
  <?php
20
  $customerId = $this->getUserId();
app/design/frontend/base/default/template/auguria/sponsorship/customer/account/dashboard/points.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ /**
3
+ * @category Auguria
4
+ * @package Auguria_Sponsorship
5
+ * @author Auguria
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ -->
9
+ <?php
10
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
11
+
12
+ if ($mode=='accumulated'):
13
+ echo $this->getChildHtml('customer_account_accumulated_points');
14
+ else:
15
+ if ($mode=='fidelity'
16
+ || $mode=='separated'):
17
+ echo $this->getChildHtml('customer_account_fidelity_points');
18
+ endif;
19
+ if ($mode=='sponsorship'
20
+ || $mode=='separated'):
21
+ echo $this->getChildHtml('customer_account_sponsor_points');
22
+ endif;
23
+ endif;
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/account/dashboard/sponsor_points.phtml RENAMED
@@ -7,7 +7,9 @@
7
  */
8
  -->
9
  <?php
10
- if (Mage::getStoreConfig('sponsorship/sponsor/sponsor_enabled')):
 
 
11
  $customerId = $this->getUserId();
12
  $customer = Mage::getModel('customer/customer')->load($customerId);
13
  $nbSponsor = $this->getNbParrainages ($customerId);
@@ -15,7 +17,7 @@ if (Mage::getStoreConfig('sponsorship/sponsor/sponsor_enabled')):
15
  <div class="box-account box-sponsorship">
16
  <div class="box-head">
17
  <h2><?php echo $this->__('Sponsorship'); ?></h2>
18
- <a href="<?php echo $this->getUrl('sponsorship/sponsorpoints') ?>"><?php echo $this->__('Details')?></a>
19
  </div>
20
  <div class="col1-set">
21
  <?php echo $this->__('Sponsorship points:') ?> <?php echo floor($customer->getSponsorPoints()); ?>
7
  */
8
  -->
9
  <?php
10
+ $mode = Mage::helper('auguria_sponsorship/config')->getModuleMode();
11
+ if ($mode=='sponsorship'
12
+ || $mode=='separated'):
13
  $customerId = $this->getUserId();
14
  $customer = Mage::getModel('customer/customer')->load($customerId);
15
  $nbSponsor = $this->getNbParrainages ($customerId);
17
  <div class="box-account box-sponsorship">
18
  <div class="box-head">
19
  <h2><?php echo $this->__('Sponsorship'); ?></h2>
20
+ <a href="<?php echo $this->getUrl('sponsorship/points/sponsorship') ?>"><?php echo $this->__('Details')?></a>
21
  </div>
22
  <div class="col1-set">
23
  <?php echo $this->__('Sponsorship points:') ?> <?php echo floor($customer->getSponsorPoints()); ?>
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/account/fidelitypointsdetail.phtml RENAMED
File without changes
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/account/sponsorpointsdetail.phtml RENAMED
File without changes
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/boost.phtml RENAMED
@@ -68,14 +68,14 @@
68
  <div>
69
  <label class="required"><em>*</em><?php echo $this->__("Your message will ends as follows:"); ?></label>
70
  <br/>
71
- <?php echo Mage::helper('sponsorship/mail')->getFooterMessage($invit->getParentId(),$invit->getChildFirstname(), $invit->getChildLastname(), $invit->getChildMail()); ?>
72
  </div>
73
  </li>
74
  </ul>
75
  </div>
76
  <div class="buttons-set">
77
  <p class="required"><?php echo $this->__('* Required Fields') ?></p>
78
- <p class="back-link"><a href="<?php echo $this->getUrl('sponsorship/sponsorpoints') ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
79
  <button class="button" type="submit"><span><?php echo $this->__('Send email') ?></span></button>
80
  </div>
81
  </form>
68
  <div>
69
  <label class="required"><em>*</em><?php echo $this->__("Your message will ends as follows:"); ?></label>
70
  <br/>
71
+ <?php echo Mage::helper('auguria_sponsorship/mail')->getFooterMessage($invit->getParentId(),$invit->getChildFirstname(), $invit->getChildLastname(), $invit->getChildMail()); ?>
72
  </div>
73
  </li>
74
  </ul>
75
  </div>
76
  <div class="buttons-set">
77
  <p class="required"><?php echo $this->__('* Required Fields') ?></p>
78
+ <p class="back-link"><a href="<?php echo $this->getUrl('sponsorship/points/sponsorship') ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
79
  <button class="button" type="submit"><span><?php echo $this->__('Send email') ?></span></button>
80
  </div>
81
  </form>
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/edit.phtml RENAMED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
@@ -54,11 +54,11 @@
54
  <?php if ($_gender->isEnabled()): ?>
55
  <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
56
  <?php endif ?>
57
- <?php $_virement = $this->getLayout()->createBlock('sponsorship/customer_widget_virement') ?>
58
  <?php
59
  /**
60
  * Start Auguria_Sponsorship custom to display IBAN & SIRET fields
61
  */
 
62
  if ($_virement->isEnabled()): ?>
63
  <li><?php echo $_virement->setIban($this->getCustomer()->getIban())
64
  ->setSiret($this->getCustomer()->getSiret())
@@ -101,7 +101,7 @@
101
  </div>
102
  <div class="buttons-set">
103
  <p class="required"><?php echo $this->__('* Required Fields') ?></p>
104
- <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
105
  <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
106
  </div>
107
  </form>
@@ -126,4 +126,4 @@
126
  setPasswordForm(true);
127
  <?php endif; ?>
128
  //]]>
129
- </script>
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  */
26
  ?>
54
  <?php if ($_gender->isEnabled()): ?>
55
  <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
56
  <?php endif ?>
 
57
  <?php
58
  /**
59
  * Start Auguria_Sponsorship custom to display IBAN & SIRET fields
60
  */
61
+ $_virement = $this->getLayout()->createBlock('auguria_sponsorship/customer_widget_virement');
62
  if ($_virement->isEnabled()): ?>
63
  <li><?php echo $_virement->setIban($this->getCustomer()->getIban())
64
  ->setSiret($this->getCustomer()->getSiret())
101
  </div>
102
  <div class="buttons-set">
103
  <p class="required"><?php echo $this->__('* Required Fields') ?></p>
104
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
105
  <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
106
  </div>
107
  </form>
126
  setPasswordForm(true);
127
  <?php endif; ?>
128
  //]]>
129
+ </script>
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/pointschange.phtml RENAMED
@@ -17,14 +17,15 @@
17
  </div>
18
  <br/>
19
  <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
20
- <form action="<?php echo $this->getUrl('sponsorship/'.$module.'points/save') ?>" method="post" id="form-validate">
21
  <?php echo $this->getBlockHtml('formkey')?>
22
  <input type="hidden" name="module" id="module" value="<?php echo $module ?>"/>
23
  <input type="hidden" name="type" id="type" value="<?php echo $type ?>"/>
24
  <?php echo $this->getChildHtml($type) ?>
25
  <div class="buttons-set">
26
  <p class="required"><?php echo $this->__('* Required Fields') ?></p>
27
- <p class="back-link"><a href="<?php echo Mage::getUrl('sponsorship/'.$module.'points') ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
 
28
  <button class="button" type="submit"><span><?php echo $this->__('Validate') ?></span></button>
29
  </div>
30
  </form>
17
  </div>
18
  <br/>
19
  <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
20
+ <form action="<?php echo $this->getUrl('sponsorship/points/save') ?>" method="post" id="form-validate">
21
  <?php echo $this->getBlockHtml('formkey')?>
22
  <input type="hidden" name="module" id="module" value="<?php echo $module ?>"/>
23
  <input type="hidden" name="type" id="type" value="<?php echo $type ?>"/>
24
  <?php echo $this->getChildHtml($type) ?>
25
  <div class="buttons-set">
26
  <p class="required"><?php echo $this->__('* Required Fields') ?></p>
27
+ <?php if($module=='sponsor'){$module='sponsorship';}?>
28
+ <p class="back-link"><a href="<?php echo Mage::getUrl('sponsorship/points/'.$module) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
29
  <button class="button" type="submit"><span><?php echo $this->__('Validate') ?></span></button>
30
  </div>
31
  </form>
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/pointschange/pointschange_cash.phtml RENAMED
File without changes
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/pointschange/pointschange_coupon.phtml RENAMED
@@ -7,7 +7,7 @@
7
  */
8
  -->
9
  <?php
10
- $change = $this->getChange();
11
  $module = $change['module'];
12
  $Module = ucfirst($module);
13
  $type = $change['type'];
7
  */
8
  -->
9
  <?php
10
+ $change = $this->getChange();
11
  $module = $change['module'];
12
  $Module = ucfirst($module);
13
  $type = $change['type'];
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/pointschange/pointschange_gift.phtml RENAMED
File without changes
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/form/register.phtml RENAMED
@@ -18,10 +18,10 @@
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
- * @category design_default
22
- * @package Mage
23
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
 
26
  * @category Auguria
27
  * @package Auguria_Sponsorship
@@ -60,7 +60,7 @@
60
  */
61
  if ($this->htmlEscape($this->getFormData()->getEmail())=='')
62
  {
63
- echo $this->htmlEscape(Mage::getBlockSingleton('sponsorship/customer_widget_name')-> getInvit('email'));
64
  }
65
  else
66
  {
@@ -188,7 +188,7 @@
188
  </div>
189
  <div class="buttons-set">
190
  <p class="required"><?php echo $this->__('* Required Fields') ?></p>
191
- <p class="back-link"><a href="<?php echo $this->urlEscape($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
192
  <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
193
  </div>
194
  </form>
@@ -200,4 +200,4 @@
200
  <?php endif; ?>
201
  //]]>
202
  </script>
203
- </div>
18
  * versions in the future. If you wish to customize Magento for your
19
  * needs please refer to http://www.magentocommerce.com for more information.
20
  *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
 
26
  * @category Auguria
27
  * @package Auguria_Sponsorship
60
  */
61
  if ($this->htmlEscape($this->getFormData()->getEmail())=='')
62
  {
63
+ echo $this->htmlEscape(Mage::getBlockSingleton('auguria_sponsorship/customer_widget_name')-> getInvit('email'));
64
  }
65
  else
66
  {
188
  </div>
189
  <div class="buttons-set">
190
  <p class="required"><?php echo $this->__('* Required Fields') ?></p>
191
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
192
  <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
193
  </div>
194
  </form>
200
  <?php endif; ?>
201
  //]]>
202
  </script>
203
+ </div>
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/widget/name.phtml RENAMED
File without changes
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/customer/widget/virement.phtml RENAMED
File without changes
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/openinviter.phtml RENAMED
@@ -7,7 +7,7 @@
7
  */
8
  -->
9
  <?php
10
- if (Mage::getStoreConfig('sponsorship/open_inviter/open_inviter_enabled')==true):
11
  ?>
12
  <div id="messages_openinviter"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
13
  <form action="<?php echo $this->getUrl('sponsorship/openinviter/import') ?>" id="openinviter" method="post">
7
  */
8
  -->
9
  <?php
10
+ if (Mage::getStoreConfig('auguria_sponsorship/open_inviter/open_inviter_enabled')==true):
11
  ?>
12
  <div id="messages_openinviter"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
13
  <form action="<?php echo $this->getUrl('sponsorship/openinviter/import') ?>" id="openinviter" method="post">
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/openinviterimport.phtml RENAMED
@@ -7,7 +7,7 @@
7
  */
8
  -->
9
  <?php
10
- if (Mage::getStoreConfig('sponsorship/open_inviter/open_inviter_enabled')==true):
11
  ?>
12
  <div id="messages_openinviter"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
13
  <form action="" id="openinviterimport" method="post" onsubmit="addContacts(); return false;">
7
  */
8
  -->
9
  <?php
10
+ if (Mage::getStoreConfig('auguria_sponsorship/open_inviter/open_inviter_enabled')==true):
11
  ?>
12
  <div id="messages_openinviter"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
13
  <form action="" id="openinviterimport" method="post" onsubmit="addContacts(); return false;">
app/design/frontend/{default/default/template → base/default/template/auguria}/sponsorship/sponsorship.phtml RENAMED
@@ -88,7 +88,7 @@
88
  <label for="message_header" class="required"><em>*</em><?php echo $this->__('Your message will be preceded by:') ?></label>
89
  <div>
90
  <?php
91
- echo Mage::helper('sponsorship/mail')->getHeaderMessage($this->__('First name'),$this->__('Last name'));
92
  ?>
93
  <input name="message[header]" value="1" title="<?php echo $this->__('Subject') ?>" id="message_header" type="hidden" />
94
  </div>
@@ -122,7 +122,7 @@
122
  /**
123
  * Open Inviter
124
  */
125
- if (Mage::getStoreConfig('sponsorship/open_inviter/open_inviter_enabled')==true): ?>
126
  <p>
127
  <?php echo $this->__('Select recipients from your address book.')?>
128
  <a href="<?php echo $this->getUrl('sponsorship/openinviter'); ?>" onclick='openPopup(this); return false'>
88
  <label for="message_header" class="required"><em>*</em><?php echo $this->__('Your message will be preceded by:') ?></label>
89
  <div>
90
  <?php
91
+ echo Mage::helper('auguria_sponsorship/mail')->getHeaderMessage($this->__('First name'),$this->__('Last name'));
92
  ?>
93
  <input name="message[header]" value="1" title="<?php echo $this->__('Subject') ?>" id="message_header" type="hidden" />
94
  </div>
122
  /**
123
  * Open Inviter
124
  */
125
+ if (Mage::getStoreConfig('auguria_sponsorship/open_inviter/open_inviter_enabled')==true): ?>
126
  <p>
127
  <?php echo $this->__('Select recipients from your address book.')?>
128
  <a href="<?php echo $this->getUrl('sponsorship/openinviter'); ?>" onclick='openPopup(this); return false'>
app/design/frontend/default/default/layout/sponsorship.xml DELETED
@@ -1,140 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * @category Auguria
5
- * @package Auguria_Sponsorship
6
- * @author Auguria
7
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
- */
9
- -->
10
- <layout version="0.1.0">
11
- <!-- Déclaration du template de l'index -->
12
- <sponsorship_index_index>
13
- <update handle="customer_account"/>
14
- <reference name="content">
15
- <block type="sponsorship/sponsorship" name="sponsorship" template="sponsorship/sponsorship.phtml" />
16
- </reference>
17
- </sponsorship_index_index>
18
-
19
- <!-- Déclaration du template OpenInviter -->
20
- <sponsorship_openinviter_index>
21
- <reference name="root">
22
- <action method="setTemplate"><template>page/empty.phtml</template></action>
23
- </reference>
24
- <reference name="content">
25
- <block type="sponsorship/openinviter" name="openinviter" template="sponsorship/openinviter.phtml" />
26
- </reference>
27
- </sponsorship_openinviter_index>
28
- <sponsorship_openinviter_import>
29
- <reference name="root">
30
- <action method="setTemplate"><template>page/empty.phtml</template></action>
31
- </reference>
32
- <reference name="content">
33
- <block type="sponsorship/openinviter" name="openinviter" template="sponsorship/openinviterimport.phtml" />
34
- </reference>
35
- </sponsorship_openinviter_import>
36
-
37
- <!-- Déclaration du block détail des points fidélité -->
38
- <sponsorship_fidelitypoints_index>
39
- <update handle="customer_account"/>
40
- <!-- Ajout du css pour table_orderer -->
41
- <reference name="head">
42
- <action method="addCss">
43
- <link>css/tableorderer.css</link>
44
- </action>
45
- <action method="addJs">
46
- <link>tableorderer/table_orderer.js</link>
47
- </action>
48
- </reference>
49
- <reference name="content">
50
- <block type="sponsorship/customer_account_pointsDetail" name="sponsorship_customer_pointsdetail" template="sponsorship/customer/account/fidelitypointsdetail.phtml"/>
51
- </reference>
52
- </sponsorship_fidelitypoints_index>
53
-
54
- <!-- Déclaration du block détail des points parrainage -->
55
- <sponsorship_sponsorpoints_index>
56
- <update handle="customer_account"/>
57
- <!-- Ajout du css pour table_orderer -->
58
- <reference name="head">
59
- <action method="addCss">
60
- <link>css/tableorderer.css</link>
61
- </action>
62
- <action method="addJs">
63
- <link>tableorderer/table_orderer.js</link>
64
- </action>
65
- </reference>
66
- <reference name="content">
67
- <block type="sponsorship/customer_account_pointsDetail" name="sponsorship_customer_pointsdetail" template="sponsorship/customer/account/sponsorpointsdetail.phtml"/>
68
- </reference>
69
- </sponsorship_sponsorpoints_index>
70
-
71
- <!-- Déclaration du block pour la relance des filleuls -->
72
- <sponsorship_boost_index>
73
- <update handle="customer_account"/>
74
- <reference name="content">
75
- <block type="sponsorship/customer_form_boost" name="sponsorship_customer_boost" template="sponsorship/customer/form/boost.phtml"/>
76
- </reference>
77
- </sponsorship_boost_index>
78
-
79
- <!-- Déclaration du block d'échange des points -->
80
- <sponsorship_fidelitypoints_change>
81
- <update handle="customer_account"/>
82
- <reference name="content">
83
- <block type="sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange" template="sponsorship/customer/form/pointschange.phtml"/>
84
- </reference>
85
- <reference name="sponsorship_customer_pointschange">
86
- <block type="sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange_cash" as="cash" template="sponsorship/customer/form/pointschange/pointschange_cash.phtml"/>
87
- <block type="sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange_coupon" as="coupon" template="sponsorship/customer/form/pointschange/pointschange_coupon.phtml"/>
88
- <block type="sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange_gift" as="gift" template="sponsorship/customer/form/pointschange/pointschange_gift.phtml"/>
89
- </reference>
90
- </sponsorship_fidelitypoints_change>
91
- <sponsorship_sponsorpoints_change>
92
- <update handle="customer_account"/>
93
- <reference name="content">
94
- <block type="sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange" template="sponsorship/customer/form/pointschange.phtml"/>
95
- </reference>
96
- <reference name="sponsorship_customer_pointschange">
97
- <block type="sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange_cash" as="cash" template="sponsorship/customer/form/pointschange/pointschange_cash.phtml"/>
98
- <block type="sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange_coupon" as="coupon" template="sponsorship/customer/form/pointschange/pointschange_coupon.phtml"/>
99
- <block type="sponsorship/customer_form_pointsChange" name="sponsorship_customer_pointschange_gift" as="gift" template="sponsorship/customer/form/pointschange/pointschange_gift.phtml"/>
100
- </reference>
101
- </sponsorship_sponsorpoints_change>
102
-
103
- <!-- Remplacement de dashboard.phtml pour ajouter un block
104
- Déclaration d'un block supplémentaire -->
105
- <customer_account_index>
106
- <reference name="customer_account_dashboard">
107
- <action method="setTemplate">
108
- <template>sponsorship/customer/account/dashboard.phtml</template>
109
- </action>
110
- <block type="sponsorship/customer_account_pointsDetail" name="customer_account_points" as="fidelity_points" template="sponsorship/customer/account/dashboard/fidelity_points.phtml"/>
111
- <block type="sponsorship/customer_account_pointsDetail" name="customer_account_points" as="sponsor_points" template="sponsorship/customer/account/dashboard/sponsor_points.phtml"/>
112
- </reference>
113
- </customer_account_index>
114
-
115
- <!-- Remplacement de edit.phtml pour ajout champ Iban dans les informations du compte-->
116
- <customer_account_edit>
117
- <reference name="customer_edit">
118
- <action method="setTemplate">
119
- <template>sponsorship/customer/form/edit.phtml</template>
120
- </action>
121
- </reference>
122
- </customer_account_edit>
123
-
124
- <!-- Ajout d'un lien vers le détail des points -->
125
- <customer_account>
126
- <reference name="customer_account_navigation">
127
- <action ifconfig="sponsorship/fidelity/fidelity_enabled" method="addLink" translate="label" module="sponsorship"><name>fidelity_points</name><path>sponsorship/fidelitypoints/</path><label>Credit fidelity points</label></action>
128
- <action ifconfig="sponsorship/sponsor/sponsor_enabled" method="addLink" translate="label" module="sponsorship"><name>sponsor_points</name><path>sponsorship/sponsorpoints/</path><label>Credit sponsor points</label></action>
129
- </reference>
130
- </customer_account>
131
-
132
- <!-- Remplacement de register.phtml pour afficher email de la session -->
133
- <customer_account_create>
134
- <reference name="customer_form_register">
135
- <action method="setTemplate">
136
- <template>sponsorship/customer/form/register.phtml</template>
137
- </action>
138
- </reference>
139
- </customer_account_create>
140
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/sponsorship/customer/account/dashboard.phtml DELETED
@@ -1,35 +0,0 @@
1
- <!--
2
- /**
3
- * @category Auguria
4
- * @package Auguria_Sponsorship
5
- * @author Auguria
6
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
- */
8
- -->
9
- <div class="dashboard">
10
- <div class="page-title">
11
- <h1><?php echo $this->__('My Dashboard') ?></h1>
12
- </div>
13
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
14
- <?php echo $this->getChildHtml('hello') ?>
15
- <?php echo $this->getChildHtml('top') ?>
16
- <div class="box-account box-info">
17
- <div class="box-head">
18
- <h2><?php echo $this->__('Account Information') ?></h2>
19
- </div>
20
- <?php echo $this->getChildHtml('info') ?>
21
- <?php echo $this->getChildHtml('address') ?>
22
- </div>
23
- <?php
24
- /**
25
- * Start custom for Auguria_Sponsorship
26
- */
27
- echo $this->getChildHtml('sponsor_points');
28
- echo $this->getChildHtml('fidelity_points');
29
- /**
30
- * End custom for Auguria_Sponsorship
31
- */
32
- ?>
33
- <?php echo $this->getChildHtml('info1') ?>
34
- <?php echo $this->getChildHtml('info2') ?>
35
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/locale/de_DE/template/email/{sponsorship_coupon.html → auguria/sponsorship/sponsorship_coupon.html} RENAMED
File without changes
app/locale/de_DE/template/email/{sponsorship_invitation.html → auguria/sponsorship/sponsorship_invitation.html} RENAMED
File without changes
app/locale/en_US/Auguria_Sponsorship.csv ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Action","Action"
2
+ ":You will receive an email with the discount code you can use on your next order.",":You will receive an email with the discount code you can use on your next order."
3
+ "'%s' is not a valid number.","'%s' is not a valid number."
4
+ "'%s' is not an integer.","'%s' is not an integer."
5
+ "'%s' is not greater than 0.","'%s' is not greater than 0."
6
+ "%s is already an email to our customers","%s is already an email to our customers"
7
+ "%s points exchange for customer (%s)","%s points exchange for customer (%s)"
8
+ "%s sponsor points","%s sponsor points"
9
+ "%s vouchers points exchange","%s vouchers points exchange"
10
+ "<a href='%s'>%s</a>","<a href='%s'>%s</a>"
11
+ "A value is required.","A value is required."
12
+ "Accumulated mode options","Accumulated mode options"
13
+ "Activated","Activated"
14
+ "Active godsons:","Active godsons:"
15
+ "Add a change","Add a change"
16
+ "Add a provider","Add a provider"
17
+ "Add a sponsorship","Add a sponsorship"
18
+ "Add an invitation","Add an invitation"
19
+ "Add Recipient","Add Recipient"
20
+ "Add recipients","Add recipients"
21
+ "Add recipients.","Add recipients."
22
+ "Address book provider:","Address book provider:"
23
+ "Allow customers who have never ordered to send invitations","Allow customers who have never ordered to send invitations"
24
+ "Allow customers who have never ordered to send sponsorship invitations","Allow customers who have never ordered to send sponsorship invitations"
25
+ "Allow to sponsor registred customers (but never ordered)","Allow to sponsor registred customers (but never ordered)"
26
+ "Allows customers to import addressbook/contacts from different email providers like Yahoo, Gmail, Hotmail, Live etc. using different CMS software like Drupal, Joomla etc. or forum software like PHPBB, SMF etc. Learn more on <a href='http://openinviter.com'>openinviter.com</a>","Allows customers to import addressbook/contacts from different email providers like Yahoo, Gmail, Hotmail, Live etc. using different CMS software like Drupal, Joomla etc. or forum software like PHPBB, SMF etc. Learn more on <a href='http://openinviter.com'>openinviter.com</a>"
27
+ "Amount of winning points for first order","Amount of winning points for first order"
28
+ "Amount of winning points for the first godson order","Amount of winning points for the first godson order"
29
+ "Amount of winning points when subscribe to newsletter on account creation","Amount of winning points when subscribe to newsletter on account creation"
30
+ "An error occured while sending sponsor notification email.","An error occured while sending sponsor notification email."
31
+ "An error occurred while saving your request.","An error occurred while saving your request."
32
+ "An error occurred while sending mail.","An error occurred while sending mail."
33
+ "An error occurred, the mail to %s could not be delivred.","An error occurred, the mail to %s could not be delivred."
34
+ "An exception occured !","An exception occured !"
35
+ "And it ends as follows:","And it ends as follows:"
36
+ "Are you sure to process mass action?","Are you sure to process mass action?"
37
+ "Automatic discount in cart","Automatic discount in cart"
38
+ "Back","Back"
39
+ "But it could not be saved.","But it could not be saved."
40
+ "Calculation period of the maximum allowed for an individual (days)","Calculation period of the maximum allowed for an individual (days)"
41
+ "Campany number","Campany number"
42
+ "Canceled","Canceled"
43
+ "Cart exchange","Cart exchange"
44
+ "Cash","Cash"
45
+ "cash","cash"
46
+ "Cash exchange","Cash exchange"
47
+ "Cash exchange enabled","Cash exchange enabled"
48
+ "Change information","Change information"
49
+ "Change your points into:","Change your points into:"
50
+ "Check or uncheck all","Check or uncheck all"
51
+ "Choose your provider","Choose your provider"
52
+ "Conversion rate of points in currency","Conversion rate of points in currency"
53
+ "coupon","coupon"
54
+ "Coupon Email Template","Coupon Email Template"
55
+ "Coupon exchange","Coupon exchange"
56
+ "Creation date","Creation date"
57
+ "Customer","Customer"
58
+ "Customer ID","Customer ID"
59
+ "Customer name","Customer name"
60
+ "Date","Date"
61
+ "Date first invitation","Date first invitation"
62
+ "Date last mail","Date last mail"
63
+ "Dear %s %s,","Dear %s %s,"
64
+ "Details","Details"
65
+ "Edit","Edit"
66
+ "Edition of the change '%s'","Edition of the change '%s'"
67
+ "Edition of the invitation '%s'","Edition of the invitation '%s'"
68
+ "Edition of the Open inviter provider '%s'","Edition of the Open inviter provider '%s'"
69
+ "Edition of the sponsorship '%s'","Edition of the sponsorship '%s'"
70
+ "Email Address:","Email Address:"
71
+ "Email missing !","Email missing !"
72
+ "Email Providers","Email Providers"
73
+ "Email:","Email:"
74
+ "emptyResults","emptyResults"
75
+ "Enter the cash you want.","Enter the cash you want."
76
+ "Enter the points you want to convert.","Enter the points you want to convert."
77
+ "errorData","errorData"
78
+ "errorURL","errorURL"
79
+ "Exchange detail","Exchange detail"
80
+ "Exchange of your %s points into %s","Exchange of your %s points into %s"
81
+ "Exported","Exported"
82
+ "Fidelity","Fidelity"
83
+ "fidelity","fidelity"
84
+ "Fidelity and separated mode options","Fidelity and separated mode options"
85
+ "Fidelity and Sponsorship","Fidelity and Sponsorship"
86
+ "Fidelity and Sponsorship (accumulated)","Fidelity and Sponsorship (accumulated)"
87
+ "Fidelity and Sponsorship (separated)","Fidelity and Sponsorship (separated)"
88
+ "Fidelity balance:","Fidelity balance:"
89
+ "Fidelity module activated","Fidelity module activated"
90
+ "Fidelity options","Fidelity options"
91
+ "Fidelity points","Fidelity points"
92
+ "Fidelity points and sponsorship management","Fidelity points and sponsorship management"
93
+ "Fidelity points by fixed amount","Fidelity points by fixed amount"
94
+ "Fidelity points by fixed amount for whole cart","Fidelity points by fixed amount for whole cart"
95
+ "Fidelity points by percentage of the original price","Fidelity points by percentage of the original price"
96
+ "Fidelity points management","Fidelity points management"
97
+ "Fidelity points:","Fidelity points:"
98
+ "filterLabel","filterLabel"
99
+ "First name","First name"
100
+ "First name:","First name:"
101
+ "gift","gift"
102
+ "Gift exchange","Gift exchange"
103
+ "Gift exchange enabled","Gift exchange enabled"
104
+ "Gifts","Gifts"
105
+ "Godson","Godson"
106
+ "Godson ID","Godson ID"
107
+ "Godson name","Godson name"
108
+ "Guest first name","Guest first name"
109
+ "Guest last name","Guest last name"
110
+ "Guest mail","Guest mail"
111
+ "Guest name","Guest name"
112
+ "IBAN","IBAN"
113
+ "ID","ID"
114
+ "Import Contacts","Import Contacts"
115
+ "Import selected contacts","Import selected contacts"
116
+ "Inactivity time before removal of the sponsorship link (days)","Inactivity time before removal of the sponsorship link (days)"
117
+ "Invalid IBAN code ""%s""","Invalid IBAN code ""%s"""
118
+ "Invitation detail","Invitation detail"
119
+ "Invitation does not exist","Invitation does not exist"
120
+ "Invitation Email Template","Invitation Email Template"
121
+ "Invitation information","Invitation information"
122
+ "Invitation to %s","Invitation to %s"
123
+ "Invitation was successfully saved","Invitation was successfully saved"
124
+ "Invitations list","Invitations list"
125
+ "Last name","Last name"
126
+ "Last name:","Last name:"
127
+ "Last order date","Last order date"
128
+ "Listing date","Listing date"
129
+ "loading","loading"
130
+ "Login failed. Please check the email and password you have provided and try again later !","Login failed. Please check the email and password you have provided and try again later !"
131
+ "Max invitations","Max invitations"
132
+ "Maximum amount permitted without company number","Maximum amount permitted without company number"
133
+ "Maximum levels of sponsorship","Maximum levels of sponsorship"
134
+ "Message","Message"
135
+ "Mode of the module","Mode of the module"
136
+ "Module","Module"
137
+ "My fidelity points","My fidelity points"
138
+ "My sponsor points","My sponsor points"
139
+ "Name:","Name:"
140
+ "Notification Email Template","Notification Email Template"
141
+ "Number of sponsorships","Number of sponsorships"
142
+ "Once you will have points, you can change them into:","Once you will have points, you can change them into:"
143
+ "Open inviter providers","Open inviter providers"
144
+ "Or add recipient manually.","Or add recipient manually."
145
+ "paginationFirst","paginationFirst"
146
+ "paginationLast","paginationLast"
147
+ "paginationNext","paginationNext"
148
+ "paginationOf","paginationOf"
149
+ "paginationPages","paginationPages"
150
+ "paginationPrev","paginationPrev"
151
+ "Password missing !","Password missing !"
152
+ "Please check the form fields.","Please check the form fields."
153
+ "Please enter the full email, not just the username","Please enter the full email, not just the username"
154
+ "Please select changes","Please select changes"
155
+ "Points","Points"
156
+ "Points balance:","Points balance:"
157
+ "Points calculation","Points calculation"
158
+ "Points exchanges list","Points exchanges list"
159
+ "Points to exchange:","Points to exchange:"
160
+ "Points validity in days(0 for unlimited)","Points validity in days(0 for unlimited)"
161
+ "Principles of Sponsorship","Principles of Sponsorship"
162
+ "Provider detail","Provider detail"
163
+ "Provider missing !","Provider missing !"
164
+ "Provider was successfully deleted","Provider was successfully deleted"
165
+ "Provider was successfully saved","Provider was successfully saved"
166
+ "Ratio applied from level 2 to calculate the points of the sponsor (in percentage)","Ratio applied from level 2 to calculate the points of the sponsor (in percentage)"
167
+ "Recall","Recall"
168
+ "Recall %s %s","Recall %s %s"
169
+ "Recipient:","Recipient:"
170
+ "Recipients:","Recipients:"
171
+ "Recovery date","Recovery date"
172
+ "Related ID","Related ID"
173
+ "Related mail","Related mail"
174
+ "Related name","Related name"
175
+ "Remove Recipient","Remove Recipient"
176
+ "Required Fields","Required Fields"
177
+ "searchLabel","searchLabel"
178
+ "Select recipients from your address book:","Select recipients from your address book:"
179
+ "Select recipients from your address book.","Select recipients from your address book."
180
+ "Select your provider and sign in:","Select your provider and sign in:"
181
+ "Send email","Send email"
182
+ "Send notification to sponsor when godchild make him earn points","Send notification to sponsor when godchild make him earn points"
183
+ "Sender:","Sender:"
184
+ "Social Networks","Social Networks"
185
+ "Solved","Solved"
186
+ "Special Rate","Special Rate"
187
+ "Special rate","Special rate"
188
+ "Sponsor","Sponsor"
189
+ "sponsor","sponsor"
190
+ "Sponsor friends","Sponsor friends"
191
+ "Sponsor ID","Sponsor ID"
192
+ "Sponsor points ","Sponsor points "
193
+ "Sponsorship","Sponsorship"
194
+ "Sponsorship and separated mode options","Sponsorship and separated mode options"
195
+ "Sponsorship balance:","Sponsorship balance:"
196
+ "Sponsorship coupon","Sponsorship coupon"
197
+ "Sponsorship date","Sponsorship date"
198
+ "Sponsorship detail","Sponsorship detail"
199
+ "Sponsorship information","Sponsorship information"
200
+ "Sponsorship invitation","Sponsorship invitation"
201
+ "Sponsorship mail options","Sponsorship mail options"
202
+ "Sponsorship management","Sponsorship management"
203
+ "Sponsorship module activated","Sponsorship module activated"
204
+ "Sponsorship notification","Sponsorship notification"
205
+ "Sponsorship options","Sponsorship options"
206
+ "Sponsorship points","Sponsorship points"
207
+ "Sponsorship points by fixed amount","Sponsorship points by fixed amount"
208
+ "Sponsorship points by fixed amount for whole cart","Sponsorship points by fixed amount for whole cart"
209
+ "Sponsorship points by percentage of the original price","Sponsorship points by percentage of the original price"
210
+ "Sponsorship points:","Sponsorship points:"
211
+ "Sponsorship was successfully saved","Sponsorship was successfully saved"
212
+ "Sponsorships list","Sponsorships list"
213
+ "Status","Status"
214
+ "Subject:","Subject:"
215
+ "The change has been successfully recorded","The change has been successfully recorded"
216
+ "The exchange of %s points in %s is disabled.","The exchange of %s points in %s is disabled."
217
+ "The gifts exchange is not yet implemented.","The gifts exchange is not yet implemented."
218
+ "This change doesn't exist","This change doesn't exist"
219
+ "This sponsorship doesn't exist","This sponsorship doesn't exist"
220
+ "Time to send it automatically (days)","Time to send it automatically (days)"
221
+ "Time validity invitations (days)","Time validity invitations (days)"
222
+ "To change more cash, you must specify a company number.","To change more cash, you must specify a company number."
223
+ "To change your points into cash, you must indicate your IBAN.","To change your points into cash, you must indicate your IBAN."
224
+ "Type","Type"
225
+ "Unable to find change to save","Unable to find change to save"
226
+ "Unable to find invitation to save","Unable to find invitation to save"
227
+ "Unable to find sponsorship to save","Unable to find sponsorship to save"
228
+ "Unable to get contacts !","Unable to get contacts !"
229
+ "Update status","Update status"
230
+ "Use of your fidelity points","Use of your fidelity points"
231
+ "Use of your points","Use of your points"
232
+ "Use of your sponsorship points","Use of your sponsorship points"
233
+ "Validate","Validate"
234
+ "Validity fidelity points ","Validity fidelity points "
235
+ "Validity points","Validity points"
236
+ "Validity sponsorship points ","Validity sponsorship points "
237
+ "Value","Value"
238
+ "Voucher exchange enabled","Voucher exchange enabled"
239
+ "Voucher exchange mail options","Voucher exchange mail options"
240
+ "Vouchers","Vouchers"
241
+ "Vouchers:","Vouchers:"
242
+ "Waiting","Waiting"
243
+ "Winning","Winning"
244
+ "You can't send an invitation to yourself","You can't send an invitation to yourself"
245
+ "You do not have active godson.","You do not have active godson."
246
+ "You do not have as many points.","You do not have as many points."
247
+ "You do not have yet send invit.","You do not have yet send invit."
248
+ "You have %d points.","You have %d points."
249
+ "You must already have purchased to sponsor.","You must already have purchased to sponsor."
250
+ "You should visit this website. It offers interesting products.","You should visit this website. It offers interesting products."
251
+ "Your email has been successfully sent.","Your email has been successfully sent."
252
+ "Your godsons","Your godsons"
253
+ "Your invitations","Your invitations"
254
+ "Your lastest orders","Your lastest orders"
255
+ "Your login:","Your login:"
256
+ "Your mail has not been sent, please try again later.","Your mail has not been sent, please try again later."
257
+ "Your message","Your message"
258
+ "Your message will be preceded by:","Your message will be preceded by:"
259
+ "Your message will ends as follows:","Your message will ends as follows:"
260
+ "Your message:","Your message:"
261
+ "Your points exchanges:","Your points exchanges:"
262
+ "Your request has been submitted, you will soon receive an email confirmation.","Your request has been submitted, you will soon receive an email confirmation."
263
+ "Cancel earned points on credit memo creation","Cancel earned points on credit memo creation"
264
+ "Cancel the use of points on credit memo creation","Cancel the use of points on credit memo creation"
app/locale/en_US/template/email/{sponsorship_coupon.html → auguria/sponsorship/sponsorship_coupon.html} RENAMED
File without changes
app/locale/en_US/template/email/{sponsorship_invitation.html → auguria/sponsorship/sponsorship_invitation.html} RENAMED
File without changes
app/locale/es_ES/template/email/{sponsorship_coupon.html → auguria/sponsorship/sponsorship_coupon.html} RENAMED
File without changes
app/locale/es_ES/template/email/{sponsorship_invitation.html → auguria/sponsorship/sponsorship_invitation.html} RENAMED
File without changes
app/locale/fr_FR/Auguria_Sponsorship.csv CHANGED
@@ -4,36 +4,53 @@
4
  "'%s' is not an integer.","'%s' n'est pas un entier."
5
  "'%s' is not greater than 0.","'%s' n'est pas supérieur à 0."
6
  "%s is already an email to our customers","%s est déjà l'email d'un de nos clients"
 
7
  "%s points exchange for customer (%s)","Échange de points %s pour le client (%s)"
 
8
  "%s vouchers points exchange","%s échange de points en bon de réduction"
9
  "<a href='%s'>%s</a>","<a href='%s'>%s</a>"
10
  "A value is required.","Une valeur est requise."
 
11
  "Activated","Activé"
12
  "Active godsons:","Filleuls actifs :"
13
  "Add a change","Ajouter un échange"
14
  "Add a provider","Ajouter un fournisseur"
15
  "Add a sponsorship","Ajouter un parrainage"
16
  "Add an invitation","Ajouter une invitation"
 
17
  "Add recipients","Ajoutez les destinataires."
18
  "Add recipients.","Ajoutez les destinataires."
19
  "Address book provider:","Fournisseur de carnet d'adresse :"
20
- "Allow to send invitations to customers who have never ordered","Autoriser l'envoie d'invitations aux clients n'ayant jamais commandé"
 
 
21
  "Allows customers to import addressbook/contacts from different email providers like Yahoo, Gmail, Hotmail, Live etc. using different CMS software like Drupal, Joomla etc. or forum software like PHPBB, SMF etc. Learn more on <a href='http://openinviter.com'>openinviter.com</a>","Permet aux clients d'importer leur carnet d'adresse depuis plusieurs fournisseurs comme Yahoo, Gmail, Hotmail, Live etc. Plus de sétails sur <a href='http://openinviter.com'>openinviter.com</a>"
22
  "Amount of winning points for first order","Montant des points gagnés pour une première commande"
23
  "Amount of winning points for the first godson order","Montant des points gagnés lors de la première commande d'un filleul"
24
  "Amount of winning points when subscribe to newsletter on account creation","Montant des points gagnés si le client s'abonne à la newletter lors de son inscription"
 
25
  "An error occurred while saving your request.","Une erreur est survenue lors de l'enregistrement de votre demande."
26
  "An error occurred while sending mail.","Une erreur est survenue lors de l'envoi du mail."
27
  "An error occurred, the mail to %s could not be delivred.","Une erreur est survenue, le mail destiné à %s n'a pas pu être délivré."
28
  "An exception occured !","Une exception s'est produite !"
29
  "And it ends as follows:","Et il se terminera comme suit :"
30
  "Are you sure to process mass action?","Êtes vous sure de vouloir procéder à une action de masse ?"
 
 
31
  "But it could not be saved.","Mais il n'a pas pu être enregistré."
 
 
32
  "Calculation period of the maximum allowed for an individual (days)","Période de calcul du maximum autorisé pour un particulier (jours)"
33
  "Campany number","SIRET"
 
 
34
  "Canceled","Annulé"
 
35
  "Cash","Cash"
36
  "cash","cash"
 
 
 
37
  "Cash exchange enabled","Échange en cash activé"
38
  "Change information","Information sur l'échange"
39
  "Change your points into:","Cliquez sur un des liens suivants pour changer vos points :"
@@ -41,9 +58,11 @@
41
  "Choose your provider","Choisissez votre fournisseur"
42
  "Conversion rate of points in currency","Taux de conversion des points en monnaie"
43
  "coupon","bon de réduction"
 
 
 
 
44
  "Creation date","Date de création"
45
- "Credit fidelity points","Crédit points de fidélité"
46
- "Credit sponsor points","Crédit points de parrainage"
47
  "Customer","Client"
48
  "Customer ID","ID Client"
49
  "Customer name","Nom client"
@@ -57,8 +76,10 @@
57
  "Edition of the invitation '%s'","Édition de l'invitation '%s'"
58
  "Edition of the Open inviter provider '%s'","Edition du fournisseur Open inviter '%s'"
59
  "Edition of the sponsorship '%s'","Édition du parrainage '%s'"
 
60
  "Email missing !","Il manque l'email !"
61
  "Email Providers","Fournisseurs de mails"
 
62
  "emptyResults","Aucun résultat"
63
  "Enter the cash you want.","Indiquez le cash que vous souhaitez obtenir."
64
  "Enter the points you want to convert.","Indiquez les points que vous voulez convertir."
@@ -66,24 +87,35 @@
66
  "errorURL","Erreur URL"
67
  "Exchange detail","Détail échange"
68
  "Exchange of your %s points into %s","Échange de vos points %s en %s"
 
69
  "Exported","Exporté"
70
  "Fidelity","Fidélité"
71
  "fidelity","fidélité"
 
72
  "Fidelity and Sponsorship","Fidélité et Parrainage"
 
 
73
  "Fidelity balance:","Solde fidélité :"
74
  "Fidelity module activated","Module de fidélité activé"
75
  "Fidelity options","Options de fidélité"
76
  "Fidelity points","Points fidélité"
 
77
  "Fidelity points by fixed amount","Points de fidélité en montant fixe"
78
  "Fidelity points by fixed amount for whole cart","Points de fidélités fixe sur tout le panier"
79
  "Fidelity points by percentage of the original price","Points de fidélité en pourcentage du prix"
 
80
  "Fidelity points:","Points fidélité :"
81
  "filterLabel","Filtrer la colonne :"
82
  "First name","Prénom"
83
  "First name:","Prénom :"
 
84
  "gift","cadeau"
 
 
 
85
  "Gift exchange enabled","Échange en cadeaux activé"
86
  "Gifts","Cadeaux"
 
87
  "Godson","Filleul"
88
  "Godson ID","ID Filleul"
89
  "Godson name","Nom filleul"
@@ -99,6 +131,7 @@
99
  "Invalid IBAN code ""%s""","Le code IBAN ""%s"" est invalide"
100
  "Invitation detail","Détail de l'invitation"
101
  "Invitation does not exist","L'invitation n'existe pas"
 
102
  "Invitation information","Information sur l'invitation"
103
  "Invitation to %s","Invitation %s"
104
  "Invitation was successfully saved","L'invitation a bien été enregistrée"
@@ -109,15 +142,24 @@
109
  "Listing date","Date inscription"
110
  "loading","chargement"
111
  "Login failed. Please check the email and password you have provided and try again later !","L'authentification a échouée. Merci de vérifier votre identifiant et votre mot de passe."
 
112
  "Max invitations","Nombre max d'invitations"
113
  "Maximum amount permitted without company number","Montant maximum autorisé sans SIRET"
114
  "Maximum levels of sponsorship","Nombre maximum de niveaux de parrainage"
115
  "Message","Message"
 
116
  "Module","Module"
 
 
 
 
 
 
117
  "Number of sponsorships","Nombre de parrainages"
118
  "Once you will have points, you can change them into:","Lorsque vous aurez des points, vous pourrez les changer en :"
119
  "Open inviter providers","Fournisseurs Open Inviter"
120
  "Or add recipient manually.","Ou ajoutez vos destinataires manuellement."
 
121
  "paginationFirst","Première"
122
  "paginationLast","Dernière"
123
  "paginationNext","Suivante"
@@ -129,8 +171,11 @@
129
  "Please enter the full email, not just the username","Merci d'indiquer votre email, et pas seulement votre nom d'utilisateur."
130
  "Please select changes","Merci de sélectionner des échanges"
131
  "Points","Points"
 
 
132
  "Points exchanges list","Liste des échanges de points"
133
  "Points to exchange:","Points à échanger :"
 
134
  "Principles of Sponsorship","Principes du parrainage"
135
  "Provider detail","Détail du fournisseur"
136
  "Provider missing !","Il manque le fournisseur !"
@@ -139,25 +184,32 @@
139
  "Ratio applied from level 2 to calculate the points of the sponsor (in percentage)","Ratio appliqué à partir du niveau 2, pour le calcul des points du parrain (en pourcentage)"
140
  "Recall","Relancer"
141
  "Recall %s %s","Relance de %s %s"
 
142
  "Recipients:","Destinataires :"
143
  "Recovery date","Date de relance"
144
  "Related ID","ID parent"
145
  "Related mail","Email parent"
146
  "Related name","Nom parent"
147
  "Remove Recipient","Supprimer le destinataire"
 
148
  "searchLabel","Recherche"
149
  "Select recipients from your address book:","Sélectionnez les destinataires dans votre carnet d'adresses :"
150
  "Select recipients from your address book.","Sélectionnez les destinataires à partir de votre carnet d'adresses."
151
  "Select your provider and sign in:","Sélectionnez votre fournisseur et identifiez vous :"
152
  "Send email","Envoyer l'email"
 
 
153
  "Social Networks","Réseaux sociaux"
154
  "Solved","Réglé"
155
  "Special Rate","Taux spécial"
 
156
  "Sponsor","Parrain"
157
  "sponsor","parrainage"
158
  "Sponsor friends","Parrainez des amis"
159
  "Sponsor ID","ID parrain"
 
160
  "Sponsorship","Parrainage"
 
161
  "Sponsorship balance:","Solde parrainage :"
162
  "Sponsorship coupon","Bon de réduction parrainage"
163
  "Sponsorship date","Date de parrainage"
@@ -165,7 +217,9 @@
165
  "Sponsorship information","Information sur le parrainage"
166
  "Sponsorship invitation","Invitation parrainage"
167
  "Sponsorship mail options","Options des mails de parrainage"
 
168
  "Sponsorship module activated","Module de parrainage activé"
 
169
  "Sponsorship options","Options de parrainage"
170
  "Sponsorship points","Points parrainage"
171
  "Sponsorship points by fixed amount","Points de parrainage en montant fixe"
@@ -192,8 +246,12 @@
192
  "Unable to get contacts !","Impossible de récupérer les contacts !"
193
  "Update status","Modifier le statut"
194
  "Use of your fidelity points","Utilisation de vos points fidélité"
 
195
  "Use of your sponsorship points","Utilisation de vos points parrainage"
196
  "Validate","Valider"
 
 
 
197
  "Value","Valeur"
198
  "Voucher exchange enabled","Échange en bons de réductions activé"
199
  "Voucher exchange mail options","Options des mails d'échange de points en bon de réduction"
@@ -201,6 +259,8 @@
201
  "Vouchers:","Bons de réduction :"
202
  "Waiting","En attente"
203
  "Winning","Points gagnés"
 
 
204
  "You do not have active godson.","Vous n'avez pas de filleul actif."
205
  "You do not have as many points.","Vous ne disposez pas d'autant de points."
206
  "You do not have yet send invit.","Vous n'avez pas encore envoyé d'invitation."
@@ -217,5 +277,6 @@
217
  "Your message will be preceded by:","Votre message sera précédé de :"
218
  "Your message will ends as follows:","Votre message se terminera comme suit :"
219
  "Your message:","Votre message :"
 
220
  "Your points exchanges:","Vos échanges de points :"
221
  "Your request has been submitted, you will soon receive an email confirmation.","Votre demande a bien été transmise, vous recevrez bientôt un mail de confirmation."
4
  "'%s' is not an integer.","'%s' n'est pas un entier."
5
  "'%s' is not greater than 0.","'%s' n'est pas supérieur à 0."
6
  "%s is already an email to our customers","%s est déjà l'email d'un de nos clients"
7
+ "%s points","%s points"
8
  "%s points exchange for customer (%s)","Échange de points %s pour le client (%s)"
9
+ "%s sponsor points","Points de parrainage %s"
10
  "%s vouchers points exchange","%s échange de points en bon de réduction"
11
  "<a href='%s'>%s</a>","<a href='%s'>%s</a>"
12
  "A value is required.","Une valeur est requise."
13
+ "Accumulated mode options","Options du mode fidélité et parrainage accumulé"
14
  "Activated","Activé"
15
  "Active godsons:","Filleuls actifs :"
16
  "Add a change","Ajouter un échange"
17
  "Add a provider","Ajouter un fournisseur"
18
  "Add a sponsorship","Ajouter un parrainage"
19
  "Add an invitation","Ajouter une invitation"
20
+ "Add Recipient","Ajouter un destinataire"
21
  "Add recipients","Ajoutez les destinataires."
22
  "Add recipients.","Ajoutez les destinataires."
23
  "Address book provider:","Fournisseur de carnet d'adresse :"
24
+ "Allow customers who have never ordered to send invitations","Autoriser les clients n'ayant jamais commandé à envoyer des invitations"
25
+ "Allow customers who have never ordered to send sponsorship invitations","Autoriser les clients n'ayant jamais commandé à envoyer des invitations"
26
+ "Allow to sponsor registred customers (but never ordered)","Autoriser le parainage de clients déjà enregistrés (mais n'ayant jamais commandé)"
27
  "Allows customers to import addressbook/contacts from different email providers like Yahoo, Gmail, Hotmail, Live etc. using different CMS software like Drupal, Joomla etc. or forum software like PHPBB, SMF etc. Learn more on <a href='http://openinviter.com'>openinviter.com</a>","Permet aux clients d'importer leur carnet d'adresse depuis plusieurs fournisseurs comme Yahoo, Gmail, Hotmail, Live etc. Plus de sétails sur <a href='http://openinviter.com'>openinviter.com</a>"
28
  "Amount of winning points for first order","Montant des points gagnés pour une première commande"
29
  "Amount of winning points for the first godson order","Montant des points gagnés lors de la première commande d'un filleul"
30
  "Amount of winning points when subscribe to newsletter on account creation","Montant des points gagnés si le client s'abonne à la newletter lors de son inscription"
31
+ "An error occured while sending sponsor notification email.","Une erreur est survenue lors de l'envoi du mail de notification au parrain"
32
  "An error occurred while saving your request.","Une erreur est survenue lors de l'enregistrement de votre demande."
33
  "An error occurred while sending mail.","Une erreur est survenue lors de l'envoi du mail."
34
  "An error occurred, the mail to %s could not be delivred.","Une erreur est survenue, le mail destiné à %s n'a pas pu être délivré."
35
  "An exception occured !","Une exception s'est produite !"
36
  "And it ends as follows:","Et il se terminera comme suit :"
37
  "Are you sure to process mass action?","Êtes vous sure de vouloir procéder à une action de masse ?"
38
+ "Automatic discount in cart","Remise automatique dans le panier"
39
+ "Back","Retour"
40
  "But it could not be saved.","Mais il n'a pas pu être enregistré."
41
+ "Buying","Achat"
42
+ "Buying cancellation","Annulation d'achat"
43
  "Calculation period of the maximum allowed for an individual (days)","Période de calcul du maximum autorisé pour un particulier (jours)"
44
  "Campany number","SIRET"
45
+ "Cancel earned points on credit memo creation","Annuler les points gagnés lors de la création d'un avoir"
46
+ "Cancel the use of points on credit memo creation","Annuler l'utilisation des points lors de la création d'un avoir"
47
  "Canceled","Annulé"
48
+ "Cart exchange","Échange panier"
49
  "Cash","Cash"
50
  "cash","cash"
51
+ "Cash exchange","Échange en cash"
52
+ "Cash exchange","Échange de cash"
53
+ "Cash exchange cancellation","Annulation échange de cash"
54
  "Cash exchange enabled","Échange en cash activé"
55
  "Change information","Information sur l'échange"
56
  "Change your points into:","Cliquez sur un des liens suivants pour changer vos points :"
58
  "Choose your provider","Choisissez votre fournisseur"
59
  "Conversion rate of points in currency","Taux de conversion des points en monnaie"
60
  "coupon","bon de réduction"
61
+ "Coupon Email Template","Gabarit du mail d'envoi du bon de réduction"
62
+ "Coupon exchange","Échange en bons de réductions"
63
+ "Coupon exchange","Échange en bon de réduction"
64
+ "Coupon exchange cancellation","Annulation échange en bon de réduction"
65
  "Creation date","Date de création"
 
 
66
  "Customer","Client"
67
  "Customer ID","ID Client"
68
  "Customer name","Nom client"
76
  "Edition of the invitation '%s'","Édition de l'invitation '%s'"
77
  "Edition of the Open inviter provider '%s'","Edition du fournisseur Open inviter '%s'"
78
  "Edition of the sponsorship '%s'","Édition du parrainage '%s'"
79
+ "Email Address:","Email :"
80
  "Email missing !","Il manque l'email !"
81
  "Email Providers","Fournisseurs de mails"
82
+ "Email:","Email :"
83
  "emptyResults","Aucun résultat"
84
  "Enter the cash you want.","Indiquez le cash que vous souhaitez obtenir."
85
  "Enter the points you want to convert.","Indiquez les points que vous voulez convertir."
87
  "errorURL","Erreur URL"
88
  "Exchange detail","Détail échange"
89
  "Exchange of your %s points into %s","Échange de vos points %s en %s"
90
+ "Expiry","Fin de validité"
91
  "Exported","Exporté"
92
  "Fidelity","Fidélité"
93
  "fidelity","fidélité"
94
+ "Fidelity and separated mode options","Options du mode fidélité et séparé"
95
  "Fidelity and Sponsorship","Fidélité et Parrainage"
96
+ "Fidelity and Sponsorship (accumulated)","Fidélité et parrainage (accumulé)"
97
+ "Fidelity and Sponsorship (separated)","Fidélité et parrainage (séparé)"
98
  "Fidelity balance:","Solde fidélité :"
99
  "Fidelity module activated","Module de fidélité activé"
100
  "Fidelity options","Options de fidélité"
101
  "Fidelity points","Points fidélité"
102
+ "Fidelity points and sponsorship management","Points de fidélité et gestion du parrainage"
103
  "Fidelity points by fixed amount","Points de fidélité en montant fixe"
104
  "Fidelity points by fixed amount for whole cart","Points de fidélités fixe sur tout le panier"
105
  "Fidelity points by percentage of the original price","Points de fidélité en pourcentage du prix"
106
+ "Fidelity points management","Gestion des points de fidélité"
107
  "Fidelity points:","Points fidélité :"
108
  "filterLabel","Filtrer la colonne :"
109
  "First name","Prénom"
110
  "First name:","Prénom :"
111
+ "First order","Première commande"
112
  "gift","cadeau"
113
+ "Gift exchange","Échange en cadeaux"
114
+ "Gift exchange","Échange cadeau"
115
+ "Gift exchange cancellation","Annulation échange cadeau"
116
  "Gift exchange enabled","Échange en cadeaux activé"
117
  "Gifts","Cadeaux"
118
+ "Godchild first order","Première commande d'un filleul"
119
  "Godson","Filleul"
120
  "Godson ID","ID Filleul"
121
  "Godson name","Nom filleul"
131
  "Invalid IBAN code ""%s""","Le code IBAN ""%s"" est invalide"
132
  "Invitation detail","Détail de l'invitation"
133
  "Invitation does not exist","L'invitation n'existe pas"
134
+ "Invitation Email Template","Gabarit du mail d'invitation"
135
  "Invitation information","Information sur l'invitation"
136
  "Invitation to %s","Invitation %s"
137
  "Invitation was successfully saved","L'invitation a bien été enregistrée"
142
  "Listing date","Date inscription"
143
  "loading","chargement"
144
  "Login failed. Please check the email and password you have provided and try again later !","L'authentification a échouée. Merci de vérifier votre identifiant et votre mot de passe."
145
+ "Manual changes","Modification manuelle"
146
  "Max invitations","Nombre max d'invitations"
147
  "Maximum amount permitted without company number","Montant maximum autorisé sans SIRET"
148
  "Maximum levels of sponsorship","Nombre maximum de niveaux de parrainage"
149
  "Message","Message"
150
+ "Mode of the module","Mode du module"
151
  "Module","Module"
152
+ "Movement","Mouvement"
153
+ "My fidelity points","Mes points de fidélité"
154
+ "My sponsor points","Mes points de parrainage"
155
+ "Name:","Nom :"
156
+ "Newsletter subscription","Abonnement à la newsletter"
157
+ "Notification Email Template","Gabarit du mail de notification"
158
  "Number of sponsorships","Nombre de parrainages"
159
  "Once you will have points, you can change them into:","Lorsque vous aurez des points, vous pourrez les changer en :"
160
  "Open inviter providers","Fournisseurs Open Inviter"
161
  "Or add recipient manually.","Ou ajoutez vos destinataires manuellement."
162
+ "Order","Commande"
163
  "paginationFirst","Première"
164
  "paginationLast","Dernière"
165
  "paginationNext","Suivante"
171
  "Please enter the full email, not just the username","Merci d'indiquer votre email, et pas seulement votre nom d'utilisateur."
172
  "Please select changes","Merci de sélectionner des échanges"
173
  "Points","Points"
174
+ "Points balance:","Solde de vos points :"
175
+ "Points calculation","Calcul des points"
176
  "Points exchanges list","Liste des échanges de points"
177
  "Points to exchange:","Points à échanger :"
178
+ "Points validity in days(0 for unlimited)","Validité des points en jours (0 pour illimité)"
179
  "Principles of Sponsorship","Principes du parrainage"
180
  "Provider detail","Détail du fournisseur"
181
  "Provider missing !","Il manque le fournisseur !"
184
  "Ratio applied from level 2 to calculate the points of the sponsor (in percentage)","Ratio appliqué à partir du niveau 2, pour le calcul des points du parrain (en pourcentage)"
185
  "Recall","Relancer"
186
  "Recall %s %s","Relance de %s %s"
187
+ "Recipient:","Destinataire :"
188
  "Recipients:","Destinataires :"
189
  "Recovery date","Date de relance"
190
  "Related ID","ID parent"
191
  "Related mail","Email parent"
192
  "Related name","Nom parent"
193
  "Remove Recipient","Supprimer le destinataire"
194
+ "Required Fields","Champs obligatoires"
195
  "searchLabel","Recherche"
196
  "Select recipients from your address book:","Sélectionnez les destinataires dans votre carnet d'adresses :"
197
  "Select recipients from your address book.","Sélectionnez les destinataires à partir de votre carnet d'adresses."
198
  "Select your provider and sign in:","Sélectionnez votre fournisseur et identifiez vous :"
199
  "Send email","Envoyer l'email"
200
+ "Send notification to sponsor when godchild make him earn points","Envoyer une notification au parrain lorsqu'un filleul lui fait gagner des points"
201
+ "Sender:","Expéditeur :"
202
  "Social Networks","Réseaux sociaux"
203
  "Solved","Réglé"
204
  "Special Rate","Taux spécial"
205
+ "Special rate","Taux spécial"
206
  "Sponsor","Parrain"
207
  "sponsor","parrainage"
208
  "Sponsor friends","Parrainez des amis"
209
  "Sponsor ID","ID parrain"
210
+ "Sponsor points ","Points parrainage"
211
  "Sponsorship","Parrainage"
212
+ "Sponsorship and separated mode options","Options du mode parrainage et séparé"
213
  "Sponsorship balance:","Solde parrainage :"
214
  "Sponsorship coupon","Bon de réduction parrainage"
215
  "Sponsorship date","Date de parrainage"
217
  "Sponsorship information","Information sur le parrainage"
218
  "Sponsorship invitation","Invitation parrainage"
219
  "Sponsorship mail options","Options des mails de parrainage"
220
+ "Sponsorship management","Gestion du parrainage"
221
  "Sponsorship module activated","Module de parrainage activé"
222
+ "Sponsorship notification","Notification du parrain"
223
  "Sponsorship options","Options de parrainage"
224
  "Sponsorship points","Points parrainage"
225
  "Sponsorship points by fixed amount","Points de parrainage en montant fixe"
246
  "Unable to get contacts !","Impossible de récupérer les contacts !"
247
  "Update status","Modifier le statut"
248
  "Use of your fidelity points","Utilisation de vos points fidélité"
249
+ "Use of your points","Utilisation de vos points"
250
  "Use of your sponsorship points","Utilisation de vos points parrainage"
251
  "Validate","Valider"
252
+ "Validity fidelity points ","Validité des points de fidélité"
253
+ "Validity points","Validité des points"
254
+ "Validity sponsorship points ","Validité des points de parrainage"
255
  "Value","Valeur"
256
  "Voucher exchange enabled","Échange en bons de réductions activé"
257
  "Voucher exchange mail options","Options des mails d'échange de points en bon de réduction"
259
  "Vouchers:","Bons de réduction :"
260
  "Waiting","En attente"
261
  "Winning","Points gagnés"
262
+ "worth %s","soit %s"
263
+ "You can't send an invitation to yourself","Vous ne pouvez pas vous envoyer une invitation à vous même."
264
  "You do not have active godson.","Vous n'avez pas de filleul actif."
265
  "You do not have as many points.","Vous ne disposez pas d'autant de points."
266
  "You do not have yet send invit.","Vous n'avez pas encore envoyé d'invitation."
277
  "Your message will be preceded by:","Votre message sera précédé de :"
278
  "Your message will ends as follows:","Votre message se terminera comme suit :"
279
  "Your message:","Votre message :"
280
+ "Your points are valid until the %s","Vos points sont valables jusqu’au %s"
281
  "Your points exchanges:","Vos échanges de points :"
282
  "Your request has been submitted, you will soon receive an email confirmation.","Votre demande a bien été transmise, vous recevrez bientôt un mail de confirmation."
app/locale/fr_FR/template/email/{sponsorship_coupon.html → auguria/sponsorship/sponsorship_coupon.html} RENAMED
File without changes
app/locale/fr_FR/template/email/{sponsorship_invitation.html → auguria/sponsorship/sponsorship_invitation.html} RENAMED
File without changes
app/locale/fr_FR/template/email/auguria/sponsorship/sponsorship_notification.html ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {* This is a comment block
2
+
3
+ @category Auguria
4
+ @package Auguria_Sponsorship
5
+ @author Auguria
6
+ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+
8
+ Available vars in sponsorship template:
9
+ subject
10
+ sender_name
11
+ sender_email
12
+ recipient_firstname
13
+ recipient_lastname
14
+ store_name
15
+ godchild_firstname
16
+ godchild_lastname
17
+ added_points
18
+ total_points
19
+
20
+ *}<!--@subject {{var data.subject}} @-->
21
+
22
+ Bonjour {{var data.recipient_firstname}} {{var data.recipient_lastname}},
23
+
24
+ Votre filleul {{var data.godchild_firstname}} {{var data.godchild_lastname}} vous a fait gagner {{var data.added_points}} points.
25
+
26
+ Vous disposez maintenant de {{var data.total_points}} points.
27
+
28
+ {{store url=""}}
29
+
30
+ --BOUNDARY_TEXT_OF_CHOICE_FOR_AUGURIA_SPONSORSHIP
31
+
32
+ <style type="text/css">
33
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
34
+ </style>
35
+
36
+ <div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
37
+ <table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
38
+ <tr>
39
+ <td align="center" valign="top">
40
+ <!-- [ header starts here] -->
41
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
42
+ <tr>
43
+ <td valign="top">
44
+ <a href="{{store url=""}}">
45
+ <img src="{{skin url="images/logo_email.gif" _area='frontend'}}" alt="{{var data.store_name}}" style="margin-bottom:10px;" border="0"/>
46
+ </a>
47
+ </td>
48
+ </tr>
49
+ </table>
50
+
51
+ </td>
52
+ </tr>
53
+ <tr>
54
+ <td align="center" valign="top">
55
+ <!-- [ middle starts here] -->
56
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
57
+ <tr>
58
+ <td valign="top">
59
+ <p><strong>Bonjour {{var data.recipient_firstname}} {{var data.recipient_lastname}}</strong>,</p>
60
+ <p>Votre filleul {{var data.godchild_firstname}} {{var data.godchild_lastname}} vous a fait gagner <strong>{{var data.added_points}}</strong> points.</p>
61
+ <p>Vous disposez maintenant de <strong>{{var data.total_points}}</strong> points.</p>
62
+ </td>
63
+ </tr>
64
+ <tr>
65
+ <td valign="top">
66
+ <a href="{{store url=""}}">{{var data.store_name}}</a>
67
+ </td>
68
+ </tr>
69
+ </table>
70
+ </td>
71
+ </tr>
72
+ </table>
73
+ </div>
js/{tableorderer → auguria/sponsorship}/table_orderer.js RENAMED
File without changes
media/sponsorship/openinviter/fleurs jaune.jpg ADDED
Binary file
package.xml CHANGED
@@ -1,31 +1,34 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Auguria_Sponsorship</name>
4
- <version>1.0.10</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>This release add german translation, ability to use transactional email and fix bug that doesn't display customer attributes on magento 1.4.2</summary>
10
- <description>The module consists of :
11
- - A form to send invitations: when an invitation is sent, the guest mail is registered , and the customer id too.
12
- - A system of affiliation: The link sent through invitations refer to a controller that will create a cookie and a session to identify a person invited. We can equally put such links on third party sites.
13
- - Account creation: When creating an account, it checks whether an invitation was sent to the email used for registration. If this is not the case, we check if a session cookie or affiliation exists. If there is a link, the user who registers become the godson of the customer who invits him.
14
- - A monitoring points for the client: the client have an interface for monitoring points in his account. He can see his godson. He can ask for trade his points.
15
- - Increment of points: Fidelity points and sponsorship points are inserted in the command, at the checkout cart. Upon payment of the command, points are awarded to customers.
16
- - Definition of rules: the management of points can be made through the catalog rules prices or cart rules prices.
17
- - Module configuration: The administration interface allows you to enable or disable fidelity points or sponsorship points. Enabling or no exchange of cash, gift or coupon. You can also define the max cash without siret number, the period of calcul of the max cash, if an order is required to sponsor, the period of validity for an invitation, the period of validity of a sponsorship whithout an order, number of levels for sponsorship calculation points, the percentage on indirect sponsorship sales, the maximum number of invitations that you can send per hour, the header message, the body message and the footer message.
18
- - An administration interface: allows to see the list of invitations sent, monitor requests for trade of points.
19
-
20
- Once installed, you must:
21
- - Create one or several catalog or cart rules for increment fidelity and sponsorship points
22
- - Edit CMS Page on sponsorship information
 
 
 
23
  - If you enable automatic sponsorship recall, activate magento cron</description>
24
  <notes>If you have ideas for improvements or find bugs, please send them to Franck Charpentier at www.auguria.net, with Auguria LastReviews as part of the subject line.</notes>
25
  <authors><author><name>Auguria</name><user>auto-converted</user><email>magento@auguria.net</email></author></authors>
26
- <date>2011-04-07</date>
27
- <time>15:32:57</time>
28
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sponsorship.xml" hash="934da279981ddb250e116b956a262c0c"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="sponsorship.xml" hash="b4e501c7d1d4bbd3f4c8db7e9fd936da"/></dir><dir name="template"><dir name="sponsorship"><dir name="customer"><dir name="account"><dir name="dashboard"><file name="fidelity_points.phtml" hash="afbada11c6c7819daa7a74c0ef186a1b"/><file name="sponsor_points.phtml" hash="a19f3594bfe1b4491bc8f906e08f86bf"/></dir><file name="dashboard.phtml" hash="a42e17c3f2458fdeb19a59c97e88a464"/><file name="fidelitypointsdetail.phtml" hash="c1a018f8c0f4d1859c7a79558ef33712"/><file name="sponsorpointsdetail.phtml" hash="bb957c677b95d359ea3281bdbd53ea3a"/></dir><dir name="form"><dir name="pointschange"><file name="pointschange_cash.phtml" hash="58adf546a6e8aa93b340a2d1aab50e73"/><file name="pointschange_coupon.phtml" hash="0190f17418f5f5b3ffa128e09ffa375e"/><file name="pointschange_gift.phtml" hash="29a244c931252894b98e1a9bf1c40fc4"/></dir><file name="boost.phtml" hash="cf19f616a64094c4ac23a635f83a67d7"/><file name="edit.phtml" hash="bc0b34815ddf80c519a61e3b24838212"/><file name="pointschange.phtml" hash="98fced0f1ac113b79e14521fea151afc"/><file name="register.phtml" hash="ec19e985600c3377a746f3a4e358d2dd"/></dir><dir name="widget"><file name="name.phtml" hash="bfb8c2e90a4e5af55a6479cc122d67b1"/><file name="virement.phtml" hash="74b9c05d0242aa06b6cc35a9abc23751"/></dir></dir><file name="openinviter.phtml" hash="b239707ebefe243d1b072a59f25b0a0b"/><file name="openinviterimport.phtml" hash="8e468750660c4b2556f4f1e1b50bfafb"/><file name="sponsorship.phtml" hash="a39616946d2f49fa0e5b55a74415628f"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Auguria_Sponsorship.xml" hash="2ace21d88c17b2636514543e866169eb"/></dir></dir></dir><dir name="js"><dir name="tableorderer"><file name="table_orderer.js" hash="f23c21e5031d7218f83c9117cf7442eb"/></dir></dir></target><target name="magecommunity"><dir name="Auguria"><dir name="Sponsorship"><dir name="Block"><dir name="Adminhtml"><dir name="Change"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="cd94427577e45107683ea305a557f9d8"/></dir><file name="Form.php" hash="ae7412b583874b8fffc05cc3897f1a2b"/><file name="Tabs.php" hash="14027188a77ed427a54211d61471c962"/></dir><file name="Edit.php" hash="5c266273137c23f763d39d93f5ef82b4"/><file name="Grid.php" hash="9962a69732ae93157eb99ff663608203"/></dir><dir name="Link"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="98a2a13987cb165ee5233dcef0927daa"/></dir><file name="Form.php" hash="e6e087ae96b24d4edbe9e1f578e7a55a"/><file name="Tabs.php" hash="7d67a25094cf51ced551a8b3e21155c1"/></dir><file name="Edit.php" hash="bb82a0a9cd963648d7e6e34c616a0122"/><file name="Grid.php" hash="8703f106255a7f89a4e19d18e57c7209"/></dir><dir name="Openinviter"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="195714b736feb365b208346ab8323385"/></dir><file name="Form.php" hash="b4bdc64549563f0117f65c66f97d0fb8"/><file name="Tabs.php" hash="41a6ef79001601dacba231c9eefd4749"/></dir><file name="Edit.php" hash="2297909cf7059abd6b15080abe9dc586"/><file name="Grid.php" hash="d7c4af65017cbcb83831af451b1488ce"/></dir><dir name="Sponsorship"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="686b9a9a14d57e0f2e7edcf3d4e0416a"/></dir><file name="Form.php" hash="a3a2352db1c72663af0caa289287a9d2"/><file name="Tabs.php" hash="257863f6b317e37110dacc86b783565b"/></dir><file name="Edit.php" hash="40ea8077f12545878ddc0cd0ad2f8cad"/><file name="Grid.php" hash="83a98d5005f4b89dfa275ddea3355c16"/></dir><dir name="Widget"><dir name="Grid"><file name="Renderer.php" hash="35c8a336e1a0e2dcc8d48b558cee9253"/></dir></dir><file name="Change.php" hash="bec41dc1406063e264b15c9755cf3a5c"/><file name="Link.php" hash="922a5716b419d7becb0150cae3bda3de"/><file name="Openinviter.php" hash="291020a06d499b7b12e37e53e1963a08"/><file name="Sponsorship.php" hash="634e37981a47519ba1063be166fc511f"/></dir><dir name="Customer"><dir name="Account"><file name="PointsDetail.php" hash="2975bcbfe44640ebf90e6417941f0e12"/></dir><dir name="Form"><file name="Boost.php" hash="33cd49ab1ceed2816feb1d45b1c7a69b"/><file name="PointsChange.php" hash="92a71fe4f081b6c3b85cc645419fac04"/></dir><dir name="Widget"><file name="Name.php" hash="3c82b2d67f219ae56ac37526f72268fe"/><file name="Virement.php" hash="ba25badce7295811fe5deeafa284c114"/></dir></dir><dir name="Promo"><dir name="Catalog"><dir name="Edit"><dir name="Tab"><file name="Actions.php" hash="f5926196fd291cb45c13b5a8e1c018b6"/></dir></dir></dir><dir name="Quote"><dir name="Edit"><dir name="Tab"><file name="Actions.php" hash="4ff4de9b5e4d5200111d602625f91362"/></dir></dir></dir></dir><file name="Openinviter.php" hash="3051e44a791ccab457a37cef01357bd5"/><file name="Sponsorship.php" hash="aeda9a7b60354970689701acd1ea0013"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ChangeController.php" hash="73c1db83413cdf077562f8fb8d4bd8ec"/><file name="LinkController.php" hash="e800d6add6c1b5362cc736f4e5c77e7a"/><file name="OpeninviterController.php" hash="82c2500286cb627c56d8655b79380d77"/><file name="SponsorshipController.php" hash="fff66a866f773ed8f6d3708c9e0d644f"/></dir><dir name="Customer"><file name="AccountController.php" hash="3589ee3b09c3d441e024dc5289b84394"/></dir><file name="BoostController.php" hash="c23cca5dfd34c8975f785e7973aa4d79"/><file name="FidelitypointsController.php" hash="3a6afcb0fe13c4430592e986730cf4f4"/><file name="IndexController.php" hash="37f688e9c6c4901e70d4d8caca157447"/><file name="OpeninviterController.php" hash="f7268aa63f3248a4c1c4a61b26990d87"/><file name="SponsorController.php" hash="b81147d898f8903d5167ab0eed14a8ed"/><file name="SponsorpointsController.php" hash="adac90799f072ea4fc11b42494b1b5fb"/></dir><dir name="etc"><file name="config.xml" hash="26ba3f9e0245a2bd7dce39d130acba34"/><file name="system.xml" hash="d23aeba936562241b58245fd16a7ddf1"/></dir><dir name="Helper"><file name="Data.php" hash="277563504bc31f781436af2db0331fe5"/><file name="Mail.php" hash="7de003c732cb57b2f19352e81aec16b9"/></dir><dir name="Lib"><dir name="OpenInviter"><dir name="conf"><file name="abv.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="aol.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="apropo.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="atlas.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="aussiemail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="azet.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="badoo.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="bebo.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="bigstring.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="bookcrossing.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="bordermail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="brazencareerist.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="canoe.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="care2.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="clevergo.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="cyworld.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="doramail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="eons.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="evite.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="facebook.conf" hash="12cfb187449596c39774c4ac193295cc"/><file name="faces.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="famiva.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="fastmail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="fdcareer.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="flickr.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="flingr.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="flixster.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="fm5.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="freemail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="friendfeed.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="friendster.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="gawab.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="gmail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="gmx_net.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="graffiti.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="hi5.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="hotmail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="hushmail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="hyves.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="inbox.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="india.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="indiatimes.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="inet.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="interia.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="katamail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="kids.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="kincafe.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="konnects.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="koolro.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="lastfm.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="libero.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="linkedin.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="livejournal.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="lovento.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="lycos.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="mail2world.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="mail_com.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="mail_in.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="mail_ru.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="meinvz.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="meta.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="mevio.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="motortopia.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="msn.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="multiply.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="mycatspace.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="mydogspace.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="mynet.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="myspace.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="netaddress.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="netlog.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="ning.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="nz11.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="o2.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="operamail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="orkut.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="perfspot.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="plaxo.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="plazes.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="plurk.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="pochta.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="popstarmail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="rambler.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="rediff.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="sapo.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="skyrock.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="tagged.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="techemail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="terra.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="twitter.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="uk2.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="vimeo.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="virgilio.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="vkontakte.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="walla.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="web_de.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="wpl.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="xanga.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="xing.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="xuqa.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="yahoo.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="yandex.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="youtube.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="zapak.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="_hosted.conf" hash="1d09309103e660729b492433acda9822"/></dir><dir name="images"><file name="ers.gif" hash="cccdfd4ed0795b767d2a01f531781c10"/><file name="oks.gif" hash="6b4b170c9f10a0fa4b25307dd8f47e5b"/></dir><dir name="plugins"><file name="abv.plg.php" hash="1685755eae909c468055b9b36c915822"/><file name="aol.plg.php" hash="dd3522033c2cafeb62fd0beed5949bcf"/><file name="apropo.plg.php" hash="4426f976c1953383cf9d1f892aa9576e"/><file name="atlas.plg.php" hash="0b8e4237970ae54ff20187f5e861f972"/><file name="aussiemail.plg.php" hash="d40188b33455b3fd2e88cbde25f61709"/><file name="azet.plg.php" hash="e4a7c19450ca1ad84783a06ae3b1d61f"/><file name="badoo.plg.php" hash="b1d4863a173a80fc9d77331f1e60f2df"/><file name="bebo.plg.php" hash="2d7db898c660380ee74963667bec6bae"/><file name="bigstring.plg.php" hash="7de7a5516a8f0c71580970d8da4121eb"/><file name="bookcrossing.plg.php" hash="212a53a3a95659c56e15d6848549e25e"/><file name="bordermail.plg.php" hash="30190fa3da58d63ddd7e30e6ab0190dc"/><file name="brazencareerist.plg.php" hash="c68f39b6d7a07550abd63ed044ad85c2"/><file name="canoe.plg.php" hash="7737d89b163689cb793f0f37f6028efb"/><file name="care2.plg.php" hash="c066e81973194cca90036c37c7740937"/><file name="clevergo.plg.php" hash="9bd12fea0eb7f60043bcdca9116cb1bc"/><file name="cyworld.plg.php" hash="588dfdddcc2bc9ab2ff26c4616e0a42c"/><file name="doramail.plg.php" hash="81037085958f90a05111ad030c5a72f8"/><file name="eons.plg.php" hash="35009d6e25ae5584c554808b50145a19"/><file name="evite.plg.php" hash="d6c8acf7c24c2848eccedb269928d6eb"/><file name="facebook.plg.php" hash="6a1cfdc0dfc76b3dc3781aa2327ee833"/><file name="faces.plg.php" hash="d0affdf4e73ff6134acfaae5fda29323"/><file name="famiva.plg.php" hash="eee1c0a9a6d645baf014245ca2e9c3e9"/><file name="fastmail.plg.php" hash="da86fea25210ed40258ae2a107dcfe8f"/><file name="fdcareer.plg.php" hash="aad3d525fe09269de056f8ec03e43104"/><file name="flickr.plg.php" hash="055d1e64f116113379e3192b23dc84fc"/><file name="flingr.plg.php" hash="c2b415851babadb8048609874b411979"/><file name="flixster.plg.php" hash="773fad1c2c1775fcb74fb33f51d1fa24"/><file name="fm5.plg.php" hash="0576df91534edaab3d6b333d1968781a"/><file name="freemail.plg.php" hash="142951e9c20ce4447f44c6db7e5cc2e8"/><file name="friendfeed.plg.php" hash="399c987766110735fdd301979997fe48"/><file name="friendster.plg.php" hash="8b3402876a73bf91a84d3a6d8dbb1951"/><file name="gawab.plg.php" hash="c4cb42d893a99b370d9597f20da5c01e"/><file name="gmail.plg.php" hash="83d92f7f75e048210aec2fdecdbd67e0"/><file name="gmx_net.plg.php" hash="218b73370a1367455aeee09695bc4e2a"/><file name="graffiti.plg.php" hash="36f6a6f03fceb9b0e008c1a281a17eb2"/><file name="hi5.plg.php" hash="ba133ae4e865c10f6ce3ddc738751374"/><file name="hotmail.plg.php" hash="ef3241a0a43020412162d8f6dd9dd206"/><file name="hushmail.plg.php" hash="d3f9f339ac03c8aa2426f7a2fe4f2606"/><file name="hyves.plg.php" hash="4dca8f35b17070c42bd16fd86352baf3"/><file name="inbox.plg.php" hash="34066ac6458b6506921e11dde302e3c2"/><file name="india.plg.php" hash="cdd4e86f5b21122b2ebf898eb78b0311"/><file name="indiatimes.plg.php" hash="bbbda190c92579f469f0b4712ba9806f"/><file name="inet.plg.php" hash="6bc3da45b492ba41012b25e501c05273"/><file name="interia.plg.php" hash="3fb3cb41913d12228f162ac32539a848"/><file name="katamail.plg.php" hash="2c2c85f1cab23f236295e5340da10511"/><file name="kids.plg.php" hash="5fae2d825799b0793e2b131162ec8e07"/><file name="kincafe.plg.php" hash="39f0d662293f3db3bd9b0bb9e57b8e27"/><file name="konnects.plg.php" hash="0fd4bc3f8361fb7e5f04d277b4f7f121"/><file name="koolro.plg.php" hash="ebc1936657a99eb8b96ee178d9b7e15c"/><file name="lastfm.plg.php" hash="a293d4bde8a36b1868ddc432e1f201e6"/><file name="libero.plg.php" hash="29cbf372f39d77fd0b62d0777ded4317"/><file name="linkedin.plg.php" hash="a705475d12bb2458d9bad14497211a14"/><file name="livejournal.plg.php" hash="c9c4bd30963d28eee5038841a7d7c788"/><file name="lovento.plg.php" hash="e26c7fe712efdd69fe3788b02ebf514b"/><file name="lycos.plg.php" hash="41a133d41ef4627b353b0f33149629c0"/><file name="mail2world.plg.php" hash="5737b208425e9d03988303d1c20baac6"/><file name="mail_com.plg.php" hash="5d2c20c61d5ba58c4e4c4fc6e162cb20"/><file name="mail_in.plg.php" hash="bf443e42022a368819bcbb788baaa095"/><file name="mail_ru.plg.php" hash="64b7d2daef963b4fd7e72dd969a04cd2"/><file name="meinvz.plg.php" hash="409380a6ca5c70f8f7ae998d37195115"/><file name="meta.plg.php" hash="17bd2e282a8509a14c2d440ea02d8961"/><file name="mevio.plg.php" hash="d175cd50dc07d749e7118a3a3b836800"/><file name="motortopia.plg.php" hash="507c050bb6e0cc73884c427d4745c7a0"/><file name="msn.plg.php" hash="2a205b0556aa7b8908dca3b15017db4f"/><file name="multiply.plg.php" hash="22e5d241084c259a79330eebff508d95"/><file name="mycatspace.plg.php" hash="1282b9619ddfcba5d924c0e31ea74cc7"/><file name="mydogspace.plg.php" hash="be44672096adbe4e2532d0a9df027b5f"/><file name="mynet.plg.php" hash="a2a38a688707957e216d3868c8b1741e"/><file name="myspace.plg.php" hash="bfcabb115825937a9ed4f9745f52ca7e"/><file name="netaddress.plg.php" hash="8e2ccf82123f831b2616c8d3a80f579f"/><file name="netlog.plg.php" hash="246411cc237ef587d31003c03c61b05b"/><file name="ning.plg.php" hash="e59cb73b203a22978ead363c49e48d3d"/><file name="nz11.plg.php" hash="b94995c177198c061b628ddc82d4c7fc"/><file name="o2.plg.php" hash="8e44c5027c493fff7be428ff034f0466"/><file name="operamail.plg.php" hash="5e3a90f0be46b03bcde54eebd76371c9"/><file name="orkut.plg.php" hash="1a291548a82889b36f976bd091260aa5"/><file name="perfspot.plg.php" hash="9d4a9b33f8cf809e5c73bfc517af53db"/><file name="plaxo.plg.php" hash="d640845713388d7c87a206b3f51060f2"/><file name="plazes.plg.php" hash="f6d71432926c126d7f165e6c83a16854"/><file name="plurk.plg.php" hash="e780f5cdd31029cc1b153a1c5b14a965"/><file name="pochta.plg.php" hash="b5732832c05bf982a5950fa32ee4d62a"/><file name="popstarmail.plg.php" hash="a36517a17fa2a461ab890861a4c452fd"/><file name="rambler.plg.php" hash="148cfdfa5b4e5eb2479692dd9f1533a7"/><file name="rediff.plg.php" hash="5679b17973310ecf1ba8b097d3acffaa"/><file name="sapo.plg.php" hash="2bd76d540c454da5f014eba59074e835"/><file name="skyrock.plg.php" hash="1d6113c0c726f48c250160bcc7826aa2"/><file name="tagged.plg.php" hash="1a88811dfd57937db6aece3026f7f99a"/><file name="techemail.plg.php" hash="9894baf3c22e835dbcf62796327d9f99"/><file name="terra.plg.php" hash="094ae4ab8e63dd0f075a860c9aba2094"/><file name="twitter.plg.php" hash="a385725eb41c3cc003c52429295d1355"/><file name="uk2.plg.php" hash="ca5238d090e6a65709302a149caf5ffb"/><file name="vimeo.plg.php" hash="de5ab46f0cc5919b242c5b200f0ef724"/><file name="virgilio.plg.php" hash="38df3729142bd2b40792b7a1793446b7"/><file name="vkontakte.plg.php" hash="7db9b7a03e8f4ee2d2d7f5192ec18912"/><file name="walla.plg.php" hash="5340dda0d54849d2e313ab97015db215"/><file name="web_de.plg.php" hash="d3ed9a0c556f08bc5c67f978c7be4727"/><file name="wpl.plg.php" hash="b151407c39c360f49ffb9ca9fd73b32b"/><file name="xanga.plg.php" hash="89b5c2c3db98e735e4d1f19fb1c81786"/><file name="xing.plg.php" hash="4f89f01bb8bcbc856441cb6ecb2fbe60"/><file name="xuqa.plg.php" hash="1219e94f6ef0919025b2c93741e55fbd"/><file name="yahoo.plg.php" hash="f2953a803d0d61ffce2c9136d1706758"/><file name="yandex.plg.php" hash="2c211df8b0511fb8c832a00976f2cee1"/><file name="youtube.plg.php" hash="fc05c436e6c2dd1c6c8fa336e7e893c5"/><file name="zapak.plg.php" hash="2274bd725d3bda8df0ae9d45d3ce1470"/><file name="_base.php" hash="79459bef6fcea96f6a7d4a584add9052"/><file name="_hosted.plg.php" hash="69514e56e1833df16884b6762bc620ce"/></dir><file name="autoupdate.php" hash="df781d645e37271f23432bb82b3360a2"/><file name="config.php" hash="6c16534afd6e50dfda0c5be417bd6fe7"/><file name="LICENSE.txt" hash="277c3d400c7488e54746141297a952cb"/><file name="notifier.php" hash="88e3be687de995aae52a8ce248c49bce"/><file name="openinviter.php" hash="d2c0237f86cd7c21dadc2c441e73abb1"/><file name="POLICY.txt" hash="6262372bc84e172c7fd89d9ac61f9794"/><file name="stats.php" hash="5af8362ab3e9f89f5e8560b2623f767a"/></dir><file name="Html2Text.php" hash="4bd5cf3bd59121ffa9d15b9a60a56ca4"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Sponsorship"><file name="Entier.php" hash="cb45db31cab4b797103d686e03404d6d"/><file name="Float.php" hash="35b76ecdc9065ae9aef1acdee66ab57c"/><file name="NaturalNumber.php" hash="62f38f42436a148ae272068d649cf1f5"/><file name="Openinviter.php" hash="b4ac237d528a505bb389f9b29d2ec486"/></dir></dir></dir></dir></dir><dir name="Core"><dir name="Email"><file name="Template.php" hash="9394636054f6709f0a41bec9f471b577"/></dir></dir><dir name="Customer"><file name="Customer.php" hash="1ee0fbe7c2ce96fac9f7dfc97e179a9e"/></dir><dir name="Mysql4"><dir name="CatalogFidelityPoint"><file name="Collection.php" hash="b151b96d8370ea1fe9e309559fb04573"/></dir><dir name="CatalogSponsorPoint"><file name="Collection.php" hash="a56b2950a04ae446dcf82ad4bdfadb07"/></dir><dir name="Change"><file name="Collection.php" hash="99a67418cc7b573f285c04a5d7f6020d"/></dir><dir name="FidelityLog"><file name="Collection.php" hash="7230b303a336da8167709168410c0531"/></dir><dir name="Sponsorlog"><file name="Collection.php" hash="8efa2fb23ec7a6ad2373395ff4739f1e"/></dir><dir name="Sponsorship"><file name="Collection.php" hash="bea288d9bdc6faee88795895eb5bd6ee"/></dir><dir name="Sponsorshipopeninviter"><file name="Collection.php" hash="02d068c627dcfde82019855510d33c1f"/></dir><file name="CatalogFidelityPoint.php" hash="ab4402569102622be8264d135768afbc"/><file name="CatalogSponsorPoint.php" hash="f34d98e76da49afe1e2049dcb3c73626"/><file name="Change.php" hash="fcc6ad58aae6b4051fa997c03b5b5756"/><file name="Fidelitylog.php" hash="47a37a5374c82d3428a6bcc301316ce8"/><file name="Rule.php" hash="2ee2d8879d6ac0be3432e1e5334d77cf"/><file name="Sponsorlog.php" hash="97bde1eef9156b5a20f5f2f92a6fee03"/><file name="Sponsorship.php" hash="2c6d63261112e53a9c442ea3568e2e32"/><file name="Sponsorshipopeninviter.php" hash="ad84d61baa3a105b6f9ff469ca4ba08a"/></dir><dir name="SocialBookmarking"><file name="Urls.php" hash="8507b7302d5aa76c9b6bc8e1e92e0598"/></dir><file name="AutoBoost.php" hash="4295a1eaaf2bfd3935d4601ed7d0f1c9"/><file name="Change.php" hash="c4e3f0cd6077fab4ebc7e078d031fc3d"/><file name="Changestatut.php" hash="21106c8021072b8f8cf8419fec0ad0a9"/><file name="Fidelitylog.php" hash="1644dc508b0a1c4d06397a48509f652c"/><file name="Observer.php" hash="c90f4d1e30cbd919d237630570877857"/><file name="Openinviter.php" hash="a10e89360e9d94d46afc69b7c13fc047"/><file name="Sponsorlog.php" hash="834b0e8e29eff5061abb18621a22ddb5"/><file name="Sponsorship.php" hash="acd91d3c6a6dbe801e7dde41a8d2fb06"/><file name="Sponsorshipopeninviter.php" hash="9b2af360ba8b4c6b233697d2bf8b8798"/><file name="Status.php" hash="ad5779cf7a0887635315b74827780063"/><file name="Validator.php" hash="87d39a07bff5133894f8334f9f5fe967"/></dir><dir name="sql"><dir name="sponsorship_setup"><file name="mysql4-install-0.1.0.php" hash="cde2a97370601a046bcc559e22a7cdb8"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="99c4e9b7ab6d3aab2477195310482242"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="08dc31268dcb35b68abbc4c179f7ed03"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="9966b88c1e297dd4cae297859e4034a0"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="0d55e5801c8e4031aeece7787ffc94c1"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="6de811c47e0031c134a8343e230ca451"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="d6f43e969bf07f5859b1f251540c358d"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="5289d74fa889d0046a19d9714df5572b"/><file name="mysql4-upgrade-0.1.7-0.1.8.php" hash="89acdec2f7785fc2e6e82ff6265e439a"/><file name="mysql4-upgrade-0.1.8-0.1.9.php" hash="02158b6524f5d24c8e9d07022da2aa27"/><file name="mysql4-upgrade-0.1.10-0.1.11.php" hash="b29284b6cf0df556810ed3bdb47fd7dc"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="d6bd4428ca5918e44603d7dbcff23e74"/><file name="mysql4-upgrade-1.0.7-1.0.8.php" hash="54d2e16a888361b67d5640072e3ddc76"/><file name="mysql4-upgrade-1.0.8-1.0.9.php" hash="6b65268dde1a93b43bc808345ef5900a"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><dir name="template"><dir name="email"><file name="sponsorship_coupon.html" hash="087a9a72f7f7c63d4136ff498730382f"/><file name="sponsorship_invitation.html" hash="30fe91c3b83ee223f6bffb3dd779dd26"/></dir></dir><file name="Auguria_Sponsorship.csv" hash="db9b02ed8a00479a96bb83a0a5b9f293"/></dir><dir name="en_US"><dir name="template"><dir name="email"><file name="sponsorship_coupon.html" hash="0ca5d0c23070e0a6a9f9822ad9612678"/><file name="sponsorship_invitation.html" hash="30fe91c3b83ee223f6bffb3dd779dd26"/></dir></dir></dir><dir name="es_ES"><dir name="template"><dir name="email"><file name="sponsorship_coupon.html" hash="5918b7eba6d7cdeb8f410de14e7f2329"/><file name="sponsorship_invitation.html" hash="30fe91c3b83ee223f6bffb3dd779dd26"/></dir></dir><file name="Auguria_Sponsorship.csv" hash="e060bf41dc40cafa679e324a530dfa0d"/></dir><dir name="fr_FR"><dir name="template"><dir name="email"><file name="sponsorship_coupon.html" hash="265d0d49f825eeb40b6c6c3d74ac4dab"/><file name="sponsorship_invitation.html" hash="30fe91c3b83ee223f6bffb3dd779dd26"/></dir></dir><file name="Auguria_Sponsorship.csv" hash="7eb6e58b58abf61a7ceb53df33e9c24f"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="tableorderer.css" hash="30454132306ff6ac4dcf190aa922b7cc"/></dir><dir name="images"><dir name="tableorderer"><file name="asc.gif" hash="a54846803de3cc786eec3d69f9ac2d38"/><file name="bg.gif" hash="c01ad2e7c59d1a20a433cb873c21bd88"/><file name="bkg_toolbar.gif" hash="fb7ed019476eaa1643af922b59ede4fb"/><file name="desc.gif" hash="f8a1940c9cf44ab8870319169f3a14ff"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="sponsorship"><dir name="openinviter"><file name="logo_auguria.png" hash="cdbd00ab6efa0ff8e3ce6eaaa07c53ce"/></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies/>
31
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Auguria_Sponsorship</name>
4
+ <version>1.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>This module allows customers to earn fidelity and sponsorship points.&#xD;
10
+ Customers can invit friends on your site and when their friends buy products, they earn sponsorship points. If a godchild sponsor a person, the sponsor will earn a percentage too.&#xD;
11
+ When customers buy, they can win fidelity points. &#xD;
12
+ These points can then be exchanged against cash, discounts or gifts (not yet implemented).</summary>
13
+ <description>The module consists of :&#xD;
14
+ - A form to send invitations: when an invitation is sent, the guest mail is registered , and the customer id too.&#xD;
15
+ - A system of affiliation: The link sent through invitations refer to a controller that will create a cookie and a session to identify a person invited. We can equally put such links on third party sites.&#xD;
16
+ - Account creation: When creating an account, it checks whether an invitation was sent to the email used for registration. If this is not the case, we check if a session cookie or affiliation exists. If there is a link, the user who registers become the godson of the customer who invits him.&#xD;
17
+ - A monitoring points for the client: the client have an interface for monitoring points in his account. He can see his godson. He can ask for trade his points.&#xD;
18
+ - Increment of points: Fidelity points and sponsorship points are inserted in the command, at the checkout cart. Upon payment of the command, points are awarded to customers.&#xD;
19
+ - Definition of rules: the management of points can be made through the catalog rules prices or cart rules prices.&#xD;
20
+ - Module configuration: The administration interface allows you to enable or disable fidelity points or sponsorship points. Enabling or no exchange of cash, gift or coupon. You can also define the max cash without siret number, the period of calcul of the max cash, if an order is required to sponsor, the period of validity for an invitation, the period of validity of a sponsorship whithout an order, number of levels for sponsorship calculation points, the percentage on indirect sponsorship sales, the maximum number of invitations that you can send per hour, the header message, the body message and the footer message.&#xD;
21
+ - An administration interface: allows to see the list of invitations sent, monitor requests for trade of points.&#xD;
22
+ &#xD;
23
+ Once installed, you must:&#xD;
24
+ - Create one or several catalog or cart rules for increment fidelity and sponsorship points&#xD;
25
+ - Edit CMS Page on sponsorship information&#xD;
26
  - If you enable automatic sponsorship recall, activate magento cron</description>
27
  <notes>If you have ideas for improvements or find bugs, please send them to Franck Charpentier at www.auguria.net, with Auguria LastReviews as part of the subject line.</notes>
28
  <authors><author><name>Auguria</name><user>auto-converted</user><email>magento@auguria.net</email></author></authors>
29
+ <date>2011-10-03</date>
30
+ <time>14:45:08</time>
31
+ <contents><target name="magecommunity"><dir name="Auguria"><dir name="Sponsorship"><dir name="Block"><dir name="Adminhtml"><dir name="Change"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="7271b9c47190cdff0b2af24968c4e155"/></dir><file name="Form.php" hash="ae7412b583874b8fffc05cc3897f1a2b"/><file name="Tabs.php" hash="2c8257d215289d5ae86c985f42721650"/></dir><file name="Edit.php" hash="856fb2d016982d1c1f47c462195e7f39"/><file name="Grid.php" hash="39bae596eb7cd73879a5e769d82c00db"/></dir><dir name="Customer"><dir name="Tabs"><file name="Sponsorship.php" hash="a32d0d1979be05d6a37bb928820b6e04"/></dir></dir><dir name="Link"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="89cf7a2479cd6b5606884a73d9122d4a"/></dir><file name="Form.php" hash="e6e087ae96b24d4edbe9e1f578e7a55a"/><file name="Tabs.php" hash="fd3d95a2cfe3e194d26ba94c45353bf1"/></dir><file name="Edit.php" hash="4ecef8c6e59c6642a6b3348ae24d5ab8"/><file name="Grid.php" hash="17bb23c2a473542e44d3e2878c61af58"/></dir><dir name="Openinviter"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="a0f4530da07ba12f9d4aa53c612cca09"/></dir><file name="Form.php" hash="b4bdc64549563f0117f65c66f97d0fb8"/><file name="Tabs.php" hash="a7595c7aab4bb62da7a55674bac936e8"/></dir><file name="Edit.php" hash="79c8c3b6ca7d0e07e9a9cb8ddc18a9c5"/><file name="Grid.php" hash="7c323452ac344c6bb446d90f7c42e11c"/></dir><dir name="Sales"><dir name="Order"><dir name="Invoice"><file name="Totals.php" hash="292697b2443939616b7db683ecfe64d0"/></dir><file name="Totals.php" hash="e174624626a3d4952b257f4a9481f471"/></dir></dir><dir name="Sponsorship"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="ac62217927d4092f047b8fb8b849668f"/></dir><file name="Form.php" hash="a3a2352db1c72663af0caa289287a9d2"/><file name="Tabs.php" hash="88eb68796c7de324dc1cdea77deaa4ae"/></dir><file name="Edit.php" hash="7ae0b40486d27042caa70bf42c747383"/><file name="Grid.php" hash="a10dd155e32fea5c218880211573832d"/></dir><dir name="Widget"><dir name="Grid"><file name="Renderer.php" hash="35c8a336e1a0e2dcc8d48b558cee9253"/></dir></dir><file name="Change.php" hash="b9046a8e50dceaacc6d248471275a9ca"/><file name="Link.php" hash="4c9673d016652b74338b8e5ed49b5240"/><file name="Openinviter.php" hash="2fbf061ee8aaff7ee34a9f5b723d84c0"/><file name="Sponsorship.php" hash="6d133ec629d775d5e23b7967bb7bcc78"/></dir><dir name="Customer"><dir name="Account"><file name="PointsDetail.php" hash="4039776b07ebb525c899c37f65066ef3"/></dir><dir name="Form"><file name="Boost.php" hash="18c1f531695bc529103af1bc4c3394d6"/><file name="PointsChange.php" hash="db26c8991b5ba182662424f94f020cd2"/></dir><dir name="Widget"><file name="Name.php" hash="886513495ba42430c77a640a2f7af42f"/><file name="Virement.php" hash="cafde77d6d5504ae64c63fc9732a3461"/></dir></dir><dir name="Promo"><dir name="Catalog"><dir name="Edit"><dir name="Tab"><file name="Actions.php" hash="f5926196fd291cb45c13b5a8e1c018b6"/></dir></dir></dir><dir name="Quote"><dir name="Edit"><dir name="Tab"><file name="Actions.php" hash="4ff4de9b5e4d5200111d602625f91362"/></dir></dir></dir></dir><dir name="Sales"><dir name="Order"><file name="Totals.php" hash="da373c7bfc6dadefa78f38ac96a0e7c4"/></dir></dir><file name="Openinviter.php" hash="3051e44a791ccab457a37cef01357bd5"/><file name="Sponsorship.php" hash="b38d23fea90cf387b00508c264da736c"/></dir><dir name="Helper"><file name="Config.php" hash="a0f587b32f97094e5dee3fc5b0fd5af5"/><file name="Data.php" hash="5f928ac8a2e9973a0d3e7cf4ede16969"/><file name="Mail.php" hash="e4c1942582ae354bde08e462c9df888a"/></dir><dir name="Lib"><dir name="OpenInviter"><dir name="conf"><file name="_hosted.conf" hash="1d09309103e660729b492433acda9822"/><file name="abv.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="aol.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="apropo.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="atlas.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="aussiemail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="azet.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="badoo.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="bebo.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="bigstring.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="bookcrossing.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="bordermail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="brazencareerist.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="canoe.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="care2.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="clevergo.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="cyworld.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="doramail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="eons.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="evite.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="facebook.conf" hash="12cfb187449596c39774c4ac193295cc"/><file name="faces.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="famiva.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="fastmail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="fdcareer.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="flickr.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="flingr.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="flixster.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="fm5.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="freemail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="friendfeed.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="friendster.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="gawab.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="gmail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="gmx_net.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="graffiti.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="hi5.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="hotmail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="hushmail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="hyves.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="inbox.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="india.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="indiatimes.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="inet.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="interia.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="katamail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="kids.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="kincafe.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="konnects.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="koolro.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="lastfm.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="libero.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="linkedin.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="livejournal.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="lovento.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="lycos.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="mail2world.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="mail_com.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="mail_in.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="mail_ru.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="meinvz.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="meta.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="mevio.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="motortopia.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="msn.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="multiply.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="mycatspace.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="mydogspace.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="mynet.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="myspace.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="netaddress.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="netlog.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="ning.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="nz11.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="o2.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="operamail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="orkut.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="perfspot.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="plaxo.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="plazes.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="plurk.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="pochta.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="popstarmail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="rambler.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="rediff.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="sapo.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="skyrock.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="tagged.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="techemail.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="terra.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="twitter.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="uk2.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="vimeo.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="virgilio.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="vkontakte.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="walla.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="web_de.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="wpl.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="xanga.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="xing.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="xuqa.conf" hash="6e2fad3c6d126d7da250cb8976a9ad4f"/><file name="yahoo.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="yandex.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="youtube.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/><file name="zapak.conf" hash="42ed0b97cb6919d0cd402831bccc1ea3"/></dir><dir name="images"><file name="ers.gif" hash="cccdfd4ed0795b767d2a01f531781c10"/><file name="oks.gif" hash="6b4b170c9f10a0fa4b25307dd8f47e5b"/></dir><dir name="plugins"><file name="_base.php" hash="79459bef6fcea96f6a7d4a584add9052"/><file name="_hosted.plg.php" hash="69514e56e1833df16884b6762bc620ce"/><file name="abv.plg.php" hash="1685755eae909c468055b9b36c915822"/><file name="aol.plg.php" hash="dd3522033c2cafeb62fd0beed5949bcf"/><file name="apropo.plg.php" hash="4426f976c1953383cf9d1f892aa9576e"/><file name="atlas.plg.php" hash="0b8e4237970ae54ff20187f5e861f972"/><file name="aussiemail.plg.php" hash="d40188b33455b3fd2e88cbde25f61709"/><file name="azet.plg.php" hash="e4a7c19450ca1ad84783a06ae3b1d61f"/><file name="badoo.plg.php" hash="b1d4863a173a80fc9d77331f1e60f2df"/><file name="bebo.plg.php" hash="2d7db898c660380ee74963667bec6bae"/><file name="bigstring.plg.php" hash="7de7a5516a8f0c71580970d8da4121eb"/><file name="bookcrossing.plg.php" hash="212a53a3a95659c56e15d6848549e25e"/><file name="bordermail.plg.php" hash="30190fa3da58d63ddd7e30e6ab0190dc"/><file name="brazencareerist.plg.php" hash="c68f39b6d7a07550abd63ed044ad85c2"/><file name="canoe.plg.php" hash="7737d89b163689cb793f0f37f6028efb"/><file name="care2.plg.php" hash="c066e81973194cca90036c37c7740937"/><file name="clevergo.plg.php" hash="9bd12fea0eb7f60043bcdca9116cb1bc"/><file name="cyworld.plg.php" hash="588dfdddcc2bc9ab2ff26c4616e0a42c"/><file name="doramail.plg.php" hash="81037085958f90a05111ad030c5a72f8"/><file name="eons.plg.php" hash="35009d6e25ae5584c554808b50145a19"/><file name="evite.plg.php" hash="d6c8acf7c24c2848eccedb269928d6eb"/><file name="facebook.plg.php" hash="6a1cfdc0dfc76b3dc3781aa2327ee833"/><file name="faces.plg.php" hash="d0affdf4e73ff6134acfaae5fda29323"/><file name="famiva.plg.php" hash="eee1c0a9a6d645baf014245ca2e9c3e9"/><file name="fastmail.plg.php" hash="da86fea25210ed40258ae2a107dcfe8f"/><file name="fdcareer.plg.php" hash="aad3d525fe09269de056f8ec03e43104"/><file name="flickr.plg.php" hash="055d1e64f116113379e3192b23dc84fc"/><file name="flingr.plg.php" hash="c2b415851babadb8048609874b411979"/><file name="flixster.plg.php" hash="773fad1c2c1775fcb74fb33f51d1fa24"/><file name="fm5.plg.php" hash="0576df91534edaab3d6b333d1968781a"/><file name="freemail.plg.php" hash="142951e9c20ce4447f44c6db7e5cc2e8"/><file name="friendfeed.plg.php" hash="399c987766110735fdd301979997fe48"/><file name="friendster.plg.php" hash="8b3402876a73bf91a84d3a6d8dbb1951"/><file name="gawab.plg.php" hash="c4cb42d893a99b370d9597f20da5c01e"/><file name="gmail.plg.php" hash="83d92f7f75e048210aec2fdecdbd67e0"/><file name="gmx_net.plg.php" hash="218b73370a1367455aeee09695bc4e2a"/><file name="graffiti.plg.php" hash="36f6a6f03fceb9b0e008c1a281a17eb2"/><file name="hi5.plg.php" hash="ba133ae4e865c10f6ce3ddc738751374"/><file name="hotmail.plg.php" hash="ef3241a0a43020412162d8f6dd9dd206"/><file name="hushmail.plg.php" hash="d3f9f339ac03c8aa2426f7a2fe4f2606"/><file name="hyves.plg.php" hash="4dca8f35b17070c42bd16fd86352baf3"/><file name="inbox.plg.php" hash="34066ac6458b6506921e11dde302e3c2"/><file name="india.plg.php" hash="cdd4e86f5b21122b2ebf898eb78b0311"/><file name="indiatimes.plg.php" hash="bbbda190c92579f469f0b4712ba9806f"/><file name="inet.plg.php" hash="6bc3da45b492ba41012b25e501c05273"/><file name="interia.plg.php" hash="3fb3cb41913d12228f162ac32539a848"/><file name="katamail.plg.php" hash="2c2c85f1cab23f236295e5340da10511"/><file name="kids.plg.php" hash="5fae2d825799b0793e2b131162ec8e07"/><file name="kincafe.plg.php" hash="39f0d662293f3db3bd9b0bb9e57b8e27"/><file name="konnects.plg.php" hash="0fd4bc3f8361fb7e5f04d277b4f7f121"/><file name="koolro.plg.php" hash="ebc1936657a99eb8b96ee178d9b7e15c"/><file name="lastfm.plg.php" hash="a293d4bde8a36b1868ddc432e1f201e6"/><file name="libero.plg.php" hash="29cbf372f39d77fd0b62d0777ded4317"/><file name="linkedin.plg.php" hash="a705475d12bb2458d9bad14497211a14"/><file name="livejournal.plg.php" hash="c9c4bd30963d28eee5038841a7d7c788"/><file name="lovento.plg.php" hash="e26c7fe712efdd69fe3788b02ebf514b"/><file name="lycos.plg.php" hash="41a133d41ef4627b353b0f33149629c0"/><file name="mail2world.plg.php" hash="5737b208425e9d03988303d1c20baac6"/><file name="mail_com.plg.php" hash="5d2c20c61d5ba58c4e4c4fc6e162cb20"/><file name="mail_in.plg.php" hash="bf443e42022a368819bcbb788baaa095"/><file name="mail_ru.plg.php" hash="64b7d2daef963b4fd7e72dd969a04cd2"/><file name="meinvz.plg.php" hash="409380a6ca5c70f8f7ae998d37195115"/><file name="meta.plg.php" hash="17bd2e282a8509a14c2d440ea02d8961"/><file name="mevio.plg.php" hash="d175cd50dc07d749e7118a3a3b836800"/><file name="motortopia.plg.php" hash="507c050bb6e0cc73884c427d4745c7a0"/><file name="msn.plg.php" hash="2a205b0556aa7b8908dca3b15017db4f"/><file name="multiply.plg.php" hash="22e5d241084c259a79330eebff508d95"/><file name="mycatspace.plg.php" hash="1282b9619ddfcba5d924c0e31ea74cc7"/><file name="mydogspace.plg.php" hash="be44672096adbe4e2532d0a9df027b5f"/><file name="mynet.plg.php" hash="a2a38a688707957e216d3868c8b1741e"/><file name="myspace.plg.php" hash="bfcabb115825937a9ed4f9745f52ca7e"/><file name="netaddress.plg.php" hash="8e2ccf82123f831b2616c8d3a80f579f"/><file name="netlog.plg.php" hash="246411cc237ef587d31003c03c61b05b"/><file name="ning.plg.php" hash="e59cb73b203a22978ead363c49e48d3d"/><file name="nz11.plg.php" hash="b94995c177198c061b628ddc82d4c7fc"/><file name="o2.plg.php" hash="8e44c5027c493fff7be428ff034f0466"/><file name="operamail.plg.php" hash="5e3a90f0be46b03bcde54eebd76371c9"/><file name="orkut.plg.php" hash="1a291548a82889b36f976bd091260aa5"/><file name="perfspot.plg.php" hash="9d4a9b33f8cf809e5c73bfc517af53db"/><file name="plaxo.plg.php" hash="d640845713388d7c87a206b3f51060f2"/><file name="plazes.plg.php" hash="f6d71432926c126d7f165e6c83a16854"/><file name="plurk.plg.php" hash="e780f5cdd31029cc1b153a1c5b14a965"/><file name="pochta.plg.php" hash="b5732832c05bf982a5950fa32ee4d62a"/><file name="popstarmail.plg.php" hash="a36517a17fa2a461ab890861a4c452fd"/><file name="rambler.plg.php" hash="148cfdfa5b4e5eb2479692dd9f1533a7"/><file name="rediff.plg.php" hash="5679b17973310ecf1ba8b097d3acffaa"/><file name="sapo.plg.php" hash="2bd76d540c454da5f014eba59074e835"/><file name="skyrock.plg.php" hash="1d6113c0c726f48c250160bcc7826aa2"/><file name="tagged.plg.php" hash="1a88811dfd57937db6aece3026f7f99a"/><file name="techemail.plg.php" hash="9894baf3c22e835dbcf62796327d9f99"/><file name="terra.plg.php" hash="094ae4ab8e63dd0f075a860c9aba2094"/><file name="twitter.plg.php" hash="a385725eb41c3cc003c52429295d1355"/><file name="uk2.plg.php" hash="ca5238d090e6a65709302a149caf5ffb"/><file name="vimeo.plg.php" hash="de5ab46f0cc5919b242c5b200f0ef724"/><file name="virgilio.plg.php" hash="38df3729142bd2b40792b7a1793446b7"/><file name="vkontakte.plg.php" hash="7db9b7a03e8f4ee2d2d7f5192ec18912"/><file name="walla.plg.php" hash="5340dda0d54849d2e313ab97015db215"/><file name="web_de.plg.php" hash="d3ed9a0c556f08bc5c67f978c7be4727"/><file name="wpl.plg.php" hash="b151407c39c360f49ffb9ca9fd73b32b"/><file name="xanga.plg.php" hash="89b5c2c3db98e735e4d1f19fb1c81786"/><file name="xing.plg.php" hash="4f89f01bb8bcbc856441cb6ecb2fbe60"/><file name="xuqa.plg.php" hash="1219e94f6ef0919025b2c93741e55fbd"/><file name="yahoo.plg.php" hash="f2953a803d0d61ffce2c9136d1706758"/><file name="yandex.plg.php" hash="2c211df8b0511fb8c832a00976f2cee1"/><file name="youtube.plg.php" hash="fc05c436e6c2dd1c6c8fa336e7e893c5"/><file name="zapak.plg.php" hash="2274bd725d3bda8df0ae9d45d3ce1470"/></dir><file name="LICENSE.txt" hash="277c3d400c7488e54746141297a952cb"/><file name="POLICY.txt" hash="6262372bc84e172c7fd89d9ac61f9794"/><file name="autoupdate.php" hash="df781d645e37271f23432bb82b3360a2"/><file name="config.php" hash="6c16534afd6e50dfda0c5be417bd6fe7"/><file name="notifier.php" hash="88e3be687de995aae52a8ce248c49bce"/><file name="openinviter.php" hash="d2c0237f86cd7c21dadc2c441e73abb1"/><file name="stats.php" hash="5af8362ab3e9f89f5e8560b2623f767a"/></dir><file name="Html2Text.php" hash="4bd5cf3bd59121ffa9d15b9a60a56ca4"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Sponsorship"><file name="Entier.php" hash="cf171a4ec5debf707f182bd0ec09e3a2"/><file name="Float.php" hash="ff5bc3a5019785a1d87bfe9e9e85eeec"/><file name="Mode.php" hash="6fbdbd370813976837cb77369cc36f60"/><file name="NaturalNumber.php" hash="383c3f35a56c6d00d7a23c2c0080481e"/><file name="Openinviter.php" hash="b4ac237d528a505bb389f9b29d2ec486"/></dir></dir><dir name="Source"><file name="Mode.php" hash="79b02420ae291a2a0bfbd3b7b4dbe4c6"/></dir></dir></dir></dir><dir name="Core"><dir name="Email"><file name="Template.php" hash="9394636054f6709f0a41bec9f471b577"/></dir></dir><dir name="Eav"><dir name="Entity"><file name="Setup.php" hash="94056f3946824a5f37fa32efc97a8836"/></dir></dir><dir name="Mysql4"><dir name="CatalogFidelityPoint"><file name="Collection.php" hash="c868af7749d3f4bb3613c24b910a0a01"/></dir><dir name="CatalogSponsorPoint"><file name="Collection.php" hash="a7641c2909bc1bb6709e1fdde41bf3a3"/></dir><dir name="Change"><file name="Collection.php" hash="bdc69d01c3e5d5ef56aa2b4fb895473b"/></dir><dir name="Log"><file name="Collection.php" hash="bdaf560e27eae80a47e17b86b69cc5be"/></dir><dir name="Sponsorship"><file name="Collection.php" hash="4308184c9423622b51ea3cb6ce901eb7"/></dir><dir name="Sponsorshipopeninviter"><file name="Collection.php" hash="92e554ef5e4e989607dc2ce398271aa2"/></dir><file name="CatalogFidelityPoint.php" hash="972dc679be4e776e655ee91da788bfa9"/><file name="CatalogSponsorPoint.php" hash="600b57d8ca471c97338961937aa6d551"/><file name="Change.php" hash="756d869c8993f7bf582964876cdf0bab"/><file name="Log.php" hash="39c4dfcddd04caa6b1d7665eaa8a0ec3"/><file name="Rule.php" hash="afb4dce6ff602c44d69f506ec76c0383"/><file name="Sponsorship.php" hash="23332641f0e4330e44a3f103d8903490"/><file name="Sponsorshipopeninviter.php" hash="151e51e1ac5091f33df564408d3920a8"/></dir><dir name="SocialBookmarking"><file name="Urls.php" hash="8507b7302d5aa76c9b6bc8e1e92e0598"/></dir><dir name="Total"><dir name="Creditmemo"><file name="Discount.php" hash="be82cd179cbda9a7121ec8bf8a5451aa"/></dir><dir name="Invoice"><file name="Discount.php" hash="b0b7dd8c49ce237e9d7eb384170dc118"/></dir><dir name="Quote"><file name="Discount.php" hash="1c3b0e16bb547bc19b9f437fbd54d7c0"/></dir></dir><file name="ApplyValidity.php" hash="79ffbe31be02b062e2649a33e61d68be"/><file name="AutoBoost.php" hash="a8f27a827bc1eaeadb80e78d77df5c6b"/><file name="Change.php" hash="b2c4962c0eba8a8e661fe7231bdea130"/><file name="Changestatut.php" hash="11e5d285ee8ab8d6dce81fd47df89947"/><file name="Log.php" hash="0fb2fa51dd96857c1b75aa88ffd51d84"/><file name="Observer.php" hash="a20cfe00b01fa5595319fc600cc8793f"/><file name="Openinviter.php" hash="51957bc2f051988ca17538aa0dae2fc8"/><file name="Sponsorship.php" hash="8d8097f19381b803b7e8c9f6a9a4bc4c"/><file name="Sponsorshipopeninviter.php" hash="9552a5df39edcd97f682bf0fb97c48c0"/><file name="Status.php" hash="ad7199148cba19358874c50216c4dfde"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ChangeController.php" hash="6963b3313b4ac5ddb8600bcde4d465b2"/><file name="LinkController.php" hash="ab8ac9481d252a01768a7a6073ad056f"/><file name="OpeninviterController.php" hash="bbe5124ae5c6eb41f3694a54a52691f8"/><file name="SponsorshipController.php" hash="28c9468f489e1f9762ab7d2d5c15954a"/></dir><file name="BoostController.php" hash="d65930c627d96b7640bd1e218c59eafb"/><file name="IndexController.php" hash="cd0c664a1dbf9781affed72c7a3a892e"/><file name="OpeninviterController.php" hash="fb6cef92064934e7ecb9696b75429a3c"/><file name="PointsController.php" hash="e93a72bdf58fe77a9230c3e7881f08b9"/><file name="SponsorController.php" hash="b81147d898f8903d5167ab0eed14a8ed"/></dir><dir name="etc"><file name="config.xml" hash="56223413dc8a4a1ffc07744e2b33d875"/><file name="system.xml" hash="7ea9d901d496fd485c91d683f8eb9a71"/></dir><dir name="sql"><dir name="auguria_sponsorship_setup"><file name="mysql4-install-0.1.0.php" hash="8b2a066a564a97affa4382d7fbec2f4d"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="209b1d59555704d1d203d4f6f345d216"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="93b2f00355c4c524753d57b7d2942bc6"/><file name="mysql4-upgrade-0.1.10-0.1.11.php" hash="d783dd639aa5f388bfd2c30309fbd95d"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="a3390325854c1a63cad3c5a41da7a207"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="1d3a1e2e4f4801ec8c1e89f85a308bc9"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="d6ed18d5dfd6e32d802b94907395ebab"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="548b1dcadfb413c949bb8aba2d4f94b7"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="84853debcd7a5334b862d520b1f55e47"/><file name="mysql4-upgrade-0.1.7-0.1.8.php" hash="70449ff87b44d43741c40c564f34788f"/><file name="mysql4-upgrade-0.1.8-0.1.9.php" hash="d8dbde5d26e4c4ceccb6321dabc2b742"/><file name="mysql4-upgrade-1.0.10-1.1.0.php" hash="e580abc4c388017c77e469f18092da9c"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="47a47f9b34313bc487f49a8be35c1429"/><file name="mysql4-upgrade-1.0.7-1.0.8.php" hash="869fd3f0b144c67d81df7a79644a2885"/><file name="mysql4-upgrade-1.0.8-1.0.9.php" hash="40ce669e7abbeeda11754ad21b099d1c"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="518923277e2720373bc99c50d665c31a"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="fd17577efce7d682cc238d04c6b3db75"/><file name="mysql4-upgrade-1.1.2-1.1.3.php" hash="f63e39c3d9372830942cae2757b1944c"/><file name="mysql4-upgrade-1.1.3-1.1.4.php" hash="5b746c9b0b10c55896a920a82ca16f87"/><file name="mysql4-upgrade-1.1.4-1.1.5.php" hash="fc6a7da70cbed3ddc99487cedbc2fff4"/><file name="mysql4-upgrade-1.1.5-1.1.6.php" hash="f95981f2ba8c69c1f5da030e22c4e334"/><file name="mysql4-upgrade-1.1.6-1.1.7.php" hash="8ae766daa9638512d717e312b6dca41c"/><file name="mysql4-upgrade-1.1.7-1.1.8.php" hash="8cd04c3921e305484edc60bd3a2087ac"/><file name="mysql4-upgrade-1.1.8-1.1.9.php" hash="7dfc00ec719161b356e7906c7472dd8b"/><file name="mysql4-upgrade-1.1.9-1.2.0.php" hash="447ca4ba43020737475ed29e354bd600"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="auguria"><file name="sponsorship.xml" hash="371c2611330cb1009d144f8982e1fc7d"/></dir></dir><dir name="template"><dir name="auguria"><dir name="sponsorship"><dir name="customer"><dir name="tabs"><file name="sponsorship.phtml" hash="aab9cbcfd31154d203782aabe46c6082"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="auguria"><file name="sponsorship.xml" hash="843be19ea53724944970776262c323d6"/></dir></dir><dir name="template"><dir name="auguria"><dir name="sponsorship"><dir name="customer"><dir name="account"><dir name="dashboard"><file name="accumulated_points.phtml" hash="4fa4eff30def3f87b229ce0b312268de"/><file name="fidelity_points.phtml" hash="91bd2ce632a8e17b76aaf67d4dce2fa8"/><file name="points.phtml" hash="c779f3966c372a40d77d433d78fcf4eb"/><file name="sponsor_points.phtml" hash="d87849c128855339c696589ecbb0e1d1"/></dir><file name="accumulatedpointsdetail.phtml" hash="eeaf710561b02effb776434f0b783ee8"/><file name="fidelitypointsdetail.phtml" hash="c1a018f8c0f4d1859c7a79558ef33712"/><file name="sponsorpointsdetail.phtml" hash="bb957c677b95d359ea3281bdbd53ea3a"/></dir><dir name="form"><dir name="pointschange"><file name="pointschange_cash.phtml" hash="58adf546a6e8aa93b340a2d1aab50e73"/><file name="pointschange_coupon.phtml" hash="c9704825166c4766471a73e058509409"/><file name="pointschange_gift.phtml" hash="29a244c931252894b98e1a9bf1c40fc4"/></dir><file name="boost.phtml" hash="e5c4a698f08480c262279891cf3b1a65"/><file name="edit.phtml" hash="0cd4878bb98a0de294ebc72dc90e86a6"/><file name="pointschange.phtml" hash="83ef04108e63b4bce003316b6b9cdb18"/><file name="register.phtml" hash="2a9577cee680a5ca8eebd3e2b35d73d5"/></dir><dir name="widget"><file name="name.phtml" hash="bfb8c2e90a4e5af55a6479cc122d67b1"/><file name="virement.phtml" hash="74b9c05d0242aa06b6cc35a9abc23751"/></dir></dir><file name="openinviter.phtml" hash="6a0c23121f247349883574720436222f"/><file name="openinviterimport.phtml" hash="8a81b13bf5aaa6b033926fa71736bed0"/><file name="sponsorship.phtml" hash="cc7737d96f469058472e80824cef0caa"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Auguria_Sponsorship.xml" hash="2ace21d88c17b2636514543e866169eb"/></dir></dir></dir><dir name="js"><dir name="auguria"><dir name="sponsorship"><file name="table_orderer.js" hash="f23c21e5031d7218f83c9117cf7442eb"/></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><dir name="template"><dir name="email"><dir name="auguria"><dir name="sponsorship"><file name="sponsorship_coupon.html" hash="265d0d49f825eeb40b6c6c3d74ac4dab"/><file name="sponsorship_invitation.html" hash="30fe91c3b83ee223f6bffb3dd779dd26"/><file name="sponsorship_notification.html" hash="fc9958622daabadb1edf728eac927097"/></dir></dir></dir></dir><file name="Auguria_Sponsorship.csv" hash="ddb3be7f26bfd278be193e94e9fa502a"/></dir><dir name="en_US"><dir name="template"><dir name="email"><dir name="auguria"><dir name="sponsorship"><file name="sponsorship_coupon.html" hash="0ca5d0c23070e0a6a9f9822ad9612678"/><file name="sponsorship_invitation.html" hash="30fe91c3b83ee223f6bffb3dd779dd26"/></dir></dir></dir></dir><file name="Auguria_Sponsorship.csv" hash="fbb67ec0b525bb2576544d82d4cee7f1"/></dir><dir name="de_DE"><dir name="template"><dir name="email"><dir name="auguria"><dir name="sponsorship"><file name="sponsorship_coupon.html" hash="087a9a72f7f7c63d4136ff498730382f"/><file name="sponsorship_invitation.html" hash="30fe91c3b83ee223f6bffb3dd779dd26"/></dir></dir></dir></dir><file name="Auguria_Sponsorship.csv" hash="db9b02ed8a00479a96bb83a0a5b9f293"/></dir><dir name="es_ES"><dir name="template"><dir name="email"><dir name="auguria"><dir name="sponsorship"><file name="sponsorship_coupon.html" hash="5918b7eba6d7cdeb8f410de14e7f2329"/><file name="sponsorship_invitation.html" hash="30fe91c3b83ee223f6bffb3dd779dd26"/></dir></dir></dir></dir><file name="Auguria_Sponsorship.csv" hash="e060bf41dc40cafa679e324a530dfa0d"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="auguria"><dir name="sponsorship"><file name="tableorderer.css" hash="d531681dc9605ab5bdc41f24990a4944"/></dir></dir></dir><dir name="images"><dir name="auguria"><dir name="sponsorship"><dir name="tableorderer"><file name="asc.gif" hash="a54846803de3cc786eec3d69f9ac2d38"/><file name="bg.gif" hash="c01ad2e7c59d1a20a433cb873c21bd88"/><file name="bkg_pager.gif" hash="fb7ed019476eaa1643af922b59ede4fb"/><file name="bkg_toolbar.gif" hash="9d8c73339b22615b742ca025ab668900"/><file name="desc.gif" hash="f8a1940c9cf44ab8870319169f3a14ff"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="sponsorship"><dir name="openinviter"><file name="fleurs jaune.jpg" hash="83a9fb1d81d85e5fc7e3b56223e49be5"/><file name="logo_auguria.png" hash="cdbd00ab6efa0ff8e3ce6eaaa07c53ce"/></dir></dir></target></contents>
32
  <compatible/>
33
  <dependencies/>
34
  </package>
skin/frontend/{default/default/css → base/default/css/auguria/sponsorship}/tableorderer.css RENAMED
@@ -1,50 +1,20 @@
1
- /*TAB SORTER *//*
2
- table.pager select,
3
- table.view-by select { margin:0 3px; font-size:.95em; }
4
- table.pager select { width:50px; }
5
- table.view-by td.sort-by { text-align:right; padding-right:44px; }
6
- table.view-by select { width:85px; }
7
- table.pager, table.view-by {
8
- width:100%;
9
- background:url(../images/pager_bg.gif) repeat-x 0 100% #fff;
10
- font-size:.95em;
11
- }
12
- table.pager td {
13
- width:32%;
14
- border-top:1px solid #eee;
15
- padding:4px 8px;
16
- vertical-align:middle;
17
- }
18
- table.pager td.pages { padding:4px 0; white-space:nowrap; text-align:center; }
19
- table.pager ol, table.pager li {
20
- display:inline;
21
- }
22
- table.pager li { padding:0 2px; }
23
- table.view-by td {
24
- width:33%;
25
- border-top:1px solid #e2e2e2;
26
- padding:4px 8px;
27
- vertical-align:middle;
28
- }
29
- */
30
-
31
  .prototools-table{ width:100%; text-align:center; font-size:12px; border:1px solid #bebcb7; }
32
  .prototools-table th{
33
  margin:0;
34
  cursor:pointer;
35
  background-position:right center;
36
  background-repeat:no-repeat;
37
- background-image:url(../images/tableorderer/bg.gif);
38
  border-right:1px solid #c2d3e0;
39
  color:#0a263c;
40
  padding : 2px 18px;
41
  text-align:center;
42
  }
43
 
44
- .prototools-table thead tr { background:url(../images/bkg_th.gif) repeat-x 0 100% #d9e5ee; }
45
 
46
- .prototools-table th.desc{background-image:url('../images/tableorderer/desc.gif'); }
47
- .prototools-table th.asc{background-image:url('../images/tableorderer/asc.gif'); }
48
  .prototools-table th.on{ cursor :pointer;}
49
 
50
  .prototools-table td { border-bottom:1px solid #d9dde3; border-right:1px solid #d9dde3; padding : 6px; }
@@ -54,11 +24,11 @@ table.view-by td {
54
  /*.prototools-table tr.on{ background-color:#CDDBDC; }*/
55
  .prototools-table tr.selected{ background-color:#E4E4E4; }
56
 
57
- div.prototools-options { font-size:12px; padding :5px 7px; background:url(../images/tableorderer/bkg_toolbar.gif) repeat-x 0 100% #fff;}
58
  div.prototools-options input, div.prototools-options select{border : 1px solid #CCC; font-size:12px; padding :1px 3px; margin :0 5px;}
59
  /*.prev-page-button {background:url(../images/login_box_form_buttons_bg.gif) }*/
60
 
61
- div.prototools-pager { font-size:11px; padding :5px 7px; text-align:right; background:url(../images/tableorderer/bkg_toolbar.gif) repeat-x 0 100% #fff;}
62
  div.prototools-pager .currentpage {padding-left:10px; padding-right:10px;}
63
  div.prototools-pager .totalpages {padding:0;}
64
  div.prototools-pager input {font-size:11px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  .prototools-table{ width:100%; text-align:center; font-size:12px; border:1px solid #bebcb7; }
2
  .prototools-table th{
3
  margin:0;
4
  cursor:pointer;
5
  background-position:right center;
6
  background-repeat:no-repeat;
7
+ background-image:url('../../../images/auguria/sponsorship/tableorderer/bg.gif');
8
  border-right:1px solid #c2d3e0;
9
  color:#0a263c;
10
  padding : 2px 18px;
11
  text-align:center;
12
  }
13
 
14
+ .prototools-table thead tr { background: #d9e5ee; }
15
 
16
+ .prototools-table th.desc{background-image:url('../../../images/auguria/sponsorship/tableorderer/desc.gif'); }
17
+ .prototools-table th.asc{background-image:url('../../../images/auguria/sponsorship/tableorderer/asc.gif'); }
18
  .prototools-table th.on{ cursor :pointer;}
19
 
20
  .prototools-table td { border-bottom:1px solid #d9dde3; border-right:1px solid #d9dde3; padding : 6px; }
24
  /*.prototools-table tr.on{ background-color:#CDDBDC; }*/
25
  .prototools-table tr.selected{ background-color:#E4E4E4; }
26
 
27
+ div.prototools-options { font-size:12px; padding :3px 7px; background:url('../../../images/auguria/sponsorship/tableorderer/bkg_toolbar.gif') repeat-x 0 100% #fff;}
28
  div.prototools-options input, div.prototools-options select{border : 1px solid #CCC; font-size:12px; padding :1px 3px; margin :0 5px;}
29
  /*.prev-page-button {background:url(../images/login_box_form_buttons_bg.gif) }*/
30
 
31
+ div.prototools-pager { font-size:11px; padding :5px 7px; text-align:right; background:url('../../../images/auguria/sponsorship/tableorderer/bkg_pager.gif') repeat-x 0 100% #fff;}
32
  div.prototools-pager .currentpage {padding-left:10px; padding-right:10px;}
33
  div.prototools-pager .totalpages {padding:0;}
34
  div.prototools-pager input {font-size:11px;}
skin/frontend/{default/default/images → base/default/images/auguria/sponsorship}/tableorderer/asc.gif RENAMED
File without changes
skin/frontend/{default/default/images → base/default/images/auguria/sponsorship}/tableorderer/bg.gif RENAMED
File without changes
skin/frontend/{default/default/images/tableorderer/bkg_toolbar.gif → base/default/images/auguria/sponsorship/tableorderer/bkg_pager.gif} RENAMED
File without changes
skin/frontend/base/default/images/auguria/sponsorship/tableorderer/bkg_toolbar.gif ADDED
Binary file
skin/frontend/{default/default/images → base/default/images/auguria/sponsorship}/tableorderer/desc.gif RENAMED
File without changes