From b2ef34665f4b75c2ade0b1c4d4a333affe5e2902 Mon Sep 17 00:00:00 2001 From: Aidan Saunders Date: Wed, 6 Dec 2023 17:24:07 +0000 Subject: [PATCH] Path mangling for managePremiums --- CRM/Contribute/Form/ManagePremiums.php | 2 +- CRM/Contribute/Page/ManagePremiums.php | 6 +++--- CRM/Contribute/xml/Menu/Contribute.xml | 5 +++++ templates/CRM/Contribute/Page/ManagePremiums.tpl | 2 +- xml/schema/Contribute/Product.xml | 6 ++++++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CRM/Contribute/Form/ManagePremiums.php b/CRM/Contribute/Form/ManagePremiums.php index 247c3df103..85e25503d0 100644 --- a/CRM/Contribute/Form/ManagePremiums.php +++ b/CRM/Contribute/Form/ManagePremiums.php @@ -264,7 +264,7 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form { catch (CRM_Core_Exception $e) { $message = ts("This Premium is linked to an Online Contribution page. Please remove it before deleting this Premium.", [1 => CRM_Utils_System::url('civicrm/admin/contribute', 'reset=1')]); CRM_Core_Session::setStatus($message, ts('Cannot delete Premium'), 'error'); - CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin/contribute/managePremiums', 'reset=1&action=browse')); + CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin/contribute/managePremiums', 'reset=1')); return; } CRM_Core_Session::setStatus( diff --git a/CRM/Contribute/Page/ManagePremiums.php b/CRM/Contribute/Page/ManagePremiums.php index 9e7a453341..0fa88c979e 100644 --- a/CRM/Contribute/Page/ManagePremiums.php +++ b/CRM/Contribute/Page/ManagePremiums.php @@ -52,14 +52,14 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic { self::$_links = [ CRM_Core_Action::UPDATE => [ 'name' => ts('Edit'), - 'url' => 'civicrm/admin/contribute/managePremiums', + 'url' => 'civicrm/admin/contribute/managePremiums/edit', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Premium'), 'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::UPDATE), ], CRM_Core_Action::PREVIEW => [ 'name' => ts('Preview'), - 'url' => 'civicrm/admin/contribute/managePremiums', + 'url' => 'civicrm/admin/contribute/managePremiums/edit', 'qs' => 'action=preview&id=%%id%%', 'title' => ts('Preview Premium'), 'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::PREVIEW), @@ -78,7 +78,7 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic { ], CRM_Core_Action::DELETE => [ 'name' => ts('Delete'), - 'url' => 'civicrm/admin/contribute/managePremiums', + 'url' => 'civicrm/admin/contribute/managePremiums/edit', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Premium'), 'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::DELETE), diff --git a/CRM/Contribute/xml/Menu/Contribute.xml b/CRM/Contribute/xml/Menu/Contribute.xml index 1757c746a6..242bd1eedf 100644 --- a/CRM/Contribute/xml/Menu/Contribute.xml +++ b/CRM/Contribute/xml/Menu/Contribute.xml @@ -111,6 +111,11 @@ CiviContribute 365 + + civicrm/admin/contribute/managePremiums/edit + Manage Premiums + CRM_Contribute_Form_ManagePremiums + civicrm/admin/financial/financialType Financial Types diff --git a/templates/CRM/Contribute/Page/ManagePremiums.tpl b/templates/CRM/Contribute/Page/ManagePremiums.tpl index e73c541c65..d5ec4b8f44 100644 --- a/templates/CRM/Contribute/Page/ManagePremiums.tpl +++ b/templates/CRM/Contribute/Page/ManagePremiums.tpl @@ -66,7 +66,7 @@ {if $action ne 1 and $action ne 2}
{ts}status{/ts} - {capture assign=crmURL}{crmURL p='civicrm/admin/contribute/managePremiums' q="action=add&reset=1"}{/capture} + {capture assign=crmURL}{crmURL p='civicrm/admin/contribute/managePremiums/edit' q="action=add&reset=1"}{/capture} {ts 1=$crmURL}No premium products have been created for your site. You can add one.{/ts}
{/if} diff --git a/xml/schema/Contribute/Product.xml b/xml/schema/Contribute/Product.xml index 16ff28127d..237453035b 100644 --- a/xml/schema/Contribute/Product.xml +++ b/xml/schema/Contribute/Product.xml @@ -9,6 +9,12 @@ true CiviContribute name + + civicrm/admin/contribute/managePremiums/edit?action=add&reset=1 + civicrm/admin/contribute/managePremiums/edit?action=update&id=[id]&reset=1 + civicrm/admin/contribute/managePremiums/edit?action=delete&id=[id]&reset=1 + civicrm/admin/contribute/managePremiums/ + id Product ID -- 2.25.1