fix conflict

This commit is contained in:
Marion Muszynski 2016-11-23 16:36:24 +01:00
commit a1970081c1
2 changed files with 36 additions and 2 deletions

View File

@ -11,6 +11,11 @@ class AdminAntConfigurations extends AdminTab
public function postProcess() {
global $cookie;
if(Tools::isSubmit('submitProductSaleCache')) {
$fileName = 'cron_sale_cache.php';
$output = shell_exec("ps -ax | grep $fileName | wc -l");
if($output > 2){
echo '<p class="error">'.$this->l('Association automatique en cours, réessayez plus tard').'</p><br />';
}
$hour = (int) date('H');
$min = (int) date('i');
if ($hour%3 == 0 && $min <= 20 && $min >= 10 ){
@ -39,7 +44,16 @@ class AdminAntConfigurations extends AdminTab
WHERE p.`id_product` >= '.$min_id_product.'
)
');
mail('marion@antadis.com', '[BBB] Re Associate products to sale', 'Date : '.date("d/m/Y H:i").' - Employee : '.$cookie->id_employee); // check for bad behaviour
// LOG ACTION
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'ant_log`
VALUES (
DEFAULT,
'.(int) $cookie->id_employee.',
"'.pSQL('Association manuelle product_ps_cache via Configuration').'",
NOW()
)
');
echo '<p class="conf">'.$this->l('Produits associés aux ventes depuis le produit #').$min_id_product.'</p><br />';
} else {
echo '<p class="error">'.$this->l('Pas de produit ajouté depuis 10 jours').'</p><br />';
@ -47,10 +61,19 @@ class AdminAntConfigurations extends AdminTab
}
} elseif(Tools::isSubmit('submitCategorySaleCache')) {
$id_sale = Tools::getValue('id_sale');
mail('marion@antadis.com', '[BBB] Re Associate category to sale - buildCategoryCache', 'Date : '.date("d/m/Y H:i").' - Sale : '.$id_sale.' - Employee : '.$cookie->id_employee); // check for bad behaviour
if($id_sale) {
$sale = new Sale((int)$id_sale);
$sale->buildCategoryCache();
// LOG ACTION
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'ant_log`
VALUES (
DEFAULT,
'.(int) $cookie->id_employee.',
"'.pSQL('Association manuelle categories via Configuration, sale: '.$id_sale).'",
NOW()
)
');
echo '<p class="conf">'.$this->l('Categories associés à la vente ').$id_sale.'</p><br />';
} else {
echo '<p class="error">'.$this->l('Veuillez choisir une vente').'</p><br />';

View File

@ -10,6 +10,7 @@ class AdminPhileaMagistor extends AdminTab {
public function postProcess() {
if(Tools::isSubmit('submitProductSaleCache')) {
global $cookie;
$fileName = 'cron_sale_cache.php';
$output = shell_exec("ps -ax | grep $fileName | wc -l");
if($output > 2){
@ -43,6 +44,16 @@ class AdminPhileaMagistor extends AdminTab {
WHERE p.`id_product` >= '.$min_id_product.'
)
');
// LOG ACTION
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'ant_log`
VALUES (
DEFAULT,
'.(int) $cookie->id_employee.',
"'.pSQL('Association manuelle product_ps_cache via Philéa').'",
NOW()
)
');
echo '<p class="conf">'.$this->l('Produits associés aux ventes depuis le produit #').$min_id_product.'</p><br />';
} else {
echo '<p class="error">'.$this->l('Pas de produit ajouté depuis 10 jours').'</p><br />';