Bugzilla – Attachment 158720 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.28 KB, created by
Marcel de Rooy
on 2023-11-09 14:14:39 UTC
(
hide
)
Description:
Bug 35012: Apply change to all events
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-11-09 14:14:39 UTC
Size:
2.28 KB
patch
obsolete
>From cb7141593408964ba7c50af751cd532087d0e52e 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 >Content-Type: text/plain; charset=utf-8 > >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> >--- > 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.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