ScheduledReminders - Refactor form to work at a standalone url
authorcolemanw <coleman@civicrm.org>
Thu, 20 Jul 2023 01:38:49 +0000 (21:38 -0400)
committercolemanw <coleman@civicrm.org>
Thu, 20 Jul 2023 02:55:10 +0000 (22:55 -0400)
CRM/Admin/Form/ScheduleReminders.php
CRM/Admin/Page/ScheduleReminders.php
CRM/Core/DAO/ActionSchedule.php
CRM/Core/xml/Menu/Admin.xml
templates/CRM/Admin/Form/ScheduleReminders.hlp [moved from templates/CRM/Admin/Page/ScheduleReminders.hlp with 100% similarity]
templates/CRM/Admin/Page/ScheduleReminders.tpl
xml/schema/Core/ActionSchedule.xml

index b910ff8d23d2f24d02f6d0c27bac1cee2e368f7d..b3f68fd7f379f3c0e29a297e71f2fdde39cf8a49 100644 (file)
@@ -22,12 +22,6 @@ use Civi\Token\TokenProcessor;
  */
 class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
 
-  /**
-   * Scheduled Reminder ID.
-   * @var int
-   */
-  public $_id;
-
   protected $_compId;
 
   /**
@@ -54,6 +48,13 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
     $this->_compId = $compId;
   }
 
+  /**
+   * @return string
+   */
+  public function getDefaultEntity(): string {
+    return 'ActionSchedule';
+  }
+
   /**
    * Build the form object.
    *
@@ -371,7 +372,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
   }
 
   /**
-   * @return int
+   * @return array
    */
   public function setDefaultValues() {
     if ($this->_action & CRM_Core_Action::ADD) {
index 1f3e1b57fe78ece1603c1ded2a5a7fbc1d96939f..c6a3415ebbe7ab9061292b95c7f1a1fb4d39458c 100644 (file)
@@ -22,13 +22,6 @@ class CRM_Admin_Page_ScheduleReminders extends CRM_Core_Page_Basic {
 
   public $useLivePageJS = TRUE;
 
-  /**
-   * The action links that we need to display for the browse screen.
-   *
-   * @var array
-   */
-  public static $_links = NULL;
-
   /**
    * Get BAO Name.
    *
@@ -39,45 +32,6 @@ class CRM_Admin_Page_ScheduleReminders extends CRM_Core_Page_Basic {
     return 'CRM_Core_BAO_ActionSchedule';
   }
 
-  /**
-   * Get action Links.
-   *
-   * @return array
-   *   (reference) of action links
-   */
-  public function &links() {
-    if (!(self::$_links)) {
-      // helper variable for nicer formatting
-      self::$_links = [
-        CRM_Core_Action::UPDATE => [
-          'name' => ts('Edit'),
-          'class' => 'no-popup',
-          'url' => 'civicrm/admin/scheduleReminders',
-          'qs' => 'action=update&id=%%id%%&reset=1',
-          'title' => ts('Edit Schedule Reminders'),
-        ],
-        CRM_Core_Action::ENABLE => [
-          'name' => ts('Enable'),
-          'ref' => 'crm-enable-disable',
-          'title' => ts('Enable Label Format'),
-        ],
-        CRM_Core_Action::DISABLE => [
-          'name' => ts('Disable'),
-          'ref' => 'crm-enable-disable',
-          'title' => ts('Disable Label Format'),
-        ],
-        CRM_Core_Action::DELETE => [
-          'name' => ts('Delete'),
-          'url' => 'civicrm/admin/scheduleReminders',
-          'qs' => 'action=delete&id=%%id%%',
-          'title' => ts('Delete Schedule Reminders'),
-        ],
-      ];
-    }
-
-    return self::$_links;
-  }
-
   /**
    * Get name of edit form.
    *
index 4a7b0184f8c463b7a9506a59e09cecf46949b632..b7021c77f4c26a53e72e7e62cb764136a90f0206 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/ActionSchedule.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8098f787ce516453231c9dd5c11e2185)
+ * (GenCodeChecksum:247a35dcd0734c0cd3d00c42910cf725)
  */
 
 /**
@@ -37,6 +37,17 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
    */
   public static $_log = FALSE;
 
+  /**
+   * Paths for accessing this entity in the UI.
+   *
+   * @var string[]
+   */
+  protected static $_paths = [
+    'add' => 'civicrm/admin/scheduleReminders/edit?reset=1&action=add',
+    'update' => 'civicrm/admin/scheduleReminders/edit?reset=1&action=update&id=[id]',
+    'delete' => 'civicrm/admin/scheduleReminders/edit?reset=1&action=delete&id=[id]',
+  ];
+
   /**
    * @var int|string|null
    *   (SQL type: int unsigned)
index 0aa9b984b20a4a7054c0fa3311908196757fd84e..5cac2d95188f6f550668e16879ecb512dbcd7e07 100644 (file)
      <adminGroup>Communications</adminGroup>
      <weight>40</weight>
   </item>
+  <item>
+     <path>civicrm/admin/scheduleReminders/edit</path>
+     <title>Schedule Reminders</title>
+     <page_callback>CRM_Admin_Form_ScheduleReminders</page_callback>
+     <access_callback>1</access_callback>
+     <access_arguments>administer CiviCRM data;edit all events</access_arguments>
+  </item>
   <item>
      <path>civicrm/admin/weight</path>
      <page_callback>CRM_Utils_Weight::fixOrder</page_callback>
index 9fd046b00e23d57e5f657cef64625b00998d2728..c5ed999c9508b534749fef58f0612a75badf3d23 100644 (file)
@@ -34,7 +34,7 @@
     </div>
   {/if}
   <div class="action-link">
-    {assign var='link' value="civicrm/admin/scheduleReminders"}
+    {assign var='link' value="civicrm/admin/scheduleReminders/edit"}
     {if !empty($component)}
       {assign var='urlParams' value="action=add&context=$component&compId=$id&reset=1"}
     {else}
index 2c37ad7200dc72762b3e4a1152926601faede9d9..9c2194faf238d9c3779f04dc98a7bb317ab9da88 100644 (file)
@@ -6,6 +6,12 @@
   <name>civicrm_action_schedule</name>
   <comment>Table to store the reminders.</comment>
   <add>3.4</add>
+  <labelField>title</labelField>
+  <paths>
+    <add>civicrm/admin/scheduleReminders/edit?reset=1&amp;action=add</add>
+    <update>civicrm/admin/scheduleReminders/edit?reset=1&amp;action=update&amp;id=[id]</update>
+    <delete>civicrm/admin/scheduleReminders/edit?reset=1&amp;action=delete&amp;id=[id]</delete>
+  </paths>
   <field>
     <name>id</name>
     <title>Action Schedule ID</title>