Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop

This commit is contained in:
root 2017-07-21 11:17:45 +02:00
commit bc29984ea7

View File

@ -269,6 +269,8 @@ class Sale {
');
}
self::sortActiveSaleAfterAdd();
Module::hookExec('privatesales_create', array('sale' => $this));
}
}
@ -297,6 +299,21 @@ class Sale {
}
}
public static function sortActiveSaleAfterAdd(){
foreach(Db::getInstance()->executeS('
SELECT id_sale, position
FROM '._DB_PREFIX_.'privatesale
WHERE lock_position = 1
AND `date_end` > NOW()
ORDER BY position DESC
') as $sale){
$pos = $sale['position']+1;
Db::getInstance()->ExecuteS( 'UPDATE '._DB_PREFIX_.'privatesale SET position = position-1 WHERE position = '. $pos);
Db::getInstance()->ExecuteS( 'UPDATE '._DB_PREFIX_.'privatesale SET position = position+1 WHERE id_sale = '. $sale['id_sale']);
}
}
public static function rrmdir($dir) {
if(is_dir($dir)) {
$objects = scandir($dir);