From e69e9697fb514ea0d9446f86356be807f063b8f0 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Mon, 10 Jul 2023 11:27:48 +0200 Subject: [PATCH] excluding deleted preorders in Preordernotification --- application/Preorder/PreorderModel.php | 2 ++ application/Preordernotification/Preordernotification.php | 1 + .../Preordernotification/PreordernotificationController.php | 1 + 3 files changed, 4 insertions(+) diff --git a/application/Preorder/PreorderModel.php b/application/Preorder/PreorderModel.php index 9c10d4f24..f6de716af 100644 --- a/application/Preorder/PreorderModel.php +++ b/application/Preorder/PreorderModel.php @@ -300,6 +300,8 @@ class PreorderModel { $deleted = $filter['deleted']; if(is_numeric($deleted)) { $where .= " AND deleted=$deleted"; + } elseif($deleted == null) { + $where .= " (AND deleted IS NULL OR deleted = 0)" } } diff --git a/application/Preordernotification/Preordernotification.php b/application/Preordernotification/Preordernotification.php index 42e71cfa5..1d6a74e70 100644 --- a/application/Preordernotification/Preordernotification.php +++ b/application/Preordernotification/Preordernotification.php @@ -13,6 +13,7 @@ class Preordernotification extends mfBaseModel { $preorder_filter = json_decode($this->preorder_filter, true); $preorder_filter['preordercampaign_id'] = $this->preordercampaign_id; + $preorder_filter['deleted'] = null; $preorders = PreorderModel::search($preorder_filter); return $preorders; diff --git a/application/Preordernotification/PreordernotificationController.php b/application/Preordernotification/PreordernotificationController.php index e38a09952..bb67fdcbf 100644 --- a/application/Preordernotification/PreordernotificationController.php +++ b/application/Preordernotification/PreordernotificationController.php @@ -363,6 +363,7 @@ class PreordernotificationController extends mfBaseController { // get and save preorder count $preorder_filter = json_decode($notification->preorder_filter, true); $preorder_filter['preordercampaign_id'] = $notification->preordercampaign_id; + $preorder_filter['deleted'] = null; $preorder_count = PreorderModel::count($preorder_filter); $notification->recipient_count = $preorder_count; $notification->save();