push @EXPORT, qw(
&GetIssuesIteminfo
);
- #
- # &GetIssuingRules - delete.
- # use C4::Circulation::GetIssuingRule instead.
-
# subs to move to Members.pm
push @EXPORT, qw(
&CheckBorrowerDebarred
my $units_minus_grace = $chargeable_units - $data->{firstremind};
my $amount = 0;
if ($data->{'chargeperiod'} && ($units_minus_grace > 0) ) {
- $amount = int($chargeable_units / $data->{'chargeperiod'}) * $data->{'fine'};# TODO fine calc should be in cents
+ if ( C4::Context->preference('FinesIncludeGracePeriod') ) {
+ $amount = int($chargeable_units / $data->{'chargeperiod'}) * $data->{'fine'};# TODO fine calc should be in cents
+ } else {
+ $amount = int($units_minus_grace / $data->{'chargeperiod'}) * $data->{'fine'};
+ }
} else {
# a zero (or null) chargeperiod or negative units_minus_grace value means no charge.
}
next;
}
}
- $total_amount_other += $rec->{'amount'};
+ $total_amount_other += $rec->{'amountoutstanding'};
}
+
if (my $maxfine = C4::Context->preference('MaxFine')) {
if ($total_amount_other + $amount > $maxfine) {
my $new_amount = $maxfine - $total_amount_other;
- warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached";
return if $new_amount <= 0.00;
-
+ warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached";
$amount = $new_amount;
}
}
return 0;
}
-
-=head2 GetIssuingRules
-
-FIXME - This sub should be deprecated and removed.
-It ignores branch and defaults.
-
- $data = &GetIssuingRules($itemtype,$categorycode);
-
-Looks up for all issuingrules an item info
-
-C<$itemnumber> is a reference-to-hash whose keys are all of the fields
-from the borrowers and categories tables of the Koha database. Thus,
-
-C<$categorycode> contains information about borrowers category
-
-C<$data> contains all information about both the borrower and
-category he or she belongs to.
-=cut
-
-sub GetIssuingRules {
- warn "GetIssuingRules is deprecated: use GetIssuingRule from C4::Circulation instead.";
- my ($itemtype,$categorycode)=@_;
- my $dbh = C4::Context->dbh();
- my $query=qq|SELECT *
- FROM issuingrules
- WHERE issuingrules.itemtype=?
- AND issuingrules.categorycode=?
- |;
- my $sth = $dbh->prepare($query);
- # print $query;
- $sth->execute($itemtype,$categorycode);
- return $sth->fetchrow_hashref;
-}
-
-
sub ReplacementCost2 {
my ( $itemnum, $borrowernumber ) = @_;
my $dbh = C4::Context->dbh();