sub create_bill {
- my($class, $e, $amount, $btype, $type, $xactid, $note) = @_;
+ my($class, $e, $amount, $btype, $type, $xactid, $note, $billing_ts) = @_;
$logger->info("The system is charging $amount [$type] on xact $xactid");
$note ||= 'SYSTEM GENERATED';
my $bill = Fieldmapper::money::billing->new;
$bill->xact($xactid);
$bill->amount($amount);
+ $bill->billing_ts($billing_ts);
$bill->billing_type($type);
$bill->btype($btype);
$bill->note($note);
# restore those overdue charges voided when item was set to lost
# ------------------------------------------------------------------
- my $ods = $self->editor->search_money_billing(
+ my $ods = $self->editor->search_money_billing([
{
xact => $self->circ->id,
btype => 1
+ },
+ {
+ order_by => {mb => 'billing_ts desc'}
}
- );
+ ]);
$logger->debug("returning ".scalar(@$ods)." overdue charges pre-$tag");
# Because actual users get up to all kinds of unexpectedness, we
$ods->[0]->btype(),
$ods->[0]->billing_type(),
$self->circ->id(),
- "System: $tag RETURNED - OVERDUES REINSTATED"
+ "System: $tag RETURNED - OVERDUES REINSTATED",
+ $ods->[0]->billing_ts() # date this restoration the same as the last overdue (for possible subsequent fine generation)
);
}
}