Bugzilla – Attachment 11617 Details for
Bug 8640
GetHardDueDate functions incorrectly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8640 - GetHardDueDate functions incorrectly
Bug-8640---GetHardDueDate-functions-incorrectly.patch (text/plain), 3.80 KB, created by
Kyle M Hall (khall)
on 2012-08-14 17:18:03 UTC
(
hide
)
Description:
Bug 8640 - GetHardDueDate functions incorrectly
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-08-14 17:18:03 UTC
Size:
3.80 KB
patch
obsolete
>From f560345ae9af40ee2ba6a1245b29555ad15dc34b Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 14 Aug 2012 13:17:38 -0400 >Subject: [PATCH] Bug 8640 - GetHardDueDate functions incorrectly > >GetHardDueDate works just like GetIssuingRule, but it not only tests for having >found an row of results before returning, but checks for the existence of a >hard due date as well. That means that even if it finds a matching rule, unless >that rule has a hardduedate set it will toss it and keep looking! > >So, for example, even though there is a matching rule for say "STAFF / VIDEO / *", >but it has no hardduedate. So it gets tossed and the subroutine keeps looking. >If the next match, "STAFF / * / *" *has* a hardduedate, it is the one returned. > >This means that if a more specific rule has no hard due date, >it is overridden by a less specific rule that does have a hard due date. >--- > C4/Circulation.pm | 57 +++++++++------------------------------------------- > 1 files changed, 10 insertions(+), 47 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index d41da1f..4eae77c 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1195,53 +1195,16 @@ Get the Hard Due Date and it's comparison for an itemtype, a borrower type and a > > sub GetHardDueDate { > my ( $borrowertype, $itemtype, $branchcode ) = @_; >- my $dbh = C4::Context->dbh; >- my $sth = >- $dbh->prepare( >-"select hardduedate, hardduedatecompare from issuingrules where categorycode=? and itemtype=? and branchcode=?" >- ); >- $sth->execute( $borrowertype, $itemtype, $branchcode ); >- my $results = $sth->fetchrow_hashref; >- return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) >- if defined($results) && $results->{hardduedate}; > >- $sth->execute( $borrowertype, "*", $branchcode ); >- $results = $sth->fetchrow_hashref; >- return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) >- if defined($results) && $results->{hardduedate}; >+ my $rule = GetIssuingRule( $borrowertype, $itemtype, $branchcode ); > >- $sth->execute( "*", $itemtype, $branchcode ); >- $results = $sth->fetchrow_hashref; >- return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) >- if defined($results) && $results->{hardduedate}; >- >- $sth->execute( "*", "*", $branchcode ); >- $results = $sth->fetchrow_hashref; >- return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) >- if defined($results) && $results->{hardduedate}; >- >- $sth->execute( $borrowertype, $itemtype, "*" ); >- $results = $sth->fetchrow_hashref; >- return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) >- if defined($results) && $results->{hardduedate}; >- >- $sth->execute( $borrowertype, "*", "*" ); >- $results = $sth->fetchrow_hashref; >- return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) >- if defined($results) && $results->{hardduedate}; >- >- $sth->execute( "*", $itemtype, "*" ); >- $results = $sth->fetchrow_hashref; >- return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) >- if defined($results) && $results->{hardduedate}; >- >- $sth->execute( "*", "*", "*" ); >- $results = $sth->fetchrow_hashref; >- return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) >- if defined($results) && $results->{hardduedate}; >- >- # if no rule is set => return undefined >- return (undef, undef); >+ if ( defined( $rule ) ) { >+ if ( $rule->{hardduedate} ) { >+ return (dt_from_string($rule->{hardduedate}, 'iso'),$rule->{hardduedatecompare}); >+ } else { >+ return (undef, undef); >+ } >+ } > } > > =head2 GetIssuingRule >-- >1.7.2.5
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 8640
:
11617
|
11636