Browse Source

Bug 24595: Silent warnings from Circulation.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Jonathan Druart 3 years ago
committed by Martin Renvoize
parent
commit
eedb6ce233
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 15
      C4/Circulation.pm
  2. 4
      C4/Overdues.pm

15
C4/Circulation.pm

@ -959,7 +959,7 @@ sub CanBookBeIssued {
}
else {
my $itemtype = Koha::ItemTypes->find($biblioitem->itemtype);
if ( $itemtype and $itemtype->notforloan == 1){
if ( $itemtype && defined $itemtype->notforloan && $itemtype->notforloan == 1){
if (!C4::Context->preference("AllowNotForLoanOverride")) {
$issuingimpossible{NOT_FOR_LOAN} = 1;
$issuingimpossible{itemtype_notforloan} = $effective_itemtype;
@ -2294,7 +2294,7 @@ sub _calculate_new_debar_dt {
if ( $deltadays->subtract($grace)->is_positive() ) {
my $suspension_days = $deltadays * $finedays;
if ( $issuing_rule->{suspension_chargeperiod} > 1 ) {
if ( defined $issuing_rule->{suspension_chargeperiod} && $issuing_rule->{suspension_chargeperiod} > 1 ) {
# No need to / 1 and do not consider / 0
$suspension_days = DateTime::Duration->new(
days => floor( $suspension_days->in_units('days') / $issuing_rule->{suspension_chargeperiod} )
@ -3784,7 +3784,16 @@ sub LostItem{
defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $itemnumber...) failed!"; # zero is OK, check defined
if (C4::Context->preference('WhenLostChargeReplacementFee')){
C4::Accounts::chargelostitem($borrowernumber, $itemnumber, $issues->{'replacementprice'}, "$issues->{'title'} $issues->{'barcode'} $issues->{'itemcallnumber'}");
C4::Accounts::chargelostitem(
$borrowernumber,
$itemnumber,
$issues->{'replacementprice'},
sprintf( "%s %s %s",
$issues->{'title'} || q{},
$issues->{'barcode'} || q{},
$issues->{'itemcallnumber'} || q{},
),
);
#FIXME : Should probably have a way to distinguish this from an item that really was returned.
#warn " $issues->{'borrowernumber'} / $itemnumber ";
}

4
C4/Overdues.pm

@ -268,7 +268,7 @@ sub CalcFine {
my $charge_periods = $units / $issuing_rule->{chargeperiod};
# If chargeperiod_charge_at = 1, we charge a fine at the start of each charge period
# if chargeperiod_charge_at = 0, we charge at the end of each charge period
$charge_periods = $issuing_rule->{chargeperiod_charge_at} == 1 ? ceil($charge_periods) : floor($charge_periods);
$charge_periods = defined $issuing_rule->{chargeperiod_charge_at} && $issuing_rule->{chargeperiod_charge_at} == 1 ? ceil($charge_periods) : floor($charge_periods);
$amount = $charge_periods * $issuing_rule->{fine};
} # else { # a zero (or null) chargeperiod or negative units_minus_grace value means no charge. }
@ -527,7 +527,7 @@ sub UpdateFine {
my $itemnum = $params->{itemnumber};
my $borrowernumber = $params->{borrowernumber};
my $amount = $params->{amount};
my $due = $params->{due};
my $due = $params->{due} // q{};
$debug and warn "UpdateFine({ itemnumber => $itemnum, borrowernumber => $borrowernumber, due => $due, issue_id => $issue_id})";

Loading…
Cancel
Save