Bugzilla – Attachment 49165 Details for
Bug 9805
Lost items are un-lost if returned, but not if renewed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9805 [QA Followup] - Stop calling GetMember repeatedly
Bug-9805-QA-Followup---Stop-calling-GetMember-repe.patch (text/plain), 4.86 KB, created by
Kyle M Hall (khall)
on 2016-03-15 11:01:22 UTC
(
hide
)
Description:
Bug 9805 [QA Followup] - Stop calling GetMember repeatedly
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-03-15 11:01:22 UTC
Size:
4.86 KB
patch
obsolete
>From aa4d3263874054d7263fb53ef6e2b4a9aacff37c Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 15 Mar 2016 11:00:42 +0000 >Subject: [PATCH] Bug 9805 [QA Followup] - Stop calling GetMember repeatedly > >--- > C4/Circulation.pm | 77 +++++++++++++++++++++++++++++++------------------------ > 1 file changed, 43 insertions(+), 34 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 5506af4..f708161 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2986,18 +2986,24 @@ sub AddRenewal { > return; > } > >+ my $borrower = C4::Members::GetMemberDetails( $borrowernumber ); >+ return unless $borrower; >+ > # If the due date wasn't specified, calculate it by adding the > # book's loan length to today's date or the current due date > # based on the value of the RenewalPeriodBase syspref. > unless ($datedue) { >+ my $itemtype = >+ C4::Context->preference('item-level_itypes') >+ ? $biblio->{'itype'} >+ : $biblio->{'itemtype'}; > >- my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber ) or return; >- my $itemtype = (C4::Context->preference('item-level_itypes')) ? $biblio->{'itype'} : $biblio->{'itemtype'}; >+ $datedue = >+ C4::Context->preference('RenewalPeriodBase') eq 'date_due' >+ ? dt_from_string( $issuedata->{date_due} ) >+ : DateTime->now( time_zone => C4::Context->tz() ); > >- $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'); >+ $datedue = CalcDateDue( $datedue, $itemtype, $issuedata->{'branchcode'}, $borrower, 'is a renewal' ); > } > > # Update the issues record to have the new due date, and a new count >@@ -3013,7 +3019,6 @@ sub AddRenewal { > # Update the renewal count on the item, and tell zebra to reindex > $renews = $biblio->{'renewals'} + 1; > >- my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber ); > my $schema = Koha::Database->new()->schema(); > my $rule = $schema->resultset('DefaultBranchCircRule')->single( { branchcode => _GetCircControlBranch( $item, $borrower ) } ); > $rule ||= $schema->resultset('DefaultCircRule')->single(); >@@ -3059,27 +3064,27 @@ sub AddRenewal { > } > > # Send a renewal slip according to checkout alert preferencei >- if ( C4::Context->preference('RenewalSendNotice') eq '1') { >- my $borrower = C4::Members::GetMemberDetails( $borrowernumber, 0 ); >- my $circulation_alert = 'C4::ItemCirculationAlertPreference'; >- my %conditions = ( >- branchcode => $branch, >- categorycode => $borrower->{categorycode}, >- item_type => $item->{itype}, >- notification => 'CHECKOUT', >- ); >- if ($circulation_alert->is_enabled_for(\%conditions)) { >- SendCirculationAlert({ >- type => 'RENEWAL', >- item => $item, >- borrower => $borrower, >- branch => $branch, >- }); >- } >+ if ( C4::Context->preference('RenewalSendNotice') eq '1' ) { >+ my $circulation_alert = 'C4::ItemCirculationAlertPreference'; >+ my %conditions = ( >+ branchcode => $branch, >+ categorycode => $borrower->{categorycode}, >+ item_type => $item->{itype}, >+ notification => 'CHECKOUT', >+ ); >+ if ( $circulation_alert->is_enabled_for( \%conditions ) ) { >+ SendCirculationAlert( >+ { >+ type => 'RENEWAL', >+ item => $item, >+ borrower => $borrower, >+ branch => $branch, >+ } >+ ); >+ } > } > > # Remove any OVERDUES related debarment if the borrower has no overdues >- my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber ); > if ( $borrowernumber > && $borrower->{'debarred'} > && !C4::Members::HasOverdues( $borrowernumber ) >@@ -3089,15 +3094,19 @@ sub AddRenewal { > } > > # Log the renewal >- UpdateStats({branch => $branch, >- type => 'renew', >- amount => $charge, >- itemnumber => $itemnumber, >- itemtype => $item->{itype}, >- borrowernumber => $borrowernumber, >- ccode => $item->{'ccode'}} >- ); >- return $datedue; >+ UpdateStats( >+ { >+ branch => $branch, >+ type => 'renew', >+ amount => $charge, >+ itemnumber => $itemnumber, >+ itemtype => $item->{itype}, >+ borrowernumber => $borrowernumber, >+ ccode => $item->{'ccode'} >+ } >+ ); >+ >+ return $datedue; > } > > sub GetRenewCount { >-- >2.1.4
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 9805
:
16089
|
16090
|
16302
|
29214
|
37008
|
38430
|
38432
|
38433
|
45411
|
45412
|
45413
|
46539
|
46540
|
46541
|
47616
|
47617
|
47618
|
47619
|
48779
|
48780
|
48781
|
49091
|
49092
|
49093
|
49165
|
162473