ActionSchedule - Add missing field metadata
authorcolemanw <coleman@civicrm.org>
Sat, 29 Jul 2023 04:15:01 +0000 (00:15 -0400)
committercolemanw <coleman@civicrm.org>
Fri, 4 Aug 2023 12:10:22 +0000 (08:10 -0400)
CRM/Core/BAO/ActionSchedule.php
CRM/Core/CodeGen/Specification.php
CRM/Core/DAO/ActionSchedule.php
CRM/Core/SelectValues.php
xml/schema/Core/ActionSchedule.xml

index b8b0658ba8faee7b53e0356b657d66961f682e0a..92a50e162668d192aae1d854a2c9c38655fe758c 100644 (file)
@@ -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.
    *
index c26671270e1c32e81d692948f3133585beef2766..1a587ca00e204675b2f5abf049c0002154cdbeaf 100644 (file)
@@ -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);
         }
       }
index ef5d8d6f6da20f73959e3ff63a5e2c23d9cf34ba..18345fb3b87710b9a409f6b57844c77b1a00c5d1 100644 (file)
@@ -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',
         ],
       ];
index 7f0905ac366f675c0079bad7e2b9472d37e0457b..87fa71eba7afa9c3810e3aa78c1de8a4193d3cfc 100644 (file)
@@ -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.
    *
index 1483a627f584f96f70b0cf6cc325257479ec2e20..484818ef792e48daac3262972e69fe24444bebb3 100644 (file)
@@ -7,6 +7,7 @@
   <comment>Table to store the reminders.</comment>
   <add>3.4</add>
   <labelField>title</labelField>
+  <title>Scheduled Reminder</title>
   <paths>
     <browse>civicrm/admin/scheduleReminders</browse>
     <add>civicrm/admin/scheduleReminders/edit?reset=1&amp;action=add</add>
@@ -31,6 +32,9 @@
     <name>name</name>
     <title>Name</title>
     <type>varchar</type>
+    <html>
+      <type>Text</type>
+    </html>
     <length>64</length>
     <comment>Name of the action(reminder)</comment>
     <add>3.4</add>
@@ -39,6 +43,9 @@
     <name>title</name>
     <title>Title</title>
     <type>varchar</type>
+    <html>
+      <type>Text</type>
+    </html>
     <length>64</length>
     <comment>Title of the action(reminder)</comment>
     <add>3.4</add>
@@ -49,7 +56,7 @@
     <length>64</length>
     <comment>Recipient</comment>
     <html>
-      <label>Recipient</label>
+      <label>Limit or Add Recipients</label>
       <type>Select</type>
       <controlField>mapping_id</controlField>
     </html>
     <comment>Reminder Interval.</comment>
     <default>0</default>
     <html>
+      <type>Number</type>
+      <min>0</min>
       <label>Start Action Offset</label>
     </html>
     <add>3.4</add>
     <length>64</length>
     <comment>Reminder Action</comment>
     <html>
-      <label>Start Action condition</label>
+      <type>Select</type>
+      <label>Start Condition</label>
     </html>
+    <pseudoconstant>
+      <callback>CRM_Core_SelectValues::beforeAfter</callback>
+    </pseudoconstant>
     <add>3.4</add>
   </field>
   <field>
     <default>0</default>
     <comment>Time interval for repeating the reminder.</comment>
     <html>
+      <type>Number</type>
+      <min>0</min>
       <label>Repetition Frequency Interval</label>
     </html>
     <add>3.4</add>
     <type>int unsigned</type>
     <comment>Time interval till repeating the reminder.</comment>
     <html>
+      <type>Number</type>
+      <min>0</min>
       <label>End Frequency Interval</label>
     </html>
     <add>3.4</add>
     <length>32</length>
     <comment>Reminder Action till repeating the reminder.</comment>
     <html>
-      <label>End Action</label>
+      <type>Select</type>
+      <label>End Condition</label>
     </html>
+    <pseudoconstant>
+      <callback>CRM_Core_SelectValues::beforeAfter</callback>
+    </pseudoconstant>
     <add>3.4</add>
   </field>
   <field>
     <name>recipient_manual</name>
     <title>Recipient Manual</title>
     <type>varchar</type>
