Lines 1510-1539
sub AddIssue {
Link Here
|
1510 |
|
1510 |
|
1511 |
## If item was lost, it has now been found, reverse any list item charges if necessary. |
1511 |
## If item was lost, it has now been found, reverse any list item charges if necessary. |
1512 |
if ( $item_object->itemlost ) { |
1512 |
if ( $item_object->itemlost ) { |
1513 |
my $refund = 1; |
1513 |
$item_object->set_found; |
1514 |
my $no_refund_after_days = C4::Context->preference('NoRefundOnLostReturnedItemsAge'); |
|
|
1515 |
if ($no_refund_after_days) { |
1516 |
my $today = dt_from_string(); |
1517 |
my $lost_age_in_days = |
1518 |
dt_from_string( $item_object->itemlost_on ) |
1519 |
->delta_days($today) |
1520 |
->in_units('days'); |
1521 |
|
1522 |
$refund = 0 unless ( $lost_age_in_days < $no_refund_after_days ); |
1523 |
} |
1524 |
|
1525 |
if ( |
1526 |
$refund && Koha::CirculationRules->get_lostreturn_policy( |
1527 |
{ |
1528 |
return_branch => C4::Context->userenv->{branch}, |
1529 |
item => $item_object |
1530 |
} |
1531 |
) |
1532 |
) |
1533 |
{ |
1534 |
_FixAccountForLostAndFound( $item_object->itemnumber, undef, |
1535 |
$item_object->barcode ); |
1536 |
} |
1537 |
} |
1514 |
} |
1538 |
|
1515 |
|
1539 |
$item_object->issues( ( $item_object->issues || 0 ) + 1); |
1516 |
$item_object->issues( ( $item_object->issues || 0 ) + 1); |
Lines 2068-2099
sub AddReturn {
Link Here
|
2068 |
if ( $item->itemlost ) { |
2045 |
if ( $item->itemlost ) { |
2069 |
$messages->{'WasLost'} = 1; |
2046 |
$messages->{'WasLost'} = 1; |
2070 |
unless ( C4::Context->preference("BlockReturnOfLostItems") ) { |
2047 |
unless ( C4::Context->preference("BlockReturnOfLostItems") ) { |
2071 |
my $refund = 1; |
2048 |
my $refunded = $item->set_found( |
2072 |
my $no_refund_after_days = C4::Context->preference('NoRefundOnLostReturnedItemsAge'); |
2049 |
{ |
2073 |
if ($no_refund_after_days) { |
2050 |
holdingbranch => $item_holding_branch, |
2074 |
my $today = dt_from_string(); |
2051 |
borrowernumber => $borrowernumber |
2075 |
my $lost_age_in_days = |
2052 |
} |
2076 |
dt_from_string( $item->itemlost_on ) |
2053 |
); |
2077 |
->delta_days($today) |
|
|
2078 |
->in_units('days'); |
2079 |
|
2080 |
$refund = 0 unless ( $lost_age_in_days < $no_refund_after_days ); |
2081 |
} |
2082 |
|
2054 |
|
2083 |
if ( |
2055 |
$messages->{'LostItemFeeRefunded'} = $refunded; |
2084 |
$refund && |
|
|
2085 |
Koha::CirculationRules->get_lostreturn_policy( |
2086 |
{ |
2087 |
return_branch => C4::Context->userenv->{branch}, |
2088 |
item => $item, |
2089 |
} |
2090 |
) |
2091 |
) |
2092 |
{ |
2093 |
_FixAccountForLostAndFound( $item->itemnumber, |
2094 |
$borrowernumber, $barcode ); |
2095 |
$messages->{'LostItemFeeRefunded'} = 1; |
2096 |
} |
2097 |
} |
2056 |
} |
2098 |
} |
2057 |
} |
2099 |
|
2058 |
|