[-] 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() public function getFields()
{ {
if (!$this->id_lang) 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(); return parent::getFields();
} }
@@ -289,7 +289,7 @@ class OrderCore extends ObjectModel
if ($this->hasBeenDelivered()) 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'); throw new PrestaShopException('PS_ORDER_RETURN is not defined in table configuration');
$orderDetail->product_quantity_return += (int)($quantity); $orderDetail->product_quantity_return += (int)($quantity);
return $orderDetail->update(); return $orderDetail->update();
@@ -1041,7 +1041,7 @@ class OrderCore extends ObjectModel
public function getNumberOfDays() 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) if (!$nbReturnDays)
return true; return true;
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
@@ -1059,7 +1059,7 @@ class OrderCore extends ObjectModel
*/ */
public function isReturnable() 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 $this->getNumberOfDays();
return false; return false;
@@ -1082,10 +1082,10 @@ class OrderCore extends ObjectModel
{ {
$order_invoice = new OrderInvoice(); $order_invoice = new OrderInvoice();
$order_invoice->id_order = $this->id; $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 invoice start number has been set, you clean the value of this configuration
if ($order_invoice->number) if ($order_invoice->number)
Configuration::updateValue('PS_INVOICE_START_NUMBER', false ); Configuration::updateValue('PS_INVOICE_START_NUMBER', false, false, null, $this->id_shop);
else else
$order_invoice->number = Order::getLastInvoiceNumber() + 1; $order_invoice->number = Order::getLastInvoiceNumber() + 1;
@@ -1169,11 +1169,11 @@ class OrderCore extends ObjectModel
$order_invoice_collection = $this->getInvoicesCollection(); $order_invoice_collection = $this->getInvoicesCollection();
foreach ($order_invoice_collection as $order_invoice) 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 (!$number)
{ {
//if delivery number is not set or wrong, we set a default one. //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; $number = 1;
} }
@@ -1185,7 +1185,7 @@ class OrderCore extends ObjectModel
// Keep for backward compatibility // Keep for backward compatibility
$this->delivery_number = $number; $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 // Keep it for backward compatibility, to remove on 1.6 version
@@ -1591,7 +1591,7 @@ class OrderCore extends ObjectModel
else else
{ {
$amount = Tools::convertPrice($payment->amount, $payment->id_currency, false); $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; $total += $amount;
else else
$total += Tools::convertPrice($amount, $currency->id, true); $total += Tools::convertPrice($amount, $currency->id, true);
+1 -1
View File
@@ -210,7 +210,7 @@ class OrderHistoryCore extends ObjectModel
// if the product is a pack, we restock every products in the pack using the last negative stock mvts // if the product is a pack, we restock every products in the pack using the last negative stock mvts
if (Pack::isPack($product['product_id'])) if (Pack::isPack($product['product_id']))
{ {
$pack_products = Pack::getItems($product['product_id'], Configuration::get('PS_LANG_DEFAULT')); $pack_products = Pack::getItems($product['product_id'], Configuration::get('PS_LANG_DEFAULT', null, null, $order->id_shop));
foreach ($pack_products as $pack_product) foreach ($pack_products as $pack_product)
{ {
if ($pack_product->advanced_stock_management == 1) if ($pack_product->advanced_stock_management == 1)
+6 -6
View File
@@ -434,7 +434,7 @@ class AdminOrdersControllerCore extends AdminController
else else
{ {
$message = $customer_message->message; $message = $customer_message->message;
if (Configuration::get('PS_MAIL_TYPE') != Mail::TYPE_TEXT) if (Configuration::get('PS_MAIL_TYPE', null, null, $order->id_shop) != Mail::TYPE_TEXT)
$message = Tools::nl2br($customer_message->message); $message = Tools::nl2br($customer_message->message);
$varsTpl = array( $varsTpl = array(
@@ -972,7 +972,7 @@ class AdminOrdersControllerCore extends AdminController
} }
elseif (Tools::isSubmit('submitGenerateInvoice') && isset($order)) elseif (Tools::isSubmit('submitGenerateInvoice') && isset($order))
{ {
if (!Configuration::get('PS_INVOICE')) if (!Configuration::get('PS_INVOICE', null, null, $order->id_shop))
$this->errors[] = Tools::displayError('Invoice management has been disabled'); $this->errors[] = Tools::displayError('Invoice management has been disabled');
elseif ($order->hasInvoice()) elseif ($order->hasInvoice())
$this->errors[] = Tools::displayError('This order already has an invoice'); $this->errors[] = Tools::displayError('This order already has an invoice');
@@ -1352,7 +1352,7 @@ class AdminOrdersControllerCore extends AdminController
'invoices_collection' => $order->getInvoicesCollection(), 'invoices_collection' => $order->getInvoicesCollection(),
'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(),
'payment_methods' => $payment_methods, 'payment_methods' => $payment_methods,
'invoice_management_active' => Configuration::get('PS_INVOICE') 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop)
); );
return parent::renderView(); return parent::renderView();
@@ -1535,7 +1535,7 @@ class AdminOrdersControllerCore extends AdminController
$use_taxes = true; $use_taxes = true;
$initial_product_price_tax_incl = Product::getPriceStatic($product->id, $use_taxes, isset($combination) ? $combination->id : null, 2, null, false, true, 1, $initial_product_price_tax_incl = Product::getPriceStatic($product->id, $use_taxes, isset($combination) ? $combination->id : null, 2, null, false, true, 1,
false, $order->id_customer, $cart->id, $order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); false, $order->id_customer, $cart->id, $order->{Configuration::get('PS_TAX_ADDRESS_TYPE', null, null, $order->id_shop)});
// Creating specific price if needed // Creating specific price if needed
if ($product_informations['product_price_tax_incl'] != $initial_product_price_tax_incl) if ($product_informations['product_price_tax_incl'] != $initial_product_price_tax_incl)
@@ -1612,11 +1612,11 @@ class AdminOrdersControllerCore extends AdminController
$order_invoice->id_order = $order->id; $order_invoice->id_order = $order->id;
if ($order_invoice->number) if ($order_invoice->number)
Configuration::updateValue('PS_INVOICE_START_NUMBER', false); Configuration::updateValue('PS_INVOICE_START_NUMBER', false, false, null, $order->id_shop);
else else
$order_invoice->number = Order::getLastInvoiceNumber() + 1; $order_invoice->number = Order::getLastInvoiceNumber() + 1;
$invoice_address = new Address((int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); $invoice_address = new Address((int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE', null, null, $order->id_shop)});
$carrier = new Carrier((int)$order->id_carrier); $carrier = new Carrier((int)$order->id_carrier);
$tax_calculator = $carrier->getTaxCalculator($invoice_address); $tax_calculator = $carrier->getTaxCalculator($invoice_address);