From f8a2c7c09a995323a1fa4993a99ecfefb7223ada Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 28 Feb 2020 15:52:06 +0000 Subject: [PATCH] Bug 23165: Set branch for renewal Originally I used 'opac' as the interface so that we would follow opac rules for setting the branches for renewals. If using api we must explicitly state the branch - falling back to the checkout branch is the simplest fix as we don't have a user here. This also corrects typo if setting surname/firstname to CRON instead of ILSDI https://bugs.koha-community.org/show_bug.cgi?id=24754 --- C4/ILSDI/Services.pm | 2 +- opac/ilsdi.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 1ed424e18a..1d9d10f7e5 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -644,7 +644,7 @@ sub RenewLoan { # Add renewal if possible my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber ); - if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); } + if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber, $item->checkout->branchcode ); } my $issue = $item->checkout; return unless $issue; # FIXME should be handled diff --git a/opac/ilsdi.pl b/opac/ilsdi.pl index e138cc0a9a..b4061ba396 100755 --- a/opac/ilsdi.pl +++ b/opac/ilsdi.pl @@ -130,7 +130,7 @@ unless ( $cgi->param('service') ) { # Set the userenv C4::Context->_new_userenv(1); C4::Context->set_userenv( - undef, undef, undef, 'CRON', 'CRON', undef, + undef, undef, undef, 'ILSDI', 'ILSDI', undef, undef, undef, undef, undef, undef ); C4::Context->interface('api'); -- 2.11.0