[-] BO: get the invoice prefix from the right shop

This commit is contained in:
Rémi Gaillard
2013-02-04 15:11:29 +01:00
parent d6bd352844
commit 7bd44ca1b1
5 changed files with 9 additions and 9 deletions
@@ -135,7 +135,7 @@
{if sizeof($invoices_collection)}
<select name="product_invoice" class="edit_product_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" {if $invoice->id == $product['id_order_invoice']}selected="selected"{/if}>#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$invoice->number}</option>
<option value="{$invoice->id}" {if $invoice->id == $product['id_order_invoice']}selected="selected"{/if}>#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang, null, $order->id_shop)}{'%06d'|sprintf:$invoice->number}</option>
{/foreach}
</select>
{else}
+1 -1
View File
@@ -616,7 +616,7 @@ abstract class PaymentModuleCore extends Module
{
$pdf = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE, $this->context->smarty);
$file_attachement['content'] = $pdf->render(false);
$file_attachement['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)$order->id_lang).sprintf('%06d', $order->invoice_number).'.pdf';
$file_attachement['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->invoice_number).'.pdf';
$file_attachement['mime'] = 'application/pdf';
}
else
+2 -2
View File
@@ -654,9 +654,9 @@ class OrderInvoiceCore extends ObjectModel
* @param int $id_lang for invoice_prefix
* @return string
*/
public function getInvoiceNumberFormatted($id_lang)
public function getInvoiceNumberFormatted($id_lang, $id_shop = null)
{
return '#'.Configuration::get('PS_INVOICE_PREFIX', $id_lang).sprintf('%06d', $this->number);
return '#'.Configuration::get('PS_INVOICE_PREFIX', $id_lang, null, $id_shop).sprintf('%06d', $this->number);
}
public function saveCarrierTaxCalculator(array $taxes_amount)
+1 -1
View File
@@ -42,7 +42,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$this->date = Tools::displayDate($order_invoice->date_add, (int)$this->order->id_lang);
$id_lang = Context::getContext()->language->id;
$this->title = HTMLTemplateInvoice::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', $id_lang).sprintf('%06d', $order_invoice->number);
$this->title = HTMLTemplateInvoice::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', $id_lang, null, (int)$this->order->id_shop).sprintf('%06d', $order_invoice->number);
// footer informations
$this->shop = new Shop((int)$this->order->id_shop);
}
+4 -4
View File
@@ -1102,7 +1102,7 @@ class AdminOrdersControllerCore extends AdminController
foreach ($order_invoices_collection as $order_invoice)
{
if (Tools::getValue('discount_value') > $order_invoice->total_paid_tax_incl)
$this->errors[] = Tools::displayError('Discount value is greater than the order invoice total (Invoice:').$order_invoice->getInvoiceNumberFormatted(Context::getContext()->language->id).')';
$this->errors[] = Tools::displayError('Discount value is greater than the order invoice total (Invoice:').$order_invoice->getInvoiceNumberFormatted(Context::getContext()->language->id, (int)$order->id_shop).')';
else
{
$cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round(Tools::getValue('discount_value'), 2);
@@ -1713,7 +1713,7 @@ class AdminOrdersControllerCore extends AdminController
$invoice_array = array();
foreach ($invoice_collection as $invoice)
{
$invoice->name = $invoice->getInvoiceNumberFormatted(Context::getContext()->language->id);
$invoice->name = $invoice->getInvoiceNumberFormatted(Context::getContext()->language->id, (int)$order->id_shop);
$invoice_array[] = $invoice;
}
@@ -1916,7 +1916,7 @@ class AdminOrdersControllerCore extends AdminController
$invoice_array = array();
foreach ($invoice_collection as $invoice)
{
$invoice->name = $invoice->getInvoiceNumberFormatted(Context::getContext()->language->id);
$invoice->name = $invoice->getInvoiceNumberFormatted(Context::getContext()->language->id, (int)$order->id_shop);
$invoice_array[] = $invoice;
}
@@ -2003,7 +2003,7 @@ class AdminOrdersControllerCore extends AdminController
$invoice_array = array();
foreach ($invoice_collection as $invoice)
{
$invoice->name = $invoice->getInvoiceNumberFormatted(Context::getContext()->language->id);
$invoice->name = $invoice->getInvoiceNumberFormatted(Context::getContext()->language->id, (int)$order->id_shop);
$invoice_array[] = $invoice;
}