jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/403098 )
Change subject: CRM-21634 Stdise search fields as they relate to contacts ...................................................................... CRM-21634 Stdise search fields as they relate to contacts https://github.com/civicrm/civicrm-core/pull/11492 Bug: 184496 Change-Id: Id7edd36e043a7a3ce0f693a53da6d05af746747d --- M CRM/Contribute/Form/Search.php M CRM/Core/Form/Search.php M CRM/Event/Form/Search.php M CRM/Member/Form/Search.php M CRM/Pledge/Form/Search.php A templates/CRM/Contact/Form/Search/ContactSearchFields.tpl M templates/CRM/Contribute/Form/Search.tpl M templates/CRM/Event/Form/Search.tpl M templates/CRM/Member/Form/Search.tpl M templates/CRM/Pledge/Form/Search.tpl 10 files changed, 195 insertions(+), 73 deletions(-) Approvals: jenkins-bot: Verified Ejegg: Looks good to me, approved diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index e79c29b..30bb298 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -173,25 +173,7 @@ */ public function buildQuickForm() { parent::buildQuickForm(); - $this->addSortNameField(); - - $this->_group = CRM_Core_PseudoConstant::nestedGroup(); - - // multiselect for groups - if ($this->_group) { - $this->add('select', 'group', ts('Groups'), $this->_group, FALSE, - array('id' => 'group', 'multiple' => 'multiple', 'class' => 'crm-select2') - ); - } - - // multiselect for tags - $contactTags = CRM_Core_BAO_Tag::getTags(); - - if ($contactTags) { - $this->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE, - array('id' => 'contact_tags', 'multiple' => 'multiple', 'class' => 'crm-select2') - ); - } + $this->addContactSearchFields(); CRM_Contribute_BAO_Query::buildSearchForm($this); @@ -237,6 +219,36 @@ } /** + * Get the label for the tag field. + * + * We do this in a function so the 'ts' wraps the whole string to allow + * better translation. + * + * @return string + */ + protected function getTagLabel() { + return ts('Contributor Tag(s)'); + } + + /** + * Get the label for the group field. + * + * @return string + */ + protected function getGroupLabel() { + return ts('Contributor Group(s)'); + } + + /** + * Get the label for the group field. + * + * @return string + */ + protected function getContactTypeLabel() { + return ts('Contributor Contact Type'); + } + + /** * The post processing of the form gets done here. * * Key things done during post processing are diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php index ec2ef48..dabab86 100644 --- a/CRM/Core/Form/Search.php +++ b/CRM/Core/Form/Search.php @@ -199,4 +199,39 @@ return 'search'; } + /** + * Add generic fields that specify the contact. + */ + protected function addContactSearchFields() { + $this->addSortNameField(); + + $this->_group = CRM_Core_PseudoConstant::nestedGroup(); + if ($this->_group) { + $this->add('select', 'group', $this->getGroupLabel(), $this->_group, FALSE, + array( + 'id' => 'group', + 'multiple' => 'multiple', + 'class' => 'crm-select2', + ) + ); + } + + $contactTags = CRM_Core_BAO_Tag::getTags(); + if ($contactTags) { + $this->add('select', 'contact_tags', $this->getTagLabel(), $contactTags, FALSE, + array( + 'id' => 'contact_tags', + 'multiple' => 'multiple', + 'class' => 'crm-select2', + ) + ); + } + $this->addField('contact_type', array('entity' => 'Contact')); + + if (CRM_Core_Permission::check('access deleted contacts') && Civi::settings()->get('contact_undelete')) { + $this->addElement('checkbox', 'deleted_contacts', ts('Search in Trash') . '<br />' . ts('(deleted contacts)')); + } + + } + } diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index 4552103..5f5783d 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -29,8 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2017 - * $Id$ - * */ /** @@ -168,11 +166,7 @@ */ public function buildQuickForm() { parent::buildQuickForm(); - $this->addSortNameField(); - - if (CRM_Core_Permission::check('access deleted contacts') and Civi::settings()->get('contact_undelete')) { - $this->addElement('checkbox', 'deleted_contacts', ts('Search in Trash') . '<br />' . ts('(deleted contacts)')); - } + $this->addContactSearchFields(); CRM_Event_BAO_Query::buildSearchForm($this); @@ -273,6 +267,36 @@ } /** + * Get the label for the tag field. + * + * We do this in a function so the 'ts' wraps the whole string to allow + * better translation. + * + * @return string + */ + protected function getTagLabel() { + return ts('Participant Tag(s)'); + } + + /** + * Get the label for the group field. + * + * @return string + */ + protected function getGroupLabel() { + return ts('Participant Group(s)'); + } + + /** + * Get the label for the group field. + * + * @return string + */ + protected function getContactTypeLabel() { + return ts('Participant Contact Type'); + } + + /** * The post processing of the form gets done here. * * Key things done during post processing are diff --git a/CRM/Member/Form/Search.php b/CRM/Member/Form/Search.php index 0ff5454..a9d7b0c 100644 --- a/CRM/Member/Form/Search.php +++ b/CRM/Member/Form/Search.php @@ -153,7 +153,7 @@ */ public function buildQuickForm() { parent::buildQuickForm(); - $this->addSortNameField(); + $this->addContactSearchFields(); CRM_Member_BAO_Query::buildSearchForm($this); @@ -193,6 +193,36 @@ } /** + * Get the label for the tag field. + * + * We do this in a function so the 'ts' wraps the whole string to allow + * better translation. + * + * @return string + */ + protected function getTagLabel() { + return ts('Member Tag(s)'); + } + + /** + * Get the label for the group field. + * + * @return string + */ + protected function getGroupLabel() { + return ts('Member Group(s)'); + } + + /** + * Get the label for the group field. + * + * @return string + */ + protected function getContactTypeLabel() { + return ts('Participant Contact Type'); + } + + /** * The post processing of the form gets done here. * * Key things done during post processing are diff --git a/CRM/Pledge/Form/Search.php b/CRM/Pledge/Form/Search.php index e0e23cf..6859f79 100644 --- a/CRM/Pledge/Form/Search.php +++ b/CRM/Pledge/Form/Search.php @@ -145,7 +145,7 @@ */ public function buildQuickForm() { parent::buildQuickForm(); - $this->addSortNameField(); + $this->addContactSearchFields(); CRM_Pledge_BAO_Query::buildSearchForm($this); @@ -185,6 +185,36 @@ } /** + * Get the label for the tag field. + * + * We do this in a function so the 'ts' wraps the whole string to allow + * better translation. + * + * @return string + */ + protected function getTagLabel() { + return ts('Pledger Tag(s)'); + } + + /** + * Get the label for the group field. + * + * @return string + */ + protected function getGroupLabel() { + return ts('Pledger Group(s)'); + } + + /** + * Get the label for the group field. + * + * @return string + */ + protected function getContactTypeLabel() { + return ts('Pledger Contact Type'); + } + + /** * The post processing of the form gets done here. * * Key things done during post processing are diff --git a/templates/CRM/Contact/Form/Search/ContactSearchFields.tpl b/templates/CRM/Contact/Form/Search/ContactSearchFields.tpl new file mode 100644 index 0000000..9ac3d76 --- /dev/null +++ b/templates/CRM/Contact/Form/Search/ContactSearchFields.tpl @@ -0,0 +1,31 @@ +<tr> + <td class="font-size12pt"> + {$form.sort_name.label} {$form.sort_name.html|crmAddClass:'twenty'} + </td> + <td>{$form.buttons.html}</td> +</tr> +<tr> + {if $form.contact_tags} + <td><label>{$form.contact_tags.label}</label> + {$form.contact_tags.html} + </td> + {else} + <td> </td> + {/if} + + {if $form.group} + <td><label>{$form.group.label}</label> + {$form.group.html} + </td> + {else} + <td> </td> + {/if} +</tr> +<tr class="crm-event-search-form-block-deleted_contacts"> + <td>{$form.contact_type.label} {$form.contact_type.html}<br></td> + <td> + {if $form.deleted_contacts} + {$form.deleted_contacts.html} {$form.deleted_contacts.label} + {/if} + </td> +</tr> diff --git a/templates/CRM/Contribute/Form/Search.tpl b/templates/CRM/Contribute/Form/Search.tpl index bf8c8e8..aa54b7f 100644 --- a/templates/CRM/Contribute/Form/Search.tpl +++ b/templates/CRM/Contribute/Form/Search.tpl @@ -34,28 +34,8 @@ <div class="crm-accordion-body"> {strip} <table class="form-layout"> - <tr> - <td class="font-size12pt" colspan="2"> {$form.sort_name.label} {$form.sort_name.html|crmAddClass:'twenty'} {$form.buttons.html} - </td> - </tr> - <tr> - {if $form.contact_tags} - <td><label>{ts}Contributor Tag(s){/ts}</label> - {$form.contact_tags.html} - </td> - {else} - <td> </td> - {/if} - - {if $form.group} - <td><label>{ts}Contributor Group(s){/ts}</label> - {$form.group.html} - </td> - {else} - <td> </td> - {/if} - </tr> -{include file="CRM/Contribute/Form/Search/Common.tpl"} + {include file="CRM/Contact/Form/Search/ContactSearchFields.tpl"} + {include file="CRM/Contribute/Form/Search/Common.tpl"} <tr> <td colspan="2">{$form.buttons.html}</td> </tr> diff --git a/templates/CRM/Event/Form/Search.tpl b/templates/CRM/Event/Form/Search.tpl index 5921830..624702e 100644 --- a/templates/CRM/Event/Form/Search.tpl +++ b/templates/CRM/Event/Form/Search.tpl @@ -35,18 +35,7 @@ <div id="searchForm"> {strip} <table class="form-layout"> - <tr class="crm-event-search-form-block-sort_name"> - <td class="font-size12pt" colspan="2"> - {$form.sort_name.label} {$form.sort_name.html|crmAddClass:'twenty'} {$form.buttons.html} - </td> - </tr> - {if $form.deleted_contacts} - <tr class="crm-event-search-form-block-deleted_contacts"> - <td colspan="2"> - {$form.deleted_contacts.html} {$form.deleted_contacts.label} - </td> - </tr> - {/if} + {include file="CRM/Contact/Form/Search/ContactSearchFields.tpl"} {include file="CRM/Event/Form/Search/Common.tpl"} diff --git a/templates/CRM/Member/Form/Search.tpl b/templates/CRM/Member/Form/Search.tpl index 64e8056..705df01 100644 --- a/templates/CRM/Member/Form/Search.tpl +++ b/templates/CRM/Member/Form/Search.tpl @@ -31,12 +31,7 @@ <div class="crm-accordion-body"> {strip} <table class="form-layout"> - <tr> - <td class="font-size12pt" colspan="2"> - {$form.sort_name.label} {$form.sort_name.html|crmAddClass:'twenty'} {$form.buttons.html} - </td> - </tr> - + {include file="CRM/Contact/Form/Search/ContactSearchFields.tpl"} {include file="CRM/Member/Form/Search/Common.tpl"} <tr> diff --git a/templates/CRM/Pledge/Form/Search.tpl b/templates/CRM/Pledge/Form/Search.tpl index dfe749e..d5f205f 100644 --- a/templates/CRM/Pledge/Form/Search.tpl +++ b/templates/CRM/Pledge/Form/Search.tpl @@ -34,11 +34,7 @@ <div id="searchForm"> {strip} <table class="form-layout"> - <tr> - <td class="font-size12pt" colspan="2"> - {$form.sort_name.label} {$form.sort_name.html|crmAddClass:'twenty'} {$form.buttons.html} - </td> - </tr> + {include file="CRM/Contact/Form/Search/ContactSearchFields.tpl"} {include file="CRM/Pledge/Form/Search/Common.tpl"} <tr> -- To view, visit https://gerrit.wikimedia.org/r/403098 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id7edd36e043a7a3ce0f693a53da6d05af746747d Gerrit-PatchSet: 2 Gerrit-Project: wikimedia/fundraising/crm/civicrm Gerrit-Branch: master Gerrit-Owner: Eileen <[email protected]> Gerrit-Reviewer: Eileen <[email protected]> Gerrit-Reviewer: Ejegg <[email protected]> Gerrit-Reviewer: Mepps <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
