[-] BO : Fix carrier association listing on warehouse form

This commit is contained in:
rGaillard
2012-11-06 15:23:57 +00:00
parent 3d6d183ee7
commit 3918fe70b9
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -132,12 +132,15 @@ class WarehouseCore extends ObjectModel
* *
* @return array Ids of the associated carriers * @return array Ids of the associated carriers
*/ */
public function getCarriers() public function getCarriers($return_reference = false)
{ {
$ids_carrier = array(); $ids_carrier = array();
$query = new DbQuery(); $query = new DbQuery();
$query->select('c.id_carrier'); if ($return_reference)
$query->select('wc.id_carrier');
else
$query->select('c.id_carrier');
$query->from('warehouse_carrier', 'wc'); $query->from('warehouse_carrier', 'wc');
$query->innerJoin('carrier', 'c', 'c.id_reference = wc.id_carrier'); $query->innerJoin('carrier', 'c', 'c.id_reference = wc.id_carrier');
$query->where($this->def['primary'].' = '.(int)$this->id); $query->where($this->def['primary'].' = '.(int)$this->id);
@@ -349,7 +349,7 @@ class AdminWarehousesControllerCore extends AdminController
$ids_shop[] = $shop['id_shop']; $ids_shop[] = $shop['id_shop'];
// loads current carriers associated with this warehouse // loads current carriers associated with this warehouse
$carriers = $obj->getCarriers(); $carriers = $obj->getCarriers(true);
// if an address is available : force specific fields values // if an address is available : force specific fields values
if ($address != null) if ($address != null)