Bugzilla – Attachment 158782 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: Apply change to all events
Bug-35012-Apply-change-to-all-events.patch (text/plain), 2.29 KB, created by
Jan Kissig
on 2023-11-10 08:12:23 UTC
(
hide
)
Description:
Bug 35012: Apply change to all events
Filename:
MIME Type:
Creator:
Jan Kissig
Created:
2023-11-10 08:12:23 UTC
Size:
2.29 KB
patch
obsolete
>From f311cb9682e0eeba72643fae91f59b8fc466b856 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 9 Nov 2023 13:16:05 +0000 >Subject: [PATCH] Bug 35012: Apply change to all events > >We should not just look at Click. > >Test plan: >[1] Apply the example patch for a Blur action in barcode.pl. >[2] Check that barcode.pl is active in your framework and that > autoBarcode is not disabled. >[3] Open the browser dev console. >[4] Tab a few times through barcode in the neworderempty form of > Acquisition. If you leave the field, the Blur event fires. > => Without this patch you will see two console lines (FF may > show a little '2' icon at the right side) added. With this > patch just one. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Jan Kissig <jkissig@th-wildau.de> >--- > Koha/FrameworkPlugin.pm | 18 +++++------------- > 1 file changed, 5 insertions(+), 13 deletions(-) > >diff --git a/Koha/FrameworkPlugin.pm b/Koha/FrameworkPlugin.pm >index 37666c52d8..481bb5b271 100644 >--- a/Koha/FrameworkPlugin.pm >+++ b/Koha/FrameworkPlugin.pm >@@ -329,21 +329,13 @@ sub _add_binding { > #click event applies to buttonDot > > if( $pars =~ /^(e|ev|event)$/i ) { # new style event handler assumed >- >- 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=''; >+ $bind = qq| \$("#$ctl").off('$ev').on('$ev', \{id: '$id'\}, $fname);\n|; # remove old handler if any >+ $script = q{}; > } elsif( $fname eq 'noclick' ) { # no click: return false, no scroll >- $bind= qq| \$("#$ctl").$ev(function () { return false; });\n|; >- $script=''; >+ $bind = qq| \$("#$ctl").$ev(function () { return false; });\n|; >+ $script = q{}; > } else { # add real event handler calling the function found >- $bind=qq| \$("#$ctl").$ev(\{id: '$id'\}, ${fname}_handler);\n|; >+ $bind = qq| \$("#$ctl").off('$ev').on('$ev', \{id: '$id'\}, ${fname}_handler);\n|; > $script = $self->_add_handler( $ev, $fname ); > } > return ( $bind, $script ); >-- >2.34.1
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