$issuingimpossible{RETURN_IMPOSSIBLE} = 1;
$issuingimpossible{branch_to_return} = $message;
} else {
+ if ( C4::Context->preference('AutoReturnCheckedOutItems') ) {
+ $alerts{RETURNED_FROM_ANOTHER} = { patron => $patron };
+ } else {
$needsconfirmation{ISSUED_TO_ANOTHER} = 1;
$needsconfirmation{issued_firstname} = $patron->firstname;
$needsconfirmation{issued_surname} = $patron->surname;
$needsconfirmation{issued_cardnumber} = $patron->cardnumber;
$needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
+ }
}
}
{
borrowernumber => $borrowernumber,
itemnumber => $item,
- -or => [
- accounttype => 'FU',
- accounttype => 'O',
- ],
+ accounttype => 'OVERDUE',
+ status => 'UNRETURNED'
}
)->next();
return 0 unless $accountline; # no warning, there's just nothing to fix
if ($exemptfine) {
my $amountoutstanding = $accountline->amountoutstanding;
- $accountline->accounttype('FFOR');
+ $accountline->status('FORGIVEN');
$accountline->amountoutstanding(0);
Koha::Account::Offset->new(
&logaction("FINES", 'MODIFY',$borrowernumber,"Overdue forgiven: item $item");
}
} else {
- $accountline->accounttype('F');
+ $accountline->status('RETURNED');
}
return $accountline->store();
my $accountlines = Koha::Account::Lines->search(
{
itemnumber => $itemnumber,
- accounttype => { -in => [ 'L', 'Rep', 'W' ] },
+ accounttype => { -in => [ 'L', 'W' ] },
},
{
- order_by => { -desc => [ 'date' ] }
+ order_by => { -desc => [ 'date', 'accountlines_id' ] }
}
);
{ amount => $credit_total,
description => 'Item Returned ' . $item_id,
type => 'lost_item_return',
+ interface => C4::Context->interface,
library_id => $branchcode
}
);
$datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ?
dt_from_string( $issue->date_due, 'sql' ) :
DateTime->now( time_zone => C4::Context->tz());
- $datedue = CalcDateDue($datedue, $itemtype, $circ_library, $patron_unblessed, 'is a renewal');
+ $datedue = CalcDateDue($datedue, $itemtype, $circ_library->branchcode, $patron_unblessed, 'is a renewal');
}
my $fees = Koha::Charges::Fees->new(
amount => $charge,
description => $description,
note => undef,
- user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0,
+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
+ interface => C4::Context->interface,
type => 'rent',
item_id => $checkout->itemnumber,
issue_id => $checkout->issue_id,
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'}, "Lost Item $issues->{'title'} $issues->{'barcode'} $issues->{'itemcallnumber'}");
+ C4::Accounts::chargelostitem($borrowernumber, $itemnumber, $issues->{'replacementprice'}, "$issues->{'title'} $issues->{'barcode'} $issues->{'itemcallnumber'}");
#FIXME : Should probably have a way to distinguish this from an item that really was returned.
#warn " $issues->{'borrowernumber'} / $itemnumber ";
}
my $patron = Koha::Patrons->find({ cardnumber => $operation->{cardnumber} });
- $patron->account->pay({ amount => $operation->{amount}, library_id => $operation->{branchcode} });
+ $patron->account->pay(
+ {
+ amount => $operation->{amount},
+ library_id => $operation->{branchcode},
+ interface => 'koc'
+ }
+ );
return "Success.";
}