]> gitweb.erp-flowers.ru Git - yii-erp24/.git/commitdiff
fix for nullable date_start
authorAlexander Smirnov <fredeom@mail.ru>
Thu, 30 May 2024 16:04:43 +0000 (19:04 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Thu, 30 May 2024 16:04:43 +0000 (19:04 +0300)
erp24/api3/core/services/NotifiableService.php

index d2457025148907cf97991832f9ca2ba5f1024c8b..a2ae6e3686612b1e46721a44bed63ac4cdafb974 100644 (file)
@@ -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');