[-] BO: Fix id_shop for configuration variables in global context for orders
This commit is contained in:
+10
-10
@@ -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);
|
||||
|
||||
@@ -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 (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)
|
||||
{
|
||||
if ($pack_product->advanced_stock_management == 1)
|
||||
|
||||
@@ -434,7 +434,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
$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);
|
||||
|
||||
$varsTpl = array(
|
||||
@@ -972,7 +972,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
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');
|
||||
elseif ($order->hasInvoice())
|
||||
$this->errors[] = Tools::displayError('This order already has an invoice');
|
||||
@@ -1352,7 +1352,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'invoices_collection' => $order->getInvoicesCollection(),
|
||||
'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(),
|
||||
'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();
|
||||
@@ -1535,7 +1535,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$use_taxes = true;
|
||||
|
||||
$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
|
||||
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;
|
||||
if ($order_invoice->number)
|
||||
Configuration::updateValue('PS_INVOICE_START_NUMBER', false);
|
||||
Configuration::updateValue('PS_INVOICE_START_NUMBER', false, false, null, $order->id_shop);
|
||||
else
|
||||
$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);
|
||||
$tax_calculator = $carrier->getTaxCalculator($invoice_address);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user