-
-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Toward CRM-19751: conditionally change On-Hold criteria to select on …
…Advanced Search form.
- Loading branch information
Showing
7 changed files
with
175 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| CiviCRM version 5 | | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC (c) 2004-2017 | | ||
+--------------------------------------------------------------------+ | ||
| This file is a part of CiviCRM. | | ||
| | | ||
| CiviCRM is free software; you can copy, modify, and distribute it | | ||
| under the terms of the GNU Affero General Public License | | ||
| Version 3, 19 November 2007. | | ||
| | | ||
| CiviCRM is distributed in the hope that it will be useful, but | | ||
| WITHOUT ANY WARRANTY; without even the implied warranty of | | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | ||
| See the GNU Affero General Public License for more details. | | ||
| | | ||
| You should have received a copy of the GNU Affero General Public | | ||
| License along with this program; if not, contact CiviCRM LLC | | ||
| at info[AT]civicrm[DOT]org. If you have questions about the | | ||
| GNU Affero General Public License or the licensing of CiviCRM, | | ||
| see the CiviCRM license FAQ at http://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* Upgrade logic for FiveNine */ | ||
class CRM_Upgrade_Incremental_php_FiveNine extends CRM_Upgrade_Incremental_Base { | ||
|
||
/** | ||
* Compute any messages which should be displayed beforeupgrade. | ||
* | ||
* Note: This function is called iteratively for each upcoming | ||
* revision to the database. | ||
* | ||
* @param string $preUpgradeMessage | ||
* @param string $rev | ||
* a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'. | ||
* @param null $currentVer | ||
*/ | ||
public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) { | ||
// Example: Generate a pre-upgrade message. | ||
// if ($rev == '5.12.34') { | ||
// $preUpgradeMessage .= '<p>' . ts('A new permission, "%1", has been added. This permission is now used to control access to the Manage Tags screen.', array(1 => ts('manage tags'))) . '</p>'; | ||
// } | ||
} | ||
|
||
/** | ||
* Compute any messages which should be displayed after upgrade. | ||
* | ||
* @param string $postUpgradeMessage | ||
* alterable. | ||
* @param string $rev | ||
* an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs. | ||
*/ | ||
public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) { | ||
if ($rev == '5.9.0') { | ||
$args = array( | ||
1 => ts('Enable multiple bulk email address for a contact'), | ||
2 => ts('Email on Hold'), | ||
); | ||
$postUpgradeMessage .= '<p>' . ts('If the setting "%1" is enabled, you should update any smart groups based on the "%2" field.', $args) . '</p>'; | ||
} | ||
// Example: Generate a post-upgrade message. | ||
// if ($rev == '5.12.34') { | ||
// $postUpgradeMessage .= '<br /><br />' . ts("By default, CiviCRM now disables the ability to import directly from SQL. To use this feature, you must explicitly grant permission 'import SQL datasource'."); | ||
// } | ||
} | ||
|
||
/* | ||
* Important! All upgrade functions MUST add a 'runSql' task. | ||
* Uncomment and use the following template for a new upgrade version | ||
* (change the x in the function name): | ||
*/ | ||
|
||
// /** | ||
// * Upgrade function. | ||
// * | ||
// * @param string $rev | ||
// */ | ||
// public function upgrade_5_0_x($rev) { | ||
// $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); | ||
// $this->addTask('Do the foo change', 'taskFoo', ...); | ||
// // Additional tasks here... | ||
// // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex. | ||
// // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable. | ||
// } | ||
|
||
// public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) { | ||
// return TRUE; | ||
// } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{* file to handle db changes in 5.9.0 during upgrade *} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
/* | ||
+--------------------------------------------------------------------+ | ||
| CiviCRM version 5 | | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC (c) 2004-2018 | | ||
+--------------------------------------------------------------------+ | ||
| This file is a part of CiviCRM. | | ||
| | | ||
| CiviCRM is free software; you can copy, modify, and distribute it | | ||
| under the terms of the GNU Affero General Public License | | ||
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | ||
| | | ||
| CiviCRM is distributed in the hope that it will be useful, but | | ||
| WITHOUT ANY WARRANTY; without even the implied warranty of | | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | ||
| See the GNU Affero General Public License for more details. | | ||
| | | ||
| You should have received a copy of the GNU Affero General Public | | ||
| License and the CiviCRM Licensing Exception along | | ||
| with this program; if not, contact CiviCRM LLC | | ||
| at info[AT]civicrm[DOT]org. If you have questions about the | | ||
| GNU Affero General Public License or the licensing of CiviCRM, | | ||
| see the CiviCRM license FAQ at http://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* Test class for CRM_Contact_Form_Search_Criteria | ||
* | ||
* @package CiviCRM | ||
* @group headless | ||
*/ | ||
class CRM_Contact_Form_Search_CriteraTest extends CiviUnitTestCase { | ||
|
||
/** | ||
* Test that the 'multiple bulk email' setting correctly affects the type of | ||
* field used for the 'email on hold' criteria in Advanced Search. | ||
*/ | ||
public function testAdvancedHSearchObservesMultipleBulkEmailSetting() { | ||
|
||
// If setting is enabled, criteria should be a select element. | ||
Civi::settings()->set('civimail_multiple_bulk_emails', 1); | ||
$form = new CRM_Contact_Form_Search_Advanced(); | ||
$form->controller = new CRM_Contact_Controller_Search(); | ||
$form->preProcess(); | ||
$form->buildQuickForm(); | ||
$onHoldElemenClass = (get_class($form->_elements[$form->_elementIndex['email_on_hold']])); | ||
$this->assertEquals('HTML_QuickForm_select', $onHoldElemenClass, 'civimail_multiple_bulk_emails setting = 1, so email_on_hold should be a select element.'); | ||
|
||
// If setting is disabled, criteria should be a checkbox. | ||
Civi::settings()->set('civimail_multiple_bulk_emails', 0); | ||
$form = new CRM_Contact_Form_Search_Advanced(); | ||
$form->controller = new CRM_Contact_Controller_Search(); | ||
$form->preProcess(); | ||
$form->buildQuickForm(); | ||
$onHoldElemenClass = (get_class($form->_elements[$form->_elementIndex['email_on_hold']])); | ||
$this->assertEquals('HTML_QuickForm_advcheckbox', $onHoldElemenClass, 'civimail_multiple_bulk_emails setting = 0, so email_on_hold should be a checkbox.'); | ||
} | ||
|
||
} |