Lower-case field name uf_group.post_URL
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 6 Jun 2023 23:58:39 +0000 (11:58 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 8 Jun 2023 22:42:33 +0000 (10:42 +1200)
Apiv4 can't handle it as is...

13 files changed:
CRM/Core/DAO/UFGroup.php
CRM/Profile/Form/Edit.php
CRM/UF/Form/AdvanceSetting.php
CRM/UF/Form/Group.php
CRM/Upgrade/Incremental/sql/5.64.alpha1.mysql.tpl
api/v3/UFGroup.php
api/v3/examples/UFGroup/Create.ex.php
api/v3/examples/UFGroup/Get.ex.php
js/model/crm.uf.js
templates/CRM/UF/Form/AdvanceSetting.tpl
templates/CRM/UF/Form/Group.hlp
tests/phpunit/api/v3/UFGroupTest.php
xml/schema/Core/UFGroup.xml

index ae54985a33482864335db7476c6ac33a94a4ceb5..833e5091b5804559b45d68c968d393dae9782579 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/UFGroup.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:c8d65a421dc23cef070b148a190b37b0)
+ * (GenCodeChecksum:e1091f92ebe03a9ff5c6c73c015e8d72)
  */
 
 /**
@@ -131,13 +131,13 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
   public $limit_listings_group_id;
 
   /**
-   * Redirect to URL.
+   * Redirect to URL on submit.
    *
    * @var string|null
    *   (SQL type: varchar(255))
    *   Note that values will be retrieved from the database as a string.
    */
-  public $post_URL;
+  public $post_url;
 
   /**
    * foreign key to civicrm_group_id
@@ -194,13 +194,13 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
   public $is_update_dupe;
 
   /**
-   * Redirect to URL when Cancle button clik .
+   * Redirect to URL when Cancel button clicked .
    *
    * @var string|null
    *   (SQL type: varchar(255))
    *   Note that values will be retrieved from the database as a string.
    */
