FiveFortyNine - Don't munge soft credit 'limit-to'
authorTim Otten <totten@civicrm.org>
Wed, 18 May 2022 22:02:12 +0000 (15:02 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 19 May 2022 02:23:35 +0000 (19:23 -0700)
I'm not sure what it even means to limit a scheduled-reminder to a "soft_credit_type".

But it's a thing - I can use the 5.48 GUI to create it. Here's how it looks in the DB (in 5.48):

+----+------------------------------------------+------------------+----------+------------------+-------------------+----------+
| id | title                                    | recipient        | limit_to | recipient_manual | recipient_listing | group_id |
+----+------------------------------------------+------------------+----------+------------------+-------------------+----------+
| 11 | Limit To - Soft Credit                   | soft_credit_type |        1 | NULL             | in_memory_of      |     NULL |
+----+------------------------------------------+------------------+----------+------------------+-------------------+----------+

The `changeBooleanColumnLimitTo()` was coercing down to `limit_to=null` because it lacked `recipient_manual` and `group_id`.

CRM/Upgrade/Incremental/php/FiveFortyNine.php

index 1573d3f8eef3645a604c9f73880fb7e97492c917..58332a54c88dce774e06e5c07f0e219cfbfbf19c 100644 (file)
@@ -101,7 +101,7 @@ class CRM_Upgrade_Incremental_php_FiveFortyNine extends CRM_Upgrade_Incremental_
    */
   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);
+    CRM_Core_DAO::executeQuery("UPDATE `civicrm_action_schedule` SET `limit_to` = NULL WHERE `limit_to` = 0 AND `group_id` IS NULL AND recipient_manual IS NULL", [], TRUE, NULL, FALSE, FALSE);
     return TRUE;
   }