View | Details | Raw Unified | Return to bug 8640
Collapse All | Expand All

(-)a/C4/Circulation.pm (-46 / +8 lines)
Lines 1195-1247 Get the Hard Due Date and it's comparison for an itemtype, a borrower type and a Link Here
1195
1195
1196
sub GetHardDueDate {
1196
sub GetHardDueDate {
1197
    my ( $borrowertype, $itemtype, $branchcode ) = @_;
1197
    my ( $borrowertype, $itemtype, $branchcode ) = @_;
1198
    my $dbh = C4::Context->dbh;
1199
    my $sth =
1200
      $dbh->prepare(
1201
"select hardduedate, hardduedatecompare from issuingrules where categorycode=? and itemtype=? and branchcode=?"
1202
      );
1203
    $sth->execute( $borrowertype, $itemtype, $branchcode );
1204
    my $results = $sth->fetchrow_hashref;
1205
    return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare})
1206
      if defined($results) && $results->{hardduedate};
1207
1198
1208
    $sth->execute( $borrowertype, "*", $branchcode );
1199
    my $rule = GetIssuingRule( $borrowertype, $itemtype, $branchcode );
1209
    $results = $sth->fetchrow_hashref;
1210
    return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare})
1211
      if defined($results) && $results->{hardduedate};
1212
1200
1213
    $sth->execute( "*", $itemtype, $branchcode );
1201
    if ( defined( $rule ) ) {
1214
    $results = $sth->fetchrow_hashref;
1202
        if ( $rule->{hardduedate} ) {
1215
    return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare})
1203
            return (dt_from_string($rule->{hardduedate}, 'iso'),$rule->{hardduedatecompare});
1216
      if defined($results) && $results->{hardduedate};
1204
        } else {
1217
1205
            return (undef, undef);        
1218
    $sth->execute( "*", "*", $branchcode );
1206
        }
1219
    $results = $sth->fetchrow_hashref;
1207
    }
1220
    return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare})
1221
      if defined($results) && $results->{hardduedate};
1222
1223
    $sth->execute( $borrowertype, $itemtype, "*" );
1224
    $results = $sth->fetchrow_hashref;
1225
    return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare})
1226
      if defined($results) && $results->{hardduedate};
1227
1228
    $sth->execute( $borrowertype, "*", "*" );
1229
    $results = $sth->fetchrow_hashref;
1230
    return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare})
1231
      if defined($results) && $results->{hardduedate};
1232
1233
    $sth->execute( "*", $itemtype, "*" );
1234
    $results = $sth->fetchrow_hashref;
1235
    return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare})
1236
      if defined($results) && $results->{hardduedate};
1237
1238
    $sth->execute( "*", "*", "*" );
1239
    $results = $sth->fetchrow_hashref;
1240
    return (dt_from_string($results->{hardduedate}, 'iso'),$results->{hardduedatecompare})
1241
      if defined($results) && $results->{hardduedate};
1242
1243
    # if no rule is set => return undefined
1244
    return (undef, undef);
1245
}
1208
}
1246
1209
1247
=head2 GetIssuingRule
1210
=head2 GetIssuingRule
1248
- 

Return to bug 8640