24 if (empty($status[
'count']) || $status[
'count'] < 0)
30 'count' => $status[
'count'],
31 'steps' => $status[
'steps'],
34 $discountRows = DiscountTable::getList(
36 'select' => array(
'*'),
38 '>ID' => $status[
'lastId'],
39 'EXECUTE_MODE' => self::TMP_EXECUTE_MODE,
41 'order' => array(
'ID' =>
'ASC'),
43 'limit' => self::PORTION,
47 foreach ($discountRows as $discountRow)
49 $mode = Analyzer::getInstance()->canCalculateSeparately($discountRow) ?
50 DiscountTable::EXECUTE_MODE_SEPARATELY : DiscountTable::EXECUTE_MODE_GENERAL;
52 $connection->queryExecute(
"UPDATE b_sale_discount SET EXECUTE_MODE = {$mode} WHERE ID = {$discountRow['ID']}");
54 $newStatus[
'lastId'] = $discountRow[
'ID'];
55 $newStatus[
'steps']++;
58 if (!empty($newStatus[
'lastId']))
60 Option::set(
'sale',
'discountexecutionmodeindex', serialize($newStatus));
62 'count' => $newStatus[
'count'],
63 'steps' => $newStatus[
'steps'],
69 $canCalculateSeparately = Analyzer::getInstance()->canCalculateSeparatelyAllDiscount();
70 Option::set(
'sale',
'discount_separately_calculation', $canCalculateSeparately?
'Y' :
'N');
71 Option::delete(
'sale', array(
'name' =>
'discountexecutionmodeindex'));