AddEventHandlers in cataloging.js uses .data('events') which is now deprecated. This means that a duplicated field with the upload.pl plugin doesn't function as expected as the event handler doesn't pass to the duplicated field. To reproduce: 1) In Administration > MARC frameworks, choose a framework and through the actions button click on MARC structure 2) Search for field 856 3) Click on edit subfields 4) Select subfield "u" using the tabs at the top 5) At the bottom, in the dropdown menu called "Plugin", select "upload.pl" (bottom of the list) and save 6) Navigate to Cataloging and create a new record using the framework you have just edited 7) Click on tab 8 and check you have field 856. Click on the Upload button and the pop up should open as expected allowing you to upload a file 8) Click on the "Repeat this tag" button for the 856 tag 9) Click on the Upload button and nothing will happen 10) Delete the cloned tag 11) On the original tag, click the "Repeat this subfield" button next to the "Upload" button. 12) Click the "Upload" button on the new subfield and the same issue will occur.
Looks like this is addressed under bug 30975.
*** This bug has been marked as a duplicate of bug 30975 ***
Created attachment 151270 [details] [review] Bug 33744: Fix deprecated use of .data('events') This patch removes a deprecated internal data structure no longer supported in jQuery. This means that AddEventHandlers now correctly passes events to cloned fields in the MARC record Test plan: 1) Apply patch 2) Repeat steps in the original bug description 3) This time clicking on the Upload button for a cloned field should launch the uploads pop up.
> This patch removes a deprecated internal data structure no longer supported in jQuery. // Note: This code depends on the jQuery data for events; this structure // is moved to _data as of jQuery 1.8. - var ev= $(oldcontrol).data('events'); + var ev = $._data(oldcontrol, "events"); You are using an internal structure here. Where we really dont know how long it will be supported.
Perhaps we can use it as a temporary workaround until 30975 gets in ?
30975 is still blocked so maybe Marcel is right and we should use this patch as a temporary fix - I'll rebase and re-submit
Created attachment 153538 [details] [review] Bug 33744: Fix deprecated use of .data('events') This patch removes a deprecated internal data structure no longer supported in jQuery. This means that AddEventHandlers now correctly passes events to cloned fields in the MARC record Test plan: 1) Apply patch 2) Repeat steps in the original bug description 3) This time clicking on the Upload button for a cloned field should launch the uploads pop up.
Created attachment 154796 [details] [review] Bug 33744: Fix deprecated use of .data('events') This patch removes a deprecated internal data structure no longer supported in jQuery. This means that AddEventHandlers now correctly passes events to cloned fields in the MARC record Test plan: 1) Apply patch 2) Repeat steps in the original bug description 3) This time clicking on the Upload button for a cloned field should launch the uploads pop up. Signed-off-by: David Nind <david@davidnind.com>
I've added some comments to bug 30975 (comment 45) on whether to go ahead with 30975 as is, or go ahead with this one as a temporary measure. From the user perspective, maybe getting cloning of subfields with plugins/value builders should be the priority?
Looking here
Created attachment 155081 [details] [review] Bug 33744: Fix cloning (sub)fields with framework plugins This patch is meant as a temporary measure for fixing the problem. Bug 30975 may resolve it further, but this is good for now. Note: The original commit message referred to removing a deprecated internal structure. But this patch actually still uses the structure which has been moved to _data in jQuery now. Test plan: 1) Apply patch 2) Repeat steps in the original bug description 3) This time clicking on the Upload button for a cloned field should launch the uploads pop up. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(In reply to David Nind from comment #8) > This patch removes a deprecated internal data structure no longer supported > in jQuery. This means that AddEventHandlers now correctly passes events to > cloned fields in the MARC record Took the liberty to further clarify this statement in the commit message.
Pushed to master for 23.11. Nice work everyone, thanks!
Pushed to 23.05.x for 23.05.04
Nice work everyone! Pushed to oldstable for 22.11.x