Lines 1456-1485
sub AddIssue {
Link Here
|
1456 |
|
1456 |
|
1457 |
## 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. |
1458 |
if ( $item_object->itemlost ) { |
1458 |
if ( $item_object->itemlost ) { |
1459 |
my $refund = 1; |
1459 |
$item_object->set_found; |
1460 |
my $no_refund_after_days = C4::Context->preference('NoRefundOnLostReturnedItemsAge'); |
|
|
1461 |
if ($no_refund_after_days) { |
1462 |
my $today = dt_from_string(); |
1463 |
my $lost_age_in_days = |
1464 |
dt_from_string( $item_object->itemlost_on ) |
1465 |
->delta_days($today) |
1466 |
->in_units('days'); |
1467 |
|
1468 |
$refund = 0 unless ( $lost_age_in_days < $no_refund_after_days ); |
1469 |
} |
1470 |
|
1471 |
if ( |
1472 |
$refund && Koha::CirculationRules->get_lostreturn_policy( |
1473 |
{ |
1474 |
return_branch => C4::Context->userenv->{branch}, |
1475 |
item => $item_object |
1476 |
} |
1477 |
) |
1478 |
) |
1479 |
{ |
1480 |
_FixAccountForLostAndFound( $item_object->itemnumber, undef, |
1481 |
$item_object->barcode ); |
1482 |
} |
1483 |
} |
1460 |
} |
1484 |
|
1461 |
|
1485 |
$item_object->issues( ( $item_object->issues || 0 ) + 1); |
1462 |
$item_object->issues( ( $item_object->issues || 0 ) + 1); |
Lines 2057-2088
sub AddReturn {
Link Here
|
2057 |
if ( $item->itemlost ) { |
2034 |
if ( $item->itemlost ) { |
2058 |
$messages->{'WasLost'} = 1; |
2035 |
$messages->{'WasLost'} = 1; |
2059 |
unless ( C4::Context->preference("BlockReturnOfLostItems") ) { |
2036 |
unless ( C4::Context->preference("BlockReturnOfLostItems") ) { |
2060 |
my $refund = 1; |
2037 |
my $refunded = $item->set_found( |
2061 |
my $no_refund_after_days = C4::Context->preference('NoRefundOnLostReturnedItemsAge'); |
2038 |
{ |
2062 |
if ($no_refund_after_days) { |
2039 |
holdingbranch => $item_holding_branch, |
2063 |
my $today = dt_from_string(); |
2040 |
borrowernumber => $borrowernumber |
2064 |
my $lost_age_in_days = |
2041 |
} |
2065 |
dt_from_string( $item->itemlost_on ) |
2042 |
); |
2066 |
->delta_days($today) |
|
|
2067 |
->in_units('days'); |
2068 |
|
2069 |
$refund = 0 unless ( $lost_age_in_days < $no_refund_after_days ); |
2070 |
} |
2071 |
|
2043 |
|
2072 |
if ( |
2044 |
$messages->{'LostItemFeeRefunded'} = $refunded; |
2073 |
$refund && |
|
|
2074 |
Koha::CirculationRules->get_lostreturn_policy( |
2075 |
{ |
2076 |
return_branch => C4::Context->userenv->{branch}, |
2077 |
item => $item, |
2078 |
} |
2079 |
) |
2080 |
) |
2081 |
{ |
2082 |
_FixAccountForLostAndFound( $item->itemnumber, |
2083 |
$borrowernumber, $barcode ); |
2084 |
$messages->{'LostItemFeeRefunded'} = 1; |
2085 |
} |
2086 |
} |
2045 |
} |
2087 |
} |
2046 |
} |
2088 |
|
2047 |
|