Version Notes
Modification gestion des familles
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Speedinfo_Opensi |
| Version | 0.1.2 |
| Comparing to | |
| See all releases | |
Version 0.1.2
- app/code/community/Speedinfo/Opensi/Block/Adminhtml/Edit.php +30 -0
- app/code/community/Speedinfo/Opensi/Block/Adminhtml/Edit/Form.php +31 -0
- app/code/community/Speedinfo/Opensi/Block/Adminhtml/Edit/Tab/General.php +99 -0
- app/code/community/Speedinfo/Opensi/Block/Adminhtml/Edit/Tab/Webservices.php +39 -0
- app/code/community/Speedinfo/Opensi/Block/Adminhtml/Grid.php +89 -0
- app/code/community/Speedinfo/Opensi/Block/Adminhtml/Tabs.php +45 -0
- app/code/community/Speedinfo/Opensi/Helper/Data.php +34 -0
- app/code/community/Speedinfo/Opensi/Model/Client.php +19 -0
- app/code/community/Speedinfo/Opensi/Model/Cron.php +100 -0
- app/code/community/Speedinfo/Opensi/Model/Errorlog.php +15 -0
- app/code/community/Speedinfo/Opensi/Model/Mysql4/Client.php +26 -0
- app/code/community/Speedinfo/Opensi/Model/Mysql4/Errorlog.php +14 -0
- app/code/community/Speedinfo/Opensi/Model/Mysql4/Errorlog/Collection.php +17 -0
- app/code/community/Speedinfo/Opensi/Model/Mysql4/Webservice.php +26 -0
- app/code/community/Speedinfo/Opensi/Model/Mysql4/Webservice/Collection.php +17 -0
- app/code/community/Speedinfo/Opensi/Model/Webservice.php +19 -0
- app/code/community/Speedinfo/Opensi/Model/Webservices.php +648 -0
- app/code/community/Speedinfo/Opensi/controllers/IndexController.php +99 -0
- app/code/community/Speedinfo/Opensi/etc/config.xml +135 -0
- app/code/community/Speedinfo/Opensi/sql/opensi_setup/mysql4-install-0.1.0.php +66 -0
- app/design/adminhtml/default/default/template/opensi/tab/webservices.phtml +33 -0
- app/etc/modules/Speedinfo_Opensi.xml +9 -0
- package.xml +20 -0
app/code/community/Speedinfo/Opensi/Block/Adminhtml/Edit.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Block Edit
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Block_Adminhtml_Edit extends Mage_Adminhtml_Block_Widget_Form_Container{
|
| 10 |
+
|
| 11 |
+
public function __construct()
|
| 12 |
+
{
|
| 13 |
+
$this->_blockGroup = 'opensi';
|
| 14 |
+
$this->_controller = 'adminhtml';
|
| 15 |
+
$this->_mode = 'edit';
|
| 16 |
+
|
| 17 |
+
if(Mage::registry('store_id') == ""){
|
| 18 |
+
Mage::register('store_id',$this->getRequest()->getParam('store'));
|
| 19 |
+
}
|
| 20 |
+
parent::__construct();
|
| 21 |
+
|
| 22 |
+
$this->_updateButton('save', 'label', Mage::helper('opensi')->__('Save Configuration'));
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public function getHeaderText()
|
| 26 |
+
{
|
| 27 |
+
return 'Configuration Opensi';
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
}
|
app/code/community/Speedinfo/Opensi/Block/Adminhtml/Edit/Form.php
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Block Form Edit
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Block_Adminhtml_Edit_Form extends Mage_Adminhtml_Block_Widget_Form{
|
| 10 |
+
|
| 11 |
+
public function __construct()
|
| 12 |
+
{
|
| 13 |
+
parent::__construct();
|
| 14 |
+
$this->setId('opensi_id');
|
| 15 |
+
$this->setTitle(Mage::helper('opensi')->__('Opensi configuration'));
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
protected function _prepareForm()
|
| 19 |
+
{
|
| 20 |
+
$form = new Varien_Data_Form(array(
|
| 21 |
+
'id' => 'edit_form',
|
| 22 |
+
'action' => $this->getUrl('opensi/index/save',array("store"=>Mage::registry('store_id') == "" ? $this->getRequest()->getParam('store') : Mage::registry('store_id'))),
|
| 23 |
+
'method' => 'post'
|
| 24 |
+
));
|
| 25 |
+
|
| 26 |
+
$form->setUseContainer(true);
|
| 27 |
+
$this->setForm($form);
|
| 28 |
+
|
| 29 |
+
return parent::_prepareForm();
|
| 30 |
+
}
|
| 31 |
+
}
|
app/code/community/Speedinfo/Opensi/Block/Adminhtml/Edit/Tab/General.php
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Block Tab General
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Block_Adminhtml_Edit_Tab_General extends Mage_Adminhtml_Block_Widget_Form{
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Initialize tab
|
| 13 |
+
*
|
| 14 |
+
*/
|
| 15 |
+
public function __construct() {
|
| 16 |
+
parent::__construct();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
public function _prepareLayout()
|
| 20 |
+
{
|
| 21 |
+
parent::_prepareLayout();
|
| 22 |
+
$form = new Varien_Data_Form();
|
| 23 |
+
$client = $this->getClient();
|
| 24 |
+
|
| 25 |
+
$fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('opensi')->__('General Information')));
|
| 26 |
+
|
| 27 |
+
$fieldset->addField('opensi_id', 'text', array(
|
| 28 |
+
'name' => 'opensi[opensi_id]',
|
| 29 |
+
'label' => Mage::helper('opensi')->__('Identifiant OpenSi'),
|
| 30 |
+
'title' => Mage::helper('opensi')->__('Identifiant OpenSi'),
|
| 31 |
+
'required' => true,
|
| 32 |
+
'value' => !empty($client) ? $client->opensi_id : '',
|
| 33 |
+
'class' => 'validate-number',
|
| 34 |
+
));
|
| 35 |
+
|
| 36 |
+
$fieldset->addField('webservice_user', 'text', array(
|
| 37 |
+
'name' => 'opensi[webservice_user]',
|
| 38 |
+
'label' => Mage::helper('opensi')->__('Utilisateur webservice'),
|
| 39 |
+
'title' => Mage::helper('opensi')->__('Utilisateur webservice'),
|
| 40 |
+
'required' => true,
|
| 41 |
+
'value' => !empty($client) ? $client->webservice_user : '',
|
| 42 |
+
));
|
| 43 |
+
|
| 44 |
+
$fieldset->addField('webservice_pwd', 'text', array(
|
| 45 |
+
'name' => 'opensi[webservice_pwd]',
|
| 46 |
+
'label' => Mage::helper('opensi')->__('Mot de passe webservice'),
|
| 47 |
+
'title' => Mage::helper('opensi')->__('Mot de passe webservice'),
|
| 48 |
+
'required' => true,
|
| 49 |
+
'value' => !empty($client) ? $client->webservice_pwd : '',
|
| 50 |
+
));
|
| 51 |
+
|
| 52 |
+
$fieldset->addField('web_site_code', 'text', array(
|
| 53 |
+
'name' => 'opensi[web_site_code]',
|
| 54 |
+
'label' => Mage::helper('opensi')->__('Code site web'),
|
| 55 |
+
'title' => Mage::helper('opensi')->__('Code site web'),
|
| 56 |
+
'required' => true,
|
| 57 |
+
'value' => !empty($client) ? $client->web_site_code : '',
|
| 58 |
+
));
|
| 59 |
+
|
| 60 |
+
$fieldset->addField('deposit', 'text', array(
|
| 61 |
+
'name' => 'opensi[deposit]',
|
| 62 |
+
'label' => Mage::helper('opensi')->__('Code dépôt'),
|
| 63 |
+
'title' => Mage::helper('opensi')->__('Code dépôt'),
|
| 64 |
+
'required' => true,
|
| 65 |
+
'value' => !empty($client) ? $client->deposit : '',
|
| 66 |
+
));
|
| 67 |
+
|
| 68 |
+
$fieldset->addField('store_id', 'hidden', array(
|
| 69 |
+
'name' => 'opensi[store_id]',
|
| 70 |
+
'required' => true,
|
| 71 |
+
'value' => $this->getStore(),
|
| 72 |
+
));
|
| 73 |
+
|
| 74 |
+
$fieldset->addField('id', 'hidden', array(
|
| 75 |
+
'name' => 'opensi[id]',
|
| 76 |
+
'required' => true,
|
| 77 |
+
'value' => !empty($client) ? $client->id : 0,
|
| 78 |
+
));
|
| 79 |
+
|
| 80 |
+
$this->setForm($form);
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
public function getStore()
|
| 84 |
+
{
|
| 85 |
+
if(Mage::registry('store_id') != ""){
|
| 86 |
+
$store_id = Mage::registry('store_id');
|
| 87 |
+
}else{
|
| 88 |
+
$store_id = $this->getRequest()->getParam('store');
|
| 89 |
+
if($store_id == ""){
|
| 90 |
+
$store_id = 0;
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
return $store_id;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
public function getClient(){
|
| 97 |
+
return Mage::getModel("opensi/client")->loadByStore($this->getStore());
|
| 98 |
+
}
|
| 99 |
+
}
|
app/code/community/Speedinfo/Opensi/Block/Adminhtml/Edit/Tab/Webservices.php
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Block Tab Webservice
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Block_Adminhtml_Edit_Tab_Webservices extends Mage_Adminhtml_Block_Widget_Form{
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Initialize tab
|
| 13 |
+
*
|
| 14 |
+
*/
|
| 15 |
+
public function __construct()
|
| 16 |
+
{
|
| 17 |
+
parent::__construct();
|
| 18 |
+
// fields are not enought here, we use a template
|
| 19 |
+
$this->setTemplate('opensi/tab/webservices.phtml');
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
public function getWebservice($name){
|
| 23 |
+
$client = Mage::getModel("opensi/client")->loadByStore($this->getStore());
|
| 24 |
+
return !empty($client) ? Mage::getModel("opensi/webservice")->loadByNameClient($name,$client->id) : '';
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
public function getStore()
|
| 28 |
+
{
|
| 29 |
+
if(Mage::registry('store_id') != ""){
|
| 30 |
+
$store_id = Mage::registry('store_id');
|
| 31 |
+
}else{
|
| 32 |
+
$store_id = $this->getRequest()->getParam('store');
|
| 33 |
+
if($store_id == ""){
|
| 34 |
+
$store_id = 0;
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
return $store_id;
|
| 38 |
+
}
|
| 39 |
+
}
|
app/code/community/Speedinfo/Opensi/Block/Adminhtml/Grid.php
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Block Grid
|
| 5 |
+
*
|
| 6 |
+
* @Author Speedinfo
|
| 7 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 8 |
+
*/
|
| 9 |
+
class Speedinfo_Opensi_Block_Adminhtml_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Initialize Grid
|
| 13 |
+
*
|
| 14 |
+
*/
|
| 15 |
+
public function __construct() {
|
| 16 |
+
parent::__construct();
|
| 17 |
+
$this->setId('opensiGrid');
|
| 18 |
+
$this->setDefaultSort('id');
|
| 19 |
+
$this->setDefaultDir('desc');
|
| 20 |
+
$this->setSaveParametersInSession(true);
|
| 21 |
+
$this->setVarNameFilter('errors_filter');
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
protected function _prepareCollection() {
|
| 25 |
+
$collection = Mage::getModel('opensi/errorlog')->getCollection();
|
| 26 |
+
$this->setCollection($collection);
|
| 27 |
+
parent::_prepareCollection();
|
| 28 |
+
|
| 29 |
+
return $this;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
protected function _prepareColumns() {
|
| 33 |
+
$this->addColumn('id',
|
| 34 |
+
array(
|
| 35 |
+
'header' => Mage::helper('opensi')->__('ID'),
|
| 36 |
+
'width' => '50px',
|
| 37 |
+
'type' => 'number',
|
| 38 |
+
'index' => 'id',
|
| 39 |
+
));
|
| 40 |
+
|
| 41 |
+
$this->addColumn('opensi_id',
|
| 42 |
+
array(
|
| 43 |
+
'header' => Mage::helper('opensi')->__('Opensi ID'),
|
| 44 |
+
'width' => '60px',
|
| 45 |
+
'index' => 'opensi_id',
|
| 46 |
+
));
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
$this->addColumn('opensi_action', array(
|
| 50 |
+
'header' => Mage::helper('opensi')->__('Webservice invoqué'),
|
| 51 |
+
'index' => 'opensi_action',
|
| 52 |
+
));
|
| 53 |
+
|
| 54 |
+
$this->addColumn('error_code',
|
| 55 |
+
array(
|
| 56 |
+
'header' => Mage::helper('opensi')->__('Code erreur HTTP'),
|
| 57 |
+
'width' => '50px',
|
| 58 |
+
'type' => 'number',
|
| 59 |
+
'index' => 'error_code',
|
| 60 |
+
));
|
| 61 |
+
|
| 62 |
+
$this->addColumn('message', array(
|
| 63 |
+
'header' => Mage::helper('opensi')->__('Signification du code erreur HTTP'),
|
| 64 |
+
'index' => 'error_message',
|
| 65 |
+
));
|
| 66 |
+
|
| 67 |
+
$this->addColumn('created_at',
|
| 68 |
+
array(
|
| 69 |
+
'header' => Mage::helper('opensi')->__('Created at'),
|
| 70 |
+
'type' => 'datetime',
|
| 71 |
+
'index' => 'created_at',
|
| 72 |
+
));
|
| 73 |
+
|
| 74 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
| 75 |
+
$this->addColumn('store_id',
|
| 76 |
+
array(
|
| 77 |
+
'header' => Mage::helper('catalog')->__('Websites'),
|
| 78 |
+
'width' => '100px',
|
| 79 |
+
'sortable' => false,
|
| 80 |
+
'index' => 'store_id',
|
| 81 |
+
'type' => 'options',
|
| 82 |
+
'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
|
| 83 |
+
));
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
return parent::_prepareColumns();
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
}
|
app/code/community/Speedinfo/Opensi/Block/Adminhtml/Tabs.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Block tabs
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Block_Adminhtml_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 10 |
+
{
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Initialize Tabs
|
| 14 |
+
*
|
| 15 |
+
*/
|
| 16 |
+
public function __construct()
|
| 17 |
+
{
|
| 18 |
+
parent::__construct();
|
| 19 |
+
$this->setId('opensi_tabs');
|
| 20 |
+
$this->setDestElementId('edit_form');
|
| 21 |
+
$this->setTitle(Mage::helper('opensi')->__('Opensi'));
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
* Prepare Layout Content
|
| 27 |
+
*
|
| 28 |
+
* @return Mage_Adminhtml_Block_Catalog_Category_Tabs
|
| 29 |
+
*/
|
| 30 |
+
protected function _prepareLayout()
|
| 31 |
+
{
|
| 32 |
+
|
| 33 |
+
$this->addTab('general', array(
|
| 34 |
+
'label' => Mage::helper('opensi')->__('General Information'),
|
| 35 |
+
'content' => $this->getLayout()->createBlock('opensi/adminhtml_edit_tab_general')->toHtml(),
|
| 36 |
+
));
|
| 37 |
+
|
| 38 |
+
$this->addTab('webservices', array(
|
| 39 |
+
'label' => Mage::helper('opensi')->__('Webservices'),
|
| 40 |
+
'content' => $this->getLayout()->createBlock('opensi/adminhtml_edit_tab_webservices')->toHtml(),
|
| 41 |
+
));
|
| 42 |
+
|
| 43 |
+
return parent::_prepareLayout();
|
| 44 |
+
}
|
| 45 |
+
}
|
app/code/community/Speedinfo/Opensi/Helper/Data.php
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Fonction globales au projet
|
| 5 |
+
*
|
| 6 |
+
* @Author Speedinfo
|
| 7 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 8 |
+
*/
|
| 9 |
+
class Speedinfo_Opensi_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 10 |
+
|
| 11 |
+
public function getWebservicesName() {
|
| 12 |
+
$ws['Articles'] = array(
|
| 13 |
+
'createArticle' => array('title' => 'Création des articles', 'subtitle' => '(Envoi des articles du site vers OpenSi)', 'frequency' => 120),
|
| 14 |
+
'updateArticle' => array('title' => 'Mise à jour des articles', 'subtitle' => '(Envoi des mises à jour du site vers OpenSi)', 'frequency' => 60),
|
| 15 |
+
'getStockArticle' => array('title' => 'Récupération du stock des articles', 'subtitle' => '(Envoi du stock d\'OpenSi vers le site)', 'frequency' => 30),
|
| 16 |
+
'getPrixArticle' => array('title' => 'Récupération du prix des articles', 'subtitle' => '(Envoi du prix des articles d\'OpenSi vers le site)', 'frequency' => 30),
|
| 17 |
+
'getPubwebArticle' => array('title' => 'Récupération des statuts de publicatoin des articles', 'subtitle' => '(Envoi des statuts de publicatoin d\'OpenSi vers le site)', 'frequency' => 30)
|
| 18 |
+
);
|
| 19 |
+
|
| 20 |
+
$ws['Commandes'] = array(
|
| 21 |
+
'createCommandeWeb' => array('title' => 'Création des commandes', 'subtitle' => '(Envoi des commandes du site vers OpenSi)', 'frequency' => 10),
|
| 22 |
+
'createTransactionBancaire' => array('title' => 'Création des transactions bancaires', 'subtitle' => '(Envoi des transactions bancaires du site vers OpenSi)', 'frequency' => 60),
|
| 23 |
+
'getEtatCommande' => array('title' => 'Récupération des états des commandes', 'subtitle' => '(Envoi des états des commandes d\'OpenSi vers le site)', 'frequency' => 60),
|
| 24 |
+
'getTrackingColis' => array('title' => 'Récupération des numéros de suivie de colis', 'subtitle' => '(Envoi des numéros de suivie de colis d\'OpenSi vers le site)', 'frequency' => 60)
|
| 25 |
+
);
|
| 26 |
+
|
| 27 |
+
$ws['Clients'] = array(
|
| 28 |
+
'createClientWeb' => array('title' => 'Création des clients', 'subtitle' => '(Envoi des clients du site vers OpenSi)', 'frequency' => 60),
|
| 29 |
+
'updateClientWeb' => array('title' => 'Mise à jour des clients', 'subtitle' => '(Envoi des mises à jour du site vers OpenSi)', 'frequency' => 300)
|
| 30 |
+
);
|
| 31 |
+
return $ws;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
}
|
app/code/community/Speedinfo/Opensi/Model/Client.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Model de la table client
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Model_Client extends Mage_Core_Model_Abstract {
|
| 10 |
+
|
| 11 |
+
protected function _construct(){
|
| 12 |
+
parent::_construct();
|
| 13 |
+
$this->_init('opensi/client');
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
public function loadByStore($storeId){
|
| 17 |
+
return Mage::getResourceModel('opensi/client')->loadByStore($storeId);
|
| 18 |
+
}
|
| 19 |
+
}
|
app/code/community/Speedinfo/Opensi/Model/Cron.php
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Gestion du cron : lancement automatique des webservices
|
| 5 |
+
*
|
| 6 |
+
* @Author Speedinfo
|
| 7 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 8 |
+
*/
|
| 9 |
+
class Speedinfo_Opensi_Model_Cron extends Mage_Core_Model_Abstract {
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Cron tourne toutes les 5 minutes et verifie si des actions sont a lancer ou non
|
| 13 |
+
*/
|
| 14 |
+
public function scheduleCron() {
|
| 15 |
+
|
| 16 |
+
// on gere le storeId 0 differement
|
| 17 |
+
$clientDefault = Mage::getModel('opensi/client')->loadByStore(0);
|
| 18 |
+
if (!empty($clientDefault)) {
|
| 19 |
+
$webservicesDefault = Mage::getModel('opensi/webservice')->getCollection()->addFieldToFilter('client_id', $clientDefault->id);
|
| 20 |
+
} else {
|
| 21 |
+
$webservicesDefault = '';
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
// on verifie la config pour chaque store
|
| 25 |
+
$storeIds = $this->getStoreIds();
|
| 26 |
+
foreach ($storeIds as $storeId) {
|
| 27 |
+
$baseStoreId = $storeId;
|
| 28 |
+
$client = Mage::getModel('opensi/client')->loadByStore($storeId);
|
| 29 |
+
// le client du store existe, on utilise sa config
|
| 30 |
+
if (!empty($client)) {
|
| 31 |
+
$webservices = Mage::getModel('opensi/webservice')->getCollection()->addFieldToFilter('client_id,', $client->id);
|
| 32 |
+
} else {
|
| 33 |
+
$webservices = $webservicesDefault;
|
| 34 |
+
$client = $clientDefault;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
if (!empty($webservices)) {
|
| 38 |
+
foreach ($webservices as $webservice) {
|
| 39 |
+
$webserviceName = $webservice->getName();
|
| 40 |
+
$lastStartString = $webservice->getStartedAt();
|
| 41 |
+
// si y'a pas date de dernier lancement, on tous les articles, et les commandes / clients du jour
|
| 42 |
+
if (empty($lastStartString)) {
|
| 43 |
+
if ($webserviceName == 'createArticle'){
|
| 44 |
+
$lastStart = new DateTime('1970-01-01');
|
| 45 |
+
} else {
|
| 46 |
+
$lastStart = new DateTime(date('Y-m-d'));
|
| 47 |
+
}
|
| 48 |
+
} else {
|
| 49 |
+
$lastStart = new DateTime($lastStartString);
|
| 50 |
+
}
|
| 51 |
+
$frequency = $webservice->getFrequency();
|
| 52 |
+
$now = new Datetime();
|
| 53 |
+
|
| 54 |
+
$interval = ($now->format('U') - $lastStart->format('U')) / 60;
|
| 55 |
+
// si le temps passe depuis le dernier lancement est superieur ou egal a la frequence de lancement
|
| 56 |
+
if ($interval >= $frequency) {
|
| 57 |
+
|
| 58 |
+
// on prend une marge pour pas rater d'infos
|
| 59 |
+
$lastStart->modify('-5 min');
|
| 60 |
+
|
| 61 |
+
$webservice->setStartedAt($now->format('Y-m-d H:i:s'));
|
| 62 |
+
$webservice->save();
|
| 63 |
+
if ($webserviceName == 'createArticle' || $webserviceName == 'updateArticle'){
|
| 64 |
+
Mage::log('in ARTICLE', null, 'opensi.log');
|
| 65 |
+
$storeId = 0;
|
| 66 |
+
} else {
|
| 67 |
+
$storeId = $baseStoreId;
|
| 68 |
+
}
|
| 69 |
+
Mage::log('debut ' . $webserviceName . ' store ' . $storeId, null, 'opensi.log');
|
| 70 |
+
Mage::getModel('opensi/webservices')->$webserviceName($lastStart, $client, $storeId);
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
/**
|
| 78 |
+
* Retourne la liste des store_id
|
| 79 |
+
* @return array $storeList liste des store_id excluant le store par defaut
|
| 80 |
+
*/
|
| 81 |
+
protected function getStoreIds() {
|
| 82 |
+
$stores = Mage::getModel('core/store_group')
|
| 83 |
+
->getResourceCollection()
|
| 84 |
+
->setLoadDefault(true)
|
| 85 |
+
->load();
|
| 86 |
+
|
| 87 |
+
$stores = $stores->toArray();
|
| 88 |
+
$stores = $stores['items'];
|
| 89 |
+
|
| 90 |
+
$storeList = array();
|
| 91 |
+
foreach ($stores as $store) {
|
| 92 |
+
if ($store['default_store_id'] != '0') {
|
| 93 |
+
array_push($storeList, $store['default_store_id']);
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
return $storeList;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
}
|
app/code/community/Speedinfo/Opensi/Model/Errorlog.php
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Model de la table error_log
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Model_Errorlog extends Mage_Core_Model_Abstract {
|
| 10 |
+
|
| 11 |
+
protected function _construct(){
|
| 12 |
+
parent::_construct();
|
| 13 |
+
$this->_init('opensi/errorlog');
|
| 14 |
+
}
|
| 15 |
+
}
|
app/code/community/Speedinfo/Opensi/Model/Mysql4/Client.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Model mysql4 de la table client
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Model_Mysql4_Client extends Mage_Core_Model_Mysql4_Abstract{
|
| 10 |
+
|
| 11 |
+
protected function _construct(){
|
| 12 |
+
$this->_init('opensi/client', 'id');
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
protected function _initDb(){
|
| 16 |
+
$resource = Mage::getSingleton('core/resource');
|
| 17 |
+
return $resource;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
//Récupération des clients par store_id
|
| 21 |
+
public function loadByStore($storeId){
|
| 22 |
+
$read = $this->_initDb()->getConnection('core_read');
|
| 23 |
+
$client = $read->query("SELECT * FROM ".$this->getTable('opensi/client')." WHERE store_id=".$storeId)->fetchObject();
|
| 24 |
+
return $client;
|
| 25 |
+
}
|
| 26 |
+
}
|
app/code/community/Speedinfo/Opensi/Model/Mysql4/Errorlog.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Model mysql4 de la table error_log
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Model_Mysql4_Errorlog extends Mage_Core_Model_Mysql4_Abstract{
|
| 10 |
+
|
| 11 |
+
protected function _construct(){
|
| 12 |
+
$this->_init('opensi/error_log', 'id');
|
| 13 |
+
}
|
| 14 |
+
}
|
app/code/community/Speedinfo/Opensi/Model/Mysql4/Errorlog/Collection.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Model mysql4 de la collection de la table error_log
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Model_Mysql4_Errorlog_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 10 |
+
{
|
| 11 |
+
|
| 12 |
+
protected function _construct()
|
| 13 |
+
{
|
| 14 |
+
$this->_init('opensi/errorlog');
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
}
|
app/code/community/Speedinfo/Opensi/Model/Mysql4/Webservice.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Model mysql4 de la table webservice
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Model_Mysql4_Webservice extends Mage_Core_Model_Mysql4_Abstract{
|
| 10 |
+
|
| 11 |
+
protected function _construct(){
|
| 12 |
+
$this->_init('opensi/webservice', 'id');
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
protected function _initDb(){
|
| 16 |
+
$resource = Mage::getSingleton('core/resource');
|
| 17 |
+
return $resource;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
//Récupération des informtions sur les webservices par name de webservice et id du client
|
| 21 |
+
public function loadByNameClient($name,$clientId){
|
| 22 |
+
$read = $this->_initDb()->getConnection('core_read');
|
| 23 |
+
$ws = $read->query("SELECT * FROM ".$this->getTable('opensi/webservice')." WHERE name='".$name."' AND client_id=".$clientId)->fetchObject();
|
| 24 |
+
return $ws;
|
| 25 |
+
}
|
| 26 |
+
}
|
app/code/community/Speedinfo/Opensi/Model/Mysql4/Webservice/Collection.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Model mysql4 de la collection de la table webservice
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Model_Mysql4_Webservice_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 10 |
+
{
|
| 11 |
+
|
| 12 |
+
protected function _construct()
|
| 13 |
+
{
|
| 14 |
+
$this->_init('opensi/webservice');
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
}
|
app/code/community/Speedinfo/Opensi/Model/Webservice.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Model des webservices
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Speedinfo_Opensi_Model_Webservice extends Mage_Core_Model_Abstract {
|
| 10 |
+
|
| 11 |
+
protected function _construct(){
|
| 12 |
+
parent::_construct();
|
| 13 |
+
$this->_init('opensi/webservice');
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
public function loadByNameClient($name,$client){
|
| 17 |
+
return Mage::getResourceModel('opensi/webservice')->loadByNameClient($name,$client);
|
| 18 |
+
}
|
| 19 |
+
}
|
app/code/community/Speedinfo/Opensi/Model/Webservices.php
ADDED
|
@@ -0,0 +1,648 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Communication des donnees entre opensi et magento
|
| 5 |
+
*
|
| 6 |
+
* @Author Speedinfo
|
| 7 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 8 |
+
*/
|
| 9 |
+
class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Envoie des donnees au serveur OpenSI
|
| 13 |
+
* @param String $method POST / GET / PUT
|
| 14 |
+
* @param String $action action a effectuer
|
| 15 |
+
* @param String $xmlData donnees a envoyer format XML
|
| 16 |
+
* @param Array $client les infos sur le client opensi
|
| 17 |
+
* @param Array $params liste des parametres a envoyer au serveur
|
| 18 |
+
* @return String $response reponse du serveur
|
| 19 |
+
*/
|
| 20 |
+
protected function sendData($method, $action, $xmlData, $client, $params = '') {
|
| 21 |
+
|
| 22 |
+
$httpRequest = new Zend_Http_Client();
|
| 23 |
+
$httpRequest->setAuth($client->webservice_user, $client->webservice_pwd);
|
| 24 |
+
$httpRequest->setUri('https://webservices.opensi.eu/cows/Gateway');
|
| 25 |
+
$httpRequest->setParameterGet(array('service_id' => $client->opensi_id, 'action' => $action));
|
| 26 |
+
if (!empty($xmlData))
|
| 27 |
+
$httpRequest->setRawData($xmlData, 'text/xml');
|
| 28 |
+
if (!empty($params))
|
| 29 |
+
$httpRequest->setParameterGet($params);
|
| 30 |
+
|
| 31 |
+
$response = $httpRequest->request($method);
|
| 32 |
+
|
| 33 |
+
//on gere les logs / erreurs
|
| 34 |
+
if ($response->isError() && $response->getStatus() != '409') {
|
| 35 |
+
$this->setLogs($response, $client, $action);
|
| 36 |
+
}
|
| 37 |
+
Mage::log($httpRequest, null, 'opensi.log');
|
| 38 |
+
|
| 39 |
+
return $response->getRawBody();
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
protected function createXml() {
|
| 43 |
+
$docXml = new DomDocument('1.0', 'UTF-8');
|
| 44 |
+
$docXml->formatOutput = true;
|
| 45 |
+
|
| 46 |
+
return $docXml;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Envoie des nouvelles commandes vers OpenSI
|
| 51 |
+
*/
|
| 52 |
+
public function createCommandeWeb($startedAt, $client, $storeId) {
|
| 53 |
+
$orderCollection = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))->addFieldToFilter('store_id', $storeId);
|
| 54 |
+
|
| 55 |
+
if ($orderCollection->count() > 0) {
|
| 56 |
+
$this->createArticle($startedAt, $client, $storeId);
|
| 57 |
+
$this->createClientWeb($startedAt, $client, $storeId);
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
foreach ($orderCollection as $order) {
|
| 61 |
+
$docXml = $this->createXml();
|
| 62 |
+
$request = $docXml->createElement("request");
|
| 63 |
+
|
| 64 |
+
$docXml->appendChild($request);
|
| 65 |
+
$commandeWeb = $docXml->createElement("Commande_Web");
|
| 66 |
+
|
| 67 |
+
$orderDate = new Datetime($order->getCreatedAt());
|
| 68 |
+
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
| 69 |
+
// Informations de commande
|
| 70 |
+
$commandeWeb->setAttribute('Num_Com_Web', $order->getIncrementId());
|
| 71 |
+
$commandeWeb->setAttribute('Code_Site_Web', $client->web_site_code);
|
| 72 |
+
$commandeWeb->setAttribute('Login', $customer->getEmail());
|
| 73 |
+
$commandeWeb->setAttribute('Date_Commande', $orderDate->format('d-m-Y H:i:s'));
|
| 74 |
+
//prix en ttc ou ht ?
|
| 75 |
+
$commandeWeb->setAttribute('Edition_TTC', 0);
|
| 76 |
+
$commandeWeb->setAttribute('Frais_Port', $order->getShippingAmount());
|
| 77 |
+
|
| 78 |
+
// recuperation du taux de tva sur les frais de port
|
| 79 |
+
$taxClassId = Mage::getStoreConfig('tax/classes/shipping_tax_class', $storeId);
|
| 80 |
+
if ($taxClassId != 0) {
|
| 81 |
+
$taxRequest = Mage::getSingleton('tax/calculation')->getRateRequest($order->getShippingAddress(), $order->getBillingAddress(), "", $storeId);
|
| 82 |
+
$percent = Mage::getSingleton('tax/calculation')->getRate($taxRequest->setProductClassId($taxClassId));
|
| 83 |
+
} else {
|
| 84 |
+
$percent = 0;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
$commandeWeb->setAttribute('Taux_Tva_Port', $percent);
|
| 88 |
+
$totalTTC = $order->getSubtotal() + $order->getBaseTaxAmount();
|
| 89 |
+
//$commandeWeb->setAttribute('Remise_Pourc', ((($totalTTC - ($order->getBaseGrandTotal() - $order->getBaseShippingAmount())) / $totalTTC) * 100));
|
| 90 |
+
$commandeWeb->setAttribute('Remise_Pourc', '0');
|
| 91 |
+
$commandeWeb->setAttribute('Mode_Reglement', $order->getPayment()->getMethod());
|
| 92 |
+
|
| 93 |
+
// Informations de facturation
|
| 94 |
+
$commandeWeb->setAttribute('Civ_Fact', 0);
|
| 95 |
+
$commandeWeb->setAttribute('Nom_Fact', $order->getBillingAddress()->getLastname());
|
| 96 |
+
$commandeWeb->setAttribute('Prenom_Fact', $order->getBillingAddress()->getFirstname());
|
| 97 |
+
$billingCompany = $order->getBillingAddress()->getCompany();
|
| 98 |
+
if (!empty($billingCompany))
|
| 99 |
+
$commandeWeb->setAttribute('Societe_Fact', $billingCompany);
|
| 100 |
+
$commandeWeb->setAttribute('Adresse_1_Fact', $order->getBillingAddress()->getStreet1());
|
| 101 |
+
$billingStreet2 = $order->getBillingAddress()->getStreet2();
|
| 102 |
+
$billingStreet3 = $order->getBillingAddress()->getStreet3();
|
| 103 |
+
if (!empty($billingStreet2))
|
| 104 |
+
$commandeWeb->setAttribute('Adresse_2_Fact', $billingStreet2);
|
| 105 |
+
if (!empty($billingStreet3))
|
| 106 |
+
$commandeWeb->setAttribute('Adresse_3_Fact', $billingStreet3);
|
| 107 |
+
$commandeWeb->setAttribute('Code_Postal_Fact', $order->getBillingAddress()->getPostcode());
|
| 108 |
+
$commandeWeb->setAttribute('Ville_Fact', $order->getBillingAddress()->getCity());
|
| 109 |
+
$commandeWeb->setAttribute('Code_Pays_Fact', $order->getBillingAddress()->getCountry());
|
| 110 |
+
$billingPhone = $order->getBillingAddress()->getTelephone();
|
| 111 |
+
if (!empty($billingPhone))
|
| 112 |
+
$commandeWeb->setAttribute('Tel_Fact', $billingPhone);
|
| 113 |
+
$billingFax = $order->getBillingAddress()->getFax();
|
| 114 |
+
if (!empty($billingFax))
|
| 115 |
+
$commandeWeb->setAttribute('Fax_Fact', $billingFax);
|
| 116 |
+
$commandeWeb->setAttribute('Email_Fact', $customer->getEmail());
|
| 117 |
+
|
| 118 |
+
//Informations de livraison
|
| 119 |
+
$commandeWeb->setAttribute('Civ_Liv', 0);
|
| 120 |
+
$commandeWeb->setAttribute('Nom_Liv', $order->getShippingAddress()->getLastname());
|
| 121 |
+
$commandeWeb->setAttribute('Prenom_Liv', $order->getShippingAddress()->getFirstname());
|
| 122 |
+
$shippingCompany = $order->getShippingAddress()->getCompany();
|
| 123 |
+
if (!empty($shippingCompany))
|
| 124 |
+
$commandeWeb->setAttribute('Societe_Liv', $shippingCompany);
|
| 125 |
+
$commandeWeb->setAttribute('Adresse_1_Liv', $order->getShippingAddress()->getStreet1());
|
| 126 |
+
$shippingStreet2 = $order->getShippingAddress()->getStreet2();
|
| 127 |
+
$shippingStreet3 = $order->getShippingAddress()->getStreet3();
|
| 128 |
+
if (!empty($shippingStreet2))
|
| 129 |
+
$commandeWeb->setAttribute('Adresse_2_Liv', $shippingStreet2);
|
| 130 |
+
if (!empty($shippingStreet3))
|
| 131 |
+
$commandeWeb->setAttribute('Adresse_3_Liv', $shippingStreet3);
|
| 132 |
+
$commandeWeb->setAttribute('Code_Postal_Liv', $order->getShippingAddress()->getPostcode());
|
| 133 |
+
$commandeWeb->setAttribute('Ville_Liv', $order->getShippingAddress()->getCity());
|
| 134 |
+
$commandeWeb->setAttribute('Code_Pays_Liv', $order->getShippingAddress()->getCountry());
|
| 135 |
+
$shippingPhone = $order->getShippingAddress()->getTelephone();
|
| 136 |
+
if (!empty($shippingPhone))
|
| 137 |
+
$commandeWeb->setAttribute('Tel_Liv', $shippingPhone);
|
| 138 |
+
$shippingFax = $order->getShippingAddress()->getFax();
|
| 139 |
+
if (!empty($shippingFax))
|
| 140 |
+
$commandeWeb->setAttribute('Fax_Liv', $shippingFax);
|
| 141 |
+
$commandeWeb->setAttribute('Email_Liv', $customer->getEmail());
|
| 142 |
+
|
| 143 |
+
$request->appendChild($commandeWeb);
|
| 144 |
+
|
| 145 |
+
// Informations du contenu de la commande
|
| 146 |
+
foreach ($order->getAllVisibleItems() as $item) {
|
| 147 |
+
$ligneCommandeClient = $docXml->createElement("Ligne_Commande_Client");
|
| 148 |
+
|
| 149 |
+
$ligneCommandeClient->setAttribute('Reference', $item->getSku());
|
| 150 |
+
$ligneCommandeClient->setAttribute('Designation', $item->getName());
|
| 151 |
+
$ligneCommandeClient->setAttribute('Quantite', $item->getQtyOrdered());
|
| 152 |
+
$ligneCommandeClient->setAttribute('Prix_Unitaire', $item->getPrice());
|
| 153 |
+
$discountAmount = $item->getDiscountAmount();
|
| 154 |
+
|
| 155 |
+
//Si il existe une remise en valeur
|
| 156 |
+
if (!empty($discountAmount) && $item->getPrice() != 0) {
|
| 157 |
+
$discount = (1 - (($item->getPrice() - $item->getDiscountAmount()) / $item->getPrice())) * 100;
|
| 158 |
+
$discount = round($discount, 2);
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
$discountPourcent = $item->getDiscountPercent();
|
| 162 |
+
//Si il existe un poucentage de remise.
|
| 163 |
+
if ($discountPourcent != 0) {
|
| 164 |
+
$discount = $discountPourcent;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
//Si il existe les 2 types de remise % et montant
|
| 168 |
+
if (!empty($discountAmount) && !empty($discountPourcent)) {
|
| 169 |
+
$discountValeurDepuisPourcentage = ($item->getPrice() * $discountPourcent) / 100;
|
| 170 |
+
$discountTotalValue = $discountAmount + $discountValeurDepuisPourcentage;
|
| 171 |
+
$discountPourcent = (1 - (($item->getPrice() - $discountTotalValue) / $item->getPrice())) * 100;
|
| 172 |
+
$discount = $discountPourcent;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
$ligneCommandeClient->setAttribute('Remise_Pourc', $discount);
|
| 176 |
+
$ligneCommandeClient->setAttribute('Taux_Tva', $item->getTaxPercent());
|
| 177 |
+
|
| 178 |
+
$commandeWeb->appendChild($ligneCommandeClient);
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
$this->sendData('POST', 'create_commande_web', $docXml->saveXml(), $client);
|
| 182 |
+
} // endforeach $ordercollection
|
| 183 |
+
|
| 184 |
+
if ($orderCollection->count() > 0) {
|
| 185 |
+
$this->createTransactionBancaire($startedAt, $client, $storeId);
|
| 186 |
+
}
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/**
|
| 190 |
+
* Envoie des nouveaux produits vers OpenSI
|
| 191 |
+
*/
|
| 192 |
+
public function createArticle($startedAt, $client, $storeId) {
|
| 193 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection()->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
|
| 194 |
+
->addFieldToFilter('type_id', array('nin' => array('configurable', 'grouped')))->addStoreFilter($storeId)
|
| 195 |
+
->addAttributeToSelect(array('sku', 'price', 'name', 'description', 'short_description', 'manufacturer', 'weight', 'status'));
|
| 196 |
+
foreach ($productCollection as $product) {
|
| 197 |
+
$articleData = $this->articleData($product, $storeId);
|
| 198 |
+
$this->sendData('POST', 'create_article', $articleData, $client);
|
| 199 |
+
} // endforeach $productCollection
|
| 200 |
+
if ($productCollection->count() > 0)
|
| 201 |
+
$this->setPubwebArticle($startedAt, $client, $storeId);
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
/**
|
| 205 |
+
* Envoie des produits modifies vers OpenSI
|
| 206 |
+
*/
|
| 207 |
+
public function updateArticle($startedAt, $client, $storeId) {
|
| 208 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection()->addFieldToFilter('updated_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
|
| 209 |
+
->addFieldToFilter('created_at', array('lteq' => $startedAt->format('Y-m-d H:i:s')))->addStoreFilter($storeId)
|
| 210 |
+
->addAttributeToSelect(array('sku', 'price', 'name', 'description', 'short_description', 'manufacturer', 'weight', 'status'));
|
| 211 |
+
|
| 212 |
+
foreach ($productCollection as $product) {
|
| 213 |
+
$articleData = $this->articleData($product, $storeId);
|
| 214 |
+
$params = array('reference' => $product->getSku());
|
| 215 |
+
$this->sendData('PUT', 'update_article', $articleData, $client, $params);
|
| 216 |
+
} // endforeach $productCollection
|
| 217 |
+
if ($productCollection->count() > 0)
|
| 218 |
+
$this->setPubwebArticle($startedAt, $client, $storeId);
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
/**
|
| 222 |
+
* Creation du XML pour la creation / modification de produits
|
| 223 |
+
*/
|
| 224 |
+
public function articleData($product, $storeId) {
|
| 225 |
+
$docXml = $this->createXml();
|
| 226 |
+
$request = $docXml->createElement("request");
|
| 227 |
+
|
| 228 |
+
$docXml->appendChild($request);
|
| 229 |
+
$article = $docXml->createElement('Article');
|
| 230 |
+
|
| 231 |
+
// Informations du produit
|
| 232 |
+
$article->setAttribute('Reference', $product->getSku());
|
| 233 |
+
$article->setAttribute('Designation', $product->getName());
|
| 234 |
+
$article->setAttribute('Description_1', $product->getDescription());
|
| 235 |
+
$shortDescription = $product->getShortDescription();
|
| 236 |
+
if (!empty($shortDescription))
|
| 237 |
+
$article->setattribute('Description_2', $shortDescription);
|
| 238 |
+
$brand = $product->getAttributeText('manufacturer');
|
| 239 |
+
if (!empty($brand))
|
| 240 |
+
$article->setAttribute('Marque', $brand);
|
| 241 |
+
$categories = $product->getCategoryIds();
|
| 242 |
+
|
| 243 |
+
//limite a 3 categories
|
| 244 |
+
$i = 1;
|
| 245 |
+
$empty = true;
|
| 246 |
+
foreach ($categories as $category) {
|
| 247 |
+
$empty = false;
|
| 248 |
+
$category = Mage::getModel('catalog/category')->load($category);
|
| 249 |
+
$article->setAttribute('Famille_' . $i, $category->getName());
|
| 250 |
+
if ($i >= 3)
|
| 251 |
+
break;
|
| 252 |
+
$i++;
|
| 253 |
+
}
|
| 254 |
+
if($empty) $article->setAttribute('Famille_1','NC');
|
| 255 |
+
|
| 256 |
+
$weight = $product->getWeight();
|
| 257 |
+
if (!empty($weight))
|
| 258 |
+
$article->setAttribute('Poids', $weight);
|
| 259 |
+
$includeTax = Mage::getStoreConfig('tax/calculation/price_includes_tax', $storeId);
|
| 260 |
+
// Mage::log('tax :' . $includeTax);
|
| 261 |
+
if ($includeTax) {
|
| 262 |
+
$article->setAttribute('Tarif_TTC_1', $product->getFinalPrice());
|
| 263 |
+
} else {
|
| 264 |
+
$article->setAttribute('Tarif_HT_1', $product->getFinalPrice());
|
| 265 |
+
}
|
| 266 |
+
$updatedAt = new Datetime($product->getUpdatedAt());
|
| 267 |
+
$createdAt = new Datetime($product->getCreatedAt());
|
| 268 |
+
$article->setAttribute('Date_M', $updatedAt->format('d-m-Y H:i:s'));
|
| 269 |
+
$article->setAttribute('Date_C', $createdAt->format('d-m-Y H:i:s'));
|
| 270 |
+
//$active = $product->getStatus();
|
| 271 |
+
// Mage::log('active :' . $active);
|
| 272 |
+
//if ($active == 2) {
|
| 273 |
+
// $active = "false";
|
| 274 |
+
//} else {
|
| 275 |
+
$active = "true";
|
| 276 |
+
//}
|
| 277 |
+
$article->setAttribute('Actif', $active);
|
| 278 |
+
|
| 279 |
+
$request->appendChild($article);
|
| 280 |
+
|
| 281 |
+
return $docXml->saveXML();
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
/**
|
| 285 |
+
* Envoie des nouveaux clients vers OpenSI
|
| 286 |
+
*/
|
| 287 |
+
public function createClientWeb($startedAt, $client, $storeId) {
|
| 288 |
+
|
| 289 |
+
$customerCollection = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
|
| 290 |
+
->addAttributeToSelect(array('lastname', 'firstname'))->addAttributeToFilter('website_id', Mage::getModel('core/store')->load($storeId)->getWebsiteId());
|
| 291 |
+
|
| 292 |
+
foreach ($customerCollection as $customer) {
|
| 293 |
+
$clientData = $this->clientData($customer, $client);
|
| 294 |
+
$this->sendData('POST', 'create_client_web', $clientData, $client);
|
| 295 |
+
}
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
/**
|
| 299 |
+
* Envoie des clients modifies vers OpenSI
|
| 300 |
+
*/
|
| 301 |
+
public function updateClientWeb($startedAt, $client, $storeId) {
|
| 302 |
+
|
| 303 |
+
$customerCollection = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('updated_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
|
| 304 |
+
->addFieldToFilter('created_at', array('lteq' => $startedAt->format('Y-m-d H:i:s')))->addAttributeToSelect(array('lastname', 'firstname'))->addAttributeToFilter('website_id', Mage::getModel('core/store')->load($storeId)->getWebsiteId());
|
| 305 |
+
|
| 306 |
+
foreach ($customerCollection as $customer) {
|
| 307 |
+
$clientData = $this->clientData($customer, $client);
|
| 308 |
+
$params = array('code_site_web' => $client->web_site_code, 'login' => $customer->getId());
|
| 309 |
+
$this->sendData('PUT', 'update_client_web', $clientData, $client, $params);
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
/**
|
| 314 |
+
* Creation du XML pour la creation / modification de clients
|
| 315 |
+
*/
|
| 316 |
+
public function clientData($customer, $client) {
|
| 317 |
+
$docXml = $this->createXml();
|
| 318 |
+
$request = $docXml->createElement("request");
|
| 319 |
+
|
| 320 |
+
$docXml->appendChild($request);
|
| 321 |
+
$clientWeb = $docXml->createElement('Client_Web');
|
| 322 |
+
|
| 323 |
+
// Informations du client
|
| 324 |
+
$clientWeb->setAttribute('Code_Site_Web', $client->web_site_code);
|
| 325 |
+
$clientWeb->setAttribute('Login', $customer->getId());
|
| 326 |
+
$clientWeb->setAttribute('Civilite', '0');
|
| 327 |
+
$clientWeb->setAttribute('Nom', $customer->getLastname());
|
| 328 |
+
$clientWeb->setAttribute('Prenom', $customer->getFirstname());
|
| 329 |
+
$clientWeb->setAttribute('Adresse_1', 'NC');
|
| 330 |
+
$clientWeb->setAttribute('Ville', 'NC');
|
| 331 |
+
$clientWeb->setAttribute('Code_Pays', 'FR');
|
| 332 |
+
$clientWeb->setAttribute('Email', $customer->getEmail());
|
| 333 |
+
|
| 334 |
+
$request->appendChild($clientWeb);
|
| 335 |
+
|
| 336 |
+
return $docXml->saveXML();
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
/**
|
| 340 |
+
* Recuperation des stocks depuis OpenSI et mise a jour du site
|
| 341 |
+
*/
|
| 342 |
+
public function getStockArticle($startedAt, $client, $storeId) {
|
| 343 |
+
$params = array('code_depot' => $client->deposit, 'date_debut' => $startedAt->format('d-m-Y'));
|
| 344 |
+
|
| 345 |
+
$resultXML = $this->sendData("GET", "get_stock_article", "", $client, $params);
|
| 346 |
+
|
| 347 |
+
$xmlDomDocument = new DomDocument();
|
| 348 |
+
$xmlDomDocument->loadXML($resultXML);
|
| 349 |
+
|
| 350 |
+
$stockArticles = $xmlDomDocument->getElementsByTagName("Stock_Article");
|
| 351 |
+
|
| 352 |
+
foreach ($stockArticles as $stockArticle) {
|
| 353 |
+
|
| 354 |
+
$sku = $stockArticle->getAttribute('Reference');
|
| 355 |
+
$qty = $stockArticle->getAttribute('Stock_Dispo');
|
| 356 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
|
| 357 |
+
if ($product) {
|
| 358 |
+
$stockArticle = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId());
|
| 359 |
+
if ($qty > 0) {
|
| 360 |
+
$stockArticle->setQty($qty);
|
| 361 |
+
$stockArticle->setIsInStock(true);
|
| 362 |
+
} else {
|
| 363 |
+
$stockArticle->setQty(0);
|
| 364 |
+
$stockArticle->setIsInStock(false);
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
$stockArticle->setStoreId($storeId);
|
| 368 |
+
$stockArticle->save();
|
| 369 |
+
}
|
| 370 |
+
}
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
/**
|
| 374 |
+
* Envoie des infos de paiement a OpenSI
|
| 375 |
+
*/
|
| 376 |
+
public function createTransactionBancaire($startedAt, $client, $storeId) {
|
| 377 |
+
//recuperation des commandes
|
| 378 |
+
$orderCollection = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))->addFieldToFilter('store_id', $storeId);
|
| 379 |
+
|
| 380 |
+
foreach ($orderCollection as $order) {
|
| 381 |
+
$methodPayment = $order->getPayment()->getMethod();
|
| 382 |
+
$numOrder = $order->getIncrementId();
|
| 383 |
+
$numeroTransaction = $numOrder;
|
| 384 |
+
|
| 385 |
+
$invoiceCollection = Mage::getResourceModel('sales/order_invoice_collection')
|
| 386 |
+
->addAttributeToSelect('order_id')
|
| 387 |
+
->addAttributeToSelect('increment_id')
|
| 388 |
+
->addAttributeToSelect('created_at')
|
| 389 |
+
->addAttributeToSelect('state')
|
| 390 |
+
->addAttributeToSelect('base_grand_total')
|
| 391 |
+
->setOrderFilter($order);
|
| 392 |
+
|
| 393 |
+
$dateTransaction = "";
|
| 394 |
+
$montant = 0;
|
| 395 |
+
$bool = false;
|
| 396 |
+
foreach ($invoiceCollection as $invoice) {
|
| 397 |
+
//On vérifie que la facture est payé
|
| 398 |
+
if ($invoice->getState() == 2) {
|
| 399 |
+
$bool = true;
|
| 400 |
+
$dateTransaction = $invoice->getCreatedAt();
|
| 401 |
+
$montant += $invoice->getBaseGrandTotal();
|
| 402 |
+
}
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
if ($bool) {
|
| 406 |
+
$dateTransaction = new Datetime($dateTransaction);
|
| 407 |
+
|
| 408 |
+
$docXml = $this->createXml();
|
| 409 |
+
$request = $docXml->createElement("request");
|
| 410 |
+
|
| 411 |
+
$docXml->appendChild($request);
|
| 412 |
+
$transactionComWeb = $docXml->createElement("Transaction_Com_Web");
|
| 413 |
+
|
| 414 |
+
$transactionComWeb->setAttribute('Code_Site_Web', $client->web_site_code);
|
| 415 |
+
$transactionComWeb->setAttribute('Num_Com_Web', $numOrder);
|
| 416 |
+
$transactionComWeb->setAttribute('Num_Transaction', $numeroTransaction);
|
| 417 |
+
$transactionComWeb->setAttribute('Mode_Reglement', $methodPayment);
|
| 418 |
+
$transactionComWeb->setAttribute('Date_Transaction', $dateTransaction->format('d-m-Y'));
|
| 419 |
+
$transactionComWeb->setAttribute('Montant', $montant);
|
| 420 |
+
|
| 421 |
+
$request->appendChild($transactionComWeb);
|
| 422 |
+
|
| 423 |
+
$this->sendData('POST', 'create_transaction_bancaire', $docXml->saveXml(), $client);
|
| 424 |
+
}
|
| 425 |
+
}
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
/**
|
| 429 |
+
* Recuperation des etats de commande depuis OpenSI et mise a jour du site
|
| 430 |
+
*/
|
| 431 |
+
public function getEtatCommande($startedAt, $client, $storeId) {
|
| 432 |
+
$params = array('code_site_web' => $client->web_site_code, 'date_debut' => $startedAt->format('d-m-Y'));
|
| 433 |
+
$resultXML = $this->sendData("GET", "get_etat_commande", "", $client, $params);
|
| 434 |
+
|
| 435 |
+
$xmlDomDocument = new DomDocument();
|
| 436 |
+
$xmlDomDocument->loadXML($resultXML);
|
| 437 |
+
$listEtatCommande = $xmlDomDocument->getElementsByTagName("Etat_Commande");
|
| 438 |
+
|
| 439 |
+
foreach ($listEtatCommande as $etatCommande) {
|
| 440 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($etatCommande->getAttribute('Num_Com_Web'));
|
| 441 |
+
|
| 442 |
+
if (!$order->getId()) {
|
| 443 |
+
continue;
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
//recup du statut de paiement = si termine on facture pour considerer la commande paye
|
| 447 |
+
if ($etatCommande->getAttribute('Statut_Paiement') == 'T') {
|
| 448 |
+
|
| 449 |
+
if ($order->canInvoice()) {
|
| 450 |
+
$invoiceCollection = $order->getInvoiceCollection();
|
| 451 |
+
$invoiceId = '';
|
| 452 |
+
foreach ($invoiceCollection as $invoice) {
|
| 453 |
+
$invoiceId = $invoice->getIncrementId();
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
if (empty($invoiceId))
|
| 457 |
+
$invoiceId = Mage::getModel('sales/order_invoice_api')->create($order->getIncrementId(), array());
|
| 458 |
+
|
| 459 |
+
$invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId($invoiceId);
|
| 460 |
+
if ($invoice->canCapture()) {
|
| 461 |
+
$invoice->capture();
|
| 462 |
+
}
|
| 463 |
+
$invoice->save();
|
| 464 |
+
}
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
//recup du statut de livraison
|
| 469 |
+
if ($etatCommande->getAttribute('Statut_Logistique') == 'E') {
|
| 470 |
+
|
| 471 |
+
if ($order->canShip()) {
|
| 472 |
+
$shipmentCollection = $order->getShipmentsCollection();
|
| 473 |
+
$shipmentId = '';
|
| 474 |
+
foreach ($shipmentCollection as $shipment) {
|
| 475 |
+
$shipmentId = $shipment->getIncrementId();
|
| 476 |
+
}
|
| 477 |
+
Mage::log('shipmentId = ' . $shipmentId);
|
| 478 |
+
if (empty($shipmentId))
|
| 479 |
+
$shipmentId = Mage::getModel('sales/order_shipment_api')->create($order->getIncrementId(), array());
|
| 480 |
+
}
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
$status = $order->getStatus();
|
| 484 |
+
//passer derniere valeur a true pour envoyer mail au client
|
| 485 |
+
switch ($etatCommande->getAttribute('Etat')) {
|
| 486 |
+
case 'N':
|
| 487 |
+
if ($status != 'pending')
|
| 488 |
+
$order->setState('pending', true, 'changement de statut OpenSI', false);
|
| 489 |
+
break;
|
| 490 |
+
|
| 491 |
+
case 'T':
|
| 492 |
+
if ($status != 'processing')
|
| 493 |
+
$order->setState('processing', true, 'changement de statut OpenSI', false);
|
| 494 |
+
break;
|
| 495 |
+
|
| 496 |
+
case 'A':
|
| 497 |
+
if ($status != 'canceled')
|
| 498 |
+
$order->setState('canceled', true, 'changement de statut OpenSI', false);
|
| 499 |
+
break;
|
| 500 |
+
|
| 501 |
+
case 'C':
|
| 502 |
+
if ($status != 'complete' && Mage::getVersion() > '1.4.0.0')
|
| 503 |
+
$order->setState('complete', true, 'changement de statut OpenSI', false);
|
| 504 |
+
break;
|
| 505 |
+
}
|
| 506 |
+
$order->save();
|
| 507 |
+
}
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
/**
|
| 511 |
+
* Recuperation des infos de suivi de colis depuis OpenSI et mise a jour du site
|
| 512 |
+
*/
|
| 513 |
+
public function getTrackingColis($startedAt, $client, $storeId) {
|
| 514 |
+
$now = new Datetime();
|
| 515 |
+
$params = array('code_site_web' => $client->web_site_code, 'date_debut' => $startedAt->format('d-m-Y'), 'date_fin' => $now->format('d-m-Y'));
|
| 516 |
+
$resultXML = $this->sendData("GET", "get_tracking_colis", "", $client, $params);
|
| 517 |
+
|
| 518 |
+
$xmlDomDocument = new DomDocument();
|
| 519 |
+
$xmlDomDocument->loadXML($resultXML);
|
| 520 |
+
$listExpedition = $xmlDomDocument->getElementsByTagName("Colis_Expedition");
|
| 521 |
+
|
| 522 |
+
foreach ($listExpedition as $expedition) {
|
| 523 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($expedition->getAttribute('Num_Com_Web'));
|
| 524 |
+
/**
|
| 525 |
+
* Check order existing
|
| 526 |
+
*/
|
| 527 |
+
if (!$order->getId()) {
|
| 528 |
+
continue;
|
| 529 |
+
}
|
| 530 |
+
/**
|
| 531 |
+
* Check shipment create availability
|
| 532 |
+
*/
|
| 533 |
+
if (!$order->canShip()) {
|
| 534 |
+
continue;
|
| 535 |
+
}
|
| 536 |
+
$shipmentCollection = $order->getShipmentsCollection();
|
| 537 |
+
$shipmentId = '';
|
| 538 |
+
foreach ($shipmentCollection as $shipment) {
|
| 539 |
+
$shipmentId = $shipment->getIncrementId();
|
| 540 |
+
}
|
| 541 |
+
if (empty($shipmentId))
|
| 542 |
+
$shipmentId = Mage::getModel('sales/order_shipment_api')->create($order->getIncrementId(), array());
|
| 543 |
+
$track = Mage::getModel('sales/order_shipment_api')->addTrack($shipmentId, "custom", $expedition->getAttribute('Transporteur') . ' - ' . $expedition->getAttribute('Mode_Expedition'), $expedition->getAttribute('Num_Colis'));
|
| 544 |
+
}
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
/**
|
| 548 |
+
* Recuperation des publications de produits depuis OpenSI et mise a jour du site
|
| 549 |
+
*/
|
| 550 |
+
public function getPubwebArticle($startedAt, $client, $storeId) {
|
| 551 |
+
$params = array('code_site_web' => $client->web_site_code, 'date_debut' => $startedAt->format('d-m-Y'));
|
| 552 |
+
$resultXML = $this->sendData("GET", "get_pubweb_article", "", $client, $params);
|
| 553 |
+
|
| 554 |
+
$xmlDomDocument = new DomDocument();
|
| 555 |
+
$xmlDomDocument->loadXML($resultXML);
|
| 556 |
+
$listPublicationArticle = $xmlDomDocument->getElementsByTagName("Pubweb_Article");
|
| 557 |
+
|
| 558 |
+
foreach ($listPublicationArticle as $publicationArticle) {
|
| 559 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $publicationArticle->getAttribute('Reference'));
|
| 560 |
+
if ($product) {
|
| 561 |
+
if ($publicationArticle->getAttribute('Publication') == "true") {
|
| 562 |
+
$product->setStatus('1');
|
| 563 |
+
} else {
|
| 564 |
+
$product->setStatus('2');
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
$product->setStoreId($storeId);
|
| 568 |
+
$product->save();
|
| 569 |
+
}
|
| 570 |
+
}
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
/**
|
| 574 |
+
* Envoie des publications a OpenSI
|
| 575 |
+
*/
|
| 576 |
+
public function setPubwebArticle($startedAt, $client, $storeId) {
|
| 577 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection()->addFieldToFilter('updated_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
|
| 578 |
+
->addStoreFilter($storeId)
|
| 579 |
+
->addAttributeToSelect(array('sku', 'status'));
|
| 580 |
+
|
| 581 |
+
foreach ($productCollection as $product) {
|
| 582 |
+
$docXml = $this->createXml();
|
| 583 |
+
$request = $docXml->createElement("request");
|
| 584 |
+
|
| 585 |
+
$docXml->appendChild($request);
|
| 586 |
+
$pubWebArticle = $docXml->createElement("Pubweb_Article");
|
| 587 |
+
|
| 588 |
+
$pubWebArticle->setAttribute('Reference', $product->getSku());
|
| 589 |
+
$pubWebArticle->setAttribute('Code_Site_Web', $client->web_site_code);
|
| 590 |
+
if ($product->getStatus() == 2) {
|
| 591 |
+
$pubWebArticle->setAttribute('Publication', "false");
|
| 592 |
+
} else {
|
| 593 |
+
$pubWebArticle->setAttribute('Publication', "true");
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
$request->appendChild($pubWebArticle);
|
| 597 |
+
|
| 598 |
+
$params = array('reference' => $product->getSku());
|
| 599 |
+
$this->sendData('PUT', 'update_pubweb_article', $docXml->saveXml(), $client, $params);
|
| 600 |
+
} // endforeach $productCollection
|
| 601 |
+
}
|
| 602 |
+
|
| 603 |
+
/**
|
| 604 |
+
* Recuperation des prix produits depuis OpenSI et mise a jour du site
|
| 605 |
+
*/
|
| 606 |
+
public function getPrixArticle($startedAt, $client, $storeId) {
|
| 607 |
+
$params = array('code_site_web' => $client->web_site_code, 'date_debut' => $startedAt->format('d-m-Y'));
|
| 608 |
+
$resultXML = $this->sendData("GET", "get_prix_article", "", $client, $params);
|
| 609 |
+
|
| 610 |
+
$xmlDomDocument = new DomDocument();
|
| 611 |
+
$xmlDomDocument->loadXML($resultXML);
|
| 612 |
+
$listPrixArticle = $xmlDomDocument->getElementsByTagName("Prix_Article");
|
| 613 |
+
|
| 614 |
+
//Verif si dans la configuration le prix est TTC ou HT
|
| 615 |
+
$includeTax = Mage::getStoreConfig('tax/calculation/price_includes_tax', $storeId);
|
| 616 |
+
foreach ($listPrixArticle as $prixArticle) {
|
| 617 |
+
$reference = $prixArticle->getAttribute('Reference');
|
| 618 |
+
$tarifHT = $prixArticle->getAttribute('Tarif_HT_1');
|
| 619 |
+
$tarifTTC = $prixArticle->getAttribute('Tarif_TTC_1');
|
| 620 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute("sku", $reference);
|
| 621 |
+
if ($product) {
|
| 622 |
+
if ($includeTax) {
|
| 623 |
+
$product->setPrice($tarifTTC);
|
| 624 |
+
} else {
|
| 625 |
+
$product->setPrice($tarifHT);
|
| 626 |
+
}
|
| 627 |
+
$product->setStoreId($storeId);
|
| 628 |
+
$product->save();
|
| 629 |
+
}
|
| 630 |
+
}
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
/**
|
| 634 |
+
* On log les erreurs pour les afficher dans l'interface
|
| 635 |
+
*/
|
| 636 |
+
public function setLogs($response, $client, $action) {
|
| 637 |
+
$errorLogs = Mage::getModel("opensi/errorlog");
|
| 638 |
+
$errorLogs->setErrorCode($response->getStatus());
|
| 639 |
+
$errorLogs->setErrorMessage(utf8_encode($response->getMessage()));
|
| 640 |
+
$errorLogs->setOpensiId($client->opensi_id);
|
| 641 |
+
$errorLogs->setOpensiAction($action);
|
| 642 |
+
$createdAt = new dateTime();
|
| 643 |
+
$errorLogs->setCreatedAt($createdAt->format('Y-m-d H:i:s'));
|
| 644 |
+
$errorLogs->setStoreId($client->store_id);
|
| 645 |
+
$errorLogs->save();
|
| 646 |
+
}
|
| 647 |
+
|
| 648 |
+
}
|
app/code/community/Speedinfo/Opensi/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Controller des actions du backoffice
|
| 5 |
+
*
|
| 6 |
+
* @Author Speedinfo
|
| 7 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 8 |
+
*/
|
| 9 |
+
class Speedinfo_Opensi_IndexController extends Mage_Adminhtml_Controller_Action {
|
| 10 |
+
|
| 11 |
+
protected function _initAction() {
|
| 12 |
+
$this->loadLayout()
|
| 13 |
+
->_setActiveMenu('opensi/webservice');
|
| 14 |
+
return $this;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
public function indexAction() {
|
| 18 |
+
$block = $this->getLayout()->createBlock('opensi/adminhtml_edit');
|
| 19 |
+
$menu = $this->getLayout()->createBlock('opensi/adminhtml_tabs');
|
| 20 |
+
|
| 21 |
+
$this->_initAction();
|
| 22 |
+
$this->_addLeft($this->getLayout()->createBlock('adminhtml/store_switcher'))
|
| 23 |
+
->_addLeft($menu)
|
| 24 |
+
->_addContent($block)
|
| 25 |
+
->renderLayout();
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
public function errorsAction() {
|
| 29 |
+
$block = $this->getLayout()->createBlock('opensi/adminhtml_grid');
|
| 30 |
+
$this->_initAction();
|
| 31 |
+
$this->_addContent($block)->renderLayout();
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
public function saveAction() {
|
| 35 |
+
if ($params = $this->getRequest()->getPost('opensi')) {
|
| 36 |
+
|
| 37 |
+
//Création du client
|
| 38 |
+
if ($params['id'] == 0) {
|
| 39 |
+
$client = Mage::getModel('opensi/client');
|
| 40 |
+
} else {
|
| 41 |
+
// MAJ du client client
|
| 42 |
+
$client = Mage::getModel('opensi/client')->load($params['id']);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
// préparer les attributs
|
| 46 |
+
$clientData = array(
|
| 47 |
+
'opensi_id' => $params['opensi_id'],
|
| 48 |
+
'webservice_user' => $params['webservice_user'],
|
| 49 |
+
'webservice_pwd' => $params['webservice_pwd'],
|
| 50 |
+
'web_site_code' => $params['web_site_code'],
|
| 51 |
+
'deposit' => $params['deposit'],
|
| 52 |
+
'store_id' => $params['store_id'],
|
| 53 |
+
);
|
| 54 |
+
$client->setData($clientData);
|
| 55 |
+
$params['id'] != 0 ? $client->setId($params['id']) : '';
|
| 56 |
+
try {
|
| 57 |
+
$client->save();
|
| 58 |
+
$idClient = $client->getId();
|
| 59 |
+
$this->_getSession()->addSuccess($this->__('Client was successfully created.'));
|
| 60 |
+
} catch (Exception $e) {
|
| 61 |
+
$this->_getSession()->addError($e->getMessage());
|
| 62 |
+
$this->_redirect('*/*/');
|
| 63 |
+
}
|
| 64 |
+
foreach (Mage::Helper('opensi')->getWebservicesName() as $title => $ws) {
|
| 65 |
+
foreach ($ws as $name => $value) {
|
| 66 |
+
|
| 67 |
+
if ($params['id'] == 0) {
|
| 68 |
+
$ws = Mage::getModel('opensi/webservice');
|
| 69 |
+
} else {
|
| 70 |
+
$wsColl = Mage::getModel('opensi/webservice')->getCollection()
|
| 71 |
+
->addFieldToFilter("name", $name)
|
| 72 |
+
->addFieldToFilter("client_id", $idClient);
|
| 73 |
+
foreach ($wsColl as $wst) {
|
| 74 |
+
$ws = $wst;
|
| 75 |
+
}
|
| 76 |
+
$idWebservice = $ws->getId();
|
| 77 |
+
}
|
| 78 |
+
$wsData = array(
|
| 79 |
+
'name' => $name,
|
| 80 |
+
'client_id' => $idClient,
|
| 81 |
+
'active' => isset($params[$name]['active']) ? 1 : 0,
|
| 82 |
+
'frequency' => $params[$name]['frequency'],
|
| 83 |
+
);
|
| 84 |
+
$ws->setData($wsData);
|
| 85 |
+
isset($idWebservice) ? $ws->setId($idWebservice) : '';
|
| 86 |
+
try {
|
| 87 |
+
$ws->save();
|
| 88 |
+
} catch (Exception $e) {
|
| 89 |
+
$this->_getSession()->addError($e->getMessage());
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
$this->_getSession()->addSuccess($this->__('Webservices was successfully saved.'));
|
| 94 |
+
$storeId = Mage::registry('store_id') == "" ? $this->getRequest()->getParam('store') : Mage::registry('store_id');
|
| 95 |
+
$this->_redirect('*/*/', array("store" => $storeId));
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
}
|
app/code/community/Speedinfo/Opensi/etc/config.xml
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Speedinfo_Opensi>
|
| 5 |
+
<version>0.1.2</version>
|
| 6 |
+
</Speedinfo_Opensi>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<models>
|
| 10 |
+
<opensi>
|
| 11 |
+
<class>Speedinfo_Opensi_Model</class>
|
| 12 |
+
<resourceModel>opensi_mysql4</resourceModel>
|
| 13 |
+
</opensi>
|
| 14 |
+
<opensi_mysql4>
|
| 15 |
+
<class>Speedinfo_Opensi_Model_Mysql4</class>
|
| 16 |
+
<entities>
|
| 17 |
+
<error_log>
|
| 18 |
+
<table>opensi_error_log</table>
|
| 19 |
+
</error_log>
|
| 20 |
+
<error_code>
|
| 21 |
+
<table>opensi_error_code</table>
|
| 22 |
+
</error_code>
|
| 23 |
+
<client>
|
| 24 |
+
<table>opensi_client</table>
|
| 25 |
+
</client>
|
| 26 |
+
<webservice>
|
| 27 |
+
<table>opensi_webservice</table>
|
| 28 |
+
</webservice>
|
| 29 |
+
</entities>
|
| 30 |
+
</opensi_mysql4>
|
| 31 |
+
</models>
|
| 32 |
+
<blocks>
|
| 33 |
+
<opensi>
|
| 34 |
+
<class>Speedinfo_Opensi_Block</class>
|
| 35 |
+
</opensi>
|
| 36 |
+
</blocks>
|
| 37 |
+
<helpers>
|
| 38 |
+
<opensi>
|
| 39 |
+
<class>Speedinfo_Opensi_Helper</class>
|
| 40 |
+
</opensi>
|
| 41 |
+
</helpers>
|
| 42 |
+
<resources>
|
| 43 |
+
<opensi_setup>
|
| 44 |
+
<setup>
|
| 45 |
+
<module>Speedinfo_Opensi</module>
|
| 46 |
+
</setup>
|
| 47 |
+
<connection>
|
| 48 |
+
<use>core_setup</use>
|
| 49 |
+
</connection>
|
| 50 |
+
</opensi_setup>
|
| 51 |
+
<opensi_write>
|
| 52 |
+
<connection>
|
| 53 |
+
<use>core_write</use>
|
| 54 |
+
</connection>
|
| 55 |
+
</opensi_write>
|
| 56 |
+
<opensi_read>
|
| 57 |
+
<connection>
|
| 58 |
+
<use>core_read</use>
|
| 59 |
+
</connection>
|
| 60 |
+
</opensi_read>
|
| 61 |
+
</resources>
|
| 62 |
+
</global>
|
| 63 |
+
<admin>
|
| 64 |
+
<routers>
|
| 65 |
+
<opensi>
|
| 66 |
+
<use>admin</use>
|
| 67 |
+
<args>
|
| 68 |
+
<module>Speedinfo_Opensi</module>
|
| 69 |
+
<frontName>opensi</frontName>
|
| 70 |
+
</args>
|
| 71 |
+
</opensi>
|
| 72 |
+
</routers>
|
| 73 |
+
</admin>
|
| 74 |
+
<adminhtml>
|
| 75 |
+
<menu>
|
| 76 |
+
<opensi>
|
| 77 |
+
<title>OpenSi</title>
|
| 78 |
+
<sort_order>71</sort_order>
|
| 79 |
+
<children>
|
| 80 |
+
<webservice>
|
| 81 |
+
<title>Configuration</title>
|
| 82 |
+
<action>opensi/index/index</action>
|
| 83 |
+
</webservice>
|
| 84 |
+
<error_log>
|
| 85 |
+
<title>Logs de synchronisation</title>
|
| 86 |
+
<action>opensi/index/errors</action>
|
| 87 |
+
</error_log>
|
| 88 |
+
</children>
|
| 89 |
+
</opensi>
|
| 90 |
+
</menu>
|
| 91 |
+
<translate>
|
| 92 |
+
<modules>
|
| 93 |
+
<Speedinfo_Opensi>
|
| 94 |
+
<files>
|
| 95 |
+
<default>Speedinfo_OpenSi.csv</default>
|
| 96 |
+
</files>
|
| 97 |
+
</Speedinfo_Opensi>
|
| 98 |
+
</modules>
|
| 99 |
+
</translate>
|
| 100 |
+
<acl>
|
| 101 |
+
<resources>
|
| 102 |
+
<admin>
|
| 103 |
+
<children>
|
| 104 |
+
<opensi>
|
| 105 |
+
<title>Opensi Module</title>
|
| 106 |
+
<sort_order>10</sort_order>
|
| 107 |
+
<children>
|
| 108 |
+
<configuration>
|
| 109 |
+
<title>Configuration</title>
|
| 110 |
+
<sort_order>1</sort_order>
|
| 111 |
+
</configuration>
|
| 112 |
+
<log>
|
| 113 |
+
<title>Logs de synchronisation</title>
|
| 114 |
+
<sort_order>2</sort_order>
|
| 115 |
+
</log>
|
| 116 |
+
</children>
|
| 117 |
+
</opensi>
|
| 118 |
+
</children>
|
| 119 |
+
</admin>
|
| 120 |
+
</resources>
|
| 121 |
+
</acl>
|
| 122 |
+
</adminhtml>
|
| 123 |
+
<crontab>
|
| 124 |
+
<jobs>
|
| 125 |
+
<opensi_shedule_webservices>
|
| 126 |
+
<schedule>
|
| 127 |
+
<cron_expr>*/5 * * * *</cron_expr>
|
| 128 |
+
</schedule>
|
| 129 |
+
<run>
|
| 130 |
+
<model>opensi/cron::scheduleCron</model>
|
| 131 |
+
</run>
|
| 132 |
+
</opensi_shedule_webservices>
|
| 133 |
+
</jobs>
|
| 134 |
+
</crontab>
|
| 135 |
+
</config>
|
app/code/community/Speedinfo/Opensi/sql/opensi_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Création des tables
|
| 4 |
+
*
|
| 5 |
+
* @Author Speedinfo
|
| 6 |
+
* http://wwww.speedinfo.fr | http://www.opensi.fr
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
$installer = $this;
|
| 10 |
+
|
| 11 |
+
$installer->startSetup();
|
| 12 |
+
|
| 13 |
+
$installer->run("
|
| 14 |
+
DROP TABLE IF EXISTS {$this->getTable('opensi_error_log')};
|
| 15 |
+
CREATE table {$this->getTable('opensi_error_log')} (
|
| 16 |
+
id int not null primary key auto_increment,
|
| 17 |
+
error_code int not null,
|
| 18 |
+
error_message varchar(100) not null,
|
| 19 |
+
opensi_id int(11) not null,
|
| 20 |
+
opensi_action varchar(50) not null,
|
| 21 |
+
created_at datetime not null,
|
| 22 |
+
store_id int(3) not null
|
| 23 |
+
)
|
| 24 |
+
ENGINE=InnoDB
|
| 25 |
+
AUTO_INCREMENT=0
|
| 26 |
+
DEFAULT
|
| 27 |
+
CHARSET=utf8
|
| 28 |
+
COMMENT='Error Log List';
|
| 29 |
+
");
|
| 30 |
+
|
| 31 |
+
$installer->run("
|
| 32 |
+
DROP TABLE IF EXISTS {$this->getTable('opensi_client')};
|
| 33 |
+
CREATE table {$this->getTable('opensi_client')} (
|
| 34 |
+
id int not null primary key auto_increment,
|
| 35 |
+
opensi_id int(11) not null,
|
| 36 |
+
webservice_user varchar(100) not null,
|
| 37 |
+
webservice_pwd varchar(100) not null,
|
| 38 |
+
web_site_code varchar(100) not null,
|
| 39 |
+
deposit varchar(100) not null,
|
| 40 |
+
store_id int(3) not null
|
| 41 |
+
)
|
| 42 |
+
ENGINE=InnoDB
|
| 43 |
+
AUTO_INCREMENT=0
|
| 44 |
+
DEFAULT
|
| 45 |
+
CHARSET=utf8
|
| 46 |
+
COMMENT='Client List';
|
| 47 |
+
");
|
| 48 |
+
|
| 49 |
+
$installer->run("
|
| 50 |
+
DROP TABLE IF EXISTS {$this->getTable('opensi_webservice')};
|
| 51 |
+
CREATE table {$this->getTable('opensi_webservice')} (
|
| 52 |
+
id int not null primary key auto_increment,
|
| 53 |
+
name varchar(200) not null,
|
| 54 |
+
client_id int not null,
|
| 55 |
+
active bool not null default 0,
|
| 56 |
+
frequency int(5) default 0,
|
| 57 |
+
started_at datetime
|
| 58 |
+
)
|
| 59 |
+
ENGINE=InnoDB
|
| 60 |
+
AUTO_INCREMENT=0
|
| 61 |
+
DEFAULT
|
| 62 |
+
CHARSET=utf8
|
| 63 |
+
COMMENT='Webservices List';
|
| 64 |
+
");
|
| 65 |
+
|
| 66 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/opensi/tab/webservices.phtml
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="entry-edit">
|
| 2 |
+
<?php foreach(Mage::Helper('opensi')->getWebservicesName() as $title=>$ws):?>
|
| 3 |
+
<div class="entry-edit-head">
|
| 4 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__($title); ?></h4>
|
| 5 |
+
</div>
|
| 6 |
+
<div id="base_fieldset" class="fieldset ">
|
| 7 |
+
<div class="hor-scroll">
|
| 8 |
+
<table cellspacing="0" class="form-list">
|
| 9 |
+
<thead>
|
| 10 |
+
<tr>
|
| 11 |
+
<th><?php echo $this->__('Action du webservice'); ?></th>
|
| 12 |
+
<th style="display:none"><?php echo $this->__('Activé ?'); ?></th>
|
| 13 |
+
<th><?php echo $this->__('Fréquence (En minutes)'); ?></th>
|
| 14 |
+
</tr>
|
| 15 |
+
</thead>
|
| 16 |
+
<tbody>
|
| 17 |
+
<?php foreach($ws as $name=>$value):?>
|
| 18 |
+
<?php $webservice = $this->getWebservice($name);?>
|
| 19 |
+
<tr>
|
| 20 |
+
<td class="label" style="width:200px;">
|
| 21 |
+
<label style="width:300px;" for="opensi[<?php echo $name ?>]"><?php echo $value['title'] ?></label>
|
| 22 |
+
<span style="font-size:11px;color:#888"><?php echo $value['subtitle'];?></span>
|
| 23 |
+
</td>
|
| 24 |
+
<td style="width:50px;display:none"><input type="checkbox" id="opensi[<?php echo $name ?>][active]" checked="checked" class="checkbox website-checkbox" value="0" name="opensi[<?php echo $name ?>][active]"></td>
|
| 25 |
+
<td class="value"><input type="text" class="validate-number input-text" style="width:50px;" title="<?php echo $value['title'] ?>" value="<?php echo !empty($webservice) ? $webservice->frequency : $value['frequency'];?>" name="opensi[<?php echo $name ?>][frequency]" id="opensi[<?php echo $name ?>][frequency]"></td>
|
| 26 |
+
</tr>
|
| 27 |
+
<?php endforeach;?>
|
| 28 |
+
</tbody>
|
| 29 |
+
</table>
|
| 30 |
+
</div>
|
| 31 |
+
</div>
|
| 32 |
+
<?php endforeach;?>
|
| 33 |
+
</div>
|
app/etc/modules/Speedinfo_Opensi.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Speedinfo_Opensi>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Speedinfo_Opensi>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Speedinfo_Opensi</name>
|
| 4 |
+
<version>0.1.2</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>GPL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Le module OpenSi Connect vous permet de coupler Magento au logiciel de gestion commerciale et de comptabilité OpenSi E-Commerce.</summary>
|
| 10 |
+
<description>Le module OpenSi Connect vous permet de coupler Magento au logiciel de gestion commerciale et de comptabilité OpenSi E-Commerce.
|
| 11 |
+
Speedinfo a conçu un connecteur pour OpenSi E-Commerce et Magento sous la forme du module OpenSi Connect
|
| 12 |
+
OpenSi E-Commerce, est un logiciel de gestion commerciale et de comptabilité dédié à l'e-commerce</description>
|
| 13 |
+
<notes>Modification gestion des familles</notes>
|
| 14 |
+
<authors><author><name>Siau</name><user>auto-converted</user><email>jerome@speedinfo.fr</email></author></authors>
|
| 15 |
+
<date>2010-11-19</date>
|
| 16 |
+
<time>15:07:28</time>
|
| 17 |
+
<contents><target name="mage"><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="opensi"><dir name="tab"><file name="webservices.phtml" hash="fa3ab728342e6e3b4b7990c959e1bfc3"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Speedinfo_Opensi.xml" hash="16cc3fbf8e32ce7b8add016bfbc89c5f"/></dir></dir></dir></target><target name="magecommunity"><dir name="Speedinfo"><dir name="Opensi"><dir name="Block"><dir name="Adminhtml"><dir name="Edit"><dir name="Tab"><file name="General.php" hash="d1c825f23321e21f0fea86ac599dbfd9"/><file name="Webservices.php" hash="831734689e81b44d51329b2dd89d3c61"/></dir><file name="Form.php" hash="3ce2dc7af0ec4c5a44178ac46d6178a8"/></dir><file name="Edit.php" hash="1b1bbc699e9b318c098e815d7d924a64"/><file name="Grid.php" hash="938359d0bf4a9d26037fd121c71d1658"/><file name="Tabs.php" hash="2ec68b8a4dce8b680344ebb2b1d8e0fc"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="b843e876de91d68e5851bd4f17d5c06e"/></dir><dir name="etc"><file name="config.xml" hash="ee65a4c8a90327da038c83242a4ec29f"/></dir><dir name="Helper"><file name="Data.php" hash="c3e58e5695ad3f7cd613d61205fcaf99"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Errorlog"><file name="Collection.php" hash="ad19bb95ad5e56f0dcaeff4db10cf52f"/></dir><dir name="Webservice"><file name="Collection.php" hash="3a5e5d973ffb834d4eadec4f9335b36e"/></dir><file name="Client.php" hash="0b47754c6aace0dc54340dfd807eb17a"/><file name="Errorlog.php" hash="9a8c882377bbdeada65c7c5d8346af35"/><file name="Webservice.php" hash="781eb93e76ba8bffe881f091904d0f98"/></dir><file name="Client.php" hash="f89aeb3dda8d8a27bf6a05e5082a945e"/><file name="Cron.php" hash="263e89d0985c67d85d52e061c78e0eff"/><file name="Errorlog.php" hash="d269ec20ae481684a1daa2c515848252"/><file name="Webservice.php" hash="c77708c3507d79a83e64a1801ea255c2"/><file name="Webservices.php" hash="48a9f93b42ab44d138b1f593b0f2ef2a"/></dir><dir name="sql"><dir name="opensi_setup"><file name="mysql4-install-0.1.0.php" hash="ce8cef17aac76ccfadf09d7d84d23841"/></dir></dir></dir></dir></target></contents>
|
| 18 |
+
<compatible/>
|
| 19 |
+
<dependencies/>
|
| 20 |
+
</package>
|
