[-] BO: Fix id_shop for configuration variables in global context for orders

This commit is contained in:
Rémi Gaillard
2013-02-04 16:05:01 +01:00
parent 7bd44ca1b1
commit 1dbf4855cc
3 changed files with 17 additions and 17 deletions
+10 -10
View File
@@ -264,7 +264,7 @@ class OrderCore extends ObjectModel
public function getFields()
{
if (!$this->id_lang)
$this->id_lang = Configuration::get('PS_LANG_DEFAULT');
$this->id_lang = Configuration::get('PS_LANG_DEFAULT', null, null, $this->id_shop);
return parent::getFields();
}
@@ -289,7 +289,7 @@ class OrderCore extends ObjectModel
if ($this->hasBeenDelivered())
{
if (!Configuration::get('PS_ORDER_RETURN'))
if (!Configuration::get('PS_ORDER_RETURN', null, null, $this->id_shop))
throw new PrestaShopException('PS_ORDER_RETURN is not defined in table configuration');
$orderDetail->product_quantity_return += (int)($quantity);
return $orderDetail->update();
@@ -1041,7 +1041,7 @@ class OrderCore extends ObjectModel
public function getNumberOfDays()
{
$nbReturnDays = (int)(Configuration::get('PS_ORDER_RETURN_NB_DAYS'));
$nbReturnDays = (int)(Configuration::get('PS_ORDER_RETURN_NB_DAYS', null, null, $this->id_shop));
if (!$nbReturnDays)
return true;
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
@@ -1059,7 +1059,7 @@ class OrderCore extends ObjectModel
*/
public function isReturnable()
{
if (Configuration::get('PS_ORDER_RETURN') && $this->isPaidAndShipped())
if (Configuration::get('PS_ORDER_RETURN', null, null, $this->id_shop) && $this->isPaidAndShipped())
return $this->getNumberOfDays();
return false;
@@ -1082,10 +1082,10 @@ class OrderCore extends ObjectModel
{
$order_invoice = new OrderInvoice();
$order_invoice->id_order = $this->id;
$order_invoice->number = Configuration::get('PS_INVOICE_START_NUMBER');
$order_invoice->number = Configuration::get('PS_INVOICE_START_NUMBER', null, null, $this->id_shop);
// If invoice start number has been set, you clean the value of this configuration
if ($order_invoice->number)
Configuration::updateValue('PS_INVOICE_START_NUMBER', false );
Configuration::updateValue('PS_INVOICE_START_NUMBER', false, false, null, $this->id_shop);
else
$order_invoice->number = Order::getLastInvoiceNumber() + 1;
@@ -1169,11 +1169,11 @@ class OrderCore extends ObjectModel
$order_invoice_collection = $this->getInvoicesCollection();
foreach ($order_invoice_collection as $order_invoice)
{
$number = (int)Configuration::get('PS_DELIVERY_NUMBER');
$number = (int)Configuration::get('PS_DELIVERY_NUMBER', null, null, $this->id_shop);
if (!$number)
{
//if delivery number is not set or wrong, we set a default one.
Configuration::updateValue('PS_DELIVERY_NUMBER', 1);
Configuration::updateValue('PS_DELIVERY_NUMBER', 1, false, null, $this->id_shop);
$number = 1;
}
@@ -1185,7 +1185,7 @@ class OrderCore extends ObjectModel
// Keep for backward compatibility
$this->delivery_number = $number;
Configuration::updateValue('PS_DELIVERY_NUMBER', $number + 1);
Configuration::updateValue('PS_DELIVERY_NUMBER', $number + 1, false, null, $this->id_shop);
}
// Keep it for backward compatibility, to remove on 1.6 version
@@ -1591,7 +1591,7 @@ class OrderCore extends ObjectModel
else
{
$amount = Tools::convertPrice($payment->amount, $payment->id_currency, false);
if ($currency->id == Configuration::get('PS_DEFAULT_CURRENCY'))
if ($currency->id == Configuration::get('PS_DEFAULT_CURRENCY', null, null, $this->id_shop))
$total += $amount;
else
$total += Tools::convertPrice($amount, $currency->id, true);