Follow up to https://github.com/civicrm/civicrm-core/pull/26929
authorAidan Saunders <aidan.saunders@squiffle.uk>
Mon, 31 Jul 2023 19:09:27 +0000 (20:09 +0100)
committerAidan Saunders <aidan.saunders@squiffle.uk>
Mon, 31 Jul 2023 22:28:10 +0000 (23:28 +0100)
- 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
CRM/Price/DAO/PriceFieldValue.php
CRM/Upgrade/Incremental/php/FiveSixtyFive.php
templates/CRM/Price/Page/Field.tpl
templates/CRM/Price/Page/Option.tpl
xml/schema/Price/PriceField.xml
xml/schema/Price/PriceFieldValue.xml

index 9ee80bc7a58f0989b533840de25cc0a4f6db0966..0f58679a615fc558e40dddc8e9cba54b750d4de5 100644 (file)
@@ -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' => [
index d27e69ccbd64d282ed0c96915758b49901837acd..3ef0ebb4f1f7dfdebff0a0fd1d7fe8c784a3bfef 100644 (file)
@@ -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',
index 2753652918d11806e6cdd5b59ba574ed89a1f4a3..f764922a18eb5b7f9fb5f151c8cc22333c134cc3 100644 (file)
@@ -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;
+  }
+
 }
index e4284ca2b0a14434cf4bac9fc0bd543a03a63c58..e7d1211fb56360b6367fa500e1ddcdd902df29b8 100644 (file)
@@ -74,9 +74,9 @@
   </div>
   <div class="action-link">
     {if !$isReserved}
-      {crmButton p="civicrm/admin/price/edit" q="reset=1&action=add&sid=$sid" id="newPriceField"  icon="plus-circle"}{ts}Add Price Field{/ts}{/crmButton}
+      {crmButton p="civicrm/admin/price/field/edit" q="reset=1&action=add&sid=$sid" id="newPriceField"  icon="plus-circle"}{ts}Add Price Field{/ts}{/crmButton}
     {/if}
-    {crmButton p="civicrm/admin/price/edit" q="action=preview&sid=`$sid`&reset=1&context=field" icon="television"}{ts}Preview (all fields){/ts}{/crmButton}
+    {crmButton p="civicrm/admin/price/field/edit" q="action=preview&sid=`$sid`&reset=1&context=field" icon="television"}{ts}Preview (all fields){/ts}{/crmButton}
   </div>
 </div>
 {else}
index 6737dcea952436e94b9b748c3774d0f59b090fa7..7fe01d00c224fbd54f463edb4c58b92738fb803e 100644 (file)
@@ -97,8 +97,8 @@
   {/if}
   {if $addMoreFields && !$isReserved}
     <div class="action-link">
-      {crmButton p="civicrm/admin/price/field/edit" q="reset=1&action=add&fid=$fid&sid=$sid" icon="plus-circle"}{ts 1=$fieldTitle}New Option for '%1'{/ts}{/crmButton}
-      {crmButton p="civicrm/admin/price/field/edit" q="reset=1&sid=$sid" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
+      {crmButton p="civicrm/admin/price/field/option/edit" q="reset=1&action=add&fid=$fid&sid=$sid" icon="plus-circle"}{ts 1=$fieldTitle}New Option for '%1'{/ts}{/crmButton}
+      {crmButton p="civicrm/admin/price/field/option/edit" q="reset=1&sid=$sid" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
     </div>
   {/if}
 {/if}
index b337b77288ca32b315ad26dd01ba836870ff804f..255e955ef50daa053ef134c0f861f44d38df6399 100644 (file)
@@ -42,7 +42,7 @@
       <labelColumn>title</labelColumn>
     </pseudoconstant>
     <html>
-      <type>Select</type>
+      <type>EntityRef</type>
       <label>Price Set</label>
     </html>
     <add>1.8</add>
index c566cb2c4096612df3982e8219371bf21d4ccb91..d21785b1133cd5cf69ddb4024683f3d950641340 100644 (file)
@@ -35,6 +35,7 @@
     <required>true</required>
     <comment>FK to civicrm_price_field</comment>
     <html>
+      <type>EntityRef</type>
       <label>Price Field</label>
     </html>
     <add>3.3</add>
     <default>NULL</default>
     <comment>FK to Membership Type</comment>
     <html>
-      <type>Select</type>
+      <type>EntityRef</type>
       <label>Membership Type</label>
     </html>
     <add>3.4</add>