From e44a64f6e54a305aeed96e7a5f50091f4425c7d5 Mon Sep 17 00:00:00 2001 From: colemanw Date: Wed, 19 Jul 2023 21:38:49 -0400 Subject: [PATCH] ScheduledReminders - Refactor form to work at a standalone url --- CRM/Admin/Form/ScheduleReminders.php | 15 +++--- CRM/Admin/Page/ScheduleReminders.php | 46 ------------------- CRM/Core/DAO/ActionSchedule.php | 13 +++++- CRM/Core/xml/Menu/Admin.xml | 7 +++ .../{Page => Form}/ScheduleReminders.hlp | 0 .../CRM/Admin/Page/ScheduleReminders.tpl | 2 +- xml/schema/Core/ActionSchedule.xml | 6 +++ 7 files changed, 34 insertions(+), 55 deletions(-) rename templates/CRM/Admin/{Page => Form}/ScheduleReminders.hlp (100%) diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index b910ff8d23..b3f68fd7f3 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -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) { diff --git a/CRM/Admin/Page/ScheduleReminders.php b/CRM/Admin/Page/ScheduleReminders.php index 1f3e1b57fe..c6a3415ebb 100644 --- a/CRM/Admin/Page/ScheduleReminders.php +++ b/CRM/Admin/Page/ScheduleReminders.php @@ -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. * diff --git a/CRM/Core/DAO/ActionSchedule.php b/CRM/Core/DAO/ActionSchedule.php index 4a7b0184f8..b7021c77f4 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: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) diff --git a/CRM/Core/xml/Menu/Admin.xml b/CRM/Core/xml/Menu/Admin.xml index 0aa9b984b2..5cac2d9518 100644 --- a/CRM/Core/xml/Menu/Admin.xml +++ b/CRM/Core/xml/Menu/Admin.xml @@ -299,6 +299,13 @@ Communications 40 + + civicrm/admin/scheduleReminders/edit + Schedule Reminders + CRM_Admin_Form_ScheduleReminders + 1 + administer CiviCRM data;edit all events + civicrm/admin/weight CRM_Utils_Weight::fixOrder diff --git a/templates/CRM/Admin/Page/ScheduleReminders.hlp b/templates/CRM/Admin/Form/ScheduleReminders.hlp similarity index 100% rename from templates/CRM/Admin/Page/ScheduleReminders.hlp rename to templates/CRM/Admin/Form/ScheduleReminders.hlp diff --git a/templates/CRM/Admin/Page/ScheduleReminders.tpl b/templates/CRM/Admin/Page/ScheduleReminders.tpl index 9fd046b00e..c5ed999c95 100644 --- a/templates/CRM/Admin/Page/ScheduleReminders.tpl +++ b/templates/CRM/Admin/Page/ScheduleReminders.tpl @@ -34,7 +34,7 @@ {/if}