feat(main): Fixes
This commit is contained in:
@@ -9,22 +9,30 @@
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'modrefchange/classes/DocumentReferences.php');
|
||||
|
||||
class Order extends OrderCore
|
||||
{
|
||||
private static function loadDocumentReferences()
|
||||
{
|
||||
if (!class_exists('DocumentReferences')) {
|
||||
require_once(_PS_MODULE_DIR_.'modrefchange/classes/DocumentReferences.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function setInvoice($use_existing_payment = false)
|
||||
{
|
||||
if (!$this->hasInvoice()) {
|
||||
parent::setInvoice($use_existing_payment);
|
||||
self::loadDocumentReferences();
|
||||
DocumentReferences::storeReference('invoice', $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function setDelivery()
|
||||
{
|
||||
self::loadDocumentReferences();
|
||||
$order_invoice_collection = $this->getInvoicesCollection();
|
||||
foreach ($order_invoice_collection as $order_invoice) {
|
||||
if ($order_invoice->delivery_number) {
|
||||
@@ -34,9 +42,10 @@ class Order extends OrderCore
|
||||
}
|
||||
parent::setDelivery();
|
||||
}
|
||||
|
||||
|
||||
public static function generateReference()
|
||||
{
|
||||
self::loadDocumentReferences();
|
||||
return DocumentReferences::storeReference('order');
|
||||
}
|
||||
|
||||
@@ -46,7 +55,7 @@ class Order extends OrderCore
|
||||
if (Context::getContext()->controller->controller_name == 'Admin') {
|
||||
return false;
|
||||
}
|
||||
parent::hasBeenDelivered();
|
||||
return parent::hasBeenDelivered();
|
||||
} else {
|
||||
if (Tools::getIsset('action'))
|
||||
if (Tools::getValue('action') == 'editProductOnOrder' || Tools::getValue('action') == 'deleteProductLine')
|
||||
|
||||
@@ -9,15 +9,23 @@
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'modrefchange/classes/DocumentReferences.php');
|
||||
|
||||
class OrderInvoice extends OrderInvoiceCore
|
||||
{
|
||||
private static function loadDocumentReferences()
|
||||
{
|
||||
if (!class_exists('DocumentReferences')) {
|
||||
require_once(_PS_MODULE_DIR_.'modrefchange/classes/DocumentReferences.php');
|
||||
}
|
||||
}
|
||||
|
||||
public function getInvoiceNumberFormatted($id_lang, $id_shop = null, $oldFormat = false)
|
||||
{
|
||||
$invoiceNumber = DocumentReferences::getReference($this->id, 'invoice')['reference'];
|
||||
self::loadDocumentReferences();
|
||||
$reference = DocumentReferences::getReference($this->id, 'invoice');
|
||||
$invoiceNumber = $reference ? $reference['reference'] : null;
|
||||
if ($oldFormat || $invoiceNumber == NULL) {
|
||||
return parent::getInvoiceNumberFormatted($id_lang, $id_shop);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user