From 19344b0a1b4a79af4f1b3f29a0a1b353eb9cd0f1 Mon Sep 17 00:00:00 2001 From: David Kuhn Date: Tue, 25 Oct 2016 12:55:19 -0700 Subject: [PATCH] Bug 17309 - Renewing and HomeOrHoldingBranch syspref The AddRenewal subroutine currently uses the circulation rules for the branch stored in the Issues table (which is the holding branch) when calculating the new due date. This patch replaces using the branch from the Issues table with the branch specified by the HomeOrHoldingBranch syspref. To test: 1. Set up 2 branches, Branch1 and Branch2 2. Set up a loan rule in Branch1 for DVDs with a 21 day loan period and a 21 day renewal period. 3. Set up a loan rule in Branch2 for DVDs with a 14 day loan period and a 14 day renewal period. 4. Checkout a DVD belonging to Branch1 while logged into Branch2. It will receive the correct 21 day loan period. 5. Renewing the same DVD while logged into either Branch1 or Branch2 will give a 14 day due date, rather than 21 days. 6. Checkout a DVD belonging to Branch2 while logged into Branch1. It will receive the correct 14 day loan period. 7. Renewing the same DVD while logged into either Branch1 or Branch2 will give a 21 day due date, rather than 14 days. 8. Apply the patch and repeat steps 4-7. The correct due date should be given when the item is renewed, regardless of where it is checked out or renewed. --- C4/Circulation.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index cfe3442..b0d50e0 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2954,7 +2954,8 @@ sub AddRenewal { $datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ? dt_from_string( $issuedata->{date_due} ) : DateTime->now( time_zone => C4::Context->tz()); - $datedue = CalcDateDue($datedue, $itemtype, $issuedata->{'branchcode'}, $borrower, 'is a renewal'); + my $branchcode = _GetCircControlBranch($item, $borrower); + $datedue = CalcDateDue($datedue, $itemtype, $branchcode, $borrower, 'is a renewal'); } # Update the issues record to have the new due date, and a new count -- 2.1.4