// Invoice search fix
This commit is contained in:
@@ -123,6 +123,28 @@ class OrderInvoiceCore extends ObjectModel
|
||||
AND od.`id_order_invoice` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
public static function getInvoiceByNumber($id_invoice)
|
||||
{
|
||||
if (is_numeric($id_invoice))
|
||||
$id_invoice = (int)($id_invoice);
|
||||
elseif (is_string($id_invoice))
|
||||
{
|
||||
$matches = array();
|
||||
if (preg_match('/^['.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).']*([0-9]+)?/i', $id_invoice, $matches) !== FALSE)
|
||||
$id_invoice = $matches[1];
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
$id_order_invoice = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `id_order_invoice`
|
||||
FROM `'._DB_PREFIX_.'order_invoice`
|
||||
WHERE number = '.$id_invoice
|
||||
);
|
||||
|
||||
return ($id_order_invoice ? new OrderInvoice($id_order_invoice) : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get order products
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user