|
Lines 52-58
use Koha::Database;
Link Here
|
| 52 |
use Koha::Libraries; |
52 |
use Koha::Libraries; |
| 53 |
use Koha::Account::Lines; |
53 |
use Koha::Account::Lines; |
| 54 |
use Koha::Holds; |
54 |
use Koha::Holds; |
| 55 |
use Koha::RefundLostItemFeeRules; |
|
|
| 56 |
use Koha::Account::Lines; |
55 |
use Koha::Account::Lines; |
| 57 |
use Koha::Account::Offsets; |
56 |
use Koha::Account::Offsets; |
| 58 |
use Koha::Config::SysPrefs; |
57 |
use Koha::Config::SysPrefs; |
|
Lines 1457-1488
sub AddIssue {
Link Here
|
| 1457 |
|
1456 |
|
| 1458 |
## If item was lost, it has now been found, reverse any list item charges if necessary. |
1457 |
## If item was lost, it has now been found, reverse any list item charges if necessary. |
| 1459 |
if ( $item_object->itemlost ) { |
1458 |
if ( $item_object->itemlost ) { |
| 1460 |
my $refund = 1; |
1459 |
$item_object->set_found; |
| 1461 |
my $no_refund_after_days = C4::Context->preference('NoRefundOnLostReturnedItemsAge'); |
|
|
| 1462 |
if ($no_refund_after_days) { |
| 1463 |
my $today = dt_from_string(); |
| 1464 |
my $lost_age_in_days = |
| 1465 |
dt_from_string( $item_object->itemlost_on ) |
| 1466 |
->delta_days($today) |
| 1467 |
->in_units('days'); |
| 1468 |
|
| 1469 |
$refund = 0 unless ( $lost_age_in_days < $no_refund_after_days ); |
| 1470 |
} |
| 1471 |
|
| 1472 |
if ( |
| 1473 |
$refund |
| 1474 |
&& Koha::RefundLostItemFeeRules->should_refund( |
| 1475 |
{ |
| 1476 |
current_branch => C4::Context->userenv->{branch}, |
| 1477 |
item_home_branch => $item_object->homebranch, |
| 1478 |
item_holding_branch => $item_object->holdingbranch, |
| 1479 |
} |
| 1480 |
) |
| 1481 |
) |
| 1482 |
{ |
| 1483 |
_FixAccountForLostAndFound( $item_object->itemnumber, undef, |
| 1484 |
$item_object->barcode ); |
| 1485 |
} |
| 1486 |
} |
1460 |
} |
| 1487 |
|
1461 |
|
| 1488 |
$item_object->issues( ( $item_object->issues || 0 ) + 1); |
1462 |
$item_object->issues( ( $item_object->issues || 0 ) + 1); |
|
Lines 2060-2092
sub AddReturn {
Link Here
|
| 2060 |
if ( $item->itemlost ) { |
2034 |
if ( $item->itemlost ) { |
| 2061 |
$messages->{'WasLost'} = 1; |
2035 |
$messages->{'WasLost'} = 1; |
| 2062 |
unless ( C4::Context->preference("BlockReturnOfLostItems") ) { |
2036 |
unless ( C4::Context->preference("BlockReturnOfLostItems") ) { |
| 2063 |
my $refund = 1; |
2037 |
my $refunded = $item->set_found( |
| 2064 |
my $no_refund_after_days = C4::Context->preference('NoRefundOnLostReturnedItemsAge'); |
2038 |
{ |
| 2065 |
if ($no_refund_after_days) { |
2039 |
holdingbranch => $item_holding_branch, |
| 2066 |
my $today = dt_from_string(); |
2040 |
borrowernumber => $borrowernumber |
| 2067 |
my $lost_age_in_days = |
2041 |
} |
| 2068 |
dt_from_string( $item->itemlost_on ) |
2042 |
); |
| 2069 |
->delta_days($today) |
|
|
| 2070 |
->in_units('days'); |
| 2071 |
|
| 2072 |
$refund = 0 unless ( $lost_age_in_days < $no_refund_after_days ); |
| 2073 |
} |
| 2074 |
|
2043 |
|
| 2075 |
if ( |
2044 |
$messages->{'LostItemFeeRefunded'} = $refunded; |
| 2076 |
$refund && |
|
|
| 2077 |
Koha::RefundLostItemFeeRules->should_refund( |
| 2078 |
{ |
| 2079 |
current_branch => C4::Context->userenv->{branch}, |
| 2080 |
item_home_branch => $item->homebranch, |
| 2081 |
item_holding_branch => $item_holding_branch |
| 2082 |
} |
| 2083 |
) |
| 2084 |
) |
| 2085 |
{ |
| 2086 |
_FixAccountForLostAndFound( $item->itemnumber, |
| 2087 |
$borrowernumber, $barcode ); |
| 2088 |
$messages->{'LostItemFeeRefunded'} = 1; |
| 2089 |
} |
| 2090 |
} |
2045 |
} |
| 2091 |
} |
2046 |
} |
| 2092 |
|
2047 |
|