Speedinfo_Opensi - Version 0.2.3

Version Notes

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

Download this release

Release Info

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


Code changes from version 0.2.2 to 0.2.3

app/code/community/Speedinfo/Opensi/Model/Webservices.php CHANGED
@@ -90,25 +90,23 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
90
}
91
}
92
$commandeWeb->setAttribute('Mode_Expedition', $shippingDesc);
93
- $commandeWeb->setAttribute('Edition_TTC', "false");
94
- $commandeWeb->setAttribute('Frais_Port', $order->getShippingAmount());
95
96
// recuperation du taux de tva sur les frais de port
97
$taxClassId = Mage::getStoreConfig('tax/classes/shipping_tax_class', $storeId);
98
-
99
if ($taxClassId != 0) {
100
$taxRequest = Mage::getSingleton('tax/calculation')->getRateRequest($order->getShippingAddress(), $order->getBillingAddress(), "", $storeId);
101
-
102
if ($taxRequest->getCustomerClassId()) {
103
- $percent = Mage::getSingleton('tax/calculation')->getRate($taxRequest->setCustomerClassId($taxClassId));
104
- } else if ($taxRequest->getProductClassId()) {
105
$percent = Mage::getSingleton('tax/calculation')->getRate($taxRequest->setProductClassId($taxClassId));
106
} else {
107
$percent = 0;
108
}
109
} else {
110
$percent = 0;
111
}
112
113
$commandeWeb->setAttribute('Taux_Tva_Port', $percent);
114
$totalTTC = $order->getSubtotal() + $order->getBaseTaxAmount();
@@ -180,28 +178,35 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
180
$ligneCommandeClient->setAttribute('Designation', $item->getName());
181
}
182
$ligneCommandeClient->setAttribute('Quantite', $item->getQtyOrdered());
183
- $ligneCommandeClient->setAttribute('Prix_Unitaire', $item->getPrice());
184
$discountAmount = $item->getDiscountAmount();
185
186
//Si il existe une remise en valeur
187
- if (!empty($discountAmount) && $item->getPrice() != 0) {
188
- $discount = (1 - (($item->getPrice() - $item->getDiscountAmount()) / $item->getPrice())) * 100;
189
$discount = round($discount, 2);
190
}
191
192
- $discountPourcent = $item->getDiscountPercent();
193
- //Si il existe un poucentage de remise.
194
- if ($discountPourcent != 0) {
195
- $discount = $discountPourcent;
196
- }
197
-
198
- //Si il existe les 2 types de remise % et montant
199
- if (!empty($discountAmount) && !empty($discountPourcent)) {
200
- $discountValeurDepuisPourcentage = ($item->getPrice() * $discountPourcent) / 100;
201
- $discountTotalValue = $discountAmount + $discountValeurDepuisPourcentage;
202
- $discountPourcent = (1 - (($item->getPrice() - $discountTotalValue) / $item->getPrice())) * 100;
203
- $discount = $discountPourcent;
204
- }
205
206
$ligneCommandeClient->setAttribute('Remise_Pourc', $discount);
207
$ligneCommandeClient->setAttribute('Taux_Tva', $item->getTaxPercent());
@@ -222,20 +227,20 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
222
* Envoie des nouveaux produits vers OpenSI
223
*/
224
public function createArticle($startedAt, $client, $storeId) {
225
- if(Mage::getVersion() < '1.4.0.0'){
226
- $productCollection = Mage::getModel('catalog/product')->getCollection()
227
- ->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
228
- ->addFieldToFilter('type_id', array('nin' => array('configurable', 'grouped')))
229
- ->addFieldToFilter('category_ids', array('gteq' => NULL))
230
- ->addStoreFilter($storeId)
231
- ->addAttributeToSelect('*');
232
- }else{
233
- $productCollection = Mage::getModel('catalog/product')->getCollection()
234
- ->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
235
- ->addFieldToFilter('type_id', array('nin' => array('configurable', 'grouped')))
236
- ->addStoreFilter($storeId)
237
- ->addAttributeToSelect('*');
238
- }
239
foreach ($productCollection as $product) {
240
$articleData = $this->articleData($product, $storeId, 'create', $client);
241
$this->sendData('POST', 'create_article', $articleData, $client);
@@ -320,9 +325,13 @@ class Speedinfo_Opensi_Model_Webservices extends Mage_Core_Model_Abstract {
320
if ($includeTax) {
321
$article->setAttribute('Tarif_TTC_1', $product->getFinalPrice());
322
} else {
323
$article->setAttribute('Tarif_HT_1', $product->getFinalPrice());
324
}
325
$product->getCost() != "" ? $article->setAttribute('Prix_Achat', $product->getCost()) : false;
326
}
327
$updatedAt = new Datetime($product->getUpdatedAt());
328
$createdAt = new Datetime($product->getCreatedAt());
90
}
91
}
92
$commandeWeb->setAttribute('Mode_Expedition', $shippingDesc);
93
+ $commandeWeb->setAttribute('Edition_TTC', "true");
94
95
// recuperation du taux de tva sur les frais de port
96
$taxClassId = Mage::getStoreConfig('tax/classes/shipping_tax_class', $storeId);
97
if ($taxClassId != 0) {
98
$taxRequest = Mage::getSingleton('tax/calculation')->getRateRequest($order->getShippingAddress(), $order->getBillingAddress(), "", $storeId);
99
if ($taxRequest->getCustomerClassId()) {
100
$percent = Mage::getSingleton('tax/calculation')->getRate($taxRequest->setProductClassId($taxClassId));
101
+ } else if ($taxRequest->getProductClassId()) {
102
+ $percent = Mage::getSingleton('tax/calculation')->getRate($taxRequest->setCustomerClassId($taxClassId));
103
} else {
104
$percent = 0;
105
}
106
} else {
107
$percent = 0;
108
}
109
+ $commandeWeb->setAttribute('Frais_Port', $order->getShippingAmount() * (1 + $percent / 100));
110
111
$commandeWeb->setAttribute('Taux_Tva_Port', $percent);
112
$totalTTC = $order->getSubtotal() + $order->getBaseTaxAmount();
178
$ligneCommandeClient->setAttribute('Designation', $item->getName());
179
}
180
$ligneCommandeClient->setAttribute('Quantite', $item->getQtyOrdered());
181
+
182
+ //TTC
183
+ $rowTotal = $item->getRowTotal() + $item->getTaxAmount();
184
+ $itemTotal = $rowTotal / $item->getQtyOrdered();
185
+ $ligneCommandeClient->setAttribute('Prix_Unitaire', $itemTotal );
186
+
187
$discountAmount = $item->getDiscountAmount();
188
189
//Si il existe une remise en valeur
190
+ if (!empty($discountAmount) && $itemTotal != 0) {
191
+ $discount = (1 - (($itemTotal - $item->getDiscountAmount()) / $itemTotal)) * 100;
192
$discount = round($discount, 2);
193
}
194
195
+ // $discountPourcent = $item->getDiscountPercent();
196
+ // //Si il existe un poucentage de remise.
197
+ // if ($discountPourcent != 0) {
198
+ // $discount = $discountPourcent;
199
+ // }
200
+ // Mage::log($discount, null, 'opensi.log');
201
+ //
202
+ // //Si il existe les 2 types de remise % et montant
203
+ // if (!empty($discountAmount) && !empty($discountPourcent)) {
204
+ // $discountValeurDepuisPourcentage = ($itemTotal * $discountPourcent) / 100;
205
+ // $discountTotalValue = $discountAmount + $discountValeurDepuisPourcentage;
206
+ // $discountPourcent = (1 - (($itemTotal - $discountTotalValue) / $itemTotal)) * 100;
207
+ // $discount = $discountPourcent;
208
+ // Mage::log($discount, null, 'opensi.log');
209
+ // }
210
211
$ligneCommandeClient->setAttribute('Remise_Pourc', $discount);
212
$ligneCommandeClient->setAttribute('Taux_Tva', $item->getTaxPercent());
227
* Envoie des nouveaux produits vers OpenSI
228
*/
229
public function createArticle($startedAt, $client, $storeId) {
230
+ // if(Mage::getVersion() < '1.4.0.0'){
231
+ // $productCollection = Mage::getModel('catalog/product')->getCollection()
232
+ // ->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
233
+ // ->addFieldToFilter('type_id', array('nin' => array('configurable', 'grouped')))
234
+ // //->addFieldToFilter('category_ids', array('gteq' => NULL))
235
+ // ->addStoreFilter($storeId)
236
+ // ->addAttributeToSelect('*');
237
+ // }else{
238
+ $productCollection = Mage::getModel('catalog/product')->getCollection()
239
+ ->addFieldToFilter('created_at', array('gteq' => $startedAt->format('Y-m-d H:i:s')))
240
+ ->addFieldToFilter('type_id', array('nin' => array('configurable', 'grouped')))
241
+ ->addStoreFilter($storeId)
242
+ ->addAttributeToSelect('*');
243
+ // }
244
foreach ($productCollection as $product) {
245
$articleData = $this->articleData($product, $storeId, 'create', $client);
246
$this->sendData('POST', 'create_article', $articleData, $client);
325
if ($includeTax) {
326
$article->setAttribute('Tarif_TTC_1', $product->getFinalPrice());
327
} else {
328
+
329
$article->setAttribute('Tarif_HT_1', $product->getFinalPrice());
330
}
331
$product->getCost() != "" ? $article->setAttribute('Prix_Achat', $product->getCost()) : false;
332
+ // $taxRequest = Mage::getSingleton('tax/calculation');
333
+ // Mage::log(Mage::getSingleton('tax/calculation')->getRate($taxRequest->setProductClassId($product->getTaxClassId())),null,'opensi.log');
334
+ // $product->getTaxPercent() != "" ? $article->setAttribute('Taux_Tva', $product->getTaxPercent()) : false;
335
}
336
$updatedAt = new Datetime($product->getUpdatedAt());
337
$createdAt = new Datetime($product->getCreatedAt());
app/code/community/Speedinfo/Opensi/controllers/IndexController.php CHANGED
@@ -112,7 +112,7 @@ class Speedinfo_Opensi_IndexController extends Mage_Adminhtml_Controller_Action
112
'client_id' => $idClient,
113
'active' => isset($params[$name]['active']) ? 1 : 0,
114
'frequency' => $params[$name]['frequency'] < $value['frequency'] ? $value['frequency'] : $params[$name]['frequency'],
115
- 'frequency' => $params[$name]['frequency'],
116
);
117
$ws->setData($wsData);
118
isset($idWebservice) ? $ws->setId($idWebservice) : '';
112
'client_id' => $idClient,
113
'active' => isset($params[$name]['active']) ? 1 : 0,
114
'frequency' => $params[$name]['frequency'] < $value['frequency'] ? $value['frequency'] : $params[$name]['frequency'],
115
+ // 'frequency' => $params[$name]['frequency'],
116
);
117
$ws->setData($wsData);
118
isset($idWebservice) ? $ws->setId($idWebservice) : '';
app/code/community/Speedinfo/Opensi/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
<config>
3
<modules>
4
<Speedinfo_Opensi>
5
- <version>0.2.2</version>
6
</Speedinfo_Opensi>
7
</modules>
8
<global>
2
<config>
3
<modules>
4
<Speedinfo_Opensi>
5
+ <version>0.2.3</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.2</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.2.
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>2010-12-17</date>
17
- <time>16: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="dc2a8632a3780c7e9ffaae2b94f0fde4"/></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="c75830c9708f854a26345d22be5edb01"/></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="9164508a161b872a18f644f015b6d221"/></dir><dir name="etc"><file name="config.xml" hash="6f276126dcaec602eaf51298ba7ed855"/></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="94436f6e624d9f665bc27cb92cadb001"/><file name="Errorlog.php" hash="d269ec20ae481684a1daa2c515848252"/><file name="Webservice.php" hash="c77708c3507d79a83e64a1801ea255c2"/><file name="Webservices.php" hash="5bde98a8eb485029524b5c47b5a52ff9"/></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"/></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.2.3</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.2.3.
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-01-07</date>
17
+ <time>14:42:50</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="dc2a8632a3780c7e9ffaae2b94f0fde4"/></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="c75830c9708f854a26345d22be5edb01"/></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="b4e7604d12a41cebbeb8dc2e83399075"/></dir><dir name="etc"><file name="config.xml" hash="8296bd30b1221124be08bf44e1eb6f1e"/></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="94436f6e624d9f665bc27cb92cadb001"/><file name="Errorlog.php" hash="d269ec20ae481684a1daa2c515848252"/><file name="Webservice.php" hash="c77708c3507d79a83e64a1801ea255c2"/><file name="Webservices.php" hash="d6c80e5c65e04c67969027aeb7f0fef4"/></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"/></dir></dir></dir></dir></target></contents>
19
<compatible/>
20
<dependencies/>
21
</package>