update function expe48hbis

This commit is contained in:
Marion Muszynski 2016-06-10 14:37:34 +02:00
parent 1386f8460f
commit e3bc588287

View File

@ -133,12 +133,20 @@ function generateInvoicesPDFPrivateSales48hBis()
include(dirname(__FILE__).'/../modules/privatesales/Sale.php');
if($sale = new Sale((int) Tools::getValue('id_sale'))) {
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
$orders = $sale->getOrdersFromSale($statuts, TRUE, TRUE);
$orders = $sale->getOrdersFromSale($statuts, FALSE, TRUE);
if(count($orders) == 0) {
die (Tools::displayError('No invoices found'));
}
$orders2 = $sale->getOrdersFromSale($statuts, FALSE, TRUE);
$orders2 = Db::getInstance()->ExecuteS('
SELECT DISTINCT od.`id_order`
FROM `'._DB_PREFIX_.'order_detail` od
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON (c.`id_product` = od.`product_id`)
LEFT JOIN `'._DB_PREFIX_.'privatesale` s ON (s.`id_sale` = c.`id_sale`)
WHERE od.`id_order` IN ('.implode(',', $orders).')
AND od.`product_quantity` - od.`product_quantity_return` != 0
AND (s.delivery_delay != 2 AND s.delivery_delay != 6)
');
if (!empty($orders2)) {
foreach ($orders2 as $key => $order) {
if (in_array($order, $orders)) {