snippet-library icon indicating copy to clipboard operation
snippet-library copied to clipboard

`gpnf-override-parent-merge-tag-on-submission.php`: Fixed an issue with parent merge tags not updating Time value on entry edit.

Open saifsultanc opened this issue 1 year ago • 1 comments
trafficstars

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2725972610/72284

Summary

The snippet gpnf-override-parent-merge-tag-on-submission works for all default values besides the "Hour", "Minute" and "AM/PM" default values from the Time field.

Steps to Reproduce the issue:

  1. Create a parent and child form
  2. add a Time field to both forms. On the child form, set the "Hour", "Minute" and "AM/PM" default values to the {Parent:X} merge tag.
  3. install and configure snippet gpnf-override-parent-merge-tag-on-submission
  4. Go to parent form, enter a random time, add a new child entry, and then submit the parent form.
  5. Go to edit parent entry and change the values of the time field, then update.
  6. Now go to child entry and notice that time has not been overwritten by the new time.

The issue was because the time field stores the value as a string on entry, so "11:12 PM". So if the time field has its field ID 7, we will have $entry[7] containing that time string "11:12 PM". So we must fetch the string part via 7 and not 7.1, 7.2 etc. This is what this proposed update focuses on.

After Update: https://www.loom.com/share/be2f4d27721c4af691f0776bf57baa60

saifsultanc avatar Oct 11 '24 20:10 saifsultanc