Bugzilla – Attachment 8314 Details for
Bug 7751
Decrease loan period on items with a high number of holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7751 : Make Reduce Duedate aware of New Date formats
Bug-7751--Make-Reduce-Duedate-aware-of-New-Date-fo.patch (text/plain), 3.46 KB, created by
Chris Cormack
on 2012-03-19 21:05:04 UTC
(
hide
)
Description:
Bug 7751 : Make Reduce Duedate aware of New Date formats
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2012-03-19 21:05:04 UTC
Size:
3.46 KB
patch
obsolete
>From 28f2d03a2a47b4e45903b17009eef0572b3cce2d Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Mon, 20 Jun 2011 17:02:49 +0100 >Subject: [PATCH] Bug 7751 : Make Reduce Duedate aware of New Date formats > >--- > C4/Circulation.pm | 34 ++++++++++++++-------------------- > 1 files changed, 14 insertions(+), 20 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 8bfbfc0..6ee6331 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -913,7 +913,7 @@ sub CanBookBeIssued { > } > } > } >- >+ > ## check for high holds decreasing loan period > if (C4::Context->preference("decreaseLoanHighHolds") == 1) > { >@@ -924,7 +924,7 @@ sub CanBookBeIssued { > $needsconfirmation{HIGHHOLDS} = 1; > $needsconfirmation{'num_holds'} = $num; > $needsconfirmation{'duration'} = $duration; >- $needsconfirmation{'returndate'} = format_date($returndate); >+ $needsconfirmation{'returndate'} = output_pref($returndate); > } > } > >@@ -944,38 +944,32 @@ sub checkHighHolds { > my $biblio = GetBiblioFromItemNumber($item->{itemnumber}); > my $branch = _GetCircControlBranch($item,$borrower); > my $dbh = C4::Context->dbh; >- my $sth; >- $sth = $dbh->prepare("select count(borrowernumber) as num_holds from reserves where biblionumber=?"); >+ my $sth = $dbh->prepare('select count(borrowernumber) as num_holds from reserves where biblionumber=?'); > $sth->execute($item->{'biblionumber'}); >- my $holds = $sth->fetchrow_array; >- if ($holds>0) >+ my ($holds) = $sth->fetchrow_array; >+ if ($holds) > { >- my $issuedate = strftime( "%Y-%m-%d", localtime ); >- my $startdate=C4::Dates->new( $issuedate, 'iso' ); >- my $calendar = C4::Calendar->new( branchcode => $branch ); >+ my $issuedate = DateTime->new( time_zone => C4::Context->tz()); >+ # my $startdate=C4::Dates->new( $issuedate, 'iso' ); >+ my $calendar = Koha::Calendar->new( branchcode => $branch ); > > my $itype = ( C4::Context->preference('item-level_itypes') ) ? $biblio->{'itype'} : $biblio->{'itemtype'}; >- my $due = C4::Circulation::CalcDateDue( C4::Dates->new( $issuedate, 'iso' ), $itype, $branch, $borrower ); >- my $normaldue = sprintf("%04d-%02d-%02d",($due->{'dmy_arrayref'}[5]+1900),($due->{'dmy_arrayref'}[4]+1), >- $due->{'dmy_arrayref'}[3]); >+ my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branch, $borrower ); > >- my $datedue = $calendar->addDate($startdate, C4::Context->preference("decreaseLoanHighHoldsDuration")); >- my $returndate = sprintf("%04d-%02d-%02d",($datedue->{'dmy_arrayref'}[5]+1900),($datedue->{'dmy_arrayref'}[4]+1), >- $datedue->{'dmy_arrayref'}[3]); >+ my $reduced_datedue = $calendar->addDate($issuedate, C4::Context->preference("decreaseLoanHighHoldsDuration")); > >- my $daysBetween = $calendar->daysBetween($datedue, $due); >- if ($daysBetween>0) >+ if (DateTime->compare($reduced_datedue,$orig_due) == -1 ) > { >- return (1,$holds,C4::Context->preference("decreaseLoanHighHoldsDuration"),$returndate); >+ return (1,$holds,C4::Context->preference("decreaseLoanHighHoldsDuration"),$reduced_datedue); > } > else > { >- return (0,0,0,0); >+ return (0,0,0,undef); > } > } > else > { >- return (0,0,0,0); >+ return (0,0,0,undef); > } > } > >-- >1.7.5.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 7751
:
8313
|
8314
|
8315
|
9801
|
9803
|
9804
|
9810
|
9811
|
9812
|
9834
|
10040
|
10199
|
10204
|
11477
|
11672
|
11676
|
12337
|
12345
|
12528
|
12643
|
12786
|
12787
|
12802
|
12803