From 6f158b99ae0ea4ee4071659750673166ae75a767 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Wed, 21 Dec 2022 16:17:16 +0100 Subject: [PATCH] Added address source filter in Preorder --- Layout/default/Preorder/Index.php | 11 +++++++++++ application/Preorder/PreorderController.php | 10 ++++++++++ application/Preorder/PreorderModel.php | 9 +++++++++ 3 files changed, 30 insertions(+) diff --git a/Layout/default/Preorder/Index.php b/Layout/default/Preorder/Index.php index d938127a0..033ee4aea 100644 --- a/Layout/default/Preorder/Index.php +++ b/Layout/default/Preorder/Index.php @@ -80,6 +80,17 @@ + +
+
+ + +
+
diff --git a/application/Preorder/PreorderController.php b/application/Preorder/PreorderController.php index aec93e37b..c51d4b1a6 100644 --- a/application/Preorder/PreorderController.php +++ b/application/Preorder/PreorderController.php @@ -117,6 +117,16 @@ class PreorderController extends mfBaseController { $new_filter['addon_services'] = true; } + if(array_key_exists("address_source", $filter)) { + if($filter['address_source'] == "manual") { + $new_filter['address_created'] = true; + } + if($filter['address_source'] == "addressdb") { + $new_filter['address_created'] = null; + } + } + + if(is_array($filter) && count($filter)) { foreach($filter as $name => $value) { $new_filter[$name] = $value; diff --git a/application/Preorder/PreorderModel.php b/application/Preorder/PreorderModel.php index ad86326f9..f2c6d9513 100644 --- a/application/Preorder/PreorderModel.php +++ b/application/Preorder/PreorderModel.php @@ -366,6 +366,15 @@ class PreorderModel { } } + if(array_key_exists("address_created", $filter)) { + $address_created = $filter['address_created']; + if($address_created === true) { + $where .= " AND address_created > 0"; + } elseif($address_created == null) { + $where .= " AND address_created IS NULL"; + } + } + if(array_key_exists("type", $filter)) { $type = $filter['type']; if(is_array($type) && count($type)) {