Bugzilla – Attachment 11636 Details for
Bug 8640
GetHardDueDate functions incorrectly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 8640 - GetHardDueDate functions incorrectly
0001-SIGNED-OFF-Bug-8640-GetHardDueDate-functions-incorre.patch (text/plain), 3.87 KB, created by
Julian Maurice
on 2012-08-16 10:15:00 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 8640 - GetHardDueDate functions incorrectly
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2012-08-16 10:15:00 UTC
Size:
3.87 KB
patch
obsolete
>From 29eed687cde2d6dd3a849a1bdc7d94c4403544a9 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] [SIGNED-OFF] 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. > >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> >--- > C4/Circulation.pm | 53 ++++++++--------------------------------------------- > 1 file changed, 8 insertions(+), 45 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 78915ed..c7eaf1a 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1212,53 +1212,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.10.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 8640
:
11617
| 11636