Commit 4a6cab73 authored by Benjamin Rokseth's avatar Benjamin Rokseth
Browse files

small fixes in overdue_messages and purresaker cronjobs

parent 280e88e1
......@@ -70,6 +70,7 @@ Du har lån som skulle vært levert :
[% FOREACH o IN overdues %]
[% o.title %], [% o.author %] [% o.barcode %]
[% END %]
Du har nå fått et purregebyr på 100 kroner og er sperret for videre lån inntil lånene er levert og purregebyret er betalt. Du kan betale gebyret på Mine sider: https://sok.deichman.no/profile
Levér så fort du kan. Det er flere som kan ha lyst til å låne det du har lånt.
Hvis ikke materialet blir levert, vil du motta et erstatningskrav fra Oslo kemnerkontor.
......@@ -219,7 +220,8 @@ PATRON: while ( my $patron = $patrons->fetchrow_hashref() ) {
$overdues or next PERIOD;
my $ct = scalar @{$overdues};
$totalOverdues += $ct;
my $trigger = grep { $_->{days_overdue} == 29} @{$overdues};
# Check if we have an overdue that matches this delay trigger, otherwise move to next
my $trigger = grep { $_->{days_overdue} == $rule->{"letter$i"}->{delay}} @{$overdues};
if ($trigger) {
++$triggeredOverdues;
# Send message
......@@ -227,7 +229,7 @@ PATRON: while ( my $patron = $patrons->fetchrow_hashref() ) {
my $transport;
my $transports = $rule->{"letter$i"}->{transports};
#warn Dumper($transports);
# Not used?
# Item_Due notice not used? We override by forcing mail first, sms second, print last resort, if patron have these
#my $patron_message_prefs = C4::Members::Messaging::GetMessagingPreferences({ borrowernumber => $patron->{borrowernumber}, message_name => 'Item_Due' });
if ( $patron->{borremail} && grep /^email$/, @{$transports} ) {
......
......@@ -97,7 +97,7 @@ sub calcFine {
$amount = $charge_periods * $issuing_rule->fine;
} # else { # a zero (or null) chargeperiod or negative units_minus_grace value means no charge. }
# why return amount = overduefinescap ?
# Deichman mod: we need to know if issue generated real fine or not. why return amount = overduefinescap ?
$amount = $issuing_rule->overduefinescap if $issuing_rule->overduefinescap && $amount > $issuing_rule->overduefinescap;
$amount = $item->{replacementprice} if ( $issuing_rule->cap_fine_to_replacement_price && $item->{replacementprice} && $amount > $item->{replacementprice} );
return ($amount, {}, $units_minus_grace, $charge_duration);
......@@ -131,8 +131,8 @@ while ( my $overdue = $overdues->fetchrow_hashref() ) {
++$finesCount;
my $purresak;
unless ($test_mode) {
$purresak = Koha::Purresaker->AddPurresak($overdue->{borrowernumber}, $amount);
$purresakCount += $purresak->rows;
$purresak = Koha::Purresaker->new->AddPurresak($overdue->{borrowernumber}, $amount, $overdue->{issue_id});
$purresakCount++;
}
# NOTE: charge_type is always empty hash
$test_mode or C4::Overdues::UpdateFine({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment