From: Alexander Smirnov Date: Thu, 30 May 2024 16:04:43 +0000 (+0300) Subject: fix for nullable date_start X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=ab43968fd7d5d5457b3fc8c7468043189d74a3ee;p=yii-erp24%2F.git fix for nullable date_start --- diff --git a/erp24/api3/core/services/NotifiableService.php b/erp24/api3/core/services/NotifiableService.php index d245702..a2ae6e3 100644 --- a/erp24/api3/core/services/NotifiableService.php +++ b/erp24/api3/core/services/NotifiableService.php @@ -35,8 +35,11 @@ class NotifiableService $userBonuses = UsersBonus::find()->select(['phone', 'sum(CASE WHEN tip=\'plus\' THEN bonus ELSE -bonus END) as sum']) ->where(['in', 'phone', array_keys($buffer)]) - ->andWhere(['<', 'date_start', new Expression('NOW()')]) - ->andWhere(['or', ['>', 'date_end', new Expression('NOW()')], ['tip' => 'minus']]) + ->andWhere([ + 'or', + ['<', 'date_start', new Expression('NOW()')], + ['date_start' => null] + ]) ->groupBy(['phone'])->all(); $buffer2 = ArrayHelper::map($userBonuses, 'phone', 'sum');