+    <html>
+      <type>EntityRef</type>
+      <label>Manual Recipients</label>
+      <multiple>1</multiple>
+    </html>
     <length>128</length>
     <comment>Contact IDs to which reminder should be sent.</comment>
     <serialize>COMMA</serialize>
     <name>body_text</name>
     <title>Reminder Text</title>
     <type>longtext</type>
+    <html>
+      <type>TextArea</type>
+    </html>
     <comment>Body of the mailing in text format.</comment>
     <add>3.4</add>
   </field>
     <name>body_html</name>
     <title>Reminder HTML</title>
     <type>longtext</type>
+    <html>
+      <type>RichTextEditor</type>
+    </html>
     <comment>Body of the mailing in html format.</comment>
     <add>3.4</add>
   </field>
     <name>sms_body_text</name>
     <title>SMS Reminder Text</title>
     <type>longtext</type>
+    <html>
+      <type>TextArea</type>
+    </html>
     <comment>Content of the SMS text.</comment>
     <add>4.5</add>
   </field>
     <name>subject</name>
     <title>Reminder Subject</title>
     <type>varchar</type>
+    <html>
+      <type>Text</type>
+    </html>
     <length>128</length>
     <comment>Subject of mailing</comment>
     <add>3.4</add>
   </field>
   <field>
     <name>record_activity</name>
-    <title>Record Activity for Reminder?</title>
+    <title>Record Activity</title>
     <type>boolean</type>
+    <html>
+      <type>CheckBox</type>
+    </html>
     <default>0</default>
     <required>true</required>
     <comment>Record Activity for this reminder?</comment>
     <name>absolute_date</name>
     <title>Fixed Date for Reminder</title>
     <type>date</type>
+    <html>
+      <type>Select Date</type>
+      <formatType>activityDate</formatType>
+    </html>
     <comment>Date on which the reminder be sent.</comment>
     <add>4.1</add>
   </field>
     <name>from_name</name>
     <title>Reminder from Name</title>
     <type>varchar</type>
+    <html>
+      <label>From Name</label>
+      <type>Text</type>
+    </html>
     <length>255</length>
     <comment>Name in "from" field</comment>
     <add>4.5</add>
     <name>from_email</name>
     <title>Reminder From Email</title>
     <type>varchar</type>
+    <html>
+      <label>From Email</label>
+      <type>Email</type>
+    </html>
     <length>255</length>
     <comment>Email address in "from" field</comment>
     <add>4.5</add>
       <type>Select</type>
       <label>SMS Provider</label>
     </html>
+    <pseudoconstant>
+      <callback>CRM_Core_SelectValues::smsProvider</callback>
+    </pseudoconstant>
   </field>
   <foreignKey>
     <name>sms_provider_id</name>
     <type>varchar</type>
     <length>128</length>
     <comment>Used for multilingual installation</comment>
+    <serialize>SEPARATOR_TRIMMED</serialize>
     <html>
-      <label>Filter Contact Language</label>
+      <type>Select</type>
+      <multiple>1</multiple>
+      <label>Recipients Language</label>
     </html>
+    <pseudoconstant>
+      <callback>CRM_Core_BAO_ActionSchedule::getFilterContactLanguageOptions</callback>
+    </pseudoconstant>
     <add>4.7</add>
   </field>
   <field>
     <length>8</length>
     <comment>Used for multilingual installation</comment>
     <html>
+      <type>Select</type>
       <label>Communication Language</label>
     </html>
+    <pseudoconstant>
+      <callback>CRM_Core_BAO_ActionSchedule::getCommunicationLanguageOptions</callback>
+    </pseudoconstant>
     <add>4.7</add>
   </field>
   <field>
     <title>Effective start date</title>
     <uniqueName>action_schedule_effective_start_date</uniqueName>
     <type>timestamp</type>
+    <html>
+      <type>Select Date</type>
+      <formatType>activityDate</formatType>
+    </html>
     <comment>Earliest date to consider start events from.</comment>
     <required>false</required>
     <export>true</export>
     <title>Effective end date</title>
     <uniqueName>action_schedule_effective_end_date</uniqueName>
     <type>timestamp</type>
+    <html>
+      <type>Select Date</type>
+      <formatType>activityDate</formatType>
+    </html>
     <comment>Latest date to consider end events from.</comment>
     <required>false</required>
     <export>true</export>