From: Monish Deb Date: Tue, 17 May 2022 07:01:23 +0000 (+0530) Subject: Revert civicrm_action_schedule.limit_to boolean column to be NULL X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fe59d89afbd46bee42684f2b0a829af96f65788e;p=civicrm-core.git Revert civicrm_action_schedule.limit_to boolean column to be NULL --- diff --git a/CRM/Core/DAO/ActionSchedule.php b/CRM/Core/DAO/ActionSchedule.php index cd58cfb12d..e20791704c 100644 --- a/CRM/Core/DAO/ActionSchedule.php +++ b/CRM/Core/DAO/ActionSchedule.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/ActionSchedule.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:444acdd7b222ed9f593b0b84aebfb763) + * (GenCodeChecksum:79492485b0099dc4a6a101f3191d64dd) */ /** @@ -67,7 +67,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { /** * Is this the recipient criteria limited to OR in addition to? * - * @var bool|string + * @var bool|string|null * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -512,9 +512,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Limit To'), 'description' => ts('Is this the recipient criteria limited to OR in addition to?'), - 'required' => TRUE, 'where' => 'civicrm_action_schedule.limit_to', - 'default' => '1', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', diff --git a/CRM/Upgrade/Incremental/php/FiveFortyNine.php b/CRM/Upgrade/Incremental/php/FiveFortyNine.php index e6d0ec2d34..568e566cf9 100644 --- a/CRM/Upgrade/Incremental/php/FiveFortyNine.php +++ b/CRM/Upgrade/Incremental/php/FiveFortyNine.php @@ -60,6 +60,24 @@ class CRM_Upgrade_Incremental_php_FiveFortyNine extends CRM_Upgrade_Incremental_ } } + /** + * Upgrade function. + * + * @param string $rev + */ + public function upgrade_5_49_2($rev) { + $this->addtask('Revert civicrm_action_schedule.limit_to to be NULL', 'changeBooleanColumnLimitTo'); + } + + /** + * Revert boolean default civicrm_action_schedule.limit_to to be NULL + */ + public static function changeBooleanColumnLimitTo() { + CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_action_schedule` CHANGE `limit_to` `limit_to` tinyint NULL COMMENT 'Is this the recipient criteria limited to OR in addition to?'", [], TRUE, NULL, FALSE, FALSE); + CRM_Core_DAO::executeQuery("UPDATE `civicrm_action_schedule` SET `limit_to` = NULL WHERE `group_id` IS NULL AND recipient_manual IS NULL", [], TRUE, NULL, FALSE, FALSE); + return TRUE; + } + /** * Converts a boolean table column to be NOT NULL * @param CRM_Queue_TaskContext $ctx diff --git a/CRM/Upgrade/Incremental/php/FiveFortyNine/Core.bool.php b/CRM/Upgrade/Incremental/php/FiveFortyNine/Core.bool.php index 504fc370ac..1e6732cbf7 100644 --- a/CRM/Upgrade/Incremental/php/FiveFortyNine/Core.bool.php +++ b/CRM/Upgrade/Incremental/php/FiveFortyNine/Core.bool.php @@ -1,7 +1,6 @@ [ - 'limit_to' => "DEFAULT 1 COMMENT 'Is this the recipient criteria limited to OR in addition to?'", 'is_repeat' => "DEFAULT 0", 'is_active' => "DEFAULT 1 COMMENT 'Is this option active?'", 'record_activity' => "DEFAULT 0 COMMENT 'Record Activity for this reminder?'", diff --git a/xml/schema/Core/ActionSchedule.xml b/xml/schema/Core/ActionSchedule.xml index 8ea04d1b7a..1f89acb9ca 100644 --- a/xml/schema/Core/ActionSchedule.xml +++ b/xml/schema/Core/ActionSchedule.xml @@ -53,8 +53,6 @@ - 1 - true 4.4