[-] BO: Invoices and products order detail are now not empty after deleting a product

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16741 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-08-07 12:20:10 +00:00
parent 1cf5ddd038
commit 8ba7ebd80b
6 changed files with 20 additions and 7 deletions
+2 -3
View File
@@ -488,9 +488,8 @@ class OrderCore extends ObjectModel
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT *
FROM `'._DB_PREFIX_.'order_detail` od
LEFT JOIN `'._DB_PREFIX_.'product` p
ON p.id_product = od.product_id
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = od.product_id)
LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
WHERE od.`id_order` = '.(int)($this->id));
}
+8 -1
View File
@@ -39,6 +39,9 @@ class OrderDetailCore extends ObjectModel
/** @var integer */
public $product_id;
/** @var integer */
public $id_shop;
/** @var integer */
public $product_attribute_id;
@@ -160,6 +163,7 @@ class OrderDetailCore extends ObjectModel
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_order_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'product_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'product_attribute_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'product_name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
@@ -546,7 +550,10 @@ class OrderDetailCore extends ObjectModel
// Set order invoice id
$this->id_order_invoice = (int)$id_order_invoice;
// Set shop id
$this->id_shop = (int)$product['id_shop'];
// Add new entry to the table
$this->save();
+1 -1
View File
@@ -119,7 +119,7 @@ class OrderInvoiceCore extends ObjectModel
FROM `'._DB_PREFIX_.'order_detail` od
LEFT JOIN `'._DB_PREFIX_.'product` p
ON p.id_product = od.product_id
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
WHERE od.`id_order` = '.(int)$this->id_order.'
AND od.`id_order_invoice` = '.(int)$this->id);
}