From 5feafff137165f6cbbe5d08c522080fa2f23d55a Mon Sep 17 00:00:00 2001 From: lLefevre Date: Tue, 27 Mar 2012 09:20:01 +0000 Subject: [PATCH] [*] Bo : #PSTEST-1095 : Remove id_address of the table table supplier and add a new fixture in the installer for the table address git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14287 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Supplier.php | 7 ------ .../admin/AdminSuppliersController.php | 8 +++++-- install-dev/fixtures/apple/data/address.xml | 24 ++++++++++++++----- install-dev/upgrade/sql/1.5.0.10.sql | 2 +- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/classes/Supplier.php b/classes/Supplier.php index 6f2beeb07..8a4b1390f 100644 --- a/classes/Supplier.php +++ b/classes/Supplier.php @@ -59,12 +59,6 @@ class SupplierCore extends ObjectModel /** @var boolean active */ public $active; - /** - * @since 1.5.0 - * @var int address - * */ - public $id_address; - /** * @see ObjectModel::$definition */ @@ -74,7 +68,6 @@ class SupplierCore extends ObjectModel 'multilang' => true, 'fields' => array( 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64), - 'id_address' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'active' => array('type' => self::TYPE_BOOL), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), diff --git a/controllers/admin/AdminSuppliersController.php b/controllers/admin/AdminSuppliersController.php index fe083a471..b7d239259 100644 --- a/controllers/admin/AdminSuppliersController.php +++ b/controllers/admin/AdminSuppliersController.php @@ -214,8 +214,12 @@ class AdminSuppliersControllerCore extends AdminController // loads current address for this supplier - if possible $address = null; - if ($obj->id_address > 0) - $address = new Address($obj->id_address); + + $id_address = Address::getAddressIdBySupplierId($obj->id); + + if ($id_address > 0) + $address = new Address((int)$id_address); + // force specific fields values (address) if ($address != null) { diff --git a/install-dev/fixtures/apple/data/address.xml b/install-dev/fixtures/apple/data/address.xml index 8a2b5ae7b..ae9278252 100644 --- a/install-dev/fixtures/apple/data/address.xml +++ b/install-dev/fixtures/apple/data/address.xml @@ -29,11 +29,23 @@ Cupertino -
- 16, Main street - 2nd floor - Paris - -
+
+ 16, Main street + 2nd floor + Paris + +
+
+ 767 Fifth Ave. + + New York + +
+
+ 5800 W. Touhy Ave + + Niles + +
diff --git a/install-dev/upgrade/sql/1.5.0.10.sql b/install-dev/upgrade/sql/1.5.0.10.sql index 21dd5e8b4..1492d9fee 100644 --- a/install-dev/upgrade/sql/1.5.0.10.sql +++ b/install-dev/upgrade/sql/1.5.0.10.sql @@ -1 +1 @@ -/* PHP:module_blockwishlist_multishop(); */; +/* PHP:module_blockwishlist_multishop(); */; \ No newline at end of file