Lines 30-36
use C4::Items;
Link Here
|
30 |
use C4::Members; |
30 |
use C4::Members; |
31 |
use C4::Dates; |
31 |
use C4::Dates; |
32 |
use C4::Dates qw(format_date); |
32 |
use C4::Dates qw(format_date); |
33 |
use C4::Accounts; |
33 |
use Koha::Accounts; |
34 |
use C4::ItemCirculationAlertPreference; |
34 |
use C4::ItemCirculationAlertPreference; |
35 |
use C4::Message; |
35 |
use C4::Message; |
36 |
use C4::Debug; |
36 |
use C4::Debug; |
Lines 48-53
use Data::Dumper;
Link Here
|
48 |
use Koha::DateUtils; |
48 |
use Koha::DateUtils; |
49 |
use Koha::Calendar; |
49 |
use Koha::Calendar; |
50 |
use Koha::Borrower::Debarments; |
50 |
use Koha::Borrower::Debarments; |
|
|
51 |
use Koha::Database; |
51 |
use Carp; |
52 |
use Carp; |
52 |
use Date::Calc qw( |
53 |
use Date::Calc qw( |
53 |
Today |
54 |
Today |
Lines 1276-1282
sub AddIssue {
Link Here
|
1276 |
## If item was lost, it has now been found, reverse any list item charges if neccessary. |
1277 |
## If item was lost, it has now been found, reverse any list item charges if neccessary. |
1277 |
if ( $item->{'itemlost'} ) { |
1278 |
if ( $item->{'itemlost'} ) { |
1278 |
if ( C4::Context->preference('RefundLostItemFeeOnReturn' ) ) { |
1279 |
if ( C4::Context->preference('RefundLostItemFeeOnReturn' ) ) { |
1279 |
_FixAccountForLostAndReturned( $item->{'itemnumber'}, undef, $item->{'barcode'} ); |
1280 |
_FixAccountForLostAndReturned( $item->{'itemnumber'} ); |
1280 |
} |
1281 |
} |
1281 |
} |
1282 |
} |
1282 |
|
1283 |
|
Lines 1813-1821
sub AddReturn {
Link Here
|
1813 |
if ( $amount > 0 |
1814 |
if ( $amount > 0 |
1814 |
&& C4::Context->preference('finesMode') eq 'production' ) |
1815 |
&& C4::Context->preference('finesMode') eq 'production' ) |
1815 |
{ |
1816 |
{ |
1816 |
C4::Overdues::UpdateFine( $issue->{itemnumber}, |
1817 |
C4::Overdues::UpdateFine( |
1817 |
$issue->{borrowernumber}, |
1818 |
{ |
1818 |
$amount, $type, output_pref($datedue) ); |
1819 |
itemnumber => $issue->{itemnumber}, |
|
|
1820 |
borrowernumber => $issue->{borrowernumber}, |
1821 |
amount => $amount, |
1822 |
due => output_pref($datedue), |
1823 |
issue_id => $issue->{issue_id} |
1824 |
} |
1825 |
); |
1819 |
} |
1826 |
} |
1820 |
} |
1827 |
} |
1821 |
|
1828 |
|
Lines 1865-1882
sub AddReturn {
Link Here
|
1865 |
$messages->{'WasLost'} = 1; |
1872 |
$messages->{'WasLost'} = 1; |
1866 |
|
1873 |
|
1867 |
if ( C4::Context->preference('RefundLostItemFeeOnReturn' ) ) { |
1874 |
if ( C4::Context->preference('RefundLostItemFeeOnReturn' ) ) { |
1868 |
_FixAccountForLostAndReturned($item->{'itemnumber'}, $borrowernumber, $barcode); # can tolerate undef $borrowernumber |
1875 |
_FixAccountForLostAndReturned( $item->{'itemnumber'} ); |
1869 |
$messages->{'LostItemFeeRefunded'} = 1; |
1876 |
$messages->{'LostItemFeeRefunded'} = 1; |
1870 |
} |
1877 |
} |
1871 |
} |
1878 |
} |
1872 |
|
1879 |
|
1873 |
# fix up the overdues in accounts... |
1880 |
# fix up the overdues in accounts... |
1874 |
if ($borrowernumber) { |
1881 |
if ($borrowernumber) { |
1875 |
my $fix = _FixOverduesOnReturn($borrowernumber, $item->{itemnumber}, $exemptfine, $dropbox); |
1882 |
_FixOverduesOnReturn( |
1876 |
defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!"; # zero is OK, check defined |
1883 |
{ |
|
|
1884 |
exempt_fine => $exemptfine, |
1885 |
dropbox => $dropbox, |
1886 |
issue => $issue, |
1887 |
} |
1888 |
); |
1877 |
|
1889 |
|
1878 |
if ( $issue->{overdue} && $issue->{date_due} ) { |
1890 |
if ( $issue->{overdue} && $issue->{date_due} ) { |
1879 |
# fix fine days |
1891 |
# fix fine days |
1880 |
my $debardate = |
1892 |
my $debardate = |
1881 |
_debar_user_on_return( $borrower, $item, $issue->{date_due}, $today ); |
1893 |
_debar_user_on_return( $borrower, $item, $issue->{date_due}, $today ); |
1882 |
$messages->{Debarred} = $debardate if ($debardate); |
1894 |
$messages->{Debarred} = $debardate if ($debardate); |
Lines 2094-2232
Internal function, called only by AddReturn
Link Here
|
2094 |
=cut |
2106 |
=cut |
2095 |
|
2107 |
|
2096 |
sub _FixOverduesOnReturn { |
2108 |
sub _FixOverduesOnReturn { |
2097 |
my ($borrowernumber, $item); |
2109 |
my ( $params ) = @_; |
2098 |
unless ($borrowernumber = shift) { |
2110 |
|
2099 |
warn "_FixOverduesOnReturn() not supplied valid borrowernumber"; |
2111 |
my $exemptfine = $params->{exempt_fine}; |
2100 |
return; |
2112 |
my $dropbox = $params->{dropbox}; |
2101 |
} |
2113 |
my $issue = $params->{issue}; |
2102 |
unless ($item = shift) { |
2114 |
|
2103 |
warn "_FixOverduesOnReturn() not supplied valid itemnumber"; |
|
|
2104 |
return; |
2105 |
} |
2106 |
my ($exemptfine, $dropbox) = @_; |
2107 |
my $dbh = C4::Context->dbh; |
2115 |
my $dbh = C4::Context->dbh; |
2108 |
|
2116 |
|
2109 |
# check for overdue fine |
2117 |
my $schema = Koha::Database->new()->schema; |
2110 |
my $sth = $dbh->prepare( |
2118 |
my $fine = |
2111 |
"SELECT * FROM accountlines WHERE (borrowernumber = ?) AND (itemnumber = ?) AND (accounttype='FU' OR accounttype='O')" |
2119 |
$schema->resultset('AccountDebit') |
2112 |
); |
2120 |
->single( { issue_id => $issue->{issue_id}, type => Koha::Accounts::DebitTypes::Fine() } ); |
2113 |
$sth->execute( $borrowernumber, $item ); |
|
|
2114 |
|
2121 |
|
2115 |
# alter fine to show that the book has been returned |
2122 |
return unless ( $fine ); |
2116 |
my $data = $sth->fetchrow_hashref; |
2123 |
|
2117 |
return 0 unless $data; # no warning, there's just nothing to fix |
2124 |
$fine->accruing(0); |
2118 |
|
2125 |
|
2119 |
my $uquery; |
|
|
2120 |
my @bind = ($data->{'accountlines_id'}); |
2121 |
if ($exemptfine) { |
2126 |
if ($exemptfine) { |
2122 |
$uquery = "update accountlines set accounttype='FFOR', amountoutstanding=0"; |
2127 |
AddCredit( |
2123 |
if (C4::Context->preference("FinesLog")) { |
2128 |
{ |
2124 |
&logaction("FINES", 'MODIFY',$borrowernumber,"Overdue forgiven: item $item"); |
2129 |
borrower => $fine->borrowernumber(), |
2125 |
} |
2130 |
amount => $fine->amount_original(), |
2126 |
} elsif ($dropbox && $data->{lastincrement}) { |
2131 |
debit_id => $fine->debit_id(), |
2127 |
my $outstanding = $data->{amountoutstanding} - $data->{lastincrement} ; |
2132 |
type => Koha::Accounts::CreditTypes::Forgiven(), |
2128 |
my $amt = $data->{amount} - $data->{lastincrement} ; |
2133 |
} |
|
|
2134 |
); |
2129 |
if (C4::Context->preference("FinesLog")) { |
2135 |
if (C4::Context->preference("FinesLog")) { |
2130 |
&logaction("FINES", 'MODIFY',$borrowernumber,"Dropbox adjustment $amt, item $item"); |
2136 |
&logaction( |
|
|
2137 |
"FINES", 'MODIFY', |
2138 |
$issue->{borrowernumber}, |
2139 |
"Overdue forgiven: item " . $issue->{itemnumber} |
2140 |
); |
2131 |
} |
2141 |
} |
2132 |
$uquery = "update accountlines set accounttype='F' "; |
2142 |
} elsif ($dropbox && $fine->amount_last_increment() != $fine->amount_original() ) { |
2133 |
if($outstanding >= 0 && $amt >=0) { |
2143 |
if ( C4::Context->preference("FinesLog") ) { |
2134 |
$uquery .= ", amount = ? , amountoutstanding=? "; |
2144 |
&logaction( "FINES", 'MODIFY', $issue->{borrowernumber}, |
2135 |
unshift @bind, ($amt, $outstanding) ; |
2145 |
"Dropbox adjustment " |
|
|
2146 |
. $fine->amount_last_increment() |
2147 |
. ", item " . $issue->{itemnumber} ); |
2136 |
} |
2148 |
} |
2137 |
} else { |
2149 |
$fine->amount_original( |
2138 |
$uquery = "update accountlines set accounttype='F' "; |
2150 |
$fine->amount_original() - $fine->amount_last_increment() ); |
|
|
2151 |
$fine->amount_outstanding( |
2152 |
$fine->amount_outstanding - $fine->amount_last_increment() ); |
2153 |
$schema->resultset('AccountOffset')->create( |
2154 |
{ |
2155 |
debit_id => $fine->debit_id(), |
2156 |
type => Koha::Accounts::OffsetTypes::Dropbox(), |
2157 |
amount => $fine->amount_last_increment() * -1, |
2158 |
} |
2159 |
); |
2139 |
} |
2160 |
} |
2140 |
$uquery .= " where (accountlines_id = ?)"; |
2161 |
|
2141 |
my $usth = $dbh->prepare($uquery); |
2162 |
return $fine->update(); |
2142 |
return $usth->execute(@bind); |
|
|
2143 |
} |
2163 |
} |
2144 |
|
2164 |
|
2145 |
=head2 _FixAccountForLostAndReturned |
2165 |
=head2 _FixAccountForLostAndReturned |
2146 |
|
2166 |
|
2147 |
&_FixAccountForLostAndReturned($itemnumber, [$borrowernumber, $barcode]); |
2167 |
&_FixAccountForLostAndReturned($itemnumber); |
2148 |
|
|
|
2149 |
Calculates the charge for a book lost and returned. |
2150 |
|
2168 |
|
2151 |
Internal function, not exported, called only by AddReturn. |
2169 |
Refunds a lost item fee in necessary |
2152 |
|
|
|
2153 |
FIXME: This function reflects how inscrutable fines logic is. Fix both. |
2154 |
FIXME: Give a positive return value on success. It might be the $borrowernumber who received credit, or the amount forgiven. |
2155 |
|
2170 |
|
2156 |
=cut |
2171 |
=cut |
2157 |
|
2172 |
|
2158 |
sub _FixAccountForLostAndReturned { |
2173 |
sub _FixAccountForLostAndReturned { |
2159 |
my $itemnumber = shift or return; |
2174 |
my ( $itemnumber ) = @_; |
2160 |
my $borrowernumber = @_ ? shift : undef; |
2175 |
|
2161 |
my $item_id = @_ ? shift : $itemnumber; # Send the barcode if you want that logged in the description |
2176 |
my $schema = Koha::Database->new()->schema; |
2162 |
my $dbh = C4::Context->dbh; |
2177 |
|
2163 |
# check for charge made for lost book |
2178 |
# Find the last issue for this item |
2164 |
my $sth = $dbh->prepare("SELECT * FROM accountlines WHERE itemnumber = ? AND accounttype IN ('L', 'Rep', 'W') ORDER BY date DESC, accountno DESC"); |
2179 |
my $issue = |
2165 |
$sth->execute($itemnumber); |
2180 |
$schema->resultset('Issue')->single( { itemnumber => $itemnumber } ); |
2166 |
my $data = $sth->fetchrow_hashref; |
2181 |
$issue ||= |
2167 |
$data or return; # bail if there is nothing to do |
2182 |
$schema->resultset('OldIssue')->single( { itemnumber => $itemnumber } ); |
2168 |
$data->{accounttype} eq 'W' and return; # Written off |
2183 |
|
2169 |
|
2184 |
return unless $issue; |
2170 |
# writeoff this amount |
2185 |
|
2171 |
my $offset; |
2186 |
# Find a lost fee for this issue |
2172 |
my $amount = $data->{'amount'}; |
2187 |
my $debit = $schema->resultset('AccountDebit')->single( |
2173 |
my $acctno = $data->{'accountno'}; |
2188 |
{ |
2174 |
my $amountleft; # Starts off undef/zero. |
2189 |
issue_id => $issue->issue_id(), |
2175 |
if ($data->{'amountoutstanding'} == $amount) { |
2190 |
type => Koha::Accounts::DebitTypes::Lost() |
2176 |
$offset = $data->{'amount'}; |
2191 |
} |
2177 |
$amountleft = 0; # Hey, it's zero here, too. |
2192 |
); |
2178 |
} else { |
2193 |
|
2179 |
$offset = $amount - $data->{'amountoutstanding'}; # Um, isn't this the same as ZERO? We just tested those two things are == |
2194 |
return unless $debit; |
2180 |
$amountleft = $data->{'amountoutstanding'} - $amount; # Um, isn't this the same as ZERO? We just tested those two things are == |
2195 |
|
2181 |
} |
2196 |
# Check for an existing found credit for this debit, if there is one, the fee has already been refunded and we do nothing |
2182 |
my $usth = $dbh->prepare("UPDATE accountlines SET accounttype = 'LR',amountoutstanding='0' |
2197 |
my @credits = $debit->account_offsets->search_related('credit', { 'credit.type' => Koha::Accounts::CreditTypes::Found() }); |
2183 |
WHERE (accountlines_id = ?)"); |
2198 |
|
2184 |
$usth->execute($data->{'accountlines_id'}); # We might be adjusting an account for some OTHER borrowernumber now. Not the one we passed in. |
2199 |
return if @credits; |
2185 |
#check if any credit is left if so writeoff other accounts |
2200 |
|
2186 |
my $nextaccntno = getnextacctno($data->{'borrowernumber'}); |
2201 |
# Ok, so we know we have an unrefunded lost item fee, let's refund it |
2187 |
$amountleft *= -1 if ($amountleft < 0); |
2202 |
CreditLostItem( |
2188 |
if ($amountleft > 0) { |
2203 |
{ |
2189 |
my $msth = $dbh->prepare("SELECT * FROM accountlines WHERE (borrowernumber = ?) |
2204 |
borrower => $issue->borrower(), |
2190 |
AND (amountoutstanding >0) ORDER BY date"); # might want to order by amountoustanding ASC (pay smallest first) |
2205 |
debit => $debit |
2191 |
$msth->execute($data->{'borrowernumber'}); |
2206 |
} |
2192 |
# offset transactions |
2207 |
); |
2193 |
my $newamtos; |
2208 |
|
2194 |
my $accdata; |
|
|
2195 |
while (($accdata=$msth->fetchrow_hashref) and ($amountleft>0)){ |
2196 |
if ($accdata->{'amountoutstanding'} < $amountleft) { |
2197 |
$newamtos = 0; |
2198 |
$amountleft -= $accdata->{'amountoutstanding'}; |
2199 |
} else { |
2200 |
$newamtos = $accdata->{'amountoutstanding'} - $amountleft; |
2201 |
$amountleft = 0; |
2202 |
} |
2203 |
my $thisacct = $accdata->{'accountlines_id'}; |
2204 |
# FIXME: move prepares outside while loop! |
2205 |
my $usth = $dbh->prepare("UPDATE accountlines SET amountoutstanding= ? |
2206 |
WHERE (accountlines_id = ?)"); |
2207 |
$usth->execute($newamtos,$thisacct); |
2208 |
$usth = $dbh->prepare("INSERT INTO accountoffsets |
2209 |
(borrowernumber, accountno, offsetaccount, offsetamount) |
2210 |
VALUES |
2211 |
(?,?,?,?)"); |
2212 |
$usth->execute($data->{'borrowernumber'},$accdata->{'accountno'},$nextaccntno,$newamtos); |
2213 |
} |
2214 |
} |
2215 |
$amountleft *= -1 if ($amountleft > 0); |
2216 |
my $desc = "Item Returned " . $item_id; |
2217 |
$usth = $dbh->prepare("INSERT INTO accountlines |
2218 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding) |
2219 |
VALUES (?,?,now(),?,?,'CR',?)"); |
2220 |
$usth->execute($data->{'borrowernumber'},$nextaccntno,0-$amount,$desc,$amountleft); |
2221 |
if ($borrowernumber) { |
2222 |
# FIXME: same as query above. use 1 sth for both |
2223 |
$usth = $dbh->prepare("INSERT INTO accountoffsets |
2224 |
(borrowernumber, accountno, offsetaccount, offsetamount) |
2225 |
VALUES (?,?,?,?)"); |
2226 |
$usth->execute($borrowernumber, $data->{'accountno'}, $nextaccntno, $offset); |
2227 |
} |
2228 |
ModItem({ paidfor => '' }, undef, $itemnumber); |
2209 |
ModItem({ paidfor => '' }, undef, $itemnumber); |
2229 |
return; |
|
|
2230 |
} |
2210 |
} |
2231 |
|
2211 |
|
2232 |
=head2 _GetCircControlBranch |
2212 |
=head2 _GetCircControlBranch |
Lines 2603-2621
sub AddRenewal {
Link Here
|
2603 |
# Charge a new rental fee, if applicable? |
2583 |
# Charge a new rental fee, if applicable? |
2604 |
my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); |
2584 |
my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); |
2605 |
if ( $charge > 0 ) { |
2585 |
if ( $charge > 0 ) { |
2606 |
my $accountno = getnextacctno( $borrowernumber ); |
|
|
2607 |
my $item = GetBiblioFromItemNumber($itemnumber); |
2586 |
my $item = GetBiblioFromItemNumber($itemnumber); |
2608 |
my $manager_id = 0; |
2587 |
|
2609 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
2588 |
my $borrower = |
2610 |
$sth = $dbh->prepare( |
2589 |
Koha::Database->new()->schema->resultset('Borrower') |
2611 |
"INSERT INTO accountlines |
2590 |
->find($borrowernumber); |
2612 |
(date, borrowernumber, accountno, amount, manager_id, |
2591 |
|
2613 |
description,accounttype, amountoutstanding, itemnumber) |
2592 |
AddDebit( |
2614 |
VALUES (now(),?,?,?,?,?,?,?,?)" |
2593 |
{ |
|
|
2594 |
borrower => $borrower, |
2595 |
itemnumber => $itemnumber, |
2596 |
amount => $charge, |
2597 |
type => Koha::Accounts::DebitTypes::Rental(), |
2598 |
description => |
2599 |
"Renewal of Rental Item $item->{'title'} $item->{'barcode'}" |
2600 |
} |
2615 |
); |
2601 |
); |
2616 |
$sth->execute( $borrowernumber, $accountno, $charge, $manager_id, |
|
|
2617 |
"Renewal of Rental Item $item->{'title'} $item->{'barcode'}", |
2618 |
'Rent', $charge, $itemnumber ); |
2619 |
} |
2602 |
} |
2620 |
|
2603 |
|
2621 |
# Send a renewal slip according to checkout alert preferencei |
2604 |
# Send a renewal slip according to checkout alert preferencei |
Lines 2834-2858
sub _get_discount_from_rule {
Link Here
|
2834 |
|
2817 |
|
2835 |
=head2 AddIssuingCharge |
2818 |
=head2 AddIssuingCharge |
2836 |
|
2819 |
|
2837 |
&AddIssuingCharge( $itemno, $borrowernumber, $charge ) |
2820 |
&AddIssuingCharge( $itemnumber, $borrowernumber, $amount ) |
2838 |
|
2821 |
|
2839 |
=cut |
2822 |
=cut |
2840 |
|
2823 |
|
2841 |
sub AddIssuingCharge { |
2824 |
sub AddIssuingCharge { |
2842 |
my ( $itemnumber, $borrowernumber, $charge ) = @_; |
2825 |
my ( $itemnumber, $borrowernumber, $amount ) = @_; |
2843 |
my $dbh = C4::Context->dbh; |
2826 |
|
2844 |
my $nextaccntno = getnextacctno( $borrowernumber ); |
2827 |
return AddDebit( |
2845 |
my $manager_id = 0; |
2828 |
{ |
2846 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
2829 |
borrower => Koha::Database->new()->schema->resultset('Borrower')->find($borrowernumber), |
2847 |
my $query =" |
2830 |
itemnumber => $itemnumber, |
2848 |
INSERT INTO accountlines |
2831 |
amount => $amount, |
2849 |
(borrowernumber, itemnumber, accountno, |
2832 |
type => Koha::Accounts::DebitTypes::Rental(), |
2850 |
date, amount, description, accounttype, |
2833 |
} |
2851 |
amountoutstanding, manager_id) |
2834 |
); |
2852 |
VALUES (?, ?, ?,now(), ?, 'Rental', 'Rent',?,?) |
|
|
2853 |
"; |
2854 |
my $sth = $dbh->prepare($query); |
2855 |
$sth->execute( $borrowernumber, $itemnumber, $nextaccntno, $charge, $charge, $manager_id ); |
2856 |
} |
2835 |
} |
2857 |
|
2836 |
|
2858 |
=head2 GetTransfers |
2837 |
=head2 GetTransfers |
Lines 3371-3400
sub ReturnLostItem{
Link Here
|
3371 |
sub LostItem{ |
3350 |
sub LostItem{ |
3372 |
my ($itemnumber, $mark_returned) = @_; |
3351 |
my ($itemnumber, $mark_returned) = @_; |
3373 |
|
3352 |
|
3374 |
my $dbh = C4::Context->dbh(); |
3353 |
my $schema = Koha::Database->new()->schema; |
3375 |
my $sth=$dbh->prepare("SELECT issues.*,items.*,biblio.title |
|
|
3376 |
FROM issues |
3377 |
JOIN items USING (itemnumber) |
3378 |
JOIN biblio USING (biblionumber) |
3379 |
WHERE issues.itemnumber=?"); |
3380 |
$sth->execute($itemnumber); |
3381 |
my $issues=$sth->fetchrow_hashref(); |
3382 |
|
3354 |
|
3383 |
# If a borrower lost the item, add a replacement cost to the their record |
3355 |
my $issue = |
3384 |
if ( my $borrowernumber = $issues->{borrowernumber} ){ |
3356 |
$schema->resultset('Issue')->single( { itemnumber => $itemnumber } ); |
3385 |
my $borrower = C4::Members::GetMemberDetails( $borrowernumber ); |
3357 |
|
|
|
3358 |
my ( $borrower, $item ); |
3359 |
|
3360 |
if ( $issue ) { |
3361 |
$borrower = $issue->borrower(); |
3362 |
$item = $issue->item(); |
3363 |
} |
3386 |
|
3364 |
|
|
|
3365 |
# If a borrower lost the item, add a replacement cost to the their record |
3366 |
if ( $borrower ){ |
3387 |
if (C4::Context->preference('WhenLostForgiveFine')){ |
3367 |
if (C4::Context->preference('WhenLostForgiveFine')){ |
3388 |
my $fix = _FixOverduesOnReturn($borrowernumber, $itemnumber, 1, 0); # 1, 0 = exemptfine, no-dropbox |
3368 |
_FixOverduesOnReturn( |
3389 |
defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $itemnumber...) failed!"; # zero is OK, check defined |
3369 |
{ |
|
|
3370 |
exempt_fine => 1, |
3371 |
dropbox => 0, |
3372 |
issue => $issue, |
3373 |
} |
3374 |
); |
3390 |
} |
3375 |
} |
3391 |
if (C4::Context->preference('WhenLostChargeReplacementFee')){ |
3376 |
if ( C4::Context->preference('WhenLostChargeReplacementFee') ) { |
3392 |
C4::Accounts::chargelostitem($borrowernumber, $itemnumber, $issues->{'replacementprice'}, "Lost Item $issues->{'title'} $issues->{'barcode'}"); |
3377 |
DebitLostItem( { borrower => $borrower, issue => $issue } ); |
3393 |
#FIXME : Should probably have a way to distinguish this from an item that really was returned. |
|
|
3394 |
#warn " $issues->{'borrowernumber'} / $itemnumber "; |
3395 |
} |
3378 |
} |
3396 |
|
3379 |
|
3397 |
MarkIssueReturned($borrowernumber,$itemnumber,undef,undef,$borrower->{'privacy'}) if $mark_returned; |
3380 |
MarkIssueReturned( $borrower->borrowernumber(), $item->itemnumber(), undef, undef, $borrower->privacy() ) if $mark_returned; |
3398 |
} |
3381 |
} |
3399 |
} |
3382 |
} |
3400 |
|
3383 |
|