From 40fed8e61e928fbb409443ee945b5758e4de82a5 Mon Sep 17 00:00:00 2001 From: Aidan Saunders Date: Mon, 31 Jul 2023 20:09:27 +0100 Subject: [PATCH] Follow up to https://github.com/civicrm/civicrm-core/pull/26929 - fix unreleased regression relating to adding new price set fields and values - add Upgrader Switch html type from Select to EntityRef for Price Fields and Values --- CRM/Price/DAO/PriceField.php | 4 ++-- CRM/Price/DAO/PriceFieldValue.php | 5 +++-- CRM/Upgrade/Incremental/php/FiveSixtyFive.php | 12 ++++++++++++ templates/CRM/Price/Page/Field.tpl | 4 ++-- templates/CRM/Price/Page/Option.tpl | 4 ++-- xml/schema/Price/PriceField.xml | 2 +- xml/schema/Price/PriceFieldValue.xml | 3 ++- 7 files changed, 24 insertions(+), 10 deletions(-) diff --git a/CRM/Price/DAO/PriceField.php b/CRM/Price/DAO/PriceField.php index 9ee80bc7a5..0f58679a61 100644 --- a/CRM/Price/DAO/PriceField.php +++ b/CRM/Price/DAO/PriceField.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Price/PriceField.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:eedc14b6c87ac773e343c29a35e302ee) + * (GenCodeChecksum:f41e66e916d22789b0a328cab214e1ed) */ /** @@ -285,7 +285,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { 'localizable' => 0, 'FKClassName' => 'CRM_Price_DAO_PriceSet', 'html' => [ - 'type' => 'Select', + 'type' => 'EntityRef', 'label' => ts("Price Set"), ], 'pseudoconstant' => [ diff --git a/CRM/Price/DAO/PriceFieldValue.php b/CRM/Price/DAO/PriceFieldValue.php index d27e69ccbd..3ef0ebb4f1 100644 --- a/CRM/Price/DAO/PriceFieldValue.php +++ b/CRM/Price/DAO/PriceFieldValue.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Price/PriceFieldValue.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:e5a4abf9acb4543aec6643717ee2d3d7) + * (GenCodeChecksum:1a91c79d5269c3dd811610148bc4af43) */ /** @@ -298,6 +298,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO { 'localizable' => 0, 'FKClassName' => 'CRM_Price_DAO_PriceField', 'html' => [ + 'type' => 'EntityRef', 'label' => ts("Price Field"), ], 'add' => '3.3', @@ -538,7 +539,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO { 'localizable' => 0, 'FKClassName' => 'CRM_Member_DAO_MembershipType', 'html' => [ - 'type' => 'Select', + 'type' => 'EntityRef', 'label' => ts("Membership Type"), ], 'add' => '3.4', diff --git a/CRM/Upgrade/Incremental/php/FiveSixtyFive.php b/CRM/Upgrade/Incremental/php/FiveSixtyFive.php index 2753652918..f764922a18 100644 --- a/CRM/Upgrade/Incremental/php/FiveSixtyFive.php +++ b/CRM/Upgrade/Incremental/php/FiveSixtyFive.php @@ -41,6 +41,7 @@ class CRM_Upgrade_Incremental_php_FiveSixtyFive extends CRM_Upgrade_Incremental_ $this->addTask('Update ActionSchedule.limit_to column', 'alterColumn', 'civicrm_action_schedule', 'limit_to', "int COMMENT 'Is this the recipient criteria limited to OR in addition to?'"); $this->addTask('Remove Batch Create/Edit Activity Types', 'removeFinancialBatchActivityTypes'); + $this->addTask('Update New Price Set path', 'updateNewPriceSetPath'); } /** @@ -76,4 +77,15 @@ class CRM_Upgrade_Incremental_php_FiveSixtyFive extends CRM_Upgrade_Incremental_ return TRUE; } + /** + * Update menu paths for 'New Price Set' - https://github.com/civicrm/civicrm-core/pull/26929 + */ + public static function updateNewPriceSetPath($ctx): bool { + \Civi\Api4\Navigation::update(FALSE) + ->addWhere('name', '=', 'New Price Set') + ->addValue('url', 'civicrm/admin/price/edit?reset=1&action=add') + ->execute(); + return TRUE; + } + } diff --git a/templates/CRM/Price/Page/Field.tpl b/templates/CRM/Price/Page/Field.tpl index e4284ca2b0..e7d1211fb5 100644 --- a/templates/CRM/Price/Page/Field.tpl +++ b/templates/CRM/Price/Page/Field.tpl @@ -74,9 +74,9 @@ {else} diff --git a/templates/CRM/Price/Page/Option.tpl b/templates/CRM/Price/Page/Option.tpl index 6737dcea95..7fe01d00c2 100644 --- a/templates/CRM/Price/Page/Option.tpl +++ b/templates/CRM/Price/Page/Option.tpl @@ -97,8 +97,8 @@ {/if} {if $addMoreFields && !$isReserved} {/if} {/if} diff --git a/xml/schema/Price/PriceField.xml b/xml/schema/Price/PriceField.xml index b337b77288..255e955ef5 100644 --- a/xml/schema/Price/PriceField.xml +++ b/xml/schema/Price/PriceField.xml @@ -42,7 +42,7 @@ title - Select + EntityRef 1.8 diff --git a/xml/schema/Price/PriceFieldValue.xml b/xml/schema/Price/PriceFieldValue.xml index c566cb2c40..d21785b113 100644 --- a/xml/schema/Price/PriceFieldValue.xml +++ b/xml/schema/Price/PriceFieldValue.xml @@ -35,6 +35,7 @@ true FK to civicrm_price_field + EntityRef 3.3 @@ -165,7 +166,7 @@ NULL FK to Membership Type - Select + EntityRef 3.4 -- 2.25.1