-  public $cancel_URL;
+  public $cancel_url;
 
   /**
    * Should we create a cms user for this profile
@@ -542,11 +542,11 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
           ],
           'add' => '1.4',
         ],
-        'post_URL' => [
-          'name' => 'post_URL',
+        'post_url' => [
+          'name' => 'post_url',
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Post Url'),
-          'description' => ts('Redirect to URL.'),
+          'description' => ts('Redirect to URL on submit.'),
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
           'usage' => [
@@ -555,7 +555,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
             'duplicate_matching' => FALSE,
             'token' => FALSE,
           ],
-          'where' => 'civicrm_uf_group.post_URL',
+          'where' => 'civicrm_uf_group.post_url',
           'table_name' => 'civicrm_uf_group',
           'entity' => 'UFGroup',
           'bao' => 'CRM_Core_BAO_UFGroup',
@@ -687,11 +687,11 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
           'localizable' => 0,
           'add' => '1.7',
         ],
-        'cancel_URL' => [
-          'name' => 'cancel_URL',
+        'cancel_url' => [
+          'name' => 'cancel_url',
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Profile Cancel URL'),
-          'description' => ts('Redirect to URL when Cancle button clik .'),
+          'description' => ts('Redirect to URL when Cancel button clicked .'),
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
           'usage' => [
@@ -700,11 +700,14 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
             'duplicate_matching' => FALSE,
             'token' => FALSE,
           ],
-          'where' => 'civicrm_uf_group.cancel_URL',
+          'where' => 'civicrm_uf_group.cancel_url',
           'table_name' => 'civicrm_uf_group',
           'entity' => 'UFGroup',
           'bao' => 'CRM_Core_BAO_UFGroup',
           'localizable' => 0,
+          'html' => [
+            'label' => ts("Cancel URL"),
+          ],
           'add' => '1.4',
         ],
         'is_cms_user' => [
index f58da43349d87cd9dd720210d1a9c3ce4cad19c5..88c219860718e2462e93b190f14f3d7adcf1aa67 100644 (file)
@@ -146,8 +146,8 @@ SELECT module,is_reserved
     $this->assign('recentlyViewed', FALSE);
 
     if ($this->_context !== 'dialog') {
-      $this->_postURL = $this->_ufGroup['post_URL'];
-      $this->_cancelURL = $this->_ufGroup['cancel_URL'];
+      $this->_postURL = $this->_ufGroup['post_url'];
+      $this->_cancelURL = $this->_ufGroup['cancel_url'];
 
       $gidString = $this->_gid;
       if (!empty($this->_profileIds)) {
index 56a247a916a34a91adc95f75f9b07787918e3f0c..bacdbf7683ab9c9f00181419a7fa12746ffd0ec8 100644 (file)
@@ -34,10 +34,10 @@ class CRM_UF_Form_AdvanceSetting extends CRM_UF_Form_Group {
     // should we allow updates on a exisitng contact
     $form->addRadio('is_update_dupe', ts('What to do upon duplicate match'), [ts('Issue warning and do not save'), ts('Update the matching contact'), ts('Allow duplicate contact to be created')]);
     // we do not have any url checks to allow relative urls
-    $form->addElement('text', 'post_URL', ts('Redirect URL'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'post_URL'));
+    $form->addElement('text', 'post_url', ts('Redirect URL'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'post_url'));
 
     $form->add('advcheckbox', 'add_cancel_button', ts('Include Cancel Button?'));
-    $form->addElement('text', 'cancel_URL', ts('Cancel Redirect URL'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'cancel_URL'));
+    $form->addElement('text', 'cancel_url', ts('Cancel Redirect URL'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'cancel_url'));
 
     // add select for groups
     $group = ['' => ts('- select -')] + $form->_group;
index 881b1ceedfd42cb2dc906c610b3c4508a64ec2a5..a170fee960e4e7bed265f4d70dd5200abf7abe63 100644 (file)
@@ -252,8 +252,8 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
       $showAdvanced = 0;
       $advFields = [
         'group',
-        'post_URL',
-        'cancel_URL',
+        'post_url',
+        'cancel_url',
         'add_captcha',
         'is_map',
         'is_uf_link',
index eae59044638ee8b9d64b24dbf973d15704243e99..883b1a10f4c3f88bf0c6cdeaf5396d4334d3d2de 100644 (file)
@@ -1 +1,8 @@
 {* file to handle db changes in 5.64.alpha1 during upgrade *}
+
+-- fix mis-casing of field name. Note the php function doesn't permit the name change hence it is here
+-- but field is not localised.
+ALTER TABLE civicrm_uf_group
+CHANGE `post_URL` `post_url` varchar(255) DEFAULT NULL COMMENT 'Redirect to URL on submit.',
+CHANGE `cancel_URL` `cancel_url` varchar(255) DEFAULT NULL COMMENT 'Redirect to URL when Cancel button clicked.'
+;
index 2d25eedea0815fd591631aea0f71b714d08b8bd4..784c007011a53a47ee4392658957b32228f8f703 100644 (file)
@@ -28,6 +28,8 @@ function _civicrm_api3_uf_group_create_spec(&$params) {
   // Default to the logged in user.
   $params['created_id']['api.default'] = 'user_contact_id';
   $params['created_date']['api.default'] = 'now';
+  $params['post_url']['api.aliases'] = ['post_URL'];
+  $params['cancel_url']['api.aliases'] = ['cancel_URL'];
 }
 
 /**
index d4ea27b1810ada50e1119868b8be7d087d6d67d4..baab92ae8c57c8894067fd5af953e0ea59deda46 100644 (file)
@@ -15,7 +15,7 @@ function uf_group_create_example() {
     'add_captcha' => 1,
     'add_contact_to_group' => 1,
     'group' => 1,
-    'cancel_URL' => 'http://example.org/cancel',
+    'cancel_url' => 'http://example.org/cancel',
     'created_date' => '2009-06-27 00:00:00',
     'created_id' => 1,
     'group_type' => 'Individual,Contact',
@@ -30,7 +30,7 @@ function uf_group_create_example() {
     'is_update_dupe' => 1,
     'name' => 'Test_Group',
     'notify' => 'admin@example.org',
-    'post_URL' => 'http://example.org/post',
+    'post_url' => 'http://example.org/post',
     'title' => 'Test Group',
   ];
 
@@ -77,14 +77,14 @@ function uf_group_create_expectedresult() {
         'help_pre' => 'help pre',
         'help_post' => 'help post',
         'limit_listings_group_id' => '1',
-        'post_URL' => 'http://example.org/post',
+        'post_url' => 'http://example.org/post',
         'add_to_group_id' => '1',
         'add_captcha' => '1',
         'is_map' => '1',
         'is_edit_link' => '1',
         'is_uf_link' => '1',
         'is_update_dupe' => '1',
-        'cancel_URL' => 'http://example.org/cancel',
+        'cancel_url' => 'http://example.org/cancel',
         'is_cms_user' => '1',
         'notify' => 'admin@example.org',
         'is_reserved' => '1',
index 25127e0bc9834314c34537e11ffd879a15c4a273..274b7c0c46f4a50064d7527abe441e9c1d50ce54 100644 (file)
@@ -56,7 +56,7 @@ function uf_group_get_expectedresult() {
         'help_pre' => 'help pre',
         'help_post' => 'help post',
         'limit_listings_group_id' => '1',
-        'post_URL' => 'http://example.org/post',
+        'post_url' => 'http://example.org/post',
         'add_to_group_id' => '1',
         'add_captcha' => '1',
         'is_map' => '1',
index 636304bad7e6c5550ecb04efa8edfc5672f9980e..d366b33ac5dbcb4b047acaac614df25fc3e64fb3 100644 (file)
         help: ts('Select a group if you want contacts to be automatically added to that group when the profile is submitted.'),
         type: 'Number'
       },
-      'cancel_URL': {
+      'cancel_url': {
         title: ts('Cancel Redirect URL'),
         help: ts('If you are using this profile as a contact signup or edit form, and want to redirect the user to a static URL if they click the Cancel button - enter the complete URL here. If this field is left blank, the built-in Profile form will be redisplayed.'),
         type: 'Text'
         help: ts('If you want member(s) of your organization to receive a notification email whenever this Profile form is used to enter or update contact information, enter one or more email addresses here. Multiple email addresses should be separated by a comma (e.g. jane@example.org, paula@example.org). The first email address listed will be used as the FROM address in the notifications.'),
         type: 'TextArea'
       },
-      'post_URL': {
+      'post_url': {
         title: ts('Redirect URL'),
         help: ts("If you are using this profile as a contact signup or edit form, and want to redirect the user to a static URL after they've submitted the form, you can also use contact tokens in URL - enter the complete URL here. If this field is left blank, the built-in Profile form will be redisplayed with a generic status message - 'Your contact information has been saved.'"),
         type: 'Text'
index 4ad7d6a6e107599da0e60758335f72e48728af8c..554b3e769175525cd107b56a195bf22c83740ae9 100644 (file)
@@ -29,9 +29,9 @@
             <td>{$form.notify.html} {help id='id-notify_email' file="CRM/UF/Form/Group.hlp"}</td>
         </tr>
 
-        <tr class="crm-uf-advancesetting-form-block-post_URL">
-            <td class="label">{$form.post_URL.label}</td>
-            <td>{$form.post_URL.html} {help id='id-post_URL' file="CRM/UF/Form/Group.hlp"}</td>
+        <tr class="crm-uf-advancesetting-form-block-post_url">
+            <td class="label">{$form.post_url.label}</td>
+            <td>{$form.post_url.html} {help id='id-post_url' file="CRM/UF/Form/Group.hlp"}</td>
         </tr>
 
         <tr class="crm-uf-advancesetting-form-block-add_cancel_button">
@@ -39,9 +39,9 @@
             <td>{$form.add_cancel_button.html} {$form.add_cancel_button.label} {help id='id-add_cancel_button' file="CRM/UF/Form/Group.hlp"}</td>
         </tr>
 
-        <tr class="cancel_button_section crm-uf-advancesetting-form-block-cancel_URL">
-            <td class="label">{$form.cancel_URL.label}</td>
-            <td>{$form.cancel_URL.html} {help id='id-cancel_URL' file="CRM/UF/Form/Group.hlp"}</td>
+        <tr class="cancel_button_section crm-uf-advancesetting-form-block-cancel_url">
+            <td class="label">{$form.cancel_url.label}</td>
+            <td>{$form.cancel_url.html} {help id='id-cancel_url' file="CRM/UF/Form/Group.hlp"}</td>
         </tr>
 
         {foreach from=$advancedFieldsConverted item=fieldName}
index c0d751b222533f56bd5b967ec1ff0066205b9485..caf8ae2bdc2458796476d3c803eb516c69e21cf0 100644 (file)
 {ts}If you want member(s) of your organization to receive a notification email whenever this Profile form is used to enter or update contact information, enter one or more email addresses here. Multiple email addresses should be separated by a comma (e.g. jane@example.org, paula@example.org). The first email address listed will be used as the FROM address in the notifications.{/ts}
 {/htxt}
 
-{htxt id='id-post_URL-title'}
+{htxt id='id-post_url-title'}
   {ts}Redirect{/ts}
 {/htxt}
-{htxt id='id-post_URL'}
+{htxt id='id-post_url'}
 {ts}If you are using this profile as a contact signup or edit form, and want to redirect the user to a static URL after they've submitted the form, you can also use contact tokens in URL - enter the complete URL here. If this field is left blank, the built-in Profile form will be redisplayed with a generic status message - 'Your contact information has been saved.'{/ts}
 {/htxt}
 
 {ts}Enable/Disable this checkbox to add/remove cancel button on the profile form.{/ts}
 {/htxt}
 
-{htxt id='id-cancel_URL-title'}
+{htxt id='id-cancel_url-title'}
   {ts}Cancel Redirect{/ts}
 {/htxt}
-{htxt id='id-cancel_URL'}
+{htxt id='id-cancel_url'}
 {ts}If you are using this profile as a contact signup or edit form, and want to redirect the user to a static URL if they click the Cancel button - enter the complete URL here. If this field is left blank, the built-in Profile form will be redisplayed.{/ts}
 {/htxt}
 
index 4af4170fe9090f5d9c5c8af49029440c668bc170..9d106f05121cf69c5af760b7536ce2f0ba9f090d 100644 (file)
@@ -47,7 +47,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
       'add_captcha' => 1,
       'add_contact_to_group' => $this->_groupId,
       'group' => $this->_groupId,
-      'cancel_URL' => 'http://example.org/cancel',
+      'cancel_url' => 'http://example.org/cancel',
       'created_date' => '2009-06-27 00:00:00',
       'created_id' => $this->_contactId,
       'group_type' => 'Individual,Contact',
@@ -62,7 +62,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
       'is_update_dupe' => 1,
       'name' => 'Test_Group',
       'notify' => 'admin@example.org',
-      'post_URL' => 'http://example.org/post',
+      'post_url' => 'http://example.org/post',
       'title' => 'Test Group',
     ];
   }
@@ -157,7 +157,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
       'id' => $this->_ufGroupId,
       'add_captcha' => 1,
       'add_contact_to_group' => $this->_groupId,
-      'cancel_URL' => 'http://example.org/cancel',
+      'cancel_url' => 'http://example.org/cancel',
       'created_date' => '2009-06-27',
       'created_id' => $this->_contactId,
       'group' => $this->_groupId,
@@ -173,7 +173,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase {
       'is_update_dupe' => 1,
       'name' => 'test_group',
       'notify' => 'admin@example.org',
-      'post_URL' => 'http://example.org/post',
+      'post_url' => 'http://example.org/post',
       'title' => 'Test Group',
     ];
     $result = $this->callAPISuccess('uf_group', 'create', $params);
index 7e1b3599f32d6ca943875c7f6aa95399c12daef8..3f7d1aa8b75257fb922a6a5d4020ffcb3a20ad62 100644 (file)
     <onDelete>SET NULL</onDelete>
   </foreignKey>
   <field>
-    <name>post_URL</name>
+    <name>post_url</name>
     <type>varchar</type>
     <length>255</length>
-    <comment>Redirect to URL.</comment>
+    <comment>Redirect to URL on submit.</comment>
     <html>
       <label>Post URL</label>
     </html>
     <add>1.7</add>
   </field>
   <field>
-    <name>cancel_URL</name>
+    <name>cancel_url</name>
     <title>Profile Cancel URL</title>
     <type>varchar</type>
     <length>255</length>
-    <comment>Redirect to URL when Cancle button clik .</comment>
+    <comment>Redirect to URL when Cancel button clicked.</comment>
+    <html>
+      <label>Cancel URL</label>
+    </html>
     <add>1.4</add>
   </field>
   <field>