From 1974cb37c4394cb067583f6c7bac0079c8e3d5e8 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 28 Feb 2020 15:52:06 +0000 Subject: [PATCH] Bug 24754: 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 --- 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.20.1