From f148bb008945f6af344dfca87283dec0d46ff3b2 Mon Sep 17 00:00:00 2001 From: yuri Date: Fri, 15 Jan 2016 13:24:06 +0200 Subject: [PATCH] email: is read and is important filters --- application/Espo/Core/SelectManagers/Base.php | 12 ++++++++ .../Espo/Resources/layouts/Email/filters.json | 2 ++ application/Espo/SelectManagers/Email.php | 28 +++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/application/Espo/Core/SelectManagers/Base.php b/application/Espo/Core/SelectManagers/Base.php index 992ab6bded..c97f537193 100644 --- a/application/Espo/Core/SelectManagers/Base.php +++ b/application/Espo/Core/SelectManagers/Base.php @@ -792,6 +792,18 @@ class Base { $part = array(); + if (!empty($item['field']) && !empty($item['type'])) { + $methodName = 'getWherePart' . ucfirst($item['field']) . ucfirst($item['type']); + if (method_exists($this, $methodName)) { + $value = null; + if (!empty($item['value'])) { + $value = $item['value']; + } + return $this->$methodName($value); + } + } + + if (!empty($item['dateTime'])) { return $this->convertDateTimeWhere($item); } diff --git a/application/Espo/Resources/layouts/Email/filters.json b/application/Espo/Resources/layouts/Email/filters.json index 9766ff5fa7..6d7e3446fa 100644 --- a/application/Espo/Resources/layouts/Email/filters.json +++ b/application/Espo/Resources/layouts/Email/filters.json @@ -2,6 +2,8 @@ "account", "dateSent", "emailAddress", + "isRead", + "isImportant", "name", "status", "parent", diff --git a/application/Espo/SelectManagers/Email.php b/application/Espo/SelectManagers/Email.php index 03301de0e2..ae3f856e70 100644 --- a/application/Espo/SelectManagers/Email.php +++ b/application/Espo/SelectManagers/Email.php @@ -267,5 +267,33 @@ class Email extends \Espo\Core\SelectManagers\Base } } + + protected function getWherePartIsReadIsTrue() + { + return array( + 'usersMiddle.isRead' => true + ); + } + + protected function getWherePartIsReadIsFalse() + { + return array( + 'usersMiddle.isRead' => false + ); + } + + protected function getWherePartIsImportantIsTrue() + { + return array( + 'usersMiddle.isImportant' => true + ); + } + + protected function getWherePartIsImportantIsFalse() + { + return array( + 'usersMiddle.isImportant' => false + ); + } }