Fianet_Sceau - Version 1.0.1

Version Notes

second official commit

Download this release

Release Info

Developer FIA-NET
Extension Fianet_Sceau
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

Files changed (33) hide show
  1. app/code/community/Fianet/Sceau/Block/Logo/Abstract.php +24 -0
  2. app/code/community/Fianet/Sceau/Block/Logo/Footer.php +37 -0
  3. app/code/community/Fianet/Sceau/Block/Logo/Left.php +38 -0
  4. app/code/community/Fianet/Sceau/Block/Logo/Right.php +38 -0
  5. app/code/community/Fianet/Sceau/Block/Sales/Order.php +6 -0
  6. app/code/community/Fianet/Sceau/Block/Sales/Order/Grid.php +26 -0
  7. app/code/community/Fianet/Sceau/Block/Widget/Abstract.php +25 -0
  8. app/code/community/Fianet/Sceau/Block/Widget/Footer.php +37 -0
  9. app/code/community/Fianet/Sceau/Block/Widget/Grid/Column/Filter/Fianet.php +25 -0
  10. app/code/community/Fianet/Sceau/Block/Widget/Grid/Column/Renderer/Fianet.php +66 -0
  11. app/code/community/Fianet/Sceau/Block/Widget/Left.php +38 -0
  12. app/code/community/Fianet/Sceau/Block/Widget/Right.php +38 -0
  13. app/code/community/Fianet/Sceau/Helper/Data.php +194 -0
  14. app/code/community/Fianet/Sceau/Model/Observer.php +75 -0
  15. app/code/community/Fianet/Sceau/Model/Order.php +31 -0
  16. app/code/community/Fianet/Sceau/Model/Source/Mode.php +30 -0
  17. app/code/community/Fianet/Sceau/Model/Source/Status.php +24 -0
  18. app/code/community/Fianet/Sceau/controllers/IndexController.php +52 -0
  19. app/code/community/Fianet/Sceau/etc/config.xml +168 -0
  20. app/code/community/Fianet/Sceau/etc/system.xml +219 -0
  21. app/code/community/Fianet/Sceau/sql/fianet_sceau_setup/mysql4-install-1.0.0.php +18 -0
  22. app/design/frontend/base/default/layout/fianet_sceau.xml +24 -0
  23. app/design/frontend/base/default/template/fianet_sceau/page/html/logo.phtml +9 -0
  24. app/design/frontend/base/default/template/fianet_sceau/page/html/sceau.phtml +12 -0
  25. app/etc/modules/zFianet_Sceau.xml +9 -0
  26. app/locale/fr_FR/Fianet_Sceau.csv +26 -0
  27. package.xml +18 -0
  28. skin/adminhtml/default/default/images/sceau/ko.PNG +0 -0
  29. skin/adminhtml/default/default/images/sceau/ok.JPG +0 -0
  30. skin/adminhtml/default/default/images/sceau/ok.PNG +0 -0
  31. skin/adminhtml/default/default/images/sceau/top_left_block_login.png +0 -0
  32. skin/adminhtml/default/default/images/sceau/warning.gif +0 -0
  33. skin/frontend/base/default/images/sceau/logo_fianet_sceau.png +0 -0
