Bugzilla – Attachment 115171 Details for
Bug 26352
Add plugin hooks to transform patron barcodes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26352: Switch from using call() to call_recursive()
Bug-26352-Switch-from-using-call-to-callrecursive.patch (text/plain), 8.11 KB, created by
Kyle M Hall (khall)
on 2021-01-14 15:58:48 UTC
(
hide
)
Description:
Bug 26352: Switch from using call() to call_recursive()
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-01-14 15:58:48 UTC
Size:
8.11 KB
patch
obsolete
>From 0fbaf5e12a7fcb5aba63953dd23f40f04498f227 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 14 Jan 2021 09:47:46 -0500 >Subject: [PATCH] Bug 26352: Switch from using call() to call_recursive() > >--- > C4/SIP/Sip/MsgType.pm | 16 ++++++++-------- > Koha/Patron.pm | 4 ++-- > circ/circulation.pl | 4 ++-- > members/memberentry.pl | 2 +- > opac/sco/sco-main.pl | 2 +- > .../Koha/Plugins/Barcode_transform_hooks.t | 1 + > 6 files changed, 15 insertions(+), 14 deletions(-) > >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index 1842270f5e..f3b52bffae 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -520,7 +520,7 @@ sub handle_checkout { > $fields = $self->{fields}; > > $patron_id = $fields->{ (FID_PATRON_ID) }; >- ($patron_id) = Koha::Plugins->call('patron_barcode_transform', $patron_id ) || $patron_id; >+ ($patron_id) = Koha::Plugins->call_recursive('patron_barcode_transform', $patron_id ); > $item_id = $fields->{ (FID_ITEM_ID) }; > my $fee_ack = $fields->{ (FID_FEE_ACK) }; > >@@ -742,7 +742,7 @@ sub handle_block_patron { > $patron_id = $fields->{ (FID_PATRON_ID) }; > $terminal_pwd = $fields->{ (FID_TERMINAL_PWD) }; > >- ($patron_id) = Koha::Plugins->call('patron_barcode_transform', $patron_id ) || $patron_id; >+ ($patron_id) = Koha::Plugins->call_recursive('patron_barcode_transform', $patron_id ); > > # Terminal passwords are different from account login > # passwords, but I have no idea what to do with them. So, >@@ -968,7 +968,7 @@ sub handle_patron_info { > $start = $fields->{ (FID_START_ITEM) }; > $end = $fields->{ (FID_END_ITEM) }; > >- ($patron_id) = Koha::Plugins->call('patron_barcode_transform', $patron_id ) || $patron_id; >+ ($patron_id) = Koha::Plugins->call_recursive('patron_barcode_transform', $patron_id ); > > $patron = $ils->find_patron($patron_id); > >@@ -1127,7 +1127,7 @@ sub handle_fee_paid { > $fee_id = $fields->{ (FID_FEE_ID) }; > $trans_id = $fields->{ (FID_TRANSACTION_ID) }; > >- ($patron_id) = Koha::Plugins->call('patron_barcode_transform', $patron_id ) || $patron_id; >+ ($patron_id) = Koha::Plugins->call_recursive('patron_barcode_transform', $patron_id ); > > $ils->check_inst_id( $inst_id, "handle_fee_paid" ); > >@@ -1325,7 +1325,7 @@ sub handle_patron_enable { > $patron_id = $fields->{ (FID_PATRON_ID) }; > $patron_pwd = $fields->{ (FID_PATRON_PWD) }; > >- ($patron_id) = Koha::Plugins->call('patron_barcode_transform', $patron_id ) || $patron_id; >+ ($patron_id) = Koha::Plugins->call_recursive('patron_barcode_transform', $patron_id ); > > siplog( "LOG_DEBUG", "handle_patron_enable: patron_id: '%s', patron_pwd: '%s'", $patron_id, $patron_pwd ); > >@@ -1390,7 +1390,7 @@ sub handle_hold { > $title_id = $fields->{ (FID_TITLE_ID) } || ''; > $fee_ack = $fields->{ (FID_FEE_ACK) } || 'N'; > >- ($patron_id) = Koha::Plugins->call('patron_barcode_transform', $patron_id ) || $patron_id; >+ ($patron_id) = Koha::Plugins->call_recursive('patron_barcode_transform', $patron_id ); > > if ( $hold_mode eq '+' ) { > $status = $ils->add_hold( $patron_id, $patron_pwd, $item_id, $title_id, $expiry_date, $pickup_locn, $hold_type, $fee_ack ); >@@ -1457,7 +1457,7 @@ sub handle_renew { > $item_props = $fields->{ (FID_ITEM_PROPS) }; > $fee_ack = $fields->{ (FID_FEE_ACK) }; > >- ($patron_id) = Koha::Plugins->call('patron_barcode_transform', $patron_id ) || $patron_id; >+ ($patron_id) = Koha::Plugins->call_recursive('patron_barcode_transform', $patron_id ); > > $status = $ils->renew( $patron_id, $patron_pwd, $item_id, $title_id, $no_block, $nb_due_date, $third_party, $item_props, $fee_ack ); > >@@ -1540,7 +1540,7 @@ sub handle_renew_all { > $terminal_pwd = $fields->{ (FID_TERMINAL_PWD) }; > $fee_ack = $fields->{ (FID_FEE_ACK) }; > >- ($patron_id) = Koha::Plugins->call('patron_barcode_transform', $patron_id ) || $patron_id; >+ ($patron_id) = Koha::Plugins->call_recursive('patron_barcode_transform', $patron_id ); > > $status = $ils->renew_all( $patron_id, $patron_pwd, $fee_ack ); > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 97e0de03b8..9f701f4b04 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -112,7 +112,7 @@ Autogenerate next cardnumber from highest value found in database > sub fixup_cardnumber { > my ( $self ) = @_; > >- my ( $max ) = Koha::Plugins->call( 'patron_barcode_transform', $self->cardnumber ) || undef; >+ my ( $max ) = Koha::Plugins->call_recursive( 'patron_barcode_transform', $self->cardnumber ); > > $max ||= Koha::Patrons->search({ > cardnumber => {-regexp => '^-?[0-9]+$'} >@@ -201,7 +201,7 @@ sub store { > > $self->trim_whitespaces; > >- my ( $new_cardnumber ) = Koha::Plugins->call( 'patron_barcode_transform', $self->cardnumber ) || $self->cardnumber; >+ my ( $new_cardnumber ) = Koha::Plugins->call_recursive( 'patron_barcode_transform', $self->cardnumber ); > $self->cardnumber( $new_cardnumber ); > > # Set surname to uppercase if uppercasesurname is true >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 7e4a8a18d1..34a8cc40d0 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -81,7 +81,7 @@ my $autoswitched; > my $borrowernumber = $query->param('borrowernumber'); > > if (C4::Context->preference("AutoSwitchPatron") && $barcode) { >- my ( $new_barcode ) = Koha::Plugins->call( 'patron_barcode_transform', $findborrower ) || $findborrower; >+ my ( $new_barcode ) = Koha::Plugins->call_recursive( 'patron_barcode_transform', $findborrower ); > if (Koha::Patrons->search( { cardnumber => $new_barcode} )->count() > 0) { > $findborrower = $barcode; > undef $barcode; >@@ -227,7 +227,7 @@ if ( @$barcodes == 0 && $charges eq 'yes' ) { > # > my $message; > if ($findborrower) { >- ( $findborrower ) = Koha::Plugins->call( 'patron_barcode_transform', $findborrower ) || $findborrower; >+ ( $findborrower ) = Koha::Plugins->call_recursive( 'patron_barcode_transform', $findborrower ); > my $patron = Koha::Patrons->find( { cardnumber => $findborrower } ); > if ( $patron ) { > $borrowernumber = $patron->borrowernumber; >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 30d5382050..039f84ffd4 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -334,7 +334,7 @@ if ($op eq 'save' || $op eq 'insert'){ > # If the cardnumber is blank, treat it as null. > $newdata{'cardnumber'} = undef if $newdata{'cardnumber'} =~ /^\s*$/; > >- my ( $new_barcode ) = Koha::Plugins->call( 'patron_barcode_transform', $newdata{'cardnumber'} ) || $newdata{'cardnumber'}; >+ my ( $new_barcode ) = Koha::Plugins->call_recursive( 'patron_barcode_transform', $newdata{'cardnumber'} ); > $newdata{'cardnumber'} = $new_barcode; > > if (my $error_code = checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){ >diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl >index d840592c03..e16770c11d 100755 >--- a/opac/sco/sco-main.pl >+++ b/opac/sco/sco-main.pl >@@ -124,7 +124,7 @@ if (C4::Context->preference('SelfCheckoutByLogin') && !$patronid) { > > my ( $borrower, $patron ); > if ( $patronid ) { >- ( $patronid ) = Koha::Plugins->call( 'patron_barcode_transform', $patronid ) || $patronid; >+ ( $patronid ) = Koha::Plugins->call_recursive( 'patron_barcode_transform', $patronid ); > $patron = Koha::Patrons->find( { cardnumber => $patronid } ); > $borrower = $patron->unblessed if $patron; > } >diff --git a/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t b/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t >index 7f3682b993..889dcf500b 100755 >--- a/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t >+++ b/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t >@@ -48,6 +48,7 @@ subtest '() hook tests' => sub { > > my $plugins = Koha::Plugins->new; > $plugins->InstallPlugins; >+ C4::Context->dbh->do("DELETE FROM plugin_methods WHERE plugin_class LIKE '%TestBarcodes%'"); > > my $plugin = Koha::Plugin::Test->new->enable; > >-- >2.24.1 (Apple Git-126)
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 26352
:
109533
|
109547
|
113579
|
113580
|
113880
|
113885
|
113886
|
113887
|
113888
|
115167
|
115168
|
115169
|
115170
|
115171
|
118691
|
118692
|
118693
|
118694
|
118695
|
122428
|
122429
|
122430
|
122431
|
122432