|
Lines 1212-1264
Get the Hard Due Date and it's comparison for an itemtype, a borrower type and a
Link Here
|
| 1212 |
|
1212 |
|
| 1213 |
sub GetHardDueDate { |
1213 |
sub GetHardDueDate { |
| 1214 |
my ( $borrowertype, $itemtype, $branchcode ) = @_; |
1214 |
my ( $borrowertype, $itemtype, $branchcode ) = @_; |
| 1215 |
my $dbh = C4::Context->dbh; |
|
|
| 1216 |
my $sth = |
| 1217 |
$dbh->prepare( |
| 1218 |
"select hardduedate, hardduedatecompare from issuingrules where categorycode=? and itemtype=? and branchcode=?" |
| 1219 |
); |
| 1220 |
$sth->execute( $borrowertype, $itemtype, $branchcode ); |
| 1221 |
my $results = $sth->fetchrow_hashref; |
| 1222 |
return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) |
| 1223 |
if defined($results) && $results->{hardduedate}; |
| 1224 |
|
1215 |
|
| 1225 |
$sth->execute( $borrowertype, "*", $branchcode ); |
1216 |
my $rule = GetIssuingRule( $borrowertype, $itemtype, $branchcode ); |
| 1226 |
$results = $sth->fetchrow_hashref; |
|
|
| 1227 |
return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) |
| 1228 |
if defined($results) && $results->{hardduedate}; |
| 1229 |
|
1217 |
|
| 1230 |
$sth->execute( "*", $itemtype, $branchcode ); |
1218 |
if ( defined( $rule ) ) { |
| 1231 |
$results = $sth->fetchrow_hashref; |
1219 |
if ( $rule->{hardduedate} ) { |
| 1232 |
return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) |
1220 |
return (dt_from_string($rule->{hardduedate}, 'iso'),$rule->{hardduedatecompare}); |
| 1233 |
if defined($results) && $results->{hardduedate}; |
1221 |
} else { |
| 1234 |
|
1222 |
return (undef, undef); |
| 1235 |
$sth->execute( "*", "*", $branchcode ); |
1223 |
} |
| 1236 |
$results = $sth->fetchrow_hashref; |
1224 |
} |
| 1237 |
return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) |
|
|
| 1238 |
if defined($results) && $results->{hardduedate}; |
| 1239 |
|
| 1240 |
$sth->execute( $borrowertype, $itemtype, "*" ); |
| 1241 |
$results = $sth->fetchrow_hashref; |
| 1242 |
return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) |
| 1243 |
if defined($results) && $results->{hardduedate}; |
| 1244 |
|
| 1245 |
$sth->execute( $borrowertype, "*", "*" ); |
| 1246 |
$results = $sth->fetchrow_hashref; |
| 1247 |
return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) |
| 1248 |
if defined($results) && $results->{hardduedate}; |
| 1249 |
|
| 1250 |
$sth->execute( "*", $itemtype, "*" ); |
| 1251 |
$results = $sth->fetchrow_hashref; |
| 1252 |
return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) |
| 1253 |
if defined($results) && $results->{hardduedate}; |
| 1254 |
|
| 1255 |
$sth->execute( "*", "*", "*" ); |
| 1256 |
$results = $sth->fetchrow_hashref; |
| 1257 |
return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare}) |
| 1258 |
if defined($results) && $results->{hardduedate}; |
| 1259 |
|
| 1260 |
# if no rule is set => return undefined |
| 1261 |
return (undef, undef); |
| 1262 |
} |
1225 |
} |
| 1263 |
|
1226 |
|
| 1264 |
=head2 GetIssuingRule |
1227 |
=head2 GetIssuingRule |
| 1265 |
- |
|
|