app/code/community/Fianet/Sceau/Block/Logo/Abstract.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ abstract class Fianet_Sceau_Block_Logo_Abstract extends Mage_Core_Block_Template
5
+ {
6
+
7
+ abstract public function canDisplay();
8
+ abstract public function isActive();
9
+
10
+ public function isModuleActive()
11
+ {
12
+ if (Mage::getStoreConfig('sceau/sceauconfg/active') == '1')
13
+ {
14
+ return true;
15
+ }
16
+ return false;
17
+ }
18
+
19
+ public function getLoginSceau()
20
+ {
21
+ return Mage::getStoreConfig('sceau/sceauconfg/login');
22
+ }
23
+
24
+ }
app/code/community/Fianet/Sceau/Block/Logo/Footer.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Fianet_Sceau_Block_Logo_Footer extends Fianet_Sceau_Block_Logo_Abstract
5
+ {
6
+ CONST BLOCK_CACHE_KEY_PREFIX = 'fianet_sceau_logo_block_frontend_footer_';
7
+ CONST CONFIG_PATH_BLOCK_ACTIVE = 'sceau/logoconf/logo_footer_position';
8
+
9
+ function _construct()
10
+ {
11
+ parent::_construct();
12
+
13
+ $this->setCacheKey(self::BLOCK_CACHE_KEY_PREFIX . Mage::app()->getStore()->getCode());
14
+ $this->setCacheTags(array(Mage_Core_Block_Abstract::CACHE_GROUP));
15
+ $this->setCacheLifetime(60*60*24*30);
16
+
17
+ }
18
+
19
+
20
+ public function canDisplay()
21
+ {
22
+ return ($this->isModuleActive() && $this->isActive());
23
+ }
24
+
25
+
26
+
27
+ public function isActive()
28
+ {
29
+ if (Mage::getStoreConfig(self::CONFIG_PATH_BLOCK_ACTIVE) == '1')
30
+ {
31
+ return true;
32
+ }
33
+ return false;
34
+ }
35
+
36
+
37
+ }
app/code/community/Fianet/Sceau/Block/Logo/Left.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Fianet_Sceau_Block_Logo_Left extends Fianet_Sceau_Block_Logo_Abstract
5
+ {
6
+ CONST BLOCK_CACHE_KEY_PREFIX = 'fianet_sceau_logo_block_frontend_left_';
7
+ CONST CONFIG_PATH_BLOCK_ACTIVE = 'sceau/logoconf/logo_left_position';
8
+
9
+ function _construct()
10
+ {
11
+ parent::_construct();
12
+
13
+ $this->setCacheKey(self::BLOCK_CACHE_KEY_PREFIX . Mage::app()->getStore()->getCode());
14
+ $this->setCacheTags(array(Mage_Core_Block_Abstract::CACHE_GROUP));
15
+ $this->setCacheLifetime(60*60*24*30);
16
+
17
+ }
18
+
19
+
20
+ public function canDisplay()
21
+ {
22
+
23
+ return ($this->isModuleActive() && $this->isActive());
24
+ }
25
+
26
+
27
+
28
+ public function isActive()
29
+ {
30
+ if (Mage::getStoreConfig(self::CONFIG_PATH_BLOCK_ACTIVE) == '1')
31
+ {
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+
37
+
38
+ }
app/code/community/Fianet/Sceau/Block/Logo/Right.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Fianet_Sceau_Block_Logo_Right extends Fianet_Sceau_Block_Logo_Abstract
5
+ {
6
+ CONST BLOCK_CACHE_KEY_PREFIX = 'fianet_sceau_logo_block_frontend_right_';
7
+ CONST CONFIG_PATH_BLOCK_ACTIVE = 'sceau/logoconf/logo_right_position';
8
+
9
+ function _construct()
10
+ {
11
+ parent::_construct();
12
+
13
+ $this->setCacheKey(self::BLOCK_CACHE_KEY_PREFIX . Mage::app()->getStore()->getCode());
14
+ $this->setCacheTags(array(Mage_Core_Block_Abstract::CACHE_GROUP));
15
+ $this->setCacheLifetime(60*60*24*30);
16
+
17
+ }
18
+
19
+
20
+ public function canDisplay()
21
+ {
22
+
23
+ return ($this->isModuleActive() && $this->isActive());
24
+ }
25
+
26
+
27
+
28
+ public function isActive()
29
+ {
30
+ if (Mage::getStoreConfig(self::CONFIG_PATH_BLOCK_ACTIVE) == '1')
31
+ {
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+
37
+
38
+ }
app/code/community/Fianet/Sceau/Block/Sales/Order.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Fianet_Sceau_Block_Sales_Order extends Mage_Adminhtml_Block_Sales_Order
4
+ {
5
+ protected $_blockGroup = 'fianet_sceau';
6
+ }
app/code/community/Fianet/Sceau/Block/Sales/Order/Grid.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Fianet_Sceau_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
5
+ {
6
+ protected function _prepareColumns()
7
+ {
8
+ parent::_prepareColumns();
9
+
10
+ $params = array('grid' => $this);
11
+
12
+
13
+ Mage::dispatchEvent('fianet_prepare_sales_order_grid_columns', $params);
14
+ $this->sortColumnsByOrder();
15
+ return $this;
16
+ }
17
+ protected function _prepareMassaction()
18
+ {
19
+ parent::_prepareMassaction();
20
+ $params = array('grid' => $this);
21
+
22
+ Mage::dispatchEvent('fianet_prepare_sales_order_grid_massaction', $params);
23
+
24
+ return $this;
25
+ }
26
+ }
app/code/community/Fianet/Sceau/Block/Widget/Abstract.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ abstract class Fianet_Sceau_Block_Widget_Abstract extends Mage_Core_Block_Template
5
+ {
6
+
7
+ abstract public function canDisplay();
8
+ abstract public function isActive();
9
+
10
+ public function isModuleActive()
11
+ {
12
+ if (Mage::getStoreConfig('sceau/sceauconfg/active') == '1')
13
+ {
14
+ return true;
15
+ }
16
+ return false;
17
+ }
18
+
19
+
20
+
21
+ public function getSiteId()
22
+ {
23
+ return Fianet_Sceau_Helper_Data::getSiteID();
24
+ }
25
+ }
app/code/community/Fianet/Sceau/Block/Widget/Footer.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Fianet_Sceau_Block_Widget_Footer extends Fianet_Sceau_Block_Widget_Abstract
5
+ {
6
+ CONST BLOCK_CACHE_KEY_PREFIX = 'fianet_sceau_widget_block_frontend_footer_';
7
+ CONST CONFIG_PATH_BLOCK_ACTIVE = 'sceau/widgetconf/footer_position';
8
+
9
+ function _construct()
10
+ {
11
+ parent::_construct();
12
+
13
+ $this->setCacheKey(self::BLOCK_CACHE_KEY_PREFIX . Mage::app()->getStore()->getCode());
14
+ $this->setCacheTags(array(Mage_Core_Block_Abstract::CACHE_GROUP));
15
+ $this->setCacheLifetime(60*60*24);
16
+
17
+ }
18
+
19
+
20
+ public function canDisplay()
21
+ {
22
+ return ($this->isModuleActive() && $this->isActive() && $this->getSiteId());
23
+ }
24
+
25
+
26
+
27
+ public function isActive()
28
+ {
29
+ if (Mage::getStoreConfig(self::CONFIG_PATH_BLOCK_ACTIVE) == '1')
30
+ {
31
+ return true;
32
+ }
33
+ return false;
34
+ }
35
+
36
+
37
+ }
app/code/community/Fianet/Sceau/Block/Widget/Grid/Column/Filter/Fianet.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * 2000-2012 FIA-NET
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0) that is available
9
+ * through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
10
+ * If you are unable to obtain it through the world-wide-web, please contact us
11
+ * via http://www.fia-net-group.com/formulaire.php so we can send you a copy immediately.
12
+ *
13
+ * @author Quadra Informatique <ecommerce@quadra-informatique.fr>
14
+ * @copyright 2000-2012 FIA-NET
15
+ * @version Release: $Revision: 0.0.13 $
16
+ * @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
17
+ */
18
+ class Fianet_Sceau_Block_Widget_grid_column_filter_fianet extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Abstract {
19
+
20
+ public function getHtml() {
21
+ $html = '&nbsp;';
22
+ return $html;
23
+ }
24
+
25
+ }
app/code/community/Fianet/Sceau/Block/Widget/Grid/Column/Renderer/Fianet.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * 2000-2012 FIA-NET
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0) that is available
9
+ * through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
10
+ * If you are unable to obtain it through the world-wide-web, please contact us
11
+ * via http://www.fia-net-group.com/formulaire.php so we can send you a copy immediately.
12
+ *
13
+ * @author Quadra Informatique <ecommerce@quadra-informatique.fr>
14
+ * @copyright 2000-2012 FIA-NET
15
+ * @version Release: $Revision: 0.0.13 $
16
+ * @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
17
+ */
18
+ class Fianet_Sceau_Block_Widget_grid_column_renderer_fianet extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
19
+ const PICTO_KO = "ko.PNG";
20
+ const PICTO_OK = "ok.PNG";
21
+
22
+ public function render(Varien_Object $row) {
23
+ $sent_prod = $row->getData('fianet_sceau_order_sent_prod');
24
+ $sent_preprod = $row->getData('fianet_sceau_order_sent_preprod');
25
+ $sent_error = $row->getData('fianet_sceau_order_sent_error');
26
+ if (!Mage::Helper('fianet_sceau/Data')->isModuleActive($row))
27
+ {//si le module est désactivé sur le front de la commande
28
+ return 'Module désactivé';
29
+ }
30
+
31
+
32
+
33
+ $text_pprod = '';
34
+
35
+ $icon = self::PICTO_KO;
36
+ /*if($sent_preprod == 0 && $sent_prod==0){}*/
37
+ if($sent_preprod == 1 && $sent_prod==0)
38
+ {
39
+ $icon = self::PICTO_OK;
40
+ $text_pprod = " [Test]";
41
+ }
42
+ elseif($sent_preprod == 0 && $sent_prod==1)
43
+ {
44
+ $icon = self::PICTO_OK;
45
+ }
46
+ elseif($sent_preprod == 1 && $sent_prod==1)
47
+ {
48
+ $icon = self::PICTO_OK;
49
+ }
50
+ $html = "<img src=" . $this->getSkinUrl('images/sceau/' . $icon)." WIDTH=20 >".$text_pprod;
51
+ //$html .= $row->getData('fianet_sceau_order_sent');
52
+
53
+ $order= Mage::getModel('sales/order')->load($row->getId());
54
+
55
+ /*
56
+ Zend_Debug::dump($row->getData('fianet_sceau_order_sent_prod'));
57
+ Zend_Debug::dump($row->getData('fianet_sceau_order_sent_preprod'));
58
+
59
+ Zend_Debug::dump($order->getData('fianet_sceau_order_sent_prod'), 'order->fianet_sceau_order_sent_prod');
60
+ Zend_Debug::dump($order->getData('fianet_sceau_order_sent_preprod'), 'order->fianet_sceau_order_sent_preprod');
61
+ */
62
+ if($sent_error==1)
63
+ $html .= "<img src=" . $this->getSkinUrl('images/sceau/warning.gif')." WIDTH=20 >";
64
+ return ($html);
65
+ }
66
+ }
app/code/community/Fianet/Sceau/Block/Widget/Left.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Fianet_Sceau_Block_Widget_Left extends Fianet_Sceau_Block_Widget_Abstract
5
+ {
6
+ CONST BLOCK_CACHE_KEY_PREFIX = 'fianet_sceau_widget_block_frontend_left_';
7
+ CONST CONFIG_PATH_BLOCK_ACTIVE = 'sceau/widgetconf/left_position';
8
+
9
+ function _construct()
10
+ {
11
+ parent::_construct();
12
+
13
+ $this->setCacheKey(self::BLOCK_CACHE_KEY_PREFIX . Mage::app()->getStore()->getCode());
14
+ $this->setCacheTags(array(Mage_Core_Block_Abstract::CACHE_GROUP));
15
+ $this->setCacheLifetime(60*60*24);
16
+
17
+ }
18
+
19
+
20
+ public function canDisplay()
21
+ {
22
+
23
+ return ($this->isModuleActive() && $this->isActive() && $this->getSiteId());
24
+ }
25
+
26
+
27
+
28
+ public function isActive()
29
+ {
30
+ if (Mage::getStoreConfig(self::CONFIG_PATH_BLOCK_ACTIVE) == '1')
31
+ {
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+
37
+
38
+ }
app/code/community/Fianet/Sceau/Block/Widget/Right.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Fianet_Sceau_Block_Widget_Right extends Fianet_Sceau_Block_Widget_Abstract
5
+ {
6
+ CONST BLOCK_CACHE_KEY_PREFIX = 'fianet_sceau_widget_block_frontend_right_';
7
+ CONST CONFIG_PATH_BLOCK_ACTIVE = 'sceau/widgetconf/right_position';
8
+
9
+ function _construct()
10
+ {
11
+ parent::_construct();
12
+
13
+ $this->setCacheKey(self::BLOCK_CACHE_KEY_PREFIX . Mage::app()->getStore()->getCode());
14
+ $this->setCacheTags(array(Mage_Core_Block_Abstract::CACHE_GROUP));
15
+ $this->setCacheLifetime(60*60*24);
16
+
17
+ }
18
+
19
+
20
+ public function canDisplay()
21
+ {
22
+
23
+ return ($this->isModuleActive() && $this->isActive() && $this->getSiteId());
24
+ }
25
+
26
+
27
+
28
+ public function isActive()
29
+ {
30
+ if (Mage::getStoreConfig(self::CONFIG_PATH_BLOCK_ACTIVE) == '1')
31
+ {
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+
37
+
38
+ }
app/code/community/Fianet/Sceau/Helper/Data.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Fianet_Sceau_Helper_Data extends Mage_Core_Helper_Abstract {
4
+ const ORDER_ATTR_SCEAU_SENT_PROD = 'fianet_sceau_order_sent_prod';
5
+ const ORDER_ATTR_SCEAU_SENT_PPROD = 'fianet_sceau_order_sent_preprod';
6
+ const ORDER_ATTR_SCEAU_SENT_ERROR= 'fianet_sceau_order_sent_error';
7
+
8
+ static function Generate_Sceau_xml(Mage_Sales_Model_Order $order) {
9
+ //récupération des informations
10
+ $email = $order->customer_email;
11
+ $timestamp = $order->created_at;
12
+ $refid = $order->increment_id;
13
+ $privatekey = Mage::getStoreConfig('sceau/sceauconfg/private_key', $order->getStoreId());
14
+ $crypt = md5($privatekey . "_" . $refid . "+" . $timestamp . "=" . $email);
15
+ $siteid = self::getSiteID($order);
16
+
17
+ //Si l'IP de l'internaute n'est pas présente dans Magento (en cas de création de commande depuis le BO) alors on récupère l'IP de la boutique
18
+ $ip = (!$order->getRemoteIp()) ? $_SERVER['REMOTE_ADDR'] : $order->getRemoteIp();
19
+ //Zend_Debug::dump($order);die;
20
+
21
+ return("<?xml version='1.0' encoding='UTF-8' ?><control><utilisateur><nom titre='$order->customer_prefix'><![CDATA[$order->customer_lastname]]></nom><prenom><![CDATA[$order->customer_firstname]]></prenom><email><![CDATA[$email]]></email></utilisateur><infocommande><siteid><![CDATA[$siteid]]></siteid><refid><![CDATA[$refid]]></refid><montant devise='$order->base_currency_code'><![CDATA[$order->base_grand_total]]></montant><ip timestamp='$timestamp'><![CDATA[$ip]]></ip></infocommande><crypt><![CDATA[$crypt]]></crypt></control>");
22
+ }
23
+
24
+ static public function clean_xml($xml) {
25
+ $xml = str_replace("\\'", "'", $xml);
26
+ $xml = str_replace("\\\"", "\"", $xml);
27
+ $xml = str_replace("\\\\", "\\", $xml);
28
+ $xml = str_replace("\t", "", $xml);
29
+ $xml = str_replace("\n", "", $xml);
30
+ $xml = str_replace("\r", "", $xml);
31
+ $xml = trim($xml);
32
+ return ($xml);
33
+ }
34
+
35
+ static public function clean_invalid_char($var) {
36
+ //supprimes les balises html
37
+ $var = strip_tags($var);
38
+ //$var = str_replace("&", "&&amp;", $var);
39
+ $var = str_replace('&', '', $var);
40
+ $var = str_replace("<", "&lt;", $var);
41
+ $var = str_replace(">", "&gt;", $var);
42
+ $var = trim($var);
43
+ return ($var);
44
+ }
45
+
46
+ static function processOrderToFianet(Mage_Sales_Model_Order $order) {
47
+ if (self::sendOrderToFianet($order)) {
48
+
49
+ $attribut_sceau = self::ORDER_ATTR_SCEAU_SENT_PPROD;
50
+
51
+ if (self::sendingMode($order) == Fianet_Sceau_Model_Source_Mode::MODE_PROD) {
52
+ $attribut_sceau = self::ORDER_ATTR_SCEAU_SENT_PROD;
53
+ }
54
+ $order->setData($attribut_sceau, '1');
55
+
56
+ //Mage::getSingleton('adminhtml/session')->addError('processOrderToFianet() : ' . $attribut_sceau . ' = ' . $order->getData($attribut_sceau));
57
+
58
+ return true;
59
+ }
60
+ return false;
61
+ }
62
+
63
+ static function getStatusesConfig() {
64
+ return explode(',', Mage::getStoreConfig('sceau/sceauconfg/orderstatuses'));
65
+ }
66
+
67
+ static function checkCurrentOrderStatus(Mage_Sales_Model_Order $order) {
68
+ return in_array($order->getData('status'), self::getStatusesConfig());
69
+ }
70
+
71
+ static function sendOrderToFianet(Mage_Sales_Model_Order $order) {
72
+
73
+
74
+ $flux = self::Generate_Sceau_xml($order);
75
+ //Zend_Debug::dump($flux, 'flux');
76
+
77
+ $url = self::getFianetUrl($order);
78
+ $config = array('maxredirects' => 0,
79
+ 'timeout' => 5);
80
+
81
+ $params = array('SiteID' => self::getSiteID($order),
82
+ 'CheckSum' => md5($flux),
83
+ 'XMLInfo' => $flux);
84
+
85
+ Mage::dispatchEvent('Fianet_Sceau_Before_Send_Order', array('order' => $order, 'url' => $url, 'flux' => $flux));
86
+ //Zend_Debug::dump($config, 'config');
87
+ //Zend_Debug::dump($params, 'params');
88
+
89
+ try {
90
+ //Zend_Debug::dump($url, 'flux');
91
+ $client = new Zend_Http_Client($url, $config);
92
+ $client->setMethod(Zend_Http_Client::POST);
93
+ $client->setParameterPost($params);
94
+ //Zend_Debug::dump($client, 'client');
95
+ $response = $client->request();
96
+
97
+ //Mage::getSingleton('adminhtml/session')->addError('sendOrderToFianet() : '.htmlentities($flux));
98
+ //Mage::getSingleton('adminhtml/session')->addError('sendOrderToFianet() : '.$response->getBody());
99
+
100
+ Mage::dispatchEvent('Fianet_Sceau_After_Send_Order', array('order' => $order, 'response' => $response));
101
+ //Zend_Debug::dump($response);
102
+
103
+ return self::parseFianetResponse($response, $order);
104
+ } catch (Exception $e) {
105
+ Mage::getSingleton('adminhtml/session')->addError('FIA-NET Sceau sending error : ' . $e->getMessage());
106
+ }
107
+ }
108
+
109
+ static function parseFianetResponse($response, Mage_Sales_Model_Order $order) {
110
+ $attribut_sceau_error = self::ORDER_ATTR_SCEAU_SENT_ERROR;
111
+ if ($response->isSuccessful()) {
112
+ $xml = $response->getBody();
113
+
114
+ $simplexml = new Varien_Simplexml_Config($xml);
115
+ if ($simplexml->getNode()->getAttribute('type') == 'OK') {
116
+ //Zend_Debug::dump('OK');
117
+ $order->setData($attribut_sceau_error, '0');
118
+ return true;
119
+ }
120
+ }
121
+ if ($simplexml->getNode()->detail == '')
122
+ {
123
+ $order->setData($attribut_sceau_error, '1');
124
+ $ret = "erreur de flux";
125
+ }
126
+ else
127
+ $ret = $simplexml->getNode()->detail;
128
+ Mage::getSingleton('adminhtml/session')->addError('FIA-NET Sceau sending error : ' . $ret);
129
+
130
+ return false;
131
+ }
132
+
133
+ static function getFianetUrl(Mage_Sales_Model_Order $order) {
134
+ $url = Mage::getStoreConfig('sceau/sceaulinks/test_send_url');
135
+
136
+ if (self::sendingMode($order) == Fianet_Sceau_Model_Source_Mode::MODE_PROD) {
137
+ $url = Mage::getStoreConfig('sceau/sceaulinks/prod_send_url');
138
+ }
139
+
140
+ return Mage::getStoreConfig('sceau/sceaulinks/fianet_url') . '/' . $url;
141
+ }
142
+
143
+ static function getSiteID(Mage_Sales_Model_Order $order=null) {
144
+ if (isset($order)) {
145
+ return Mage::getStoreConfig('sceau/sceauconfg/siteid', $order->getStoreId());
146
+ }
147
+ return Mage::getStoreConfig('sceau/sceauconfg/siteid');
148
+ }
149
+
150
+ static function activateWidgetComments() {
151
+ return Mage::getStoreConfig('sceau/widgetconf/commentaires');
152
+ }
153
+
154
+ static function getWidgetTransparent() {
155
+ if (Mage::getStoreConfig('sceau/widgetconf/widgettransparent') == TRUE) {
156
+ return "transparent";
157
+ }
158
+ return "blanc";
159
+ }
160
+
161
+ static public function isOrderAlreadySent(Mage_Sales_Model_Order $order) {
162
+ $attribute_name = self::ORDER_ATTR_SCEAU_SENT_PPROD;
163
+ if (self::sendingMode($order) == Fianet_Sceau_Model_Source_Mode::MODE_PROD) {
164
+ $attribute_name = self::ORDER_ATTR_SCEAU_SENT_PROD;
165
+ }
166
+
167
+ if ($order->getData($attribute_name) == '1') {
168
+ return true;
169
+ }
170
+ return false;
171
+ }
172
+
173
+ static public function getMagentoVersion() {
174
+ $version = Mage::getVersion();
175
+ $version = substr($version, 0, 5);
176
+ $version = str_replace('.', '', $version);
177
+ while (strlen($version) < 3) {
178
+ $version .= "0";
179
+ }
180
+ return (int) $version;
181
+ }
182
+
183
+ static function isModuleActive($order) {
184
+ if (Mage::getStoreConfig('sceau/sceauconfg/active', $order->getStoreId()) == '1') {
185
+ return true;
186
+ }
187
+ return false;
188
+ }
189
+
190
+ static function sendingMode(Mage_Sales_Model_Order $order) {
191
+ return Mage::getStoreConfig('sceau/sceauconfg/mode', $order->getStoreId());
192
+ }
193
+
194
+ }
app/code/community/Fianet/Sceau/Model/Observer.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Fianet_Sceau_Model_Observer extends Varien_Event_Observer {
4
+ CONST GRID_NAME_IN_LAYOUT = 'sales_order.grid';
5
+ CONST MASSACTION_BLOCK_NAME_IN_LAYOUT = 'sales_order.grid.child';
6
+ CONST MASSACTION_BLOCK_CLASS = 'Mage_Adminhtml_Block_Widget_Grid_Massaction';
7
+
8
+ public function updateSalesOrderGrid($observer) {
9
+
10
+ $event = $observer->getEvent();
11
+ $block = $event->getData('block');
12
+
13
+
14
+
15
+ if ($block->getNameInLayout() == self::GRID_NAME_IN_LAYOUT) {
16
+ $block->addColumnAfter('fianet_sceau', array(
17
+ 'header' => 'FIA-NET SCEAU',
18
+ 'sortable' => false,
19
+ 'type' => 'fianet',
20
+ 'align' => 'center',
21
+ 'width' => '20',
22
+ 'renderer' => 'Fianet_Sceau_Block_Widget_grid_column_renderer_fianet',
23
+ 'filter' => 'Fianet_Sceau_Block_Widget_grid_column_filter_fianet'
24
+ ), 'action');
25
+ }
26
+
27
+
28
+ if (preg_match('/' . self::MASSACTION_BLOCK_NAME_IN_LAYOUT . '[0-9]+/', $block->getNameInLayout())
29
+ && (get_class($block) == self::MASSACTION_BLOCK_CLASS || get_parent_class($block) == self::MASSACTION_BLOCK_CLASS)) {
30
+ $block->addItem('fianet_sceau', array(
31
+ 'label' => Mage::helper('fianet_sceau')->__('Envoyer à FIA-NET sceau'),
32
+ 'url' => Mage::getUrl('sceau/index/mass')
33
+ ));
34
+ }
35
+ }
36
+
37
+
38
+ public function sendToFianet($observer) {
39
+ //gestion de l'évènement magento
40
+ $event = $observer->getEvent();
41
+ $order = $event->getData('order');
42
+
43
+ //$myorder = (Fianet_Sceau_Model_Order)$order;
44
+ //Zend_Debug::dump($myorder);
45
+ //die;
46
+ if ($this->_canSendOrder($order))
47
+ {
48
+ Mage::Helper('fianet_sceau/Data')->processOrderToFianet($order);
49
+ }
50
+ }
51
+
52
+ protected function _canSendOrder(Mage_Sales_Model_Order $order)
53
+ {
54
+ if (!Mage::Helper('fianet_sceau/Data')->isModuleActive($order))
55
+ {//si le module est désactivé
56
+ return false;
57
+ }
58
+ else if (Mage::Helper('fianet_sceau/Data')->isOrderAlreadySent($order))
59
+ {//Si la commande a déjà été envoyée
60
+ return false;
61
+ }
62
+ elseif (Mage::Helper('fianet_sceau/Data')->checkCurrentOrderStatus($order))
63
+ {//si la status de la commande est l'un des status pour lequel l'envoi est requis
64
+ return true;
65
+ }
66
+ elseif ($order->getState() == Mage_Sales_Model_Order::STATE_NEW
67
+ && $order->getIsInProcess())
68
+ {//si la commande a été payée
69
+ return true;
70
+
71
+ }
72
+ return false;
73
+ }
74
+
75
+ }
app/code/community/Fianet/Sceau/Model/Order.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Order
10
+ *
11
+ * @author ahoury
12
+ */
13
+ class Fianet_Sceau_Model_Order
14
+ {
15
+ static function processOrderToFianet($order)
16
+ {
17
+ if (Fianet_Sceau_Helper_Data::sendOrderToFianet($this))
18
+ {
19
+
20
+ $attribut_sceau = Fianet_Sceau_Helper_Data::ORDER_ATTR_SCEAU_SENT_PPROD;
21
+
22
+ if (Fianet_Sceau_Helper_Data::sendingMode($this) == Fianet_Sceau_Model_Source_Mode::MODE_PROD) {
23
+ $attribut_sceau = Fianet_Sceau_Helper_Data::ORDER_ATTR_SCEAU_SENT_PROD;
24
+ }
25
+ $this->setData($attribut_sceau, '1');
26
+
27
+ return true;
28
+ }
29
+ return false;
30
+ }
31
+ }
app/code/community/Fianet/Sceau/Model/Source/Mode.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * 2000-2012 FIA-NET
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0) that is available
9
+ * through the world-wide-web at this URL: http://www.opensource.org/licenses/OSL-3.0
10
+ * If you are unable to obtain it through the world-wide-web, please contact us
11
+ * via http://www.fia-net-group.com/formulaire.php so we can send you a copy immediately.
12
+ *
13
+ * @author Quadra Informatique <ecommerce@quadra-informatique.fr>
14
+ * @copyright 2000-2012 FIA-NET
15
+ * @version Release: $Revision: 0.2.0 $
16
+ * @license http://www.opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
17
+ */
18
+ class Fianet_Sceau_Model_Source_Mode {
19
+
20
+ const MODE_PROD = 'prod';
21
+ const MODE_PREPROD = 'test';
22
+
23
+ public function toOptionArray() {
24
+ return array(
25
+ array('value' => self::MODE_PREPROD, 'label' => Mage::helper('adminhtml')->__('Test')),
26
+ array('value' => self::MODE_PROD, 'label' => Mage::helper('adminhtml')->__('Production')),
27
+ );
28
+ }
29
+
30
+ }
app/code/community/Fianet/Sceau/Model/Source/Status.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ class Fianet_Sceau_Model_Source_Status
9
+ {
10
+ public static function toOptionArray() {
11
+ $statuses = Mage::getModel('sales/order_status')->getCollection()->load();
12
+
13
+ $data = array();
14
+
15
+ foreach ($statuses as $status)
16
+ {
17
+ $data[] = array('label' => $status->getLabel(), 'value' => $status->getStatus());
18
+ }
19
+
20
+
21
+
22
+ return $data;
23
+ }
24
+ }
app/code/community/Fianet/Sceau/controllers/IndexController.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Fianet_Sceau_IndexController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function massAction()
7
+ {
8
+ $params = Mage::app()->getRequest()->getParams();
9
+ $orderIds = $params[$params['massaction_prepare_key']];
10
+
11
+ $successMsg = '';
12
+
13
+ foreach ($orderIds as $orderId)
14
+ {
15
+ $order = Mage::getModel('sales/order')->load($orderId);
16
+
17
+ //$order->setData('fianet_sceau_order_sent', '0');
18
+
19
+ if ( $this->_canSendOrder($order)
20
+ && Mage::Helper('fianet_sceau/Data')->processOrderToFianet($order))
21
+ {
22
+ //Zend_Debug::dump($order->getData('fianet_sceau_order_sent_prod'), 'order->fianet_sceau_order_sent_prod');
23
+ //Zend_Debug::dump($order->getData('fianet_sceau_order_sent_preprod'), 'order->fianet_sceau_order_sent_preprod');
24
+ //die;
25
+
26
+
27
+ $successMsg .= "\n<br />- Commande n° " . $order->getIncrementId();
28
+ }
29
+ }
30
+ if ($successMsg != '')
31
+ {
32
+ $successMsg = 'Commande envoyées à FIA-NET :' . $successMsg;
33
+ Mage::getSingleton('adminhtml/session')->addSuccess($successMsg);
34
+ }
35
+ $order->save();
36
+ $this->_redirect('adminhtml/sales_order/index');
37
+ }
38
+
39
+ protected function _canSendOrder(Mage_Sales_Model_Order $order)
40
+ {
41
+ if (!Mage::Helper('fianet_sceau/Data')->isModuleActive($order))
42
+ {//si le module est désactivé
43
+ return false;
44
+ }
45
+ else if (Mage::Helper('fianet_sceau/Data')->isOrderAlreadySent($order))
46
+ {//Si la commande a déjà été envoyée
47
+ return false;
48
+ }
49
+ return true;
50
+ }
51
+
52
+ }
app/code/community/Fianet/Sceau/etc/config.xml ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Fianet_Sceau>
5
+ <version>1.0.1</version>
6
+ </Fianet_Sceau>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <fianet_sceau>
11
+ <class>Fianet_Sceau_Block</class>
12
+ </fianet_sceau>
13
+ </blocks>
14
+ <helpers>
15
+ <fianet_sceau>
16
+ <class>Fianet_Sceau_Helper</class>
17
+ </fianet_sceau>
18
+ </helpers>
19
+ <models>
20
+ <fianet_sceau_mysql4>
21
+ <class>Fianet_Sceau_Model_Mysql4</class>
22
+ <entities>
23
+ </entities>
24
+ </fianet_sceau_mysql4>
25
+ </models>
26
+
27
+ <resources>
28
+ <fianet_sceau_setup>
29
+ <setup>
30
+ <module>Fianet_Sceau</module>
31
+ <class>Mage_Sales_Model_Resource_Setup</class>
32
+ </setup>
33
+ <connection>
34
+ <use>core_setup</use>
35
+ </connection>
36
+ </fianet_sceau_setup>
37
+ <fianet_sceau_write>
38
+ <connection>
39
+ <use>core_write</use>
40
+ </connection>
41
+ </fianet_sceau_write>
42
+ <fianet_sceau_read>
43
+ <connection>
44
+ <use>core_read</use>
45
+ </connection>
46
+ </fianet_sceau_read>
47
+ </resources>
48
+ <events>
49
+ <sales_order_save_before>
50
+ <observers>
51
+ <Fianet_Sceau_Model_Observer_1>
52
+ <type>singleton</type>
53
+ <class>Fianet_Sceau_Model_Observer</class>
54
+ <method>sendToFianet</method>
55
+ </Fianet_Sceau_Model_Observer_1>
56
+ </observers>
57
+ </sales_order_save_before>
58
+ </events>
59
+ </global>
60
+ <default>
61
+ <sceau>
62
+ <sceauconfg>
63
+ <orderstatuses>processing</orderstatuses>
64
+ </sceauconfg>
65
+ <widgetconf>
66
+ <active><![CDATA[1]]>
67
+ </active>
68
+ <left_position><![CDATA[1]]>
69
+ </left_position>
70
+ <right_position><![CDATA[1]]>
71
+ </right_position>
72
+ <footer_position><![CDATA[1]]>
73
+ </footer_position>
74
+ </widgetconf>
75
+ <logoconf>
76
+ <active><![CDATA[1]]>
77
+ </active>
78
+ <logo_left_position><![CDATA[1]]>
79
+ </logo_left_position>
80
+ <logo_right_position><![CDATA[1]]>
81
+ </logo_right_position>
82
+ <logo_footer_position><![CDATA[1]]>
83
+ </logo_footer_position>
84
+ </logoconf>
85
+ <url>
86
+ <url_extranet><![CDATA[https://www.fia-net.com/__extranet/]]></url_extranet>
87
+ </url>
88
+ <sceaulinks>
89
+ <fianet_url><![CDATA[https://www.fia-net.com]]></fianet_url>
90
+ <prod_send_url><![CDATA[engine/sendrating.cgi]]></prod_send_url>
91
+ <test_send_url><![CDATA[engine/preprod/sendrating.cgi]]></test_send_url>
92
+ </sceaulinks>
93
+ </sceau>
94
+ </default>
95
+ <adminhtml>
96
+ <events>
97
+ <adminhtml_block_html_before>
98
+ <observers>
99
+ <Fianet_Sceau_Model_Observer_2>
100
+ <type>singleton</type>
101
+ <class>Fianet_Sceau_Model_Observer</class>
102
+ <method>updateSalesOrderGrid</method>
103
+ </Fianet_Sceau_Model_Observer_2>
104
+ </observers>
105
+ </adminhtml_block_html_before>
106
+ </events>
107
+ <translate>
108
+ <modules>
109
+ <Fianet_Sceau>
110
+ <files>
111
+ <default>Fianet_Sceau.csv</default>
112
+ </files>
113
+ </Fianet_Sceau>
114
+ </modules>
115
+ </translate>
116
+ <acl>
117
+ <resources>
118
+ <all>
119
+ <title>Allow Everything</title>
120
+ </all>
121
+ <admin>
122
+ <children>
123
+ <sceauconfig>
124
+ <title>Sceau</title>
125
+ <sort_order>190</sort_order>
126
+ </sceauconfig>
127
+ <system>
128
+ <children>
129
+ <config>
130
+ <children>
131
+ <sceau translate="title">
132
+ <title>sceau Section</title>
133
+ <sort_order>100</sort_order>
134
+ </sceau>
135
+ </children>
136
+ </config>
137
+ </children>
138
+ </system>
139
+ </children>
140
+ </admin>
141
+ </resources>
142
+ </acl>
143
+ </adminhtml>
144
+ <frontend>
145
+ <layout>
146
+ <updates>
147
+ <fianet_sceau>
148
+ <file>fianet_sceau.xml</file>
149
+ </fianet_sceau>
150
+ </updates>
151
+ </layout>
152
+ <routers>
153
+ </routers>
154
+ </frontend>
155
+ <admin>
156
+ <routers>
157
+ <fianetsceau>
158
+ <use>admin</use>
159
+ <args>
160
+ <module>Fianet_Sceau</module>
161
+ <frontName>sceau</frontName>
162
+ </args>
163
+ </fianetsceau>
164
+ </routers>
165
+ </admin>
166
+
167
+
168
+ </config>
app/code/community/Fianet/Sceau/etc/system.xml ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <sceau translate="label">
5
+ <label>Sceau de confiance</label>
6
+ <tab>sales</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>1500</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <sceauconfg translate="label">
14
+ <label>General configuration</label>
15
+ <frontend_type>text</frontend_type>
16
+ <comment><![CDATA[<b><a href="https://www.fia-net.com/__extranet/" target="_blank" style="color: #EA7601;">Accès Extranet FIA-NET</a></b>]]></comment>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ <fields>
22
+ <!-- New fields go here -->
23
+
24
+ <active translate="label">
25
+ <label>Enabled</label>
26
+ <frontend_type>select</frontend_type>
27
+ <source_model>adminhtml/system_config_source_yesno</source_model>
28
+ <sort_order>1</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ </active>
33
+ <mode translate="label">
34
+ <label>Mode</label>
35
+ <frontend_type>select</frontend_type>
36
+ <source_model>fianet_sceau_model_source_mode</source_model>
37
+ <sort_order>2</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ </mode>
42
+ <siteid translate="label comment">
43
+ <label>SiteID</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>3</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ <comment>Correspond à votre identifant marchand FIA-NET</comment>
50
+ </siteid>
51
+ <login translate="label">
52
+ <label>Login Sceau</label>
53
+ <frontend_type>text</frontend_type>
54
+ <sort_order>3</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
+ </login>
59
+ <private_key translate="label comment">
60
+ <label>private_key</label>
61
+ <frontend_type>text</frontend_type>
62
+ <sort_order>4</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </private_key>
67
+ <password translate="label comment">
68
+ <label>password</label>
69
+ <frontend_type>text</frontend_type>
70
+ <sort_order>5</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </password>
75
+ <orderstatuses translate="label comment">
76
+ <label>Envoi automatique des commandes</label>
77
+ <frontend_type>multiselect</frontend_type>
78
+ <source_model>fianet_sceau_model_source_status</source_model>
79
+ <sort_order>6</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>0</show_in_website>
82
+ <show_in_store>0</show_in_store>
83
+ <comment>Toute commande atteignant l'un des status définis fera l'objet d'un envoi de questionnaire</comment>
84
+ </orderstatuses>
85
+ </fields>
86
+ </sceauconfg>
87
+ <widgetconf translate="label">
88
+ <label>Widget configuration</label>
89
+ <frontend_type>text</frontend_type>
90
+ <sort_order>2</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ <fields>
95
+ <left_position translate="label">
96
+ <label>left position</label>
97
+ <frontend_type>select</frontend_type>
98
+ <source_model>adminhtml/system_config_source_yesno</source_model>
99
+ <sort_order>1</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </left_position>
104
+ <right_position translate="label">
105
+ <label>right position</label>
106
+ <frontend_type>select</frontend_type>
107
+ <source_model>adminhtml/system_config_source_yesno</source_model>
108
+ <sort_order>2</sort_order>
109
+ <show_in_default>1</show_in_default>
110
+ <show_in_website>1</show_in_website>
111
+ <show_in_store>1</show_in_store>
112
+ </right_position>
113
+ <footer_position translate="label">
114
+ <label>footer position</label>
115
+ <frontend_type>select</frontend_type>
116
+ <source_model>adminhtml/system_config_source_yesno</source_model>
117
+ <sort_order>3</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
+ </footer_position>
122
+
123
+ <widgettransparent translate="label">
124
+ <label>widgettransparent</label>
125
+ <frontend_type>select</frontend_type>
126
+ <source_model>adminhtml/system_config_source_yesno</source_model>
127
+ <sort_order>4</sort_order>
128
+ <show_in_default>1</show_in_default>
129
+ <show_in_website>1</show_in_website>
130
+ <show_in_store>1</show_in_store>
131
+ </widgettransparent>
132
+ <commentaires translate="label">
133
+ <label>Activer les commentaires</label>
134
+ <frontend_type>select</frontend_type>
135
+ <source_model>adminhtml/system_config_source_yesno</source_model>
136
+ <sort_order>5</sort_order>
137
+ <show_in_default>1</show_in_default>
138
+ <show_in_website>1</show_in_website>
139
+ <show_in_store>1</show_in_store>
140
+ </commentaires>
141
+ </fields>
142
+ </widgetconf>
143
+ <logoconf translate="label">
144
+ <label>Logo configuration</label>
145
+ <frontend_type>text</frontend_type>
146
+ <sort_order>2</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>1</show_in_store>
150
+ <fields>
151
+ <logo_left_position translate="label">
152
+ <label>logo left position</label>
153
+ <frontend_type>select</frontend_type>
154
+ <source_model>adminhtml/system_config_source_yesno</source_model>
155
+ <sort_order>1</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
+ </logo_left_position>
160
+ <logo_right_position translate="label">
161
+ <label>logo right position</label>
162
+ <frontend_type>select</frontend_type>
163
+ <source_model>adminhtml/system_config_source_yesno</source_model>
164
+ <sort_order>2</sort_order>
165
+ <show_in_default>1</show_in_default>
166
+ <show_in_website>1</show_in_website>
167
+ <show_in_store>1</show_in_store>
168
+ </logo_right_position>
169
+ <logo_footer_position translate="label">
170
+ <label>logo footer position</label>
171
+ <frontend_type>select</frontend_type>
172
+ <source_model>adminhtml/system_config_source_yesno</source_model>
173
+ <sort_order>3</sort_order>
174
+ <show_in_default>1</show_in_default>
175
+ <show_in_website>1</show_in_website>
176
+ <show_in_store>1</show_in_store>
177
+ </logo_footer_position>
178
+ </fields>
179
+ </logoconf>
180
+
181
+ <sceaulinks translate="label">
182
+ <label>links</label>
183
+ <frontend_type>text</frontend_type>
184
+ <sort_order>3</sort_order>
185
+ <show_in_default>1</show_in_default>
186
+ <show_in_website>1</show_in_website>
187
+ <show_in_store>1</show_in_store>
188
+ <fields>
189
+ <fianet_url translate="label comment">
190
+ <label>fianet_url</label>
191
+ <frontend_type>text</frontend_type>
192
+ <sort_order>1</sort_order>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>0</show_in_website>
195
+ <show_in_store>0</show_in_store>
196
+ </fianet_url>
197
+ <prod_send_url translate="label comment">
198
+ <label>prod_send_url</label>
199
+ <frontend_type>text</frontend_type>
200
+ <sort_order>3</sort_order>
201
+ <show_in_default>1</show_in_default>
202
+ <show_in_website>0</show_in_website>
203
+ <show_in_store>0</show_in_store>
204
+ </prod_send_url>
205
+ <test_send_url translate="label comment">
206
+ <label>test_send_url</label>
207
+ <frontend_type>text</frontend_type>
208
+ <sort_order>2</sort_order>
209
+ <show_in_default>1</show_in_default>
210
+ <show_in_website>0</show_in_website>
211
+ <show_in_store>0</show_in_store>
212
+ </test_send_url>
213
+ </fields>
214
+ </sceaulinks>
215
+
216
+ </groups>
217
+ </sceau>
218
+ </sections>
219
+ </config>
app/code/community/Fianet/Sceau/sql/fianet_sceau_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->addAttribute('order', 'fianet_sceau_order_sent_prod', array('type' => 'int', 'visible' => false, 'required' => true, 'default_value' => 0));
8
+ $installer->getConnection()->addColumn($installer->getTable('sales_flat_order_grid'), 'fianet_sceau_order_sent_prod', 'varchar(255) default 0');
9
+
10
+
11
+ $installer->addAttribute('order', 'fianet_sceau_order_sent_preprod', array('type' => 'int', 'visible' => false, 'required' => true, 'default_value' => 0));
12
+ $installer->getConnection()->addColumn($installer->getTable('sales_flat_order_grid'), 'fianet_sceau_order_sent_preprod', 'varchar(255) default 0');
13
+
14
+ $installer->addAttribute('order', 'fianet_sceau_order_sent_error', array('type' => 'int', 'visible' => false, 'required' => true, 'default_value' => 0));
15
+ $installer->getConnection()->addColumn($installer->getTable('sales_flat_order_grid'), 'fianet_sceau_order_sent_error', 'varchar(255) default 0');
16
+
17
+
18
+ $installer->endSetup();
app/design/frontend/base/default/layout/fianet_sceau.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <layout>
4
+ <default>
5
+ <reference name="left">
6
+ <block type="fianet_sceau/widget_left" name="sceau.left" template="fianet_sceau/page/html/sceau.phtml" before="-" />
7
+ </reference>
8
+ <reference name="left">
9
+ <block type="fianet_sceau/logo_left" name="logo.left" template="fianet_sceau/page/html/logo.phtml"/>
10
+ </reference>
11
+ <reference name="right">
12
+ <block type="fianet_sceau/widget_right" name="sceau.right" template="fianet_sceau/page/html/sceau.phtml" before="-" />
13
+ </reference>
14
+ <reference name="right">
15
+ <block type="fianet_sceau/logo_right" name="logo.right" template="fianet_sceau/page/html/logo.phtml" />
16
+ </reference>
17
+ <reference name="footer">
18
+ <block type="fianet_sceau/widget_footer" name="sceau.footer" template="fianet_sceau/page/html/sceau.phtml" />
19
+ </reference>
20
+ <reference name="footer">
21
+ <block type="fianet_sceau/logo_footer" name="logo.footer" template="fianet_sceau/page/html/logo.phtml"/>
22
+ </reference>
23
+ </default>
24
+ </layout>
app/design/frontend/base/default/template/fianet_sceau/page/html/logo.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->canDisplay()): ?>
2
+
3
+ <a target="_blank" href="http://www.fia-net.com/annuaire/<?php echo Fianet_Sceau_Helper_Data::getSiteId(); ?>/<?php echo $this->getLoginSceau(); ?>.html" >
4
+ <center><img width="150px" src="<?php echo $this->getSkinUrl('images/sceau/logo_fianet_sceau.png') ?>">
5
+ </center>
6
+ </a>
7
+
8
+
9
+ <?php endif; ?>
app/design/frontend/base/default/template/fianet_sceau/page/html/sceau.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->canDisplay()){
2
+ if (Fianet_Sceau_Helper_Data::activateWidgetComments()){
3
+ echo "<center><script type='text/javascript' src='http://static.fia-net.com/widgetscomm/".Fianet_Sceau_Helper_Data::getWidgetTransparent()."/".Fianet_Sceau_Helper_Data::getSiteId().".js'></script></center>";
4
+ }
5
+ else
6
+ {
7
+ echo "<div id='widget'>
8
+ <a target='_blank' href='http://www.fia-net.com/annuaire/". Fianet_Sceau_Helper_Data::getSiteId()."'><img height='70' border='0' width='160' title='Voir les avis et commentaires sur le site FIA-NET.com' alt='Evaluation FIA-NET' src='http://static.fia-net.com/widgets/".Fianet_Sceau_Helper_Data::getWidgetTransparent()."/". Fianet_Sceau_Helper_Data::getSiteId().".png'> </a>
9
+ <script type='text/javascript'> xt_imgpub = new Image(); xtdmedpub = new Date(); xt_imgpub.src = '&type=ad&hl=' + xtdmedpub.getHours() + 'x' + xtdmedpub.getMinutes() + 'x' + xtdmedpub.getSeconds(); </script>
10
+ <br><br></div>";
11
+ }
12
+ }
app/etc/modules/zFianet_Sceau.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Fianet_Sceau>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Fianet_Sceau>
8
+ </modules>
9
+ </config>
app/locale/fr_FR/Fianet_Sceau.csv ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Sceau de confiance","Sceau de confiance"
2
+ "General configuration","Configuration générale"
3
+ "Enabled","Activation du service"
4
+ "SiteID","SiteID"
5
+ "Votre identifant marchand FIA-NET","Votre identifant marchand FIA-NET"
6
+ "left position","Affichage à gauche"
7
+ "right position","Affichage à droite"
8
+ "footer position","Affichage dans le footer"
9
+ "private_key","Clé privée"
10
+ "password","Mot de passe"
11
+ "links","Urls"
12
+ "test_send_url","[Test] Url de soumission"
13
+ "prod_send_url","[Prod] Url de soumission"
14
+ "Widget configuration","Configuration du Widget"
15
+ "fianet_url","Urls de Fia-net"
16
+ "widgettransparent","Transparence du Widget"
17
+ "Login Sceau","Login"
18
+ "Envoi automatique des commandes","Envoi automatique des commandes"
19
+ "Toute commande atteignant l'un des status définis fera l'objet d'un envoi de questionnaire","Toute commande atteignant l'un des status définis fera l'objet d'un envoi de questionnaire"
20
+ "Correspond à votre identifant marchand FIA-NET","Correspond à votre identifant marchand FIA-NET"
21
+ "Logo configuration","Configuration du logo"
22
+ "logo left position","Affichage dans la colonne de gauche"
23
+ "logo right position","Affichage dans la colonne de droite"
24
+ "logo footer position","Affichage dans le footer"
25
+ "widgettransparent","Transparence du widget"
26
+ "Envoyer à FIA-NET sceau","Envoyer questionnaire FIA-NET"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Fianet_Sceau</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/OSL-3.0">Open Software License (OSL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>FIA-NET Sceau de Confiance</summary>
10
+ <description>Seal of trust FIA-NET</description>
11
+ <notes>second official commit</notes>
12
+ <authors><author><name>FIA-NET</name><user>FIA-NET</user><email>support-boutique@fia-net.com</email></author></authors>
13
+ <date>2013-05-27</date>
14
+ <time>07:49:32</time>
15
+ <contents><target name="magecommunity"><dir name="Fianet"><dir name="Sceau"><dir name="Block"><dir name="Logo"><file name="Abstract.php" hash="61fe9dce2bfadbede1d30966d1898d97"/><file name="Footer.php" hash="af103617947cbbd5d5a32468757b691b"/><file name="Left.php" hash="87fb4aab3af002792282eaea5f806cf4"/><file name="Right.php" hash="692839ed3361af84561468245c15e4e3"/></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="1728f5da74fa5ab799f603dfd338a1e1"/></dir><file name="Order.php" hash="8caae3cbc5d66a55505664027138d866"/></dir><dir name="Widget"><file name="Abstract.php" hash="34081f22dc73992f7b4fc6575ca7fd01"/><file name="Footer.php" hash="46b8ff738bebeb17b4c80bab3f8414a2"/><dir name="Grid"><dir name="Column"><dir name="Filter"><file name="Fianet.php" hash="97b2dadc4011ce836781cc7d7d6a244b"/></dir><dir name="Renderer"><file name="Fianet.php" hash="ddb152623c2fd3f832e0c22f81819a32"/></dir></dir></dir><file name="Left.php" hash="9a81ebcfd5dbd11a6f0a4a23158157ed"/><file name="Right.php" hash="807cf3507a6d4177f3bbdc8be3f14f11"/></dir></dir><dir name="Helper"><file name="Data.php" hash="afefb0789c9ff0298b829aa6462f5b82"/></dir><dir name="Model"><file name="Observer.php" hash="318e24eeaa741e963e88408c9b7a1076"/><file name="Order.php" hash="026f7cdddd49bc71a6e60a1574d634e4"/><dir name="Source"><file name="Mode.php" hash="ac805c9b29096a3f6b317809733298a8"/><file name="Status.php" hash="55a727b776e617289242db7bfeb46fce"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="f530a33b70b8f9d71762ebd9a283e399"/></dir><dir name="etc"><file name="config.xml" hash="7acd58b2a1e66a885b8f77fdd22d0d0e"/><file name="system.xml" hash="3f6b129f84f29f54c265c1730d86a11a"/></dir><dir name="sql"><dir name="fianet_sceau_setup"><file name="mysql4-install-1.0.0.php" hash="9f0b46620626a410a4e2006498760f55"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="fianet_sceau.xml" hash="60e2e663727d881bfe171e6a74ff9a83"/></dir><dir name="template"><dir name="fianet_sceau"><dir name="page"><dir name="html"><file name="logo.phtml" hash="7326d798735c646958c10d36562bb268"/><file name="sceau.phtml" hash="82d1a56f0518a7e2cd78e172eb6e7563"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="zFianet_Sceau.xml" hash="67bebe992318bda3fa18f94c045d6c8c"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Fianet_Sceau.csv" hash="22d1904630a097040c0cf1f9db82dfc9"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="sceau"><file name="ko.PNG" hash="fe3a3f44292e6f6f3e7d6c90d22ddd54"/><file name="ok.JPG" hash="ce957f7ccb1e07277f9302f0e1fe4908"/><file name="ok.PNG" hash="f751d2b0e1eb1883144c60a8c87db2cb"/><file name="top_left_block_login.png" hash="30eb50342a004e39ac69faa0f7654701"/><file name="warning.gif" hash="c774f46bf0af9b2e5bde5789901c5083"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="sceau"><file name="logo_fianet_sceau.png" hash="befd6502a28deb2384674f696b9e1aa3"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.9</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/images/sceau/ko.PNG ADDED
Binary file
skin/adminhtml/default/default/images/sceau/ok.JPG ADDED
Binary file
skin/adminhtml/default/default/images/sceau/ok.PNG ADDED
Binary file
skin/adminhtml/default/default/images/sceau/top_left_block_login.png ADDED
Binary file
skin/adminhtml/default/default/images/sceau/warning.gif ADDED
Binary file
skin/frontend/base/default/images/sceau/logo_fianet_sceau.png ADDED
Binary file