fix cron to send articles to philea

This commit is contained in:
Marion Muszynski 2016-11-23 15:19:50 +01:00
parent c1fcfb5f85
commit 31d77b1d60

View File

@ -5,6 +5,13 @@ include dirname(__FILE__).'/../../config/config.inc.php';
if(isset($_SERVER['REMOTE_ADDR'])) { if(isset($_SERVER['REMOTE_ADDR'])) {
exit; exit;
} }
// CHECKING RUNNING OF CRON_SALE_CACHE
$fileName = 'cron_sale_cache.php';
$output = shell_exec("ps -ax | grep $fileName | wc -l");
if($output > 2){
exit;
}
set_time_limit(600); set_time_limit(600);
if($row = Db::getInstance()->getRow(' if($row = Db::getInstance()->getRow('
SELECT * SELECT *
@ -12,6 +19,13 @@ if($row = Db::getInstance()->getRow('
WHERE `status` = 0 WHERE `status` = 0
ORDER BY `date_add` ASC ORDER BY `date_add` ASC
')) { ')) {
// CHECKING ASSOCIATED PRODUCTS
$associated_products = Db::getInstance()->getValue('
SELECT COUNT(`id_sale`)
FROM `'._DB_PREFIX_.'product_ps_cache`
WHERE `id_sale` = '.(int) $row['id_sale'].'
');
if($associated_products > 0) {
// SEND ART01 // SEND ART01
Db::getInstance()->ExecuteS(' Db::getInstance()->ExecuteS('
UPDATE `'._DB_PREFIX_.'philea_sync` UPDATE `'._DB_PREFIX_.'philea_sync`
@ -31,6 +45,7 @@ if($row = Db::getInstance()->getRow('
'); ');
/*system('cd '.dirname(__FILE__).'/script && php send_recep_orderform.php '.(int) $row['id_sale']);*/ /*system('cd '.dirname(__FILE__).'/script && php send_recep_orderform.php '.(int) $row['id_sale']);*/
} }
}
if($row = Db::getInstance()->getRow(' if($row = Db::getInstance()->getRow('
SELECT * SELECT *