Revert civicrm_action_schedule.limit_to boolean column to be NULL
authorMonish Deb <monish.deb@jmaconsulting.biz>
Tue, 17 May 2022 07:01:23 +0000 (12:31 +0530)
committerTim Otten <totten@civicrm.org>
Thu, 19 May 2022 02:20:44 +0000 (19:20 -0700)
CRM/Core/DAO/ActionSchedule.php
CRM/Upgrade/Incremental/php/FiveFortyNine.php
CRM/Upgrade/Incremental/php/FiveFortyNine/Core.bool.php
xml/schema/Core/ActionSchedule.xml

index cd58cfb12d447ea6b14c552adbdbbe95ae7b63dd..e20791704ccd9a8060e4f0621ed5a13ada672f08 100644 (file)
@@ -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',
index e6d0ec2d342a9052af26da4ae237145d69491351..568e566cf91c9e6017e59fd1ef1f2faa5ebbbac6 100644 (file)
@@ -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
index 504fc370ac3ad6cbe9049951ead0c5627d69ba5b..1e6732cbf746a8d05ae2c32fe22aa4df18e6212e 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 return [
   'civicrm_action_schedule' => [
-    '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?'",
index 8ea04d1b7a9075a9a0b99e3be98ce31624b2c00f..1f89acb9cac05ec8ff8800b00f086a5c7d77cb75 100644 (file)
@@ -53,8 +53,6 @@
     <html>
       <label>Limit To</label>
     </html>
-    <default>1</default>
-    <required>true</required>
     <add>4.4</add>
   </field>
   <field>