From fe809626fba3f028266b5f6be1294810f975239f Mon Sep 17 00:00:00 2001 From: colemanw Date: Sat, 29 Jul 2023 00:15:01 -0400 Subject: [PATCH] ActionSchedule - Add missing field metadata --- CRM/Core/BAO/ActionSchedule.php | 18 +++++++ CRM/Core/CodeGen/Specification.php | 4 +- CRM/Core/DAO/ActionSchedule.php | 85 +++++++++++++++++++++++++++--- CRM/Core/SelectValues.php | 20 +++++++ xml/schema/Core/ActionSchedule.xml | 84 +++++++++++++++++++++++++++-- 5 files changed, 198 insertions(+), 13 deletions(-) diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index b8b0658ba8..92a50e1626 100644 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -146,6 +146,24 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule implements return CRM_Core_SelectValues::getRecurringFrequencyUnits($count); } + /** + * Provides pseudoconstant list for `filter_contact_language`. + * @return array + */ + public static function getFilterContactLanguageOptions(): array { + $languages = CRM_Core_I18n::languages(TRUE); + return $languages + [CRM_Core_I18n::NONE => ts('Contacts with no preferred language')]; + } + + /** + * Provides pseudoconstant list for `communication_language`. + * @return array + */ + public static function getCommunicationLanguageOptions(): array { + $languages = CRM_Core_I18n::languages(TRUE); + return [CRM_Core_I18n::AUTO => ts('Follow recipient preferred language')] + $languages; + } + /** * For each entity, get a list of entity-value labels. * diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php index c26671270e..1a587ca00e 100644 --- a/CRM/Core/CodeGen/Specification.php +++ b/CRM/Core/CodeGen/Specification.php @@ -421,6 +421,8 @@ class CRM_Core_CodeGen_Specification { 'formatType', 'label', 'controlField', + 'min', + 'max', /* Fixme: prior to CRM-13497 these were in a flat structure // CRM-13497 moved them to be nested within 'html' but there's no point // making that change in the DAOs right now since we are in the process of @@ -432,7 +434,7 @@ class CRM_Core_CodeGen_Specification { ]; $field['html'] = []; foreach ($validOptions as $htmlOption) { - if (!empty($fieldXML->html->$htmlOption)) { + if (isset($fieldXML->html->$htmlOption) && $fieldXML->html->$htmlOption !== '') { $field['html'][$htmlOption] = $this->value($htmlOption, $fieldXML->html); } } diff --git a/CRM/Core/DAO/ActionSchedule.php b/CRM/Core/DAO/ActionSchedule.php index ef5d8d6f6d..18345fb3b8 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:271b3b1e64984e8a221b98351ae68300) + * (GenCodeChecksum:cd1e6256f93e4fbc0bca48285b6b8258) */ /** @@ -436,7 +436,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { * Whether to return the plural version of the title. */ public static function getEntityTitle($plural = FALSE) { - return $plural ? ts('Action Schedules') : ts('Action Schedule'); + return $plural ? ts('Scheduled Reminders') : ts('Scheduled Reminder'); } /** @@ -505,6 +505,9 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'Text', + ], 'add' => '3.4', ], 'title' => [ @@ -525,6 +528,9 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'Text', + ], 'add' => '3.4', ], 'recipient' => [ @@ -547,7 +553,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'localizable' => 0, 'html' => [ 'type' => 'Select', - 'label' => ts("Recipient"), + 'label' => ts("Limit or Add Recipients"), 'controlField' => 'mapping_id', ], 'pseudoconstant' => [ @@ -657,7 +663,9 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'html' => [ + 'type' => 'Number', 'label' => ts("Start Action Offset"), + 'min' => '0', ], 'add' => '3.4', ], @@ -708,7 +716,11 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'html' => [ - 'label' => ts("Start Action condition"), + 'type' => 'Select', + 'label' => ts("Start Condition"), + ], + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::beforeAfter', ], 'add' => '3.4', ], @@ -808,7 +820,9 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'html' => [ + 'type' => 'Number', 'label' => ts("Repetition Frequency Interval"), + 'min' => '0', ], 'add' => '3.4', ], @@ -858,7 +872,9 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'html' => [ + 'type' => 'Number', 'label' => ts("End Frequency Interval"), + 'min' => '0', ], 'add' => '3.4', ], @@ -881,7 +897,11 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'html' => [ - 'label' => ts("End Action"), + 'type' => 'Select', + 'label' => ts("End Condition"), + ], + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::beforeAfter', ], 'add' => '3.4', ], @@ -956,6 +976,10 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'serialize' => self::SERIALIZE_COMMA, + 'html' => [ + 'type' => 'EntityRef', + 'label' => ts("Manual Recipients"), + ], 'add' => '3.4', ], 'recipient_listing' => [ @@ -1003,6 +1027,9 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'TextArea', + ], 'add' => '3.4', ], 'body_html' => [ @@ -1021,6 +1048,9 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'RichTextEditor', + ], 'add' => '3.4', ], 'sms_body_text' => [ @@ -1039,6 +1069,9 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'TextArea', + ], 'add' => '4.5', ], 'subject' => [ @@ -1059,12 +1092,15 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'Text', + ], 'add' => '3.4', ], 'record_activity' => [ 'name' => 'record_activity', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Record Activity for Reminder?'), + 'title' => ts('Record Activity'), 'description' => ts('Record Activity for this reminder?'), 'required' => TRUE, 'usage' => [ @@ -1079,6 +1115,9 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'CheckBox', + ], 'add' => '3.4', ], 'mapping_id' => [ @@ -1197,6 +1236,10 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'Select Date', + 'formatType' => 'activityDate', + ], 'add' => '4.1', ], 'from_name' => [ @@ -1217,6 +1260,10 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'Text', + 'label' => ts("From Name"), + ], 'add' => '4.5', ], 'from_email' => [ @@ -1237,6 +1284,10 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'Email', + 'label' => ts("From Email"), + ], 'add' => '4.5', ], 'mode' => [ @@ -1287,6 +1338,9 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'type' => 'Select', 'label' => ts("SMS Provider"), ], + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::smsProvider', + ], 'add' => '4.5', ], 'used_for' => [ @@ -1330,8 +1384,13 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED, 'html' => [ - 'label' => ts("Filter Contact Language"), + 'type' => 'Select', + 'label' => ts("Recipients Language"), + ], + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_BAO_ActionSchedule::getFilterContactLanguageOptions', ], 'add' => '4.7', ], @@ -1354,8 +1413,12 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'html' => [ + 'type' => 'Select', 'label' => ts("Communication Language"), ], + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_BAO_ActionSchedule::getCommunicationLanguageOptions', + ], 'add' => '4.7', ], 'action_schedule_created_date' => [ @@ -1421,6 +1484,10 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'Select Date', + 'formatType' => 'activityDate', + ], 'add' => '5.34', ], 'action_schedule_effective_end_date' => [ @@ -1441,6 +1508,10 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, + 'html' => [ + 'type' => 'Select Date', + 'formatType' => 'activityDate', + ], 'add' => '5.34', ], ]; diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 7f0905ac36..87fa71eba7 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -488,6 +488,19 @@ class CRM_Core_SelectValues { return $addr; } + public static function smsProvider(): array { + $providers = CRM_SMS_BAO_Provider::getProviders(NULL, NULL, TRUE, 'is_default desc, title'); + $result = []; + foreach ($providers as $provider) { + $result[] = [ + 'id' => $provider['id'], + 'name' => $provider['name'], + 'label' => $provider['title'], + ]; + } + return $result; + } + /** * Different type of Mailing Tokens. * @@ -1193,6 +1206,13 @@ class CRM_Core_SelectValues { ]; } + public static function beforeAfter() { + return [ + 'before' => ts('Before'), + 'after' => ts('After'), + ]; + } + /** * Columns from the option_value table which may or may not be used by each option_group. * diff --git a/xml/schema/Core/ActionSchedule.xml b/xml/schema/Core/ActionSchedule.xml index 1483a627f5..484818ef79 100644 --- a/xml/schema/Core/ActionSchedule.xml +++ b/xml/schema/Core/ActionSchedule.xml @@ -7,6 +7,7 @@ Table to store the reminders. 3.4 title + Scheduled Reminder civicrm/admin/scheduleReminders civicrm/admin/scheduleReminders/edit?reset=1&action=add @@ -31,6 +32,9 @@ name Name varchar + + Text + 64 Name of the action(reminder) 3.4 @@ -39,6 +43,9 @@ title Title varchar + + Text + 64 Title of the action(reminder) 3.4 @@ -49,7 +56,7 @@ 64 Recipient - + Select mapping_id @@ -112,6 +119,8 @@ Reminder Interval. 0 + Number + 0 3.4 @@ -137,8 +146,12 @@ 64 Reminder Action - + Select + + + CRM_Core_SelectValues::beforeAfter + 3.4 @@ -188,6 +201,8 @@ 0 Time interval for repeating the reminder. + Number + 0 3.4 @@ -212,6 +227,8 @@ int unsigned Time interval till repeating the reminder. + Number + 0 3.4 @@ -223,8 +240,12 @@ 32 Reminder Action till repeating the reminder. - + Select + + + CRM_Core_SelectValues::beforeAfter + 3.4 @@ -259,6 +280,11 @@ recipient_manual Recipient Manual varchar + + EntityRef + + 1 + 128 Contact IDs to which reminder should be sent. COMMA @@ -286,6 +312,9 @@ body_text Reminder Text longtext + + TextArea + Body of the mailing in text format. 3.4 @@ -293,6 +322,9 @@ body_html Reminder HTML longtext + + RichTextEditor + Body of the mailing in html format. 3.4 @@ -300,6 +332,9 @@ sms_body_text SMS Reminder Text longtext + + TextArea + Content of the SMS text. 4.5 @@ -307,14 +342,20 @@ subject Reminder Subject varchar + + Text + 128 Subject of mailing 3.4 record_activity - Record Activity for Reminder? + Record Activity boolean + + CheckBox + 0 true Record Activity for this reminder? @@ -392,6 +433,10 @@ absolute_date Fixed Date for Reminder date + + Select Date + activityDate + Date on which the reminder be sent. 4.1 @@ -399,6 +444,10 @@ from_name Reminder from Name varchar + + + Text + 255 Name in "from" field 4.5 @@ -407,6 +456,10 @@ from_email Reminder From Email varchar + + + Email + 255 Email address in "from" field 4.5 @@ -435,6 +488,9 @@ Select + + CRM_Core_SelectValues::smsProvider + sms_provider_id @@ -458,9 +514,15 @@ varchar 128 Used for multilingual installation + SEPARATOR_TRIMMED - + Select + 1 + + + CRM_Core_BAO_ActionSchedule::getFilterContactLanguageOptions + 4.7 @@ -469,8 +531,12 @@ 8 Used for multilingual installation + Select + + CRM_Core_BAO_ActionSchedule::getCommunicationLanguageOptions + 4.7 @@ -501,6 +567,10 @@ Effective start date action_schedule_effective_start_date timestamp + + Select Date + activityDate + Earliest date to consider start events from. false true @@ -511,6 +581,10 @@ Effective end date action_schedule_effective_end_date timestamp + + Select Date + activityDate + Latest date to consider end events from. false true -- 2.25.1