Merge lp:~mohammed-nahhas/magentoerpconnect/magento-module-dev into lp:magentoerpconnect/oerp6.1-oldstable

Proposed by Ben Othmen wided
Status: Rejected
Rejected by: Guewen Baconnier @ Camptocamp
Proposed branch: lp:~mohammed-nahhas/magentoerpconnect/magento-module-dev
Merge into: lp:magentoerpconnect/oerp6.1-oldstable
Diff against target: 3185 lines (+3033/-0)
24 files modified
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Helper/Data.php (+6/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog/Product/Api.php (+80/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Observer.php (+24/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Categories.php (+111/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attribute.php (+109/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributegroup.php (+167/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributeset.php (+58/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Tierprice.php (+71/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Products.php (+289/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Groups.php (+142/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Storeviews.php (+142/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Website.php (+171/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Address.php (+241/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Customer.php (+142/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Group.php (+142/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Subscriber.php (+163/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales/Order/Api.php (+116/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/Adminhtml/InitController.php (+61/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/OpenerpconnectorController.php (+5/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/api.xml (+526/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/config.xml (+88/-0)
Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql/openerpconnector_setup/mysql4-install-0.0.1.php (+54/-0)
Openlabs_OpenERPConnector-1.1.0/app/etc/modules/Openlabs_OpenERPConnector.xml (+41/-0)
package.xml (+84/-0)
To merge this branch: bzr merge lp:~mohammed-nahhas/magentoerpconnect/magento-module-dev
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp Disapprove
Review via email: mp+80985@code.launchpad.net
To post a comment you must log in.
28. By monahhas <monahhas@midgard>

[ADD] Compatibility with magento 1.3.x.x added, if version of magento is 1.3.x.x the module will :

- add an order attribute called 'imported' instead of column for magento 1.4.x.x and higher.
- add an observer for the event 'sales_order_place_after' which initialize the value of 'imported' to 0 every time an order is placed, if there any problem during the initialization, a log called OpenErp_Connector.log will be created in [yourmagento]/var/log/, this log contains information about the problem, increment_id, error message,...
- function retreive() compatibility with 1.3.x.x fixed
- allow you to initialize the value of the attribute 'imported' to 0 for all orders placed before installing the module, so they can be imported in OpenErp, this script can be called via this Url : http://[base_url]/index.php/connector/adminhtml_init/orders/

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hello,

This merge proposal is invalid as this branch must be merged into lp:magentoerpconnect/magento-module (Magento module) and not into lp:magentoerpconnect (OpenERP module).

Also, the reviewer of lp:magentoerpconnect/magento-module is Sharoon Thomas and not the "MagentoERPConnect core Editors" Team.

A merge proposal is currently pending on this branch on the behalf of Mohammed Nahhas as requestor and of Sharoon Thomas as reviewer : https://code.launchpad.net/~mohammed-nahhas/magentoerpconnect/magento-module-dev/+merge/63859

review: Disapprove
Revision history for this message
Thierry (tboulogne) wrote :

Hello Guewen,

Does your message related to
https://bugs.launchpad.net/magentoerpconnect/+bug/891271

too ?

> Guewen Baconnier @ Camptocamp <mailto:<email address hidden>>
> 21 novembre 2011 14:18
> Review: Disapprove
>
> Hello,
>
> This merge proposal is invalid as this branch must be merged into
> lp:magentoerpconnect/magento-module (Magento module) and not into
> lp:magentoerpconnect (OpenERP module).
>
> Also, the reviewer of lp:magentoerpconnect/magento-module is Sharoon
> Thomas and not the "MagentoERPConnect core Editors" Team.
>
> A merge proposal is currently pending on this branch on the behalf of
> Mohammed Nahhas as requestor and of Sharoon Thomas as reviewer :
> https://code.launchpad.net/~mohammed-nahhas/magentoerpconnect/magento-module-dev/+merge/63859

Unmerged revisions

28. By monahhas <monahhas@midgard>

[ADD] Compatibility with magento 1.3.x.x added, if version of magento is 1.3.x.x the module will :

- add an order attribute called 'imported' instead of column for magento 1.4.x.x and higher.
- add an observer for the event 'sales_order_place_after' which initialize the value of 'imported' to 0 every time an order is placed, if there any problem during the initialization, a log called OpenErp_Connector.log will be created in [yourmagento]/var/log/, this log contains information about the problem, increment_id, error message,...
- function retreive() compatibility with 1.3.x.x fixed
- allow you to initialize the value of the attribute 'imported' to 0 for all orders placed before installing the module, so they can be imported in OpenErp, this script can be called via this Url : http://[base_url]/index.php/connector/adminhtml_init/orders/

27. By monahhas <monahhas@midgard>

[ADD] create Configurable and Bundle product

26. By Mohammed <email address hidden>

[ADD] Missing files for previous revision (25th)

25. By Mohammed <email address hidden>

[ADD] Flag for imported orders

24. By Raimon Esteve (www.zikzakmedia.com)

[IMP] Newsletter Subscribers. WebServices (part 2)

23. By Raimon Esteve (www.zikzakmedia.com)

[IMP] Newsletter Subscribers. WebServices:
- list
- info
- create
- update
- delete (unsubscriber)
note: magento core not avaible webservice for Newsletter Subscribers

22. By Raphaël Valyi - http://www.akretion.com

[IMP] send attribute scope as we would eventually use it, especially to find out which attributes are translatable (scope=='store'), though that might be overkill

21. By Sharoon Thomas http://openlabs.co.in

[FIX]The attributes.list method now gives the details

20. By Sharoon Thomas http://openlabs.co.in

[ADD]Attribute set fixed

19. By Sharoon Thomas http://openlabs.co.in

[ADD]Api for tier price & customer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'Openlabs_OpenERPConnector-1.1.0'
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs'
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector'
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Helper'
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Helper/Data.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Helper/Data.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Helper/Data.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,6 @@
1<?php
2class Openlabs_OpenERPConnector_Helper_Data extends Mage_Core_Helper_Abstract
3{
4 //Linux4ever_MagentoXtender_Model_Api
5}
6?>
0\ No newline at end of file7\ No newline at end of file
18
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model'
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog'
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog/Product'
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog/Product/Api.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog/Product/Api.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Catalog/Product/Api.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,80 @@
1<?php
2
3/**
4 * @author Mohammed NAHHAS
5 * @package Openlabs_OpenERPConnector
6 */
7
8class Openlabs_OpenERPConnector_Model_Catalog_Product_Api extends Mage_Catalog_Model_Product_Api
9{
10 /**
11 * Set additional data before product saved
12 *
13 * @param Mage_Catalog_Model_Product $product
14 * @param array $productData
15 * @return object
16 */
17 protected function _prepareDataForSave ($product, $productData)
18 {
19 if (isset($productData['categories']) && is_array($productData['categories'])) {
20 $product->setCategoryIds($productData['categories']);
21 }
22
23 if (isset($productData['websites']) && is_array($productData['websites'])) {
24 foreach ($productData['websites'] as &$website) {
25 if (is_string($website)) {
26 try {
27 $website = Mage::app()->getWebsite($website)->getId();
28 } catch (Exception $e) { }
29 }
30 }
31 $product->setWebsiteIds($productData['websites']);
32 }
33
34 if (Mage::app()->isSingleStoreMode()) {
35 $product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId()));
36 }
37
38 if (isset($productData['stock_data']) && is_array($productData['stock_data'])) {
39 $product->setStockData($productData['stock_data']);
40 } else {
41 $product->setStockData(array('use_config_manage_stock' => 0));
42 }
43
44 if (isset($productData['tier_price']) && is_array($productData['tier_price'])) {
45 $tierPrices = Mage::getModel('catalog/product_attribute_tierprice_api')->prepareTierPrices($product, $productData['tier_price']);
46 $product->setData(Mage_Catalog_Model_Product_Attribute_Tierprice_Api::ATTRIBUTE_CODE, $tierPrices);
47 }
48
49 /*
50 * Check if configurable product data array passed
51 */
52 if(isset($productData['configurable_products_data']) && is_array($productData['configurable_products_data'])) {
53 $product->setConfigurableProductsData($productData['configurable_products_data']);
54 }
55
56 if(isset($productData['configurable_attributes_data']) && is_array($productData['configurable_attributes_data'])) {
57 foreach($productData['configurable_attributes_data'] as $key => $data) {
58
59 //Check to see if these values exist, otherwise try and populate from existing values
60 $data['label'] = (!empty($data['label'])) ? $data['label'] : $product->getResource()->getAttribute($data['attribute_code'])->getStoreLabel();
61 $data['frontend_label'] = (!empty($data['frontend_label'])) ? $data['frontend_label'] : $product->getResource()->getAttribute($data['attribute_code'])->getFrontendLabel();
62 $productData['configurable_attributes_data'][$key] = $data;
63 }
64 $product->setConfigurableAttributesData($productData['configurable_attributes_data']);
65 $product->setCanSaveConfigurableAttributes(true);
66 }
67
68 /*
69 * Check if bundle product data, options and bundle items arrays passed
70 */
71 if(isset($productData['bundle_items_data']) && isset($productData['options_data']) && is_array($productData['bundle_items_data']) && is_array($productData['options_data'])) {
72
73 $product->setBundleOptionsData($productData['options_data']);
74 $product->setBundleSelectionsData($productData['bundle_items_data']);
75 $product->setCanSaveBundleSelections(true);
76 $product->setAffectBundleProductSelections(true);
77 Mage::register('product', $product); // product must be registred in order to get the store_id, see _beforeSave() in Mage/Bundle/Model/Selection.php
78 }
79 }
80}
0\ No newline at end of file81\ No newline at end of file
182
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Observer.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Observer.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Observer.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,24 @@
1<?php
2/**
3 *
4 * @author Mohammed NAHHAS
5 * @package Openlabs_OpenERPConnector
6 *
7 */
8
9class Openlabs_OpenERPConnector_Model_Observer extends Mage_Core_Model_Abstract {
10
11 /* Initialize attribtue 'imported' if version < 1.4.0.0 */
12 public function initImported($observer) {
13 if(str_replace('.','',Mage::getVersion()) < 1400) {
14 $order = $observer->getOrder();
15 try {
16 $order->setImported(0)->save();
17 }catch (Exception $e) {
18 /* If logs are enabled (backend : system->configuration->developer->logSettings), it creates a file named OpenErp_Connector.log in /var/log/ which contains the errors */
19 Mage::log('Error, order increment_id = '.$order->getIncrementId().', attribute "imported" was not initialized - error : '.$e->getMessage(), null, 'OpenErp_Connector.log');
20 }
21 $order->setImported(0)->save();
22 }
23 }
24}
0\ No newline at end of file25\ No newline at end of file
126
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog'
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Categories.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Categories.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Categories.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,111 @@
1<?php
2
3
4/**
5 * @author Sharoon Thomas
6 * Inspired from Dieter's Magento Extender
7 * @copyright 2009
8 */
9
10class Openlabs_OpenERPConnector_Model_Olcatalog_Categories extends Mage_Catalog_Model_Api_Resource
11{
12 public function items($filters = null) {
13 try {
14 $collection = Mage :: getModel('catalog/category/attribute')->getCollection()->addAttributeToSelect('image');
15 } catch (Mage_Core_Exception $e) {
16 $this->_fault('category_not_exists');
17 }
18 if (is_array($filters)) {
19 try {
20 foreach ($filters as $field => $value) {
21 $collection->addFieldToFilter($field, $value);
22 }
23 } catch (Mage_Core_Exception $e) {
24 $this->_fault('filters_invalid', $e->getMessage());
25 // If we are adding filter on non-existent attribute
26 }
27 }
28 $result = array ();
29 foreach ($collection as $category) {
30 //$result[] = $customer->toArray();
31 $result[] = array (
32 'category_id' => $category->getId(),
33 'image' => $category->getImage(),
34 );
35 }
36 return $result;
37 }
38
39 public function info($categoryId = null) {
40 if (is_numeric($categoryId)) {
41 try {
42 $collection = Mage :: getModel('catalog/category/attribute')->load($categoryId)->getCollection()->addAttributeToSelect('image');
43 $result = array ();
44 foreach ($collection as $category) {
45 //$result[] = $customer->toArray();
46 if ($category->getId() == $categoryId) {
47 $image = $category->getImage();
48 if ($image) {
49 $path = Mage :: getBaseDir('media') . DS . 'catalog' . DS . 'category' . DS;
50 $fullpath = $path . $image;
51 try {
52 $fp = fopen($fullpath, "rb");
53 $imagebin = fread($fp, filesize($fullpath));
54 $img_data = base64_encode($imagebin);
55 fclose($fp);
56 } catch (Exception $e) {
57 $this->_fault('not_media');
58 }
59 }
60 $result[] = array (
61 'category_id' => $category->getId(),
62 'image' => $category->getImage(),
63 'image_data' => $img_data
64 );
65 }
66 }
67
68 return $result;
69
70 } catch (Mage_Core_Exception $e) {
71 $this->_fault('group_not_exists');
72 }
73
74 }
75
76 }
77
78public function create($filename,$imgdata) {
79 if ($filename)
80 {
81 $path = Mage :: getBaseDir('media') . DS . 'catalog' . DS . 'category' . DS;
82 $fullpath = $path . $filename;
83 try
84 {
85 $fp = fopen($fullpath, "w");
86 if ($fp==false)
87 {
88 return "Error in file creation";
89 }
90 $img_data = base64_decode($imgdata);
91 $imagebin = fwrite($fp,$img_data);
92 fclose($fp);
93 return $imagebin;
94 }
95 catch (Exception $e)
96 {
97 $this->_fault('not_created');
98 }
99 return False;
100 }
101}
102public function update($something=null)
103{
104 return "Not implemented yet";
105}
106public function remove($something=null)
107{
108 return "Not implemented yet";
109}
110}
111?>
0112
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product'
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attribute.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attribute.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attribute.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,109 @@
1<?php
2
3
4/**
5 * @author Sharoon Thomas
6 * Inspired from Dieter's Magento Extender
7 * @copyright 2009
8 */
9
10class Openlabs_OpenERPConnector_Model_Olcatalog_Product_Attribute extends Mage_Catalog_Model_Api_Resource {
11 public function __construct() {
12 $this->_storeIdSessionField = 'product_store_id';
13 $this->_ignoredAttributeCodes[] = 'type_id';
14 $this->_ignoredAttributeTypes[] = 'gallery';
15 $this->_ignoredAttributeTypes[] = 'media_image';
16 }
17
18 /**
19 * Retrieve attributes from specified attribute set
20 *
21 * @param int $setId
22 * @return array
23 */
24 public function relations($setId){
25 $attributes = Mage :: getModel('catalog/product')->getResource()->loadAllAttributes()->getSortedAttributes($setId);
26 $result = array ();
27 foreach ($attributes as $attribute){
28 $result[] = Array(
29 'attribute_id' => $attribute->getId()
30 );
31 }
32 return $result;
33
34 }
35 public function items($setId) {
36 $attributes = Mage :: getModel('catalog/product')->getResource()->loadAllAttributes()->getSortedAttributes($setId);
37 $result = array ();
38
39 foreach ($attributes as $attribute) {
40 /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
41 if ((!$attribute->getId() || $attribute->isInSet($setId)) && $this->_isAllowedAttribute($attribute)) {
42
43 if (!$attribute->getId() || $attribute->isScopeGlobal()) {
44 $scope = 'global';
45 }
46 elseif ($attribute->isScopeWebsite()) {
47 $scope = 'website';
48 } else {
49 $scope = 'store';
50 }
51
52 /*$result[] = array (
53 'attribute_id' => $attribute->getId(),
54 'code' => $attribute->getAttributeCode(),
55 'type' => $attribute->getFrontendInput(),
56 'required' => $attribute->getIsRequired(),
57 'attributeset' => $attribute->getattribute_set_info(),
58 'scope' => $scope
59 );*/
60 //Override hooray
61 $attribute['scope'] = $scope;
62 $result[]=$attribute->toArray();
63 }
64 }
65
66 return $result;
67 }
68
69 public function info($attributeId) {
70 try {
71 return 'hello';
72 $attribute = Mage :: getModel('catalog/product')->getResource()->getAttribute($attributeId);
73 return $attribute->toArray();
74 } catch (Exception $e) {
75 $this->_fault('not_exists');
76 }
77 }
78 /**
79 * Retrieve attribute options
80 *
81 * @param int $attributeId
82 * @param string|int $store
83 * @return array
84 */
85 public function options($attributeId, $store = null) {
86 $storeId = $this->_getStoreId($store);
87 $attribute = Mage :: getModel('catalog/product')->setStoreId($storeId)->getResource()->getAttribute($attributeId)->setStoreId($storeId);
88
89 /* @var $attribute Mage_Catalog_Model_Entity_Attribute */
90 if (!$attribute) {
91 $this->_fault('not_exists');
92 }
93
94 $options = array ();
95 foreach ($attribute->getSource()->getAllOptions() as $optionId => $optionValue) {
96 if (is_array($optionValue)) {
97 $options[] = $optionValue;
98 }
99 else {
100 $options[] = array (
101 'value' => $optionId,
102 'label' => $optionValue
103 );
104 }
105 }
106 return $options;
107 }
108}
109?>
0110
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributegroup.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributegroup.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributegroup.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,167 @@
1<?php
2
3
4/**
5 * @author Sharoon Thomas
6 * Inspired from Dieter's Magento Extender
7 * @copyright 2009
8 */
9
10class Openlabs_OpenERPConnector_Model_Olcatalog_Product_Attributegroup extends Mage_Catalog_Model_Api_Resource {
11 public function olditems($setId = null) {
12 $groups = Mage :: getModel('eav/entity_attribute_group')->getResourceCollection();
13
14 if (!is_null($setId) && !empty ($setId) && is_numeric($setId)) {
15 $groups->setAttributeSetFilter($setId);
16 }
17
18 $groups->load();
19
20 $arrGroups = array ();
21
22 foreach ($groups as $group) {
23 $arrGroups[] = array (
24 'attribute_group_id' => $group->getAttributeGroupId(),
25 'attribute_set_id' => $group->getAttributeSetId(),
26 'attribute_group_name' => $group->getAttributeGroupName(),
27 'sort_order' => $group->getSortOrder(),
28 'default_id' => $group->getDefaultId()
29 );
30 }
31
32 return $arrGroups;
33 }
34
35 public function items($filters = null) {
36 try {
37 $collection = Mage :: getModel('eav/entity_attribute_group')->getCollection();
38 } catch (Mage_Core_Exception $e) {
39 $this->_fault('group_not_exists');
40 }
41
42 if (is_array($filters)) {
43 try {
44 foreach ($filters as $field => $value) {
45 $collection->addFieldToFilter($field, $value);
46 }
47 } catch (Mage_Core_Exception $e) {
48 $this->_fault('filters_invalid', $e->getMessage());
49 // If we are adding filter on non-existent attribute
50 }
51 }
52
53 $result = array ();
54 foreach ($collection as $collection_item) {
55 $result[] = $collection_item->toArray();
56 }
57
58 return $result;
59
60 }
61 /*
62 <param><value><string>cl19t0dqhmheafqc0ccdeejc76</string></value></param>
63 <param><value><string>catalog_product_attribute_group.create</string></value></param>
64 <param>
65 <value>
66 <array>
67 <data>
68 <value><i4>26</i4></value>
69 <value><string>Leonelle</string></value>
70 </data>
71 </array>
72 </value>
73 </param>
74 */
75 public function create($setId, array $data) {
76 try {
77 // $attrOption = Mage_Eav_Model_Entity_Attribute_Group
78 $attrOption = Mage :: getModel("eav/entity_attribute_group");
79
80 $attrOption->addData($data);
81
82 // check if there already exists a group with the give groupname
83 if ($attrOption->itemExists()) {
84 $this->_fault("group_already_exists");
85 }
86
87 $attrOption->save();
88
89 return (int) $attrOption->getAttributeGroupId();
90 } catch (Exception $ex) {
91 return false;
92 }
93 }
94 /*
95 <param><value><string>cl19t0dqhmheafqc0ccdeejc76</string></value></param>
96 <param><value><string>catalog_product_attribute_group.update</string></value></param>
97 <param>
98 <value>
99 <array>
100 <data>
101 <value><i4>85</i4></value>
102 <value><string>Leonelle2</string></value>
103 <value><i4>85</i4></value>
104 <value><i4>85</i4></value>
105 </data>
106 </array>
107 </value>
108 </param>
109 */
110 public function update(array $data) {
111 try {
112 // $attrOption = Mage_Eav_Model_Entity_Attribute_Group
113 $attrOption = Mage :: getModel("eav/entity_attribute_group");
114
115 $attrOption->load($data["attribute_group_id"]);
116
117 // check if the requested group exists...
118 if (!$attrOption->getAttributeGroupId()) {
119 $this->_fault("group_not_exists");
120 }
121
122 $attrOption->addData($data);
123
124 $attrOption->save();
125
126 return true;
127 } catch (Exception $ex) {
128 return false;
129 }
130 }
131
132 /*
133 <param><value><string>cl19t0dqhmheafqc0ccdeejc76</string></value></param>
134 <param><value><string>catalog_product_attribute_group.delete</string></value></param>
135 <param>
136 <value>
137 <array>
138 <data>
139 <value><i4>85</i4></value>
140 </data>
141 </array>
142 </value>
143 </param>
144 */
145 public function delete($groupId) {
146 try {
147 // $attrOption = Mage_Eav_Model_Entity_Attribute_Group
148 $attrOption = Mage :: getModel("eav/entity_attribute_group");
149
150 $attrOption->load($groupId);
151
152 // check if the requested group exists...
153 if (!$attrOption->getAttributeGroupId()) {
154 $this->_fault("group_not_exists");
155 }
156
157 // save data
158 $attrOption->delete();
159
160 return true;
161 } catch (Exception $ex) {
162 return false;
163 }
164 }
165
166}
167?>
0168
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributeset.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributeset.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Attributeset.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,58 @@
1<?php
2/**
3 * Magento
4 *
5 * NOTICE OF LICENSE
6 *
7 * This source file is subject to the Open Software License (OSL 3.0)
8 * that is bundled with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://opensource.org/licenses/osl-3.0.php
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@magentocommerce.com so we can send you a copy immediately.
14 *
15 * DISCLAIMER
16 *
17 * Do not edit or add to this file if you wish to upgrade Magento to newer
18 * versions in the future. If you wish to customize Magento for your
19 * needs please refer to http://www.magentocommerce.com for more information.
20 *
21 * @category Mage
22 * @package Mage_Catalog
23 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25 */
26
27/**
28 * Catalog product attribute set api
29 *
30 * @category Mage
31 * @package Mage_Catalog
32 * @author Magento Core Team <core@magentocommerce.com>
33 */
34class Openlabs_OpenERPConnector_Model_Olcatalog_Product_Attributeset extends Mage_Api_Model_Resource_Abstract
35{
36 /**
37 * Retrieve attribute set list
38 *
39 * @return array
40 */
41 public function items()
42 {
43 $entityType = Mage::getModel('catalog/product')->getResource()->getEntityType();
44 $collection = Mage::getResourceModel('eav/entity_attribute_set_collection')
45 ->setEntityTypeFilter($entityType->getId());
46
47 $result = array();
48 foreach ($collection as $attributeSet) {
49 $result[] = array(
50 'attribute_set_id' => $attributeSet->getId(),
51 'attribute_set_name' => $attributeSet->getAttributeSetName()
52 );
53
54 }
55
56 return $result;
57 }
58} // Class Mage_Catalog_Model_Product_Attribute_Set_Api End
0\ No newline at end of file59\ No newline at end of file
160
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Tierprice.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Tierprice.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Product/Tierprice.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,71 @@
1<?php
2
3/**
4 * Magento
5 *
6 * NOTICE OF LICENSE
7 *
8 * This source file is subject to the Open Software License (OSL 3.0)
9 * that is bundled with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://opensource.org/licenses/osl-3.0.php
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@magentocommerce.com so we can send you a copy immediately.
15 *
16 * DISCLAIMER
17 *
18 * Do not edit or add to this file if you wish to upgrade Magento to newer
19 * versions in the future. If you wish to customize Magento for your
20 * needs please refer to http://www.magentocommerce.com for more information.
21 *
22 * @category Mage
23 * @package Mage_Catalog
24 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
25 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26 */
27
28/**
29 * Catalog Product tier price api
30 *
31 * @category Mage
32 * @package Mage_Catalog
33 * @author Magento Core Team <core@magentocommerce.com>
34 */
35class Openlabs_OpenERPConnector_Model_Olcatalog_Product_Tierprice extends Mage_Catalog_Model_Api_Resource {
36 const ATTRIBUTE_CODE = 'tier_price';
37
38
39 public function items($productIds=null) {
40 if (is_array($productIds)) {
41 $result = array ();
42 foreach ($productIds as $productId) {
43 $product = Mage :: getModel('catalog/product')->load($productId);
44 if (!$product->getId()) {
45 $this->_fault('product_not_exists');
46 }
47 $tierPrices = $product->getData(self :: ATTRIBUTE_CODE);
48 $result[$productId] = $tierPrices;
49 }
50 }
51 return $result;
52
53 }
54
55 public function items2($productIds=null) {
56 $product = Mage :: getModel('catalog/product_attribute_backend_tierprice')->_get_set_go();
57 if (!$product->getId()) {
58 $this->_fault('product_not_exists');
59 }
60
61 $tierPrices = $product->getPriceModel()->getTierPriceCount();
62 return 'hello';
63 $result[$productIds] = $tierPrices;
64
65
66 return $result;
67
68
69 }
70
71}
0\ No newline at end of file72\ No newline at end of file
173
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Products.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Products.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcatalog/Products.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,289 @@
1<?php
2
3class Openlabs_OpenERPConnector_Model_Olcatalog_Products extends Mage_Catalog_Model_Api_Resource
4{
5 protected $_filtersMap = array(
6 'product_id' => 'entity_id',
7 'set' => 'attribute_set_id',
8 'type' => 'type_id'
9 );
10
11 public function __construct()
12 {
13 $this->_storeIdSessionField = 'product_store_id';
14 $this->_ignoredAttributeTypes[] = 'gallery';
15 $this->_ignoredAttributeTypes[] = 'media_image';
16 }
17
18 /**
19 * Retrieve list of products with basic info (id, sku, type, set, name)
20 *
21 * @param array $filters
22 * @param string|int $store
23 * @return array
24 */
25 public function items($filters = null, $store = null)
26 {
27 $collection = Mage::getModel('catalog/product')->getCollection()
28 ->setStoreId($this->_getStoreId($store))
29 ->addAttributeToSelect('name');
30
31 if (is_array($filters)) {
32 try {
33 foreach ($filters as $field => $value) {
34 if (isset($this->_filtersMap[$field])) {
35 $field = $this->_filtersMap[$field];
36 }
37
38 $collection->addFieldToFilter($field, $value);
39 }
40 } catch (Mage_Core_Exception $e) {
41 $this->_fault('filters_invalid', $e->getMessage());
42 }
43 }
44
45 $result = array();
46
47 foreach ($collection as $product) {
48// $result[] = $product->getData();
49 $result[] = array( // Basic product data
50 'product_id' => $product->getId(),
51 'sku' => $product->getSku(),
52 'name' => $product->getName(),
53 'set' => $product->getAttributeSetId(),
54 'type' => $product->getTypeId(),
55 'category_ids' => $product->getCategoryIds()
56 );
57 }
58
59 return $result;
60 }
61
62 /**
63 * Retrieve product info
64 *
65 * @param int|string $productId
66 * @param string|int $store
67 * @param array $attributes
68 * @return array
69 */
70 public function biglist($productId, $store = null, $filters = null)
71 {
72 $collection = Mage::getModel('catalog/product')->getCollection()
73 ->setStoreId($this->_getStoreId($store))
74 ->addAttributeToSelect('name');
75
76 if (is_array($filters)) {
77 try {
78 foreach ($filters as $field => $value) {
79 if (isset($this->_filtersMap[$field])) {
80 $field = $this->_filtersMap[$field];
81 }
82
83 $collection->addFieldToFilter($field, $value);
84 }
85 } catch (Mage_Core_Exception $e) {
86 $this->_fault('filters_invalid', $e->getMessage());
87 }
88 }
89 foreach ($collection as $product) {
90 $data = array();
91 $data = array( // Basic product data
92 'product_id' => $product->getId(),
93 'sku' => $product->getSku(),
94 'set' => $product->getAttributeSetId(),
95 'type' => $product->getTypeId(),
96 'categories' => $product->getCategoryIds(),
97 'websites' => $product->getWebsiteIds()
98 );
99
100 foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
101 $data[$attribute->getAttributeCode()] = $product->getData($attribute->getAttributeCode());
102 }
103 $result[]=$data;
104 }
105 return $result;
106 }
107
108 /**
109 * Create new product.
110 *
111 * @param string $type
112 * @param int $set
113 * @param array $productData
114 * @return int
115 */
116 public function create($type, $set, $sku, $productData)
117 {
118 if (!$type || !$set || !$sku) {
119 $this->_fault('data_invalid');
120 }
121
122 $product = Mage::getModel('catalog/product');
123 /* @var $product Mage_Catalog_Model_Product */
124 $product->setStoreId($this->_getStoreId($store))
125 ->setAttributeSetId($set)
126 ->setTypeId($type)
127 ->setSku($sku);
128
129 if (isset($productData['website_ids']) && is_array($productData['website_ids'])) {
130 $product->setWebsiteIds($productData['website_ids']);
131 }
132
133 foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
134 if ($this->_isAllowedAttribute($attribute)
135 && isset($productData[$attribute->getAttributeCode()])) {
136 $product->setData(
137 $attribute->getAttributeCode(),
138 $productData[$attribute->getAttributeCode()]
139 );
140 }
141 }
142
143 $this->_prepareDataForSave($product, $productData);
144
145 if (is_array($errors = $product->validate())) {
146 $this->_fault('data_invalid', implode("\n", $errors));
147 }
148
149 try {
150 $product->save();
151 } catch (Mage_Core_Exception $e) {
152 $this->_fault('data_invalid', $e->getMessage());
153 }
154
155 return $product->getId();
156 }
157
158 /**
159 * Update product data
160 *
161 * @param int|string $productId
162 * @param array $productData
163 * @param string|int $store
164 * @return boolean
165 */
166 public function update($productId, $productData = array(), $store = null)
167 {
168 $product = $this->_getProduct($productId, $store);
169
170 if (!$product->getId()) {
171 $this->_fault('not_exists');
172 }
173
174 if (isset($productData['website_ids']) && is_array($productData['website_ids'])) {
175 $product->setWebsiteIds($productData['website_ids']);
176 }
177
178 foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
179 if ($this->_isAllowedAttribute($attribute)
180 && isset($productData[$attribute->getAttributeCode()])) {
181 $product->setData(
182 $attribute->getAttributeCode(),
183 $productData[$attribute->getAttributeCode()]
184 );
185 }
186 }
187
188 $this->_prepareDataForSave($product, $productData);
189
190 try {
191 if (is_array($errors = $product->validate())) {
192 $this->_fault('data_invalid', implode("\n", $errors));
193 }
194 } catch (Mage_Core_Exception $e) {
195 $this->_fault('data_invalid', $e->getMessage());
196 }
197
198 try {
199 $product->save();
200 } catch (Mage_Core_Exception $e) {
201 $this->_fault('data_invalid', $e->getMessage());
202 }
203
204 return true;
205 }
206
207 /**
208 * Set additional data before product saved
209 *
210 * @param Mage_Catalog_Model_Product $product
211 * @param array $productData
212 * @return object
213 */
214 protected function _prepareDataForSave ($product, $productData)
215 {
216 if (isset($productData['categories']) && is_array($productData['categories'])) {
217 $product->setCategoryIds($productData['categories']);
218 }
219
220 if (isset($productData['websites']) && is_array($productData['websites'])) {
221 foreach ($productData['websites'] as &$website) {
222 if (is_string($website)) {
223 try {
224 $website = Mage::app()->getWebsite($website)->getId();
225 } catch (Exception $e) { }
226 }
227 }
228 $product->setWebsiteIds($productData['websites']);
229 }
230
231 if (isset($productData['stock_data']) && is_array($productData['stock_data'])) {
232 $product->setStockData($productData['stock_data']);
233 }
234 }
235
236 /**
237 * Update product special price
238 *
239 * @param int|string $productId
240 * @param float $specialPrice
241 * @param string $fromDate
242 * @param string $toDate
243 * @param string|int $store
244 * @return boolean
245 */
246 public function setSpecialPrice($productId, $specialPrice = null, $fromDate = null, $toDate = null, $store = null)
247 {
248 return $this->update($productId, array(
249 'special_price' => $specialPrice,
250 'special_from_date' => $fromDate,
251 'special_to_date' => $toDate
252 ), $store);
253 }
254
255 /**
256 * Retrieve product special price
257 *
258 * @param int|string $productId
259 * @param string|int $store
260 * @return array
261 */
262 public function getSpecialPrice($productId, $store = null)
263 {
264 return $this->info($productId, $store, array('special_price', 'special_from_date', 'special_to_date'));
265 }
266
267 /**
268 * Delete product
269 *
270 * @param int|string $productId
271 * @return boolean
272 */
273 public function delete($productId)
274 {
275 $product = $this->_getProduct($productId);
276
277 if (!$product->getId()) {
278 $this->_fault('not_exists');
279 }
280
281 try {
282 $product->delete();
283 } catch (Mage_Core_Exception $e) {
284 $this->_fault('not_deleted', $e->getMessage());
285 }
286
287 return true;
288 }
289} // Class Mage_Catalog_Model_Product_Api End
0\ No newline at end of file290\ No newline at end of file
1291
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore'
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Groups.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Groups.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Groups.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,142 @@
1<?php
2
3/**
4 * @author Sharoon Thomas
5 * Inspired from Dieter's Magento Extender
6 * @copyright 2009
7 */
8
9class Openlabs_OpenERPConnector_Model_Olcore_Groups extends Mage_Catalog_Model_Api_Resource
10{
11 public function items($filters=null)
12 {
13 try
14 {
15 $collection = Mage::getModel('core/store_group')->getCollection();//->addAttributeToSelect('*');
16 }
17 catch (Mage_Core_Exception $e)
18 {
19 $this->_fault('group_not_exists');
20 }
21
22 if (is_array($filters)) {
23 try {
24 foreach ($filters as $field => $value) {
25 $collection->addFieldToFilter($field, $value);
26 }
27 } catch (Mage_Core_Exception $e) {
28 $this->_fault('filters_invalid', $e->getMessage());
29 // If we are adding filter on non-existent attribute
30 }
31 }
32
33 $result = array();
34 foreach ($collection as $customer) {
35 $result[] = $customer->toArray();
36 }
37
38 return $result;
39 }
40
41 public function info($groupIds = null)
42 {
43 $groups = array();
44
45 if(is_array($groupIds))
46 {
47 foreach($groupIds as $groupId)
48 {
49 try
50 {
51 $groups[] = Mage::getModel('core/store_group')->load($groupId)->toArray();
52 }
53 catch (Mage_Core_Exception $e)
54 {
55 $this->_fault('group_not_exists');
56 }
57 }
58 return $groups;
59 }
60 elseif(is_numeric($groupIds))
61 {
62 try
63 {
64 return Mage::getModel('core/store_group')->load($groupIds)->toArray();
65 }
66 catch (Mage_Core_Exception $e)
67 {
68 $this->_fault('group_not_exists');
69 }
70
71 }
72
73 }
74
75 public function create($groupdata)
76 {
77 try
78 {
79 $group = Mage::getModel('core/store_group')
80 ->setData($groupdata)
81 ->save();
82
83 }
84 catch (Magento_Core_Exception $e)
85 {
86 $this->_fault('data_invalid',$e->getMessage());
87 }
88 catch (Exception $e)
89 {
90 $this->_fault('data_invalid',$e->getMessage());
91 }
92 return $group->getId();
93 }
94
95 public function update($groupid,$groupdata)
96 {
97 try
98 {
99 $group = Mage::getModel('core/store_group')
100 ->load($groupid);
101 if (!$group->getId())
102 {
103 $this->_fault('group_not_exists');
104 }
105 $group->addData($groupdata)->save();
106 }
107 catch (Magento_Core_Exception $e)
108 {
109 $this->_fault('data_invalid',$e->getMessage());
110 }
111 catch (Exception $e)
112 {
113 $this->_fault('data_invalid',$e->getMessage());
114 }
115 return true;
116 }
117
118 public function delete($groupid)
119 {
120 try
121 {
122 $group = Mage::getModel('core/store_group')
123 ->load($groupid);
124 if (!$group->getId())
125 {
126 $this->_fault('group_not_exists');
127 }
128 $group->delete();
129
130 }
131 catch (Magento_Core_Exception $e)
132 {
133 $this->_fault('data_invalid',$e->getMessage());
134 }
135 catch (Exception $e)
136 {
137 $this->_fault('data_invalid',$e->getMessage());
138 }
139 return true;
140 }
141}
142?>
0143
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Storeviews.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Storeviews.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Storeviews.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,142 @@
1<?php
2
3/**
4 * @author Sharoon Thomas
5 * Inspired from Dieter's Magento Extender
6 * @copyright 2009
7 */
8
9class Openlabs_OpenERPConnector_Model_Olcore_Storeviews extends Mage_Catalog_Model_Api_Resource
10{
11 public function items($filters=null)
12 {
13 try
14 {
15 $collection = Mage::getModel('core/store')->getCollection();//->addAttributeToSelect('*');
16 }
17 catch (Mage_Core_Exception $e)
18 {
19 $this->_fault('store_not_exists');
20 }
21
22 if (is_array($filters)) {
23 try {
24 foreach ($filters as $field => $value) {
25 $collection->addFieldToFilter($field, $value);
26 }
27 } catch (Mage_Core_Exception $e) {
28 $this->_fault('filters_invalid', $e->getMessage());
29 // If we are adding filter on non-existent attribute
30 }
31 }
32
33 $result = array();
34 foreach ($collection as $customer) {
35 $result[] = $customer->toArray();
36 }
37
38 return $result;
39 }
40
41 public function info($storeIds = null)
42 {
43 $stores = array();
44
45 if(is_array($storeIds))
46 {
47 foreach($storeIds as $storeId)
48 {
49 try
50 {
51 $stores[] = Mage::getModel('core/store')->load($storeId)->toArray();
52 }
53 catch (Mage_Core_Exception $e)
54 {
55 $this->_fault('store_not_exists');
56 }
57 }
58 return $stores;
59 }
60 elseif(is_numeric($storeIds))
61 {
62 try
63 {
64 return Mage::getModel('core/store')->load($storeIds)->toArray();
65 }
66 catch (Mage_Core_Exception $e)
67 {
68 $this->_fault('store_not_exists');
69 }
70
71 }
72
73 }
74
75 public function create($storedata)
76 {
77 try
78 {
79 $store = Mage::getModel('core/store')
80 ->setData($storedata)
81 ->save();
82
83 }
84 catch (Magento_Core_Exception $e)
85 {
86 $this->_fault('data_invalid',$e->getMessage());
87 }
88 catch (Exception $e)
89 {
90 $this->_fault('data_invalid',$e->getMessage());
91 }
92 return $store->getId();
93 }
94
95 public function update($storeid,$storedata)
96 {
97 try
98 {
99 $store = Mage::getModel('core/store')
100 ->load($storeid);
101 if (!$store->getId())
102 {
103 $this->_fault('store_not_exists');
104 }
105 $store->addData($storedata)->save();
106 }
107 catch (Magento_Core_Exception $e)
108 {
109 $this->_fault('data_invalid',$e->getMessage());
110 }
111 catch (Exception $e)
112 {
113 $this->_fault('data_invalid',$e->getMessage());
114 }
115 return true;
116 }
117
118 public function delete($storeid)
119 {
120 try
121 {
122 $store = Mage::getModel('core/store')
123 ->load($storeid);
124 if (!$store->getId())
125 {
126 $this->_fault('store_not_exists');
127 }
128 $store->delete();
129
130 }
131 catch (Magento_Core_Exception $e)
132 {
133 $this->_fault('data_invalid',$e->getMessage());
134 }
135 catch (Exception $e)
136 {
137 $this->_fault('data_invalid',$e->getMessage());
138 }
139 return true;
140 }
141}
142?>
0143
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Website.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Website.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcore/Website.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,171 @@
1<?php
2
3/**
4 * @author Sharoon Thomas
5 * Inspired from Dieter's Magento Extender
6 * @copyright 2009
7 */
8
9class Openlabs_OpenERPConnector_Model_Olcore_Website extends Mage_Catalog_Model_Api_Resource
10{
11
12 public function items($filters=null)
13 {
14 try
15 {
16 $collection = Mage::getModel('core/website')->getCollection();//->addAttributeToSelect('*');
17 }
18 catch (Mage_Core_Exception $e)
19 {
20 $this->_fault('store_not_exists');
21 }
22
23 if (is_array($filters)) {
24 try {
25 foreach ($filters as $field => $value) {
26 $collection->addFieldToFilter($field, $value);
27 }
28 } catch (Mage_Core_Exception $e) {
29 $this->_fault('filters_invalid', $e->getMessage());
30 // If we are adding filter on non-existent attribute
31 }
32 }
33
34 $result = array();
35 foreach ($collection as $customer) {
36 $result[] = $customer->toArray();
37 }
38
39 return $result;
40 }
41
42 public function info($storeIds = null)
43 {
44 $stores = array();
45
46 if(is_array($storeIds))
47 {
48 foreach($storeIds as $storeId)
49 {
50 try
51 {
52 $stores[] = Mage::getModel('core/website')->load($storeId)->toArray();
53 }
54 catch (Mage_Core_Exception $e)
55 {
56 $this->_fault('store_not_exists');
57 }
58 }
59 return $stores;
60 }
61 elseif(is_numeric($storeIds))
62 {
63 try
64 {
65 return Mage::getModel('core/website')->load($storeIds)->toArray();
66 }
67 catch (Mage_Core_Exception $e)
68 {
69 $this->_fault('store_not_exists');
70 }
71
72 }
73
74 }
75 //This is a protected function used by items & info for fetching website information
76
77 public function create($websitedata)
78 {
79 try
80 {
81 $website = Mage::getModel('core/website')
82 ->setData($websitedata)
83 ->save();
84
85 }
86 catch (Magento_Core_Exception $e)
87 {
88 $this->_fault('data_invalid',$e->getMessage());
89 }
90 catch (Exception $e)
91 {
92 $this->_fault('data_invalid',$e->getMessage());
93 }
94 return $website->getId();
95 }
96
97 public function update($websiteid,$websitedata)
98 {
99 try
100 {
101 $website = Mage::getModel('core/website')
102 ->load($websiteid);
103 if (!$website->getId())
104 {
105 $this->_fault('website_not_exists');
106 }
107 $website->addData($websitedata)->save();
108 }
109 catch (Magento_Core_Exception $e)
110 {
111 $this->_fault('data_invalid',$e->getMessage());
112 }
113 catch (Exception $e)
114 {
115 $this->_fault('data_invalid',$e->getMessage());
116 }
117 return true;
118 }
119
120 public function delete($websiteid)
121 {
122 try
123 {
124 $website = Mage::getModel('core/website')
125 ->load($websiteid);
126 if (!$website->getId())
127 {
128 $this->_fault('website_not_exists');
129 }
130 $website->delete();
131
132 }
133 catch (Magento_Core_Exception $e)
134 {
135 $this->_fault('data_invalid',$e->getMessage());
136 }
137 catch (Exception $e)
138 {
139 $this->_fault('data_invalid',$e->getMessage());
140 }
141 return true;
142 }
143
144 public function tree()
145 {
146 $tree = array();
147
148 $websites = $this->websites();
149
150 foreach($websites as $website)
151 {
152 $groups = $this->groups($website['group_ids']);
153 $tree[$website['code']] = $website;
154 foreach($groups as $group)
155 {
156 $stores = $this->stores($group["store_ids"]);
157
158 $tree[$website['code']]['groups']['group_'.$group['group_id']] = $group;
159
160 foreach($stores as $store)
161 {
162 $tree[$website['code']]['groups']['group_'.$group['group_id']]['stores'][$store['code']] = $store;
163 }
164 }
165 }
166
167 return $tree;
168 }
169
170}
171?>
0\ No newline at end of file172\ No newline at end of file
1173
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer'
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Address.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Address.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Address.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,241 @@
1<?php
2/**
3 * Magento
4 *
5 * NOTICE OF LICENSE
6 *
7 * This source file is subject to the Open Software License (OSL 3.0)
8 * that is bundled with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://opensource.org/licenses/osl-3.0.php
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@magentocommerce.com so we can send you a copy immediately.
14 *
15 * DISCLAIMER
16 *
17 * Do not edit or add to this file if you wish to upgrade Magento to newer
18 * versions in the future. If you wish to customize Magento for your
19 * needs please refer to http://www.magentocommerce.com for more information.
20 *
21 * @category Mage
22 * @package Mage_Customer
23 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25 */
26
27/**
28 * Customer address api
29 *
30 * @category Mage
31 * @package Mage_Customer
32 * @author Magento Core Team <core@magentocommerce.com>
33 */
34class Openlabs_OpenERPConnector_Model_Olcustomer_Address extends Mage_Customer_Model_Api_Resource
35{
36 protected $_mapAttributes = array(
37 'customer_id' => 'entity_id'
38 );
39
40 public function __construct()
41 {
42 $this->_ignoredAttributeCodes[] = 'parent_id';
43 }
44
45 /**
46 * Retrive customer addresses list
47 *
48 * @param int $customerId
49 * @return array
50 */
51 public function items($customerId)
52 {
53 $customer = Mage::getModel('customer/customer')
54 ->load($customerId);
55 /* @var $customer Mage_Customer_Model_Customer */
56
57 if (!$customer->getId()) {
58 $this->_fault('customer_not_exists');
59 }
60
61 $result = array();
62 foreach ($customer->getAddresses() as $address) {
63 $data = $address->toArray();
64 $data['default_billing'] = $customer->getDefaultBilling() == $address->getId();
65 $data['default_shipping'] = $customer->getDefaultShipping() == $address->getId();
66 $result[] = $data;
67 /*$data = $address->toArray();
68 $row = array();
69
70 foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) {
71 $row[$attributeAlias] = isset($data[$attributeCode]) ? $data[$attributeCode] : null;
72 }
73
74 foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
75 if (isset($data[$attributeCode])) {
76 $row[$attributeCode] = $data[$attributeCode];
77 }
78 }
79
80 $row['is_default_billing'] = $customer->getDefaultBillingAddress() == $address->getId();
81 $row['is_default_shipping'] = $customer->getDefaultShippingAddress() == $address->getId();
82
83 $result[] = $row;*/
84
85 }
86
87 return $result;
88 }
89
90 /**
91 * Create new address for customer
92 *
93 * @param int $customerId
94 * @param array $addressData
95 * @return int
96 */
97 public function create($customerId, $addressData)
98 {
99 $customer = Mage::getModel('customer/customer')
100 ->load($customerId);
101 /* @var $customer Mage_Customer_Model_Customer */
102
103 if (!$customer->getId()) {
104 $this->_fault('customer_not_exists');
105 }
106
107 $address = Mage::getModel('customer/address');
108
109 foreach ($this->getAllowedAttributes($address) as $attributeCode=>$attribute) {
110 if (isset($addressData[$attributeCode])) {
111 $address->setData($attributeCode, $addressData[$attributeCode]);
112 }
113 }
114
115 if (isset($addressData['is_default_billing'])) {
116 $address->setIsDefaultBilling($addressData['is_default_billing']);
117 }
118
119 if (isset($addressData['is_default_shipping'])) {
120 $address->setIsDefaultShipping($addressData['is_default_shipping']);
121 }
122
123 $address->setCustomerId($customer->getId());
124
125 $valid = $address->validate();
126
127 if (is_array($valid)) {
128 $this->_fault('data_invalid', implode("\n", $valid));
129 }
130
131 try {
132 $address->save();
133 } catch (Mage_Core_Exception $e) {
134 $this->_fault('data_invalid', $e->getMessage());
135 }
136
137 return $address->getId();
138 }
139
140 /**
141 * Retrieve address data
142 *
143 * @param int $addressId
144 * @return array
145 */
146 public function info($addressId)
147 {
148 $address = Mage::getModel('customer/address')
149 ->load($addressId);
150
151 if (!$address->getId()) {
152 $this->_fault('not_exists');
153 }
154
155 $result = array();
156
157 foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) {
158 $result[$attributeAlias] = $address->getData($attributeCode);
159 }
160
161 foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
162 $result[$attributeCode] = $address->getData($attributeCode);
163 }
164
165
166 if ($customer = $address->getCustomer()) {
167 $result['is_default_billing'] = $customer->getDefaultBillingAddress() == $address->getId();
168 $result['is_default_shipping'] = $customer->getDefaultShippingAddress() == $address->getId();
169 }
170
171 return $result;
172 }
173
174 /**
175 * Update address data
176 *
177 * @param int $addressId
178 * @param array $addressData
179 * @return boolean
180 */
181 public function update($addressId, $addressData)
182 {
183 $address = Mage::getModel('customer/address')
184 ->load($addressId);
185
186 if (!$address->getId()) {
187 $this->_fault('not_exists');
188 }
189
190 foreach ($this->getAllowedAttributes($address) as $attributeCode=>$attribute) {
191 if (isset($addressData[$attributeCode])) {
192 $address->setData($attributeCode, $addressData[$attributeCode]);
193 }
194 }
195
196 if (isset($addressData['is_default_billing'])) {
197 $address->setIsDefaultBilling($addressData['is_default_billing']);
198 }
199
200 if (isset($addressData['is_default_shipping'])) {
201 $address->setIsDefaultShipping($addressData['is_default_shipping']);
202 }
203
204 $valid = $address->validate();
205 if (is_array($valid)) {
206 $this->_fault('data_invalid', implode("\n", $valid));
207 }
208
209 try {
210 $address->save();
211 } catch (Mage_Core_Exception $e) {
212 $this->_fault('data_invalid', $e->getMessage());
213 }
214
215 return true;
216 }
217
218 /**
219 * Delete address
220 *
221 * @param int $addressId
222 * @return boolean
223 */
224 public function delete($addressId)
225 {
226 $address = Mage::getModel('customer/address')
227 ->load($addressId);
228
229 if (!$address->getId()) {
230 $this->_fault('not_exists');
231 }
232
233 try {
234 $address->delete();
235 } catch (Mage_Core_Exception $e) {
236 $this->_fault('not_deleted', $e->getMessage());
237 }
238
239 return true;
240 }
241} // Class Mage_Customer_Model_Address_Api End
0\ No newline at end of file242\ No newline at end of file
1243
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Customer.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Customer.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Customer.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,142 @@
1<?php
2
3/**
4 * @author Sharoon Thomas
5 * Inspired from Dieter's Magento Extender
6 * @copyright 2009
7 */
8
9class Openlabs_OpenERPConnector_Model_Olcustomer_Customer extends Mage_Catalog_Model_Api_Resource
10{
11 public function items($filters=null)
12 {
13 try
14 {
15 $collection = Mage::getModel('customer')->getCollection();//->addAttributeToSelect('*');
16 }
17 catch (Mage_Core_Exception $e)
18 {
19 $this->_fault('customer_not_exists');
20 }
21
22 if (is_array($filters)) {
23 try {
24 foreach ($filters as $field => $value) {
25 $collection->addFieldToFilter($field, $value);
26 }
27 } catch (Mage_Core_Exception $e) {
28 $this->_fault('filters_invalid', $e->getMessage());
29 // If we are adding filter on non-existent attribute
30 }
31 }
32
33 $result = array();
34 foreach ($collection as $customer) {
35 $result[] = $customer->toArray();
36 }
37
38 return $result;
39 }
40
41 public function info($groupIds = null)
42 {
43 $groups = array();
44
45 if(is_array($groupIds))
46 {
47 foreach($groupIds as $groupId)
48 {
49 try
50 {
51 $groups[] = Mage::getModel('customer')->load($groupId)->toArray();
52 }
53 catch (Mage_Core_Exception $e)
54 {
55 $this->_fault('customer_not_exists');
56 }
57 }
58 return $groups;
59 }
60 elseif(is_numeric($groupIds))
61 {
62 try
63 {
64 return Mage::getModel('customer')->load($groupIds)->toArray();
65 }
66 catch (Mage_Core_Exception $e)
67 {
68 $this->_fault('customer_not_exists');
69 }
70
71 }
72
73 }
74
75 public function create($groupdata)
76 {
77 try
78 {
79 $group = Mage::getModel('customer')
80 ->setData($groupdata)
81 ->save();
82
83 }
84 catch (Magento_Core_Exception $e)
85 {
86 $this->_fault('data_invalid',$e->getMessage());
87 }
88 catch (Exception $e)
89 {
90 $this->_fault('data_invalid',$e->getMessage());
91 }
92 return $group->getId();
93 }
94
95 public function update($groupid,$groupdata)
96 {
97 try
98 {
99 $group = Mage::getModel('customer')
100 ->load($groupid);
101 if (!$group->getId())
102 {
103 $this->_fault('customer_not_exists');
104 }
105 $group->addData($groupdata)->save();
106 }
107 catch (Magento_Core_Exception $e)
108 {
109 $this->_fault('data_invalid',$e->getMessage());
110 }
111 catch (Exception $e)
112 {
113 $this->_fault('data_invalid',$e->getMessage());
114 }
115 return true;
116 }
117
118 public function delete($groupid)
119 {
120 try
121 {
122 $group = Mage::getModel('customer')
123 ->load($groupid);
124 if (!$group->getId())
125 {
126 $this->_fault('customer_not_exists');
127 }
128 $group->delete();
129
130 }
131 catch (Magento_Core_Exception $e)
132 {
133 $this->_fault('data_invalid',$e->getMessage());
134 }
135 catch (Exception $e)
136 {
137 $this->_fault('data_invalid',$e->getMessage());
138 }
139 return true;
140 }
141}
142?>
0143
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Group.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Group.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Group.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,142 @@
1<?php
2
3/**
4 * @author Sharoon Thomas
5 * Inspired from Dieter's Magento Extender
6 * @copyright 2009
7 */
8
9class Openlabs_OpenERPConnector_Model_Olcustomer_Group extends Mage_Catalog_Model_Api_Resource
10{
11 public function items($filters=null)
12 {
13 try
14 {
15 $collection = Mage::getModel('customer/group')->getCollection();//->addAttributeToSelect('*');
16 }
17 catch (Mage_Core_Exception $e)
18 {
19 $this->_fault('group_not_exists');
20 }
21
22 if (is_array($filters)) {
23 try {
24 foreach ($filters as $field => $value) {
25 $collection->addFieldToFilter($field, $value);
26 }
27 } catch (Mage_Core_Exception $e) {
28 $this->_fault('filters_invalid', $e->getMessage());
29 // If we are adding filter on non-existent attribute
30 }
31 }
32
33 $result = array();
34 foreach ($collection as $customer) {
35 $result[] = $customer->toArray();
36 }
37
38 return $result;
39 }
40
41 public function info($groupIds = null)
42 {
43 $groups = array();
44
45 if(is_array($groupIds))
46 {
47 foreach($groupIds as $groupId)
48 {
49 try
50 {
51 $groups[] = Mage::getModel('customer/group')->load($groupId)->toArray();
52 }
53 catch (Mage_Core_Exception $e)
54 {
55 $this->_fault('group_not_exists');
56 }
57 }
58 return $groups;
59 }
60 elseif(is_numeric($groupIds))
61 {
62 try
63 {
64 return Mage::getModel('customer/group')->load($groupIds)->toArray();
65 }
66 catch (Mage_Core_Exception $e)
67 {
68 $this->_fault('group_not_exists');
69 }
70
71 }
72
73 }
74
75 public function create($groupdata)
76 {
77 try
78 {
79 $group = Mage::getModel('customer/group')
80 ->setData($groupdata)
81 ->save();
82
83 }
84 catch (Magento_Core_Exception $e)
85 {
86 $this->_fault('data_invalid',$e->getMessage());
87 }
88 catch (Exception $e)
89 {
90 $this->_fault('data_invalid',$e->getMessage());
91 }
92 return $group->getId();
93 }
94
95 public function update($groupid,$groupdata)
96 {
97 try
98 {
99 $group = Mage::getModel('customer/group')
100 ->load($groupid);
101 if (!$group->getId())
102 {
103 $this->_fault('group_not_exists');
104 }
105 $group->addData($groupdata)->save();
106 }
107 catch (Magento_Core_Exception $e)
108 {
109 $this->_fault('data_invalid',$e->getMessage());
110 }
111 catch (Exception $e)
112 {
113 $this->_fault('data_invalid',$e->getMessage());
114 }
115 return true;
116 }
117
118 public function delete($groupid)
119 {
120 try
121 {
122 $group = Mage::getModel('customer/group')
123 ->load($groupid);
124 if (!$group->getId())
125 {
126 $this->_fault('group_not_exists');
127 }
128 $group->delete();
129
130 }
131 catch (Magento_Core_Exception $e)
132 {
133 $this->_fault('data_invalid',$e->getMessage());
134 }
135 catch (Exception $e)
136 {
137 $this->_fault('data_invalid',$e->getMessage());
138 }
139 return true;
140 }
141}
142?>
0143
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Subscriber.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Subscriber.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Olcustomer/Subscriber.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,163 @@
1<?php
2/**
3 * Magento
4 *
5 * NOTICE OF LICENSE
6 *
7 * This source file is subject to the Open Software License (OSL 3.0)
8 * that is bundled with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://opensource.org/licenses/osl-3.0.php
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@magentocommerce.com so we can send you a copy immediately.
14 *
15 * DISCLAIMER
16 *
17 * Do not edit or add to this file if you wish to upgrade Magento to newer
18 * versions in the future. If you wish to customize Magento for your
19 * needs please refer to http://www.magentocommerce.com for more information.
20 *
21 * @category Mage
22 * @package Mage_Customer
23 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25 */
26
27/**
28 * Customer address api
29 *
30 * @category Mage
31 * @package Mage_Customer
32 * @author Magento Core Team <core@magentocommerce.com>
33 */
34class Openlabs_OpenERPConnector_Model_Olcustomer_Subscriber extends Mage_Customer_Model_Api_Resource
35{
36 protected $_mapAttributes = array(
37 'customer_id' => 'entity_id'
38 );
39
40 public function __construct()
41 {
42 $this->_ignoredAttributeCodes[] = 'parent_id';
43 }
44
45 /**
46 * Retrive subscriber list
47 *
48 * @param int $filters
49 * @return array
50 */
51 public function items($filters=null)
52 {
53 $collection = Mage::getModel('customer/customer')->getCollection()
54 ->addAttributeToSelect('*');
55
56
57 if (is_array($filters)) {
58 try {
59 foreach ($filters as $field => $value) {
60 $collection->addFieldToFilter($field, $value);
61 }
62 } catch (Mage_Core_Exception $e) {
63 $this->_fault('filters_invalid', $e->getMessage());
64 // If we are adding filter on non-existent attribute
65 }
66 }
67
68 $result = array();
69
70 foreach ($collection as $customer) {
71 $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer['email']);
72 if($subscriber->getId())
73 $result[] = $subscriber->getId();
74 }
75
76 return $result;
77 }
78
79 /**
80 * Create new address for customer
81 *
82 * @param int $customerId
83 * @param array $email
84 * @return int
85 */
86 public function create($customerId,$email)
87 {
88 if($customerId && $email):
89 $customer = Mage::getModel("newsletter/subscriber");
90
91 $customer->setCustomerId($customerId);
92 $customer->setEmail($email);
93 $customer->subscriber_status = "1";
94
95 $customer->save();
96
97 return $customer->getId();
98 else:
99 return False;
100 endif;
101 }
102
103 /**
104 * Retrieve subscriber data
105 *
106 * @param int $subscriberId
107 * @return array
108 */
109 public function info($subscriberId)
110 {
111 $subscriber = Mage::getModel('newsletter/subscriber')->load($subscriberId);
112
113 if($subscriber->getId()):
114 $result[] = $subscriber->toArray();
115 endif;
116
117 return $result;
118 }
119
120 /**
121 * Update subscriber data (subscriber)
122 *
123 * @param $email
124 * @return boolean
125 */
126 public function update($email)
127 {
128 if($email):
129 $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
130
131 if($subscriber->getId()):
132 $customer = Mage::getModel("newsletter/subscriber")->load($subscriber->getId());
133 $customer->subscriber_status = "1";
134 $customer->save();
135 endif;
136
137 return $subscriber->getId();
138 else:
139 return False;
140 endif;
141 }
142
143 /**
144 * Delete subscriber (unsubscriber)
145 *
146 * @param $email
147 * @return boolean
148 */
149 public function delete($email)
150 {
151 if($email):
152 $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
153
154 if($subscriber->getId()):
155 Mage::getModel('newsletter/subscriber')->load($subscriber->getId())->unsubscribe();
156 endif;
157
158 return $subscriber->getId();
159 else:
160 return False;
161 endif;
162 }
163} // Class Mage_Customer_Model_Address_Api End
0164
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales'
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales/Order'
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales/Order/Api.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales/Order/Api.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/Model/Sales/Order/Api.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,116 @@
1<?php
2
3/**
4 *
5 * @author Mohammed NAHHAS
6 * @package Openlabs_OpenERPConnector
7 *
8 */
9
10class Openlabs_OpenERPConnector_Model_Sales_Order_Api extends Mage_Sales_Model_Order_Api {
11
12 /**
13 *
14 * Retrieve orders data based on the value of the flag 'imported'
15 * @param array
16 * @return array
17 */
18 public function retrieveOrders($data) {
19
20 $result = array();
21 if(isset($data['imported'])) {
22
23 $collection = Mage::getModel("sales/order")->getCollection()
24 ->addAttributeToSelect('*')
25 ->addAttributeToFilter('imported', array('eq' => $data['imported']));
26
27 /* addAddressFields() is called only if version >= 1400 */
28 if(str_replace('.','',Mage::getVersion()) >= 1400) {
29 $collection->addAddressFields();
30 }
31
32 if(isset($data['limit'])) {
33 $collection->setPageSize($data['limit']);
34 $collection->setOrder('entity_id', 'ASC');
35 }
36
37 if(isset($data['filters']) && is_array($data['filters'])) {
38 $filters = $data['filters'];
39 foreach($filters as $field => $value) {
40 $collection->addAttributeToFilter($field, $value);
41 }
42 }
43
44 foreach ($collection as $order) {
45 $tmp = $this->_getAttributes($order, 'order');
46
47 /* if version < 1400, billing and shipping information are added manually to order data */
48 if(str_replace('.','',Mage::getVersion()) < 1400) {
49 $address_data = $this->_getAttributes($order->getShippingAddress(), 'order_address');
50 if(!empty($address_data)) {
51 $tmp['shipping_firstname'] = $address_data['firstname'];
52 $tmp['shipping_lastname'] = $address_data['lastname'];
53 }
54
55 $address_data = $this->_getAttributes($order->getBillingAddress(), 'order_address');
56 if(!empty($address_data)) {
57 $tmp['billing_firstname'] = $address_data['firstname'];
58 $tmp['billing_lastname'] = $address_data['lastname'];
59 }
60 }
61
62 $result[] = $tmp;
63 }
64 return $result;
65 }else{
66 $this->_fault('data_invalid', "Error, the attribut 'imported' need to be specified");
67 }
68 }
69
70 public function setFlagForOrder($incrementId) {
71 $_order = $this->_initOrder($incrementId);
72 $_order->setImported(1);
73 try {
74 $_order->save();
75 return true;
76 } catch (Mage_Core_Exception $e) {
77 $this->_fault('data_invalid', $e->getMessage());
78 }
79 }
80
81 /* Retrieve increment_id of the child order */
82 public function getOrderChild($incrementId) {
83
84 $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
85 /**
86 * Check order existing
87 */
88 if (!$order->getId()) {
89 $this->_fault('order_not_exists');
90 }
91
92 if($order->getRelationChildId()) {
93 return $order->getRelationChildRealId();
94 }else{
95 return false;
96 }
97 }
98
99 /* Retrieve increment_id of the parent order */
100 public function getOrderParent($incrementId) {
101
102 $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
103 /**
104 * Check order existing
105 */
106 if (!$order->getId()) {
107 $this->_fault('order_not_exists');
108 }
109
110 if($order->getRelationParentId()) {
111 return $order->getRelationParentRealId();
112 }else{
113 return false;
114 }
115 }
116}
0\ No newline at end of file117\ No newline at end of file
1118
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers'
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/Adminhtml'
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/Adminhtml/InitController.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/Adminhtml/InitController.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/Adminhtml/InitController.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,61 @@
1<?php
2
3/**
4 *
5 * @author Mohammed NAHHAS
6 * @package Openlabs_OpenERPConnector
7 *
8 */
9
10class Openlabs_OpenERPConnector_Adminhtml_InitController extends Mage_Adminhtml_Controller_Action
11{
12 protected $_imported = 'imported';
13
14 /* Initialize the Attribute 'Imported' for orders placed before installing Openlabs_OpenERPConnector Extension */
15 public function ordersAction() {
16 /* 'imported' value will be initialized if magento version is < 1.4.0.0 */
17 if(str_replace('.','',Mage::getVersion()) < 1400) {
18 $orders = array();
19
20 /* 'imported' attribute values are stored in sales_order_int */
21 $imported_attribute_table_name = 'sales_order_int';
22
23 /* retrieve entity_type_id for order */
24 $entity_type = Mage::getModel('eav/entity_type')->loadByCode('order');
25
26 /* Load 'imported' attribute to get its attribute_id */
27 $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
28 ->setCodeFilter($this->_imported)
29 ->setEntityTypeFilter($entity_type->getEntityTypeId())
30 ->getFirstItem();
31
32 /* load order collection */
33 $collection = Mage::getResourceModel('sales/order_collection')
34 ->addAttributeToSelect($this->_imported);
35
36 if(count($collection->getItems()) > 0) {
37 foreach($collection as $order) {
38 try{
39 $test = $order->getResource()->getAttribute($this->_imported);
40 $orders[] = $order->getIncrementId();
41 $order->setImported(0)->save();
42 $request = "INSERT IGNORE INTO ".$imported_attribute_table_name." (entity_type_id, attribute_id, entity_id, value) VALUES (".$entity_type->getEntityTypeId().", ".$attributeInfo->getAttributeId().", ".$order->getEntityId().", 0)";
43 $write = Mage::getSingleton('core/resource')->getConnection('core_write');
44 $query = $write->query($request);
45 }catch (Exception $e) {
46 echo 'Error : '.$e->getMessage();
47 }
48 }
49
50 echo 'Number of Orders Initialized : '.count($collection->getItems()) .'<br />';
51 echo 'Orders List : '.'<br />';
52 echo '<pre>';
53 print_r($orders);
54 echo '</pre>';
55 }
56 }else{
57 echo 'Magento Version : '.Mage::getVersion().'<br />';
58 echo 'There is no need to initialize orders';
59 }
60 }
61}
0\ No newline at end of file62\ No newline at end of file
163
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/OpenerpconnectorController.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/OpenerpconnectorController.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/controllers/OpenerpconnectorController.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,5 @@
1<?php
2class Openlabs_OpenERPConnector_OpenerpconnectorController extends Mage_Core_Controller_Front_Action
3{
4
5}
06
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc'
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/api.xml'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/api.xml 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/api.xml 2011-11-09 09:54:26 +0000
@@ -0,0 +1,526 @@
1
2<config>
3 <api>
4 <resources>
5 <ol_websites translate="title" module="core">
6 <title>Website Management</title>
7 <model>openerpconnector/olcore_website</model>
8 <acl>core/store</acl>
9 <methods>
10 <list translate="title" module="core">
11 <title>Enumerate websites</title>
12 <method>items</method>
13 </list>
14 <create translate="title" module="core">
15 <title>Create Websites</title>
16 <!--Parameters are code,name,is_default,sort_order,default_group_id,group_ids-->
17 <method>create</method>
18 </create>
19 <info translate="title" module="core">
20 <title>Fetch detail of websites</title>
21 <method>info</method>
22 </info>
23 <update translate="title" module="core">
24 <title>Update websites info</title>
25 <method>update</method>
26 </update>
27 <delete translate="title" module="core">
28 <title>Delete websites</title>
29 <method>delete</method>
30 </delete>
31 </methods>
32 <faults module="core">
33 <website_not_exists>
34 <code>101</code>
35 <message>Requested website not found.</message>
36 </website_not_exists>
37 <data_invalid>
38 <code>102</code>
39 <message>Website creation failed due to invalid data.</message>
40 </data_invalid>
41 </faults>
42 </ol_websites>
43 <ol_groups translate="title" module="core">
44 <title>Groups Management</title>
45 <model>openerpconnector/olcore_groups</model>
46 <acl>core/store</acl>
47 <methods>
48 <list translate="title" module="core">
49 <title>Enumerate groups</title>
50 <method>items</method>
51 </list>
52 <create translate="title" module="core">
53 <title>Create groups</title>
54 <!--Parameters are code,name,is_default,sort_order,default_group_id,group_ids-->
55 <method>create</method>
56 </create>
57 <info translate="title" module="core">
58 <title>Fetch detail of groups</title>
59 <method>info</method>
60 </info>
61 <update translate="title" module="core">
62 <title>Update groups info</title>
63 <method>update</method>
64 </update>
65 <delete translate="title" module="core">
66 <title>Delete groups</title>
67 <method>delete</method>
68 </delete>
69 </methods>
70 <faults module="core">
71 <group_not_exists>
72 <code>101</code>
73 <message>Requested group not found.</message>
74 </group_not_exists>
75 <data_invalid>
76 <code>102</code>
77 <message>group creation failed due to invalid data.</message>
78 </data_invalid>
79 <filters_invalid>
80 <code>103</code>
81 <message>Invalid data fetch filter.</message>
82 </filters_invalid>
83 </faults>
84 </ol_groups>
85 <ol_storeviews translate="title" module="core">
86 <title>Stores Management</title>
87 <model>openerpconnector/olcore_storeviews</model>
88 <acl>core/store</acl>
89 <methods>
90 <list translate="title" module="core">
91 <title>Enumerate stores</title>
92 <method>items</method>
93 </list>
94 <create translate="title" module="core">
95 <title>Create stores</title>
96 <!--Parameters are code,name,is_default,sort_order,default_group_id,group_ids-->
97 <method>create</method>
98 </create>
99 <info translate="title" module="core">
100 <title>Fetch detail of stores</title>
101 <method>info</method>
102 </info>
103 <update translate="title" module="core">
104 <title>Update stores info</title>
105 <method>update</method>
106 </update>
107 <delete translate="title" module="core">
108 <title>Delete stores</title>
109 <method>delete</method>
110 </delete>
111 </methods>
112 <faults module="core">
113 <store_not_exists>
114 <code>101</code>
115 <message>Requested store not found.</message>
116 </store_not_exists>
117 <data_invalid>
118 <code>102</code>
119 <message>Store creation failed due to invalid data.</message>
120 </data_invalid>
121 <filters_invalid>
122 <code>103</code>
123 <message>Invalid data fetch filter.</message>
124 </filters_invalid>
125 </faults>
126 </ol_storeviews>
127 <ol_catalog_category_media translate="title" module="catalog">
128 <title>Product Images API</title>
129 <model>openerpconnector/olcatalog_categories</model>
130 <acl>catalog/category</acl>
131 <methods>
132 <list translate="title" module="catalog">
133 <title>Retrieve product image list</title>
134 <method>items</method>
135 </list>
136 <info translate="title" module="catalog">
137 <title>Retrieve product category image</title>
138 </info>
139 <types translate="title" module="catalog">
140 <title>Retrieve product category image types</title>
141 </types>
142 <create translate="title" module="catalog">
143 <title>Upload new product category image </title>
144 <acl>catalog/product/media/create</acl>
145 </create>
146 <update translate="title" module="catalog">
147 <title>Update product category image</title>
148 <acl>catalog/product/media/update</acl>
149 </update>
150 <remove translate="title" module="catalog">
151 <title>Remove product category image</title>
152 <acl>catalog/product/media/remove</acl>
153 </remove>
154 </methods>
155 <faults module="catalog">
156 <create_failure>
157 <code>100</code>
158 <message>Could not create file, check permissions.</message>
159 </create_failure>
160 <category_not_exists>
161 <code>101</code>
162 <message>Product not exists.</message>
163 </category_not_exists>
164 <data_invalid>
165 <code>102</code>
166 <message>Invalid data given. Details in error message.</message>
167 </data_invalid>
168 <not_exists>
169 <code>103</code>
170 <message>Requested image not exists in product images' gallery.</message>
171 </not_exists>
172 <not_created>
173 <code>104</code>
174 <message>Image creation failed. Details in error message.</message>
175 </not_created>
176 <not_updated>
177 <code>105</code>
178 <message>Image not updated. Details in error message.</message>
179 </not_updated>
180 <not_removed>
181 <code>106</code>
182 <message>Image not removed. Details in error message.</message>
183 </not_removed>
184 <not_media>
185 <code>107</code>
186 <message>Error in opening image file</message>
187 </not_media>
188 <filters_invalid>
189 <code>108</code>
190 <message>Invalid data fetch filter.</message>
191 </filters_invalid>
192 </faults>
193 </ol_catalog_category_media>
194 <ol_catalog_product_attribute translate="title" module="catalog">
195 <title>Product Images API</title>
196 <model>openerpconnector/olcatalog_product_attribute</model>
197 <acl>catalog/category</acl>
198 <methods>
199 <list translate="title" module="catalog">
200 <title>Retrieve attribute list</title>
201 <method>items</method>
202 </list>
203 <relations translate="title" module="catalog">
204 <title>Retrieve attribute sets attribute ids</title>
205 <method>relations</method>
206 </relations>
207 <info translate="title" module="catalog">
208 <title>Retrieve full attribute details</title>
209 <method>info</method>
210 </info>
211 <options translate="title" module="catalog">
212 <title>Retrieve options of attributes</title>
213 <method>options</method>
214 </options>
215 </methods>
216 <faults>
217 </faults>
218 </ol_catalog_product_attribute>
219 <ol_catalog_product_attribute_group translate="title" module="catalog">
220 <title>Product Images API</title>
221 <model>openerpconnector/olcatalog_product_attributegroup</model>
222 <acl>catalog/category</acl>
223 <methods>
224 <list translate="title" module="catalog">
225 <title>Retrieve attribute group list</title>
226 <method>items</method>
227 </list>
228 <info translate="title" module="catalog">
229 <title>Retrieve full attribute details</title>
230 <method>info</method>
231 </info>
232 </methods>
233 <faults>
234 </faults>
235 </ol_catalog_product_attribute_group>
236 <ol_customer_groups translate="title" module="core">
237 <title>Groups Management</title>
238 <model>openerpconnector/olcustomer_group</model>
239 <acl>customer/group</acl>
240 <methods>
241 <list translate="title" module="core">
242 <title>Enumerate groups</title>
243 <method>items</method>
244 </list>
245 <create translate="title" module="core">
246 <title>Create groups</title>
247 <method>create</method>
248 </create>
249 <info translate="title" module="core">
250 <title>Fetch detail of groups</title>
251 <method>info</method>
252 </info>
253 <update translate="title" module="core">
254 <title>Update groups info</title>
255 <method>update</method>
256 </update>
257 <delete translate="title" module="core">
258 <title>Delete groups</title>
259 <method>delete</method>
260 </delete>
261 </methods>
262 <faults module="core">
263 <group_not_exists>
264 <code>101</code>
265 <message>Requested group not found.</message>
266 </group_not_exists>
267 <data_invalid>
268 <code>102</code>
269 <message>group creation failed due to invalid data.</message>
270 </data_invalid>
271 <filters_invalid>
272 <code>103</code>
273 <message>Invalid data fetch filter.</message>
274 </filters_invalid>
275 </faults>
276 </ol_customer_groups>
277 <ol_customer_address translate="title" module="core">
278 <title>Address Management</title>
279 <model>openerpconnector/olcustomer_address</model>
280 <acl>customer/group</acl>
281 <methods>
282 <list translate="title" module="core">
283 <title>Enumerate groups</title>
284 <method>items</method>
285 </list>
286 <create translate="title" module="core">
287 <title>Create groups</title>
288 <method>create</method>
289 </create>
290 <info translate="title" module="core">
291 <title>Fetch detail of groups</title>
292 <method>info</method>
293 </info>
294 <update translate="title" module="core">
295 <title>Update groups info</title>
296 <method>update</method>
297 </update>
298 <delete translate="title" module="core">
299 <title>Delete groups</title>
300 <method>delete</method>
301 </delete>
302 </methods>
303 <faults module="core">
304 <customer_not_exists>
305 <code>101</code>
306 <message>Requested Customer not found.</message>
307 </customer_not_exists>
308 <data_invalid>
309 <code>102</code>
310 <message>group creation failed due to invalid data.</message>
311 </data_invalid>
312 <filters_invalid>
313 <code>103</code>
314 <message>Invalid data fetch filter.</message>
315 </filters_invalid>
316 </faults>
317 </ol_customer_address>
318 <ol_customer_subscriber translate="title" module="core">
319 <title>Subscriber Management</title>
320 <model>openerpconnector/olcustomer_subscriber</model>
321 <acl>customer/group</acl>
322 <methods>
323 <list translate="title" module="core">
324 <title>Enumerate subscriber</title>
325 <method>items</method>
326 </list>
327 <create translate="title" module="core">
328 <title>Create subscriber</title>
329 <method>create</method>
330 </create>
331 <info translate="title" module="core">
332 <title>Fetch detail of subscriber</title>
333 <method>info</method>
334 </info>
335 <update translate="title" module="core">
336 <title>Update subscriber info</title>
337 <method>update</method>
338 </update>
339 <delete translate="title" module="core">
340 <title>Delete subscriber</title>
341 <method>delete</method>
342 </delete>
343 </methods>
344 <faults module="core">
345 <customer_not_exists>
346 <code>101</code>
347 <message>Requested Customer not found.</message>
348 </customer_not_exists>
349 <data_invalid>
350 <code>102</code>
351 <message>group creation failed due to invalid data.</message>
352 </data_invalid>
353 <filters_invalid>
354 <code>103</code>
355 <message>Invalid data fetch filter.</message>
356 </filters_invalid>
357 </faults>
358 </ol_customer_subscriber>
359 <ol_customer translate="title" module="core">
360 <title>Customers Management</title>
361 <model>openerpconnector/olcustomer_customer</model>
362 <acl>customer/group</acl>
363 <methods>
364 <list translate="title" module="core">
365 <title>Enumerate Customers</title>
366 <method>items</method>
367 </list>
368 <create translate="title" module="core">
369 <title>Create Customers</title>
370 <method>create</method>
371 </create>
372 <info translate="title" module="core">
373 <title>Fetch detail of customers</title>
374 <method>info</method>
375 </info>
376 <update translate="title" module="core">
377 <title>Update customers info</title>
378 <method>update</method>
379 </update>
380 <delete translate="title" module="core">
381 <title>Delete customers</title>
382 <method>delete</method>
383 </delete>
384 </methods>
385 <faults module="core">
386 <customer_not_exists>
387 <code>101</code>
388 <message>Requested customer not found.</message>
389 </customer_not_exists>
390 <data_invalid>
391 <code>102</code>
392 <message>Customer creation failed due to invalid data.</message>
393 </data_invalid>
394 <filters_invalid>
395 <code>103</code>
396 <message>Invalid data fetch filter.</message>
397 </filters_invalid>
398 </faults>
399 </ol_customer>
400 <ol_catalog_product_tierprice translate="title" module="catalog">
401 <title>Product Tier Price API</title>
402 <model>openerpconnector/olcatalog_product_tierprice</model>
403 <acl>catalog/category</acl>
404 <methods>
405 <list translate="title" module="catalog">
406 <title>Retrieve attribute list</title>
407 <method>items</method>
408 </list>
409 <items2 translate="title" module="catalog">
410 <title>Retrieve attribute list</title>
411 <method>items2</method>
412 </items2>
413 </methods>
414 <faults>
415 <product_not_exists>
416 <code>101</code>
417 <message>Requested product not found.</message>
418 </product_not_exists>
419 <filters_invalid>
420 <code>103</code>
421 <message>Invalid data fetch filter.</message>
422 </filters_invalid>
423 </faults>
424 </ol_catalog_product_tierprice>
425 <ol_catalog_product translate="title" module="core">
426 <title>Address Management</title>
427 <model>openerpconnector/olcatalog_products</model>
428 <acl>catalog/product</acl>
429 <methods>
430 <list translate="title" module="core">
431 <title>Enumerate Products</title>
432 <method>items</method>
433 </list>
434 <create translate="title" module="core">
435 <title>Create Products</title>
436 <method>create</method>
437 </create>
438 <biglist translate="title" module="core">
439 <title>Fetch detail of products</title>
440 <method>biglist</method>
441 </biglist>
442 <update translate="title" module="core">
443 <title>Update groups info</title>
444 <method>update</method>
445 </update>
446 <delete translate="title" module="core">
447 <title>Delete groups</title>
448 <method>delete</method>
449 </delete>
450 </methods>
451 <faults module="core">
452 <customer_not_exists>
453 <code>101</code>
454 <message>Requested Customer not found.</message>
455 </customer_not_exists>
456 <data_invalid>
457 <code>102</code>
458 <message>group creation failed due to invalid data.</message>
459 </data_invalid>
460 <filters_invalid>
461 <code>103</code>
462 <message>Invalid data fetch filter.</message>
463 </filters_invalid>
464 </faults>
465 </ol_catalog_product>
466 <ol_catalog_product_attributeset translate="title" module="core">
467 <title>Attribute Set Management</title>
468 <model>openerpconnector/olcatalog_product_attributeset</model>
469 <acl>catalog/product</acl>
470 <methods>
471 <list translate="title" module="core">
472 <title>Enumerate Attribute sets</title>
473 <method>items</method>
474 </list>
475 </methods>
476 <faults module="core">
477 <customer_not_exists>
478 <code>101</code>
479 <message>Requested Customer not found.</message>
480 </customer_not_exists>
481 <data_invalid>
482 <code>102</code>
483 <message>group creation failed due to invalid data.</message>
484 </data_invalid>
485 <filters_invalid>
486 <code>103</code>
487 <message>Invalid data fetch filter.</message>
488 </filters_invalid>
489 </faults>
490 </ol_catalog_product_attributeset>
491 <sales_order translate="title" module="Openlabs_OpenERPConnector">
492 <model>sales/order_api</model>
493 <title>Custom Sales Orders API</title>
494 <methods>
495 <retrieve translate="title" module="Openlabs_OpenERPConnector">
496 <title>Retrieve list of orders by filters, nb max, etc...</title>
497 <method>retrieveOrders</method>
498 </retrieve>
499 <done translate="title" module="Openlabs_OpenERPConnector">
500 <title>Set Flag to TRUE for imported orders</title>
501 <method>setFlagForOrder</method>
502 </done>
503 <get_child translate="title" module="Openlabs_OpenERPConnector">
504 <title>get The Child of The Order Edited</title>
505 <method>getOrderChild</method>
506 </get_child>
507 <get_parent translate="title" module="Openlabs_OpenERPConnector">
508 <title>get The Parent of the order annulated</title>
509 <method>getOrderParent</method>
510 </get_parent>
511 </methods>
512 </sales_order>
513 <catalog_product translate="title" module="catalog">
514 <title>Product API</title>
515 <model>catalog/product_api</model>
516 <acl>catalog/product</acl>
517 <methods>
518 <create_bundle translate="title" module="Openlabs_OpenERPConnector">
519 <title>Create Bundle Products with Custom Options and Bundle Items</title>
520 <method>createBundleProducts</method>
521 </create_bundle>
522 </methods>
523 </catalog_product>
524 </resources>
525 </api>
526</config>
0527
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/config.xml'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/config.xml 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/etc/config.xml 2011-11-09 09:54:26 +0000
@@ -0,0 +1,88 @@
1<?xml version="1.0"?>
2<config>
3 <modules>
4 <Openlabs_OpenERPConnector>
5 <version>0.0.1</version>
6 </Openlabs_OpenERPConnector>
7 </modules>
8 <frontend>
9 <routers>
10 <openerpconnector>
11 <use>standard</use>
12 <args>
13 <module>Openlabs_OpenERPConnector</module>
14 <frontName>openerpconnector</frontName>
15 </args>
16 </openerpconnector>
17 </routers>
18 </frontend>
19 <global>
20 <models>
21 <openerpconnector>
22 <class>Openlabs_OpenERPConnector_Model</class>
23 </openerpconnector>
24 <sales>
25 <rewrite>
26 <order_api>Openlabs_OpenERPConnector_Model_Sales_Order_Api</order_api>
27 </rewrite>
28 </sales>
29 <catalog>
30 <rewrite>
31 <product_api>Openlabs_OpenERPConnector_Model_Catalog_Product_Api</product_api>
32 </rewrite>
33 </catalog>
34 </models>
35 <resources>
36 <openerpconnector_setup>
37 <setup>
38 <module>Openlabs_OpenERPConnector</module>
39 </setup>
40 <connection>
41 <use>core_setup</use>
42 </connection>
43 </openerpconnector_setup>
44 <openerpconnector_write>
45 <connection>
46 <use>core_write</use>
47 </connection>
48 </openerpconnector_write>
49 <openerpconnector_read>
50 <connection>
51 <use>core_read</use>
52 </connection>
53 </openerpconnector_read>
54 </resources>
55 <blocks>
56 <openerpconnector>
57 <class>Openlabs_OpenERPConnector_Block</class>
58 </openerpconnector>
59 </blocks>
60 <helpers>
61 <openerpconnector>
62 <class>Openlabs_OpenERPConnector_Helper</class>
63 </openerpconnector>
64 </helpers>
65 <events>
66 <sales_order_place_after>
67 <observers>
68 <init_imported_after_place_order>
69 <type>singleton</type>
70 <class>openerpconnector/observer</class>
71 <method>initImported</method>
72 </init_imported_after_place_order>
73 </observers>
74 </sales_order_place_after>
75 </events>
76 </global>
77 <admin>
78 <routers>
79 <openerpconnector>
80 <use>admin</use>
81 <args>
82 <module>Openlabs_OpenERPConnector</module>
83 <frontName>connector</frontName>
84 </args>
85 </openerpconnector>
86 </routers>
87 </admin>
88</config>
0\ No newline at end of file89\ No newline at end of file
190
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql'
=== added directory 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql/openerpconnector_setup'
=== added file 'Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql/openerpconnector_setup/mysql4-install-0.0.1.php'
--- Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql/openerpconnector_setup/mysql4-install-0.0.1.php 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/Openlabs/OpenERPConnector/sql/openerpconnector_setup/mysql4-install-0.0.1.php 2011-11-09 09:54:26 +0000
@@ -0,0 +1,54 @@
1<?php
2/**
3 *
4 * @author Mohammed NAHHAS
5 * @package Openlabs_OpenERPConnector
6 *
7 */
8
9/* Retrieve the version of Magento */
10$version = Mage::getVersion();
11
12/* Need to add a sales_order attribute if the version < 1.4.x.x - sales_order is an EAV Model */
13/* Else add a simple column to sales_flat_order Table */
14$version = str_replace('.','',$version);
15if($version >= 1400) {
16 $installer = $this;
17 $installer->startSetup();
18 $tableName='sales_flat_order';
19 $db = $installer->getConnection();
20
21 /* Delete the column if it exists before re-create it */
22 if($db->tableColumnExists($this->getTable($tableName), 'imported')) {
23 $installer->run("ALTER TABLE {$this->getTable($tableName)} drop column imported");
24 }
25
26 /* re-create 'imported' column */
27 if(!$db->tableColumnExists($this->getTable($tableName), 'imported')) {
28 $installer->run("
29 ALTER TABLE {$this->getTable($tableName)} ADD imported tinyint(1) unsigned NOT NULL default '0';
30 ");
31 }
32}else{
33 $installer = new Mage_Eav_Model_Entity_Setup('core_setup');
34 $installer->startSetup();
35
36 /* Attribute Data */
37 $attribute_data = array(
38 'type' => 'int',
39 'default' => 0,
40 'visible' => false,
41 'required' => false,
42 'user_defined' => false,
43 'searchable' => false,
44 'filterable' => false,
45 'comparable' => false
46 );
47 /* Add a sales_order attribute named 'imported' */
48 $installer->addAttribute('order', 'imported', $attribute_data);
49
50}
51
52
53/* End */
54$installer->endSetup();
0\ No newline at end of file55\ No newline at end of file
156
=== added directory 'Openlabs_OpenERPConnector-1.1.0/app'
=== added directory 'Openlabs_OpenERPConnector-1.1.0/app/etc'
=== added directory 'Openlabs_OpenERPConnector-1.1.0/app/etc/modules'
=== added file 'Openlabs_OpenERPConnector-1.1.0/app/etc/modules/Openlabs_OpenERPConnector.xml'
--- Openlabs_OpenERPConnector-1.1.0/app/etc/modules/Openlabs_OpenERPConnector.xml 1970-01-01 00:00:00 +0000
+++ Openlabs_OpenERPConnector-1.1.0/app/etc/modules/Openlabs_OpenERPConnector.xml 2011-11-09 09:54:26 +0000
@@ -0,0 +1,41 @@
1<?xml version="1.0"?>
2
3<!--
4##############################################################################
5#
6# OpenERP, Open Source Management Solution
7# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
8# Sharoon Thomas
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program. If not, see <http://www.gnu.org/licenses/>.
22#
23##############################################################################
24# * @category Community
25# * @package
26# * @copyright Copyright (c) 2009 Sharoon Thomas, openlabs.co.in
27# * @license GPL-3
28# */
29-->
30<config>
31 <modules>
32 <Openlabs_OpenERPConnector>
33 <codePool>community</codePool>
34 <active>true</active>
35 <depends>
36 <Mage_Api />
37 <Mage_Catalog />
38 </depends>
39 </Openlabs_OpenERPConnector>
40 </modules>
41</config>
042
=== added file 'package.xml'
--- package.xml 1970-01-01 00:00:00 +0000
+++ package.xml 2011-11-09 09:54:26 +0000
@@ -0,0 +1,84 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<package packagerversion="1.7.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
3 http://pear.php.net/dtd/tasks-1.0.xsd
4 http://pear.php.net/dtd/package-2.0
5 http://pear.php.net/dtd/package-2.0.xsd">
6 <name>Openlabs_OpenERPConnector</name>
7 <channel>connect.magentocommerce.com/community</channel>
8 <summary>Magento extension for multiwebsite Open ERP connector by Open Labs</summary>
9 <description>This magento extension provides additional API methods for use by the Multi website, Multi Store, Multi Product category synchronization connector.
10
11Contents:
12
13Magento Websites API
14Magento Stores(groups) API
15Magento Store Views API
16Magento Category Images API (Partial : list, info, create)
17
18Contact sharoon.thomas@openlabs.co.in for further details</description>
19 <lead>
20 <name>Sharoon Thomas</name>
21 <user>sharoonthomas</user>
22 <email>sharoonthomas@teagarden.in</email>
23 <active>yes</active>
24 </lead>
25 <date>2009-08-27</date>
26 <time>15:23:56</time>
27 <version>
28 <release>1.1.0</release>
29 <api>2.0</api>
30 </version>
31 <stability>
32 <release>beta</release>
33 <api>beta</api>
34 </stability>
35 <license>GPL</license>
36 <notes>Magento Websites API
37Magento Stores(groups) API
38Magento Store Views API
39Magento Category Images API</notes>
40 <contents>
41 <dir name="/">
42 <dir name="app">
43 <dir name="etc">
44 <dir name="modules">
45 <file md5sum="fc14d089cce44cc1e2ac08fa6c6c20a6" name="Openlabs_OpenERPConnector.xml" role="mage" />
46 </dir> <!-- /app/etc/modules -->
47 </dir> <!-- /app/etc -->
48 </dir> <!-- /app -->
49 <dir name="Openlabs">
50 <dir name="OpenERPConnector">
51 <dir name="etc">
52 <file md5sum="12668c63dc2e626940c5651510acdd95" name="api.xml" role="magecommunity" />
53 <file md5sum="c9ab22309066dc8d181061a0f158dc6f" name="config.xml" role="magecommunity" />
54 </dir> <!-- /Openlabs/OpenERPConnector/etc -->
55 <dir name="Helper">
56 <file md5sum="a2ea05cfc56bcd06be442f75844e3fc1" name="Data.php" role="magecommunity" />
57 </dir> <!-- /Openlabs/OpenERPConnector/Helper -->
58 <dir name="Model">
59 <dir name="Olcatalog">
60 <file md5sum="43c11c180f0f1ccfc576bb0d8b238015" name="Categories.php" role="magecommunity" />
61 </dir> <!-- /Openlabs/OpenERPConnector/Model/Olcatalog -->
62 <dir name="Olcore">
63 <file md5sum="568a59414cd61bb14dd9899bd3d74edc" name="Groups.php" role="magecommunity" />
64 <file md5sum="03e476e465b5794d8deee99fd027d35c" name="Storeviews.php" role="magecommunity" />
65 <file md5sum="5abd4c8db3b68b4dfd5bdd7ebbb7ec93" name="Website.php" role="magecommunity" />
66 </dir> <!-- /Openlabs/OpenERPConnector/Model/Olcore -->
67 </dir> <!-- /Openlabs/OpenERPConnector/Model -->
68 </dir> <!-- /Openlabs/OpenERPConnector -->
69 </dir> <!-- /Openlabs -->
70 </dir> <!-- / -->
71 </contents>
72 <dependencies>
73 <required>
74 <php>
75 <min>5.2.0</min>
76 <max>6.0.0</max>
77 </php>
78 <pearinstaller>
79 <min>1.6.2</min>
80 </pearinstaller>
81 </required>
82 </dependencies>
83 <phprelease />
84</package>