From 4ff6b8569388a0f1057d3eb096a6cfe7b4bcf619 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sat, 8 Jan 2022 19:17:08 +0000 Subject: [PATCH] Tidy CRM_Report_Page_Options code --- CRM/Report/Page/Options.php | 32 +++++++++++---------------- templates/CRM/Report/Page/Options.tpl | 6 ++--- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/CRM/Report/Page/Options.php b/CRM/Report/Page/Options.php index 894ba22e3a..f0d88838dd 100644 --- a/CRM/Report/Page/Options.php +++ b/CRM/Report/Page/Options.php @@ -32,21 +32,21 @@ class CRM_Report_Page_Options extends CRM_Core_Page_Basic { /** * The option group name. * - * @var array + * @var string|null */ public static $_gName = NULL; /** * The option group name in display format (capitalized, without underscores...etc) * - * @var array + * @var string|null */ - public static $_GName = NULL; + public static $_gLabel = NULL; /** * The option group id. * - * @var array + * @var int|null */ public static $_gId = NULL; @@ -58,17 +58,11 @@ class CRM_Report_Page_Options extends CRM_Core_Page_Basic { $this->_id = CRM_Utils_Request::retrieve('id', 'String', $this, FALSE); self::$_gName = "report_template"; + self::$_gLabel = ts("Report Template"); + self::$_gId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', self::$_gName, 'id', 'name'); - if (self::$_gName) { - self::$_gId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', self::$_gName, 'id', 'name'); - } - else { - CRM_Core_Error::statusBounce(ts('Unable to determine the Option Group')); - } - - self::$_GName = ucwords(str_replace('_', ' ', self::$_gName)); - - $this->assign('GName', self::$_GName); + $this->assign('gName', self::$_gName); + $this->assign('gLabel', self::$_gLabel); $newReportURL = CRM_Utils_System::url("civicrm/admin/report/register", 'reset=1' ); @@ -99,23 +93,23 @@ class CRM_Report_Page_Options extends CRM_Core_Page_Basic { 'name' => ts('Edit'), 'url' => 'civicrm/admin/report/register/' . self::$_gName, 'qs' => 'action=update&id=%%id%%&reset=1', - 'title' => ts('Edit %1', [1 => self::$_gName]), + 'title' => ts('Edit %1', [1 => self::$_gLabel]), ], CRM_Core_Action::DISABLE => [ 'name' => ts('Disable'), 'ref' => 'crm-enable-disable', - 'title' => ts('Disable %1', [1 => self::$_gName]), + 'title' => ts('Disable %1', [1 => self::$_gLabel]), ], CRM_Core_Action::ENABLE => [ 'name' => ts('Enable'), 'ref' => 'crm-enable-disable', - 'title' => ts('Enable %1', [1 => self::$_gName]), + 'title' => ts('Enable %1', [1 => self::$_gLabel]), ], CRM_Core_Action::DELETE => [ 'name' => ts('Delete'), 'url' => 'civicrm/admin/report/register/' . self::$_gName, 'qs' => 'action=delete&id=%%id%%&reset=1', - 'title' => ts('Delete %1 Type', [1 => self::$_gName]), + 'title' => ts('Delete %1 Type', [1 => self::$_gLabel]), ], ]; } @@ -168,7 +162,7 @@ class CRM_Report_Page_Options extends CRM_Core_Page_Basic { * name of this page. */ public function editName() { - return self::$_GName; + return self::$_gLabel; } /** diff --git a/templates/CRM/Report/Page/Options.tpl b/templates/CRM/Report/Page/Options.tpl index 03c9e5050b..33d2680040 100644 --- a/templates/CRM/Report/Page/Options.tpl +++ b/templates/CRM/Report/Page/Options.tpl @@ -8,11 +8,11 @@ +--------------------------------------------------------------------+ *}
- {ts 1=$GName}The existing option choices for %1 group are listed below. You can add, edit or delete them from this screen.{/ts} + {ts 1=$gLabel}The existing option choices for %1 group are listed below. You can add, edit or delete them from this screen.{/ts}
{if $action ne 1 and $action ne 2}
{/if} @@ -58,7 +58,7 @@ {if $action ne 1 and $action ne 2} {/if} -- 2.25.1