fix cron
This commit is contained in:
parent
f2b5face0a
commit
115b1b5f61
@ -70,8 +70,18 @@ foreach ($iterator as $fileinfo) {
|
||||
if ($situation == 'DPC')
|
||||
$expeditions[] = $expedition_number;
|
||||
}
|
||||
if (!count($expeditions))
|
||||
if (!count($expeditions)) {
|
||||
## ARCHIVE FILE
|
||||
$repo_archive = dirname(__FILE__) . '/archives/trace/';
|
||||
$repo_paths = array('others',date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
rename(dirname(__FILE__).'/trace/'.$fileinfo->getFilename(), $repo_archive . $fileinfo->getFilename());
|
||||
continue;
|
||||
}
|
||||
|
||||
$expedition_orders = array();
|
||||
$expedition_order_details = array();
|
||||
@ -121,6 +131,7 @@ foreach ($iterator as $fileinfo) {
|
||||
|
||||
$fully_sent = FALSE;
|
||||
$products_sent = array();
|
||||
$remaining = array();
|
||||
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT d.`id_order_detail`, IF(
|
||||
@ -136,6 +147,8 @@ foreach ($iterator as $fileinfo) {
|
||||
') as $quantity_remain) {
|
||||
if((int) $quantity_remain['remain'] == 0) {
|
||||
$products_sent[] = (int) $quantity_remain['id_order_detail'];
|
||||
} elseif ((int) $quantity_remain['remain'] == 1) {
|
||||
$remaining[] = (int) $quantity_remain['id_order_detail'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,6 +166,8 @@ foreach ($iterator as $fileinfo) {
|
||||
') as $quantity_remain) {
|
||||
if((int) $quantity_remain['remain'] == 0) {
|
||||
$products_sent[] = (int) $quantity_remain['id_order_detail'];
|
||||
} elseif ((int) $quantity_remain['remain'] == 1) {
|
||||
$remaining[] = (int) $quantity_remain['id_order_detail'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,6 +185,8 @@ foreach ($iterator as $fileinfo) {
|
||||
') as $quantity_remain) {
|
||||
if((int) $quantity_remain['remain'] == 0) {
|
||||
$products_sent[] = (int) $quantity_remain['id_order_detail'];
|
||||
} elseif ((int) $quantity_remain['remain'] == 1) {
|
||||
$remaining[] = (int) $quantity_remain['id_order_detail'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,12 +204,13 @@ foreach ($iterator as $fileinfo) {
|
||||
') as $quantity_remain) {
|
||||
if((int) $quantity_remain['remain'] == 0) {
|
||||
$products_sent[] = (int) $quantity_remain['id_order_detail'];
|
||||
} elseif ((int) $quantity_remain['remain'] == 1) {
|
||||
$remaining[] = (int) $quantity_remain['id_order_detail'];
|
||||
}
|
||||
}
|
||||
|
||||
$remaining = array();
|
||||
foreach($order_details as $d) {
|
||||
if(!in_array($d, $products_sent)) {
|
||||
if(!in_array($d, $products_sent) && !in_array($d, $remaining)) {
|
||||
$remaining[] = (int) $d;
|
||||
}
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ if($magistorModule->active) {
|
||||
str_replace(array("\r", "\n"), '', $ref),
|
||||
0,
|
||||
substr(utf8_decode(cleanChar($pack_item['name'])),0,50),
|
||||
str_replace(array("\r", "\n"), "", $ean)
|
||||
substr(str_replace(array("\r", "\n"), "", $ean),0,14)
|
||||
);
|
||||
}
|
||||
$product_rows[$p_key][1] += (max($product['product_quantity'] - max($product['product_quantity_return'], $product['product_quantity_refunded']), 0) * $pack_item['pack_quantity']);
|
||||
@ -424,7 +424,7 @@ if($magistorModule->active) {
|
||||
str_replace(array("\r", "\n"), '', $ref),
|
||||
0,
|
||||
substr(utf8_decode(cleanChar($product['product_name'])),0,50),
|
||||
str_replace(array("\r", "\n"), "", $ean),
|
||||
substr(str_replace(array("\r", "\n"), "", $ean),0,14),
|
||||
);
|
||||
}
|
||||
$product_rows[$p_key][1] += max($product['product_quantity'] - max($product['product_quantity_return'], $product['product_quantity_refunded']), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user