Speedinfo_Opensi - Version 0.3.0

Version Notes

Mise à jour du module vers la version 0.3.0
Pour plus d'informations, se référer à la documentation.

Download this release

Release Info

Developer Magento Core Team
Extension Speedinfo_Opensi
Version 0.3.0
Comparing to
See all releases


Code changes from version 0.2.9 to 0.3.0

app/code/community/Speedinfo/Opensi/Model/Cron.php CHANGED
@@ -28,7 +28,7 @@ class Speedinfo_Opensi_Model_Cron extends Mage_Core_Model_Abstract {
28
  // le client du store existe, on utilise sa config
29
  if (!empty($client)) {
30
  $useDefaultView = false;
31
- $webservices = Mage::getModel('opensi/webservice')->getCollection()->addFieldToFilter('client_id,', $client->id);
32
  } else {
33
  $useDefaultView = true;
34
  $webservices = $webservicesDefault;
28
  // le client du store existe, on utilise sa config
29
  if (!empty($client)) {
30
  $useDefaultView = false;
31
+ $webservices = Mage::getModel('opensi/webservice')->getCollection()->addFieldToFilter('client_id', $client->id);
32
  } else {
33
  $useDefaultView = true;
34
  $webservices = $webservicesDefault;
app/code/community/Speedinfo/Opensi/Model/Webservices.php CHANGED
@@ -331,6 +331,16 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
331
  $params = array('reference' => $product->getSku());
332
  if (!empty($articleData))
333
  $this->sendData('PUT', 'update_article', $articleData, $client, $params);
 
 
 
 
 
 
 
 
 
 
334
  } // endforeach $productCollection
335
  if ($productCollection->count() > 0)
336
  $this->setPubwebArticle($startedAt, $client, $storeId);
@@ -422,7 +432,11 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
422
  ->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
423
  ->addAttributeToSelect('*')
424
  ->addAttributeToFilter('website_id', Mage::getModel('core/store')->load($storeId)->getWebsiteId());
 
425
  foreach ($customerCollection as $customer) {
 
 
 
426
  $clientData = $this->clientData($customer, $client);
427
  $this->sendData('POST', 'create_client_web', $clientData, $client);
428
  }
@@ -437,8 +451,11 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
437
  ->addFieldToFilter('created_at', array('lteq' => $startedAt->format('Y-m-d H:i:s')))
438
  ->addAttributeToSelect('*')
439
  ->addAttributeToFilter('website_id', Mage::getModel('core/store')->load($storeId)->getWebsiteId());
440
-
441
  foreach ($customerCollection as $customer) {
 
 
 
442
  $clientData = $this->clientData($customer, $client);
443
  $params = array('code_site_web' => $client->web_site_code, 'login' => $customer->getId());
444
  $this->sendData('PUT', 'update_client_web', $clientData, $client, $params);
@@ -565,8 +582,12 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
565
  public function createTransactionBancaire($startedAt, $client, $storeId) {
566
  //recuperation des commandes
567
  $orderCollection = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))->addFieldToFilter('store_id', $storeId);
568
-
569
  foreach ($orderCollection as $order) {
 
 
 
 
570
  $numOrder = $order->getIncrementId();
571
 
572
  //Test pour savoir si la commande est déjà payée
@@ -636,8 +657,11 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
636
  $xmlDomDocument = new DomDocument();
637
  $xmlDomDocument->loadXML($resultXML);
638
  $listEtatCommande = $xmlDomDocument->getElementsByTagName("Etat_Commande");
639
-
640
  foreach ($listEtatCommande as $etatCommande) {
 
 
 
641
  $order = Mage::getModel('sales/order')->loadByIncrementId($etatCommande->getAttribute('Num_Com_Web'));
642
 
643
  if (!$order->getId()) {
@@ -690,8 +714,8 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
690
  $invoice->save();
691
  }
692
  }
 
693
  }
694
- $order->save();
695
 
696
  //recup du statut de livraison | E = Expediée
697
  if ($etatCommande->getAttribute('Statut_Logistique') == 'E') {
@@ -705,13 +729,13 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
705
  if (empty($shipmentId))
706
  $shipmentId = Mage::getModel('sales/order_shipment_api')->create($order->getIncrementId(), array());
707
  }
 
708
  }
709
- $order->save();
710
 
711
  //passer derniere valeur a true pour envoyer mail au client
712
  switch ($etatCommande->getAttribute('Etat')) {
713
  case 'N': //Non validée
714
- if ($status != 'pending')
715
  $order->setState('pending', true, 'changement de statut OpenSI (Pending)', true);
716
  break;
717
 
@@ -746,8 +770,11 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
746
  $xmlDomDocument = new DomDocument();
747
  $xmlDomDocument->loadXML($resultXML);
748
  $listExpedition = $xmlDomDocument->getElementsByTagName("Colis_Expedition");
749
-
750
  foreach ($listExpedition as $expedition) {
 
 
 
751
  $order = Mage::getModel('sales/order')->loadByIncrementId($expedition->getAttribute('Num_Com_Web'));
752
  /**
753
  * Check order existing
331
  $params = array('reference' => $product->getSku());
332
  if (!empty($articleData))
333
  $this->sendData('PUT', 'update_article', $articleData, $client, $params);
334
+
335
+ //Si le produit ne marche pas en update alors on essai de le créer
336
+ if(!empty($articleData) && $this->_error == "404"){
337
+ $articleData = $this->articleData($product, $storeId, 'create', $client);
338
+ if (!empty($articleData))
339
+ $this->sendData('POST', 'create_article', $articleData, $client);
340
+ //Vérifier si 409 ne pas lancer
341
+ if($this->_error != "409")
342
+ $this->setStockArticle($product,$client);
343
+ }
344
  } // endforeach $productCollection
345
  if ($productCollection->count() > 0)
346
  $this->setPubwebArticle($startedAt, $client, $storeId);
432
  ->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
433
  ->addAttributeToSelect('*')
434
  ->addAttributeToFilter('website_id', Mage::getModel('core/store')->load($storeId)->getWebsiteId());
435
+ ini_set('max_execution_time', 50 );
436
  foreach ($customerCollection as $customer) {
437
+ ini_set('max_execution_time', ini_get('max_execution_time')+1 );
438
+ if (ini_get('max_execution_time') == 100)
439
+ ini_set('max_execution_time', 50 );
440
  $clientData = $this->clientData($customer, $client);
441
  $this->sendData('POST', 'create_client_web', $clientData, $client);
442
  }
451
  ->addFieldToFilter('created_at', array('lteq' => $startedAt->format('Y-m-d H:i:s')))
452
  ->addAttributeToSelect('*')
453
  ->addAttributeToFilter('website_id', Mage::getModel('core/store')->load($storeId)->getWebsiteId());
454
+ ini_set('max_execution_time', 50 );
455
  foreach ($customerCollection as $customer) {
456
+ ini_set('max_execution_time', ini_get('max_execution_time')+1 );
457
+ if (ini_get('max_execution_time') == 100)
458
+ ini_set('max_execution_time', 50 );
459
  $clientData = $this->clientData($customer, $client);
460
  $params = array('code_site_web' => $client->web_site_code, 'login' => $customer->getId());
461
  $this->sendData('PUT', 'update_client_web', $clientData, $client, $params);
582
  public function createTransactionBancaire($startedAt, $client, $storeId) {
583
  //recuperation des commandes
584
  $orderCollection = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))->addFieldToFilter('store_id', $storeId);
585
+ ini_set('max_execution_time', 50 );
586
  foreach ($orderCollection as $order) {
587
+ ini_set('max_execution_time', ini_get('max_execution_time')+1 );
588
+ if (ini_get('max_execution_time') == 100)
589
+ ini_set('max_execution_time', 50 );
590
+
591
  $numOrder = $order->getIncrementId();
592
 
593
  //Test pour savoir si la commande est déjà payée
657
  $xmlDomDocument = new DomDocument();
658
  $xmlDomDocument->loadXML($resultXML);
659
  $listEtatCommande = $xmlDomDocument->getElementsByTagName("Etat_Commande");
660
+ ini_set('max_execution_time', 50 );
661
  foreach ($listEtatCommande as $etatCommande) {
662
+ ini_set('max_execution_time', ini_get('max_execution_time')+1 );
663
+ if (ini_get('max_execution_time') == 100)
664
+ ini_set('max_execution_time', 50 );
665
  $order = Mage::getModel('sales/order')->loadByIncrementId($etatCommande->getAttribute('Num_Com_Web'));
666
 
667
  if (!$order->getId()) {
714
  $invoice->save();
715
  }
716
  }
717
+ $order->save();
718
  }
 
719
 
720
  //recup du statut de livraison | E = Expediée
721
  if ($etatCommande->getAttribute('Statut_Logistique') == 'E') {
729
  if (empty($shipmentId))
730
  $shipmentId = Mage::getModel('sales/order_shipment_api')->create($order->getIncrementId(), array());
731
  }
732
+ $order->save();
733
  }
 
734
 
735
  //passer derniere valeur a true pour envoyer mail au client
736
  switch ($etatCommande->getAttribute('Etat')) {
737
  case 'N': //Non validée
738
+ if ($status != 'pending' && $status != 'processing')
739
  $order->setState('pending', true, 'changement de statut OpenSI (Pending)', true);
740
  break;
741
 
770
  $xmlDomDocument = new DomDocument();
771
  $xmlDomDocument->loadXML($resultXML);
772
  $listExpedition = $xmlDomDocument->getElementsByTagName("Colis_Expedition");
773
+ ini_set('max_execution_time', 50 );
774
  foreach ($listExpedition as $expedition) {
775
+ ini_set('max_execution_time', ini_get('max_execution_time')+1 );
776
+ if (ini_get('max_execution_time') == 100)
777
+ ini_set('max_execution_time', 50 );
778
  $order = Mage::getModel('sales/order')->loadByIncrementId($expedition->getAttribute('Num_Com_Web'));
779
  /**
780
  * Check order existing
app/code/community/Speedinfo/Opensi/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Speedinfo_Opensi>
5
- <version>0.2.9</version>
6
  </Speedinfo_Opensi>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Speedinfo_Opensi>
5
+ <version>0.3.0</version>
6
  </Speedinfo_Opensi>
7
  </modules>
8
  <global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Speedinfo_Opensi</name>
4
- <version>0.2.9</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
@@ -10,12 +10,12 @@
10
  <description>Le module OpenSi Connect vous permet de coupler Magento au logiciel de gestion commerciale et de comptabilit&#xE9; OpenSi E-Commerce.
11
  Speedinfo a con&#xE7;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&#xE9; d&#xE9;di&#xE9; &#xE0; l'e-commerce.</description>
13
- <notes>Mise &#xE0; jour du module vers la version 0.2.9.
14
  Pour plus d'informations, se r&#xE9;f&#xE9;rer &#xE0; la documentation.</notes>
15
  <authors><author><name>Dray</name><user>auto-converted</user><email>rony.dray@speedinfo.fr</email></author></authors>
16
- <date>2011-02-22</date>
17
- <time>15:37:43</time>
18
- <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="44197706123f54d5c2e17475cd64b9f1"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Speedinfo_Opensi.xml" hash="16cc3fbf8e32ce7b8add016bfbc89c5f"/></dir></dir><dir name="locale"><dir name="fr_FR"><file name="Speedinfo_OpenSi.csv" hash="51f46b50056059d178766fa9111fe072"/></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="Attributs.php" hash="562e895af0d5f2a1cffa1be63d0b5fa4"/><file name="Familles.php" hash="317e2361f1dcb6c494ca9ab6bf0d5cae"/><file name="General.php" hash="485e888e215dde1762a42d147cced3e1"/><file name="Webservices.php" hash="09ccc564f6ba4e7cbb58e0357c43e035"/></dir><file name="Form.php" hash="3ce2dc7af0ec4c5a44178ac46d6178a8"/></dir><file name="Edit.php" hash="b91602dd06e9432d879db352fa2aaeaa"/><file name="Grid.php" hash="6ace416ae5264fed2bbc57aa5d152e6e"/><file name="Tabs.php" hash="4383dd11c3e1fffe43868e489f6b977f"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="9754ad25b294a0306d4e28090bf9e4cb"/></dir><dir name="etc"><file name="config.xml" hash="641ce07c8e9cc355fbdddc33376ce88b"/></dir><dir name="Helper"><file name="Data.php" hash="b5798cdae9319b34ada4c3de5964c0b4"/></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="d7040e0bdb5fa735ff976ed357e1d4c7"/><file name="Errorlog.php" hash="d269ec20ae481684a1daa2c515848252"/><file name="Webservice.php" hash="c77708c3507d79a83e64a1801ea255c2"/><file name="Webservices.php" hash="ad2827363526cc2323116d029eea3be3"/></dir><dir name="sql"><dir name="opensi_setup"><file name="mysql4-install-0.1.0.php" hash="ce8cef17aac76ccfadf09d7d84d23841"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="f207b0704a6cad542dced6b40ac25341"/><file name="mysql4-upgrade-0.2.4-0.2.5.php" hash="99fcd03734f514441005dd8af5c22809"/></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies/>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Speedinfo_Opensi</name>
4
+ <version>0.3.0</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
10
  <description>Le module OpenSi Connect vous permet de coupler Magento au logiciel de gestion commerciale et de comptabilit&#xE9; OpenSi E-Commerce.
11
  Speedinfo a con&#xE7;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&#xE9; d&#xE9;di&#xE9; &#xE0; l'e-commerce.</description>
13
+ <notes>Mise &#xE0; jour du module vers la version 0.3.0
14
  Pour plus d'informations, se r&#xE9;f&#xE9;rer &#xE0; la documentation.</notes>
15
  <authors><author><name>Dray</name><user>auto-converted</user><email>rony.dray@speedinfo.fr</email></author></authors>
16
+ <date>2011-03-17</date>
17
+ <time>10:02:04</time>
18
+ <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="44197706123f54d5c2e17475cd64b9f1"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Speedinfo_Opensi.xml" hash="16cc3fbf8e32ce7b8add016bfbc89c5f"/></dir></dir><dir name="locale"><dir name="fr_FR"><file name="Speedinfo_OpenSi.csv" hash="51f46b50056059d178766fa9111fe072"/></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="Attributs.php" hash="562e895af0d5f2a1cffa1be63d0b5fa4"/><file name="Familles.php" hash="317e2361f1dcb6c494ca9ab6bf0d5cae"/><file name="General.php" hash="485e888e215dde1762a42d147cced3e1"/><file name="Webservices.php" hash="09ccc564f6ba4e7cbb58e0357c43e035"/></dir><file name="Form.php" hash="3ce2dc7af0ec4c5a44178ac46d6178a8"/></dir><file name="Edit.php" hash="b91602dd06e9432d879db352fa2aaeaa"/><file name="Grid.php" hash="6ace416ae5264fed2bbc57aa5d152e6e"/><file name="Tabs.php" hash="4383dd11c3e1fffe43868e489f6b977f"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="9754ad25b294a0306d4e28090bf9e4cb"/></dir><dir name="etc"><file name="config.xml" hash="60f8666ee77ff7ffcebed04fc9b898f4"/></dir><dir name="Helper"><file name="Data.php" hash="b5798cdae9319b34ada4c3de5964c0b4"/></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="3f231dd81c71238d7e7efaa144ded9af"/><file name="Errorlog.php" hash="d269ec20ae481684a1daa2c515848252"/><file name="Webservice.php" hash="c77708c3507d79a83e64a1801ea255c2"/><file name="Webservices.php" hash="ea0b1c8dd9dd778e864c7cafc69e37e5"/></dir><dir name="sql"><dir name="opensi_setup"><file name="mysql4-install-0.1.0.php" hash="ce8cef17aac76ccfadf09d7d84d23841"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="f207b0704a6cad542dced6b40ac25341"/><file name="mysql4-upgrade-0.2.4-0.2.5.php" hash="99fcd03734f514441005dd8af5c22809"/></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies/>
21
  </package>