Bugzilla – Attachment 158718 Details for
Bug 35012
Framework item plugins fire twice on Acquisition item blocks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35012: Prevent Click handler firing twice
Bug-35012-Prevent-Click-handler-firing-twice.patch (text/plain), 1.89 KB, created by
Marcel de Rooy
on 2023-11-09 14:14:34 UTC
(
hide
)
Description:
Bug 35012: Prevent Click handler firing twice
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-11-09 14:14:34 UTC
Size:
1.89 KB
patch
obsolete
>From bee3a5ce05bdaa61d231ada1cc7c9ac2654ade4e Mon Sep 17 00:00:00 2001 >From: Jan Kissig <jkissig@th-wildau.de> >Date: Tue, 10 Oct 2023 13:36:04 +0200 >Subject: [PATCH] Bug 35012: Prevent Click handler firing twice >Content-Type: text/plain; charset=utf-8 > >test plan: >a) build a new basket + order line using "item create on placing an order" >b) in the item creation dialog (neworderempty.pl) please use the webbrowsers dev tools to analyze the [...] button next to subfield d (Date acquired) and inspect the events that get fired by clicking >c) notice the Clicktag_952_subfield_d_* event gets fired twice. >d) apply patch and reload page >e) there should be only 1 click handler left (besides the jquery one), which points to the Clicktag_952_subfield_* function > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >See also bug 35298. You may have seen that the Focus event of dateaccessioned >did not fire. But that is related to use of Flatpickr in this plugin. >--- > Koha/FrameworkPlugin.pm | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > >diff --git a/Koha/FrameworkPlugin.pm b/Koha/FrameworkPlugin.pm >index 2331bfa6b3..37666c52d8 100644 >--- a/Koha/FrameworkPlugin.pm >+++ b/Koha/FrameworkPlugin.pm >@@ -329,7 +329,15 @@ sub _add_binding { > #click event applies to buttonDot > > if( $pars =~ /^(e|ev|event)$/i ) { # new style event handler assumed >- $bind= qq| \$("#$ctl").$ev(\{id: '$id'\}, $fname);\n|; >+ >+ if ($ev eq "click"){ >+ # remove already registered click listeners >+ $bind= qq| \$("#$ctl").off('click');\n|; >+ $bind.= qq| \$("#$ctl").$ev(\{id: '$id'\}, $fname);\n|; >+ } else { >+ $bind= qq| \$("#$ctl").$ev(\{id: '$id'\}, $fname);\n|; >+ } >+ > $script=''; > } elsif( $fname eq 'noclick' ) { # no click: return false, no scroll > $bind= qq| \$("#$ctl").$ev(function () { return false; });\n|; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35012
:
156792
|
156793
|
158718
|
158719
|
158720
|
158782
|
158816
|
158817
|
158818