From 8a2f13df99b9144cb612cd9dac5a71b3f29ae3f9 Mon Sep 17 00:00:00 2001 From: JediKev <kevin@enhancesoft.com> Date: Wed, 21 Mar 2018 17:49:55 -0500 Subject: [PATCH] UserForm: Phone Field This updates the Phone Field name back to `phone` and changes the flags to make the variable name non-editable. This also adds a check for the phone field on the User Form and if one exists adds it to the search. --- include/ajax.users.php | 9 ++++++--- .../upgrader/streams/core/cce1ba43-e7dfe821.patch.sql | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/ajax.users.php b/include/ajax.users.php index d42349924..5ec144a5b 100644 --- a/include/ajax.users.php +++ b/include/ajax.users.php @@ -73,12 +73,15 @@ class UsersAjaxAPI extends AjaxController { return $this->search($type, $fulltext); } } else { - $users->filter(Q::any(array( + $filter = Q::any(array( 'emails__address__contains' => $q, 'name__contains' => $q, 'org__name__contains' => $q, - 'cdata__phone__contains' => $q, - ))); + )); + if (UserForm::getInstance()->getField('phone')) + $filter->add(array('cdata__phone__contains' => $q)); + + $users->filter($filter); } // Omit already-imported remote users diff --git a/include/upgrader/streams/core/cce1ba43-e7dfe821.patch.sql b/include/upgrader/streams/core/cce1ba43-e7dfe821.patch.sql index 660400dde..233b1e174 100644 --- a/include/upgrader/streams/core/cce1ba43-e7dfe821.patch.sql +++ b/include/upgrader/streams/core/cce1ba43-e7dfe821.patch.sql @@ -9,6 +9,11 @@ ALTER TABLE `%TABLE_PREFIX%faq_category` ADD `category_pid` int(10) unsigned DEFAULT NULL AFTER `category_id`; +-- Phone Field `name` and `flags` +UPDATE `%TABLE_PREFIX%form_field` + SET `flags` = `flags` + 262144 + WHERE `type` = 'phone' AND `name` = 'phone' AND `form_id` = 1 AND `id` < 10; + -- Finished with patch UPDATE `%TABLE_PREFIX%config` SET `value` = 'e7dfe82131b906a14f6a13163943855f' -- GitLab