|
Lines 1492-1521
sub AddIssue {
Link Here
|
| 1492 |
|
1492 |
|
| 1493 |
## If item was lost, it has now been found, reverse any list item charges if necessary. |
1493 |
## If item was lost, it has now been found, reverse any list item charges if necessary. |
| 1494 |
if ( $item_object->itemlost ) { |
1494 |
if ( $item_object->itemlost ) { |
| 1495 |
my $refund = 1; |
1495 |
$item_object->set_found; |
| 1496 |
my $no_refund_after_days = C4::Context->preference('NoRefundOnLostReturnedItemsAge'); |
|
|
| 1497 |
if ($no_refund_after_days) { |
| 1498 |
my $today = dt_from_string(); |
| 1499 |
my $lost_age_in_days = |
| 1500 |
dt_from_string( $item_object->itemlost_on ) |
| 1501 |
->delta_days($today) |
| 1502 |
->in_units('days'); |
| 1503 |
|
| 1504 |
$refund = 0 unless ( $lost_age_in_days < $no_refund_after_days ); |
| 1505 |
} |
| 1506 |
|
| 1507 |
if ( |
| 1508 |
$refund && Koha::CirculationRules->get_lostreturn_policy( |
| 1509 |
{ |
| 1510 |
return_branch => C4::Context->userenv->{branch}, |
| 1511 |
item => $item_object |
| 1512 |
} |
| 1513 |
) |
| 1514 |
) |
| 1515 |
{ |
| 1516 |
_FixAccountForLostAndFound( $item_object->itemnumber, undef, |
| 1517 |
$item_object->barcode ); |
| 1518 |
} |
| 1519 |
} |
1496 |
} |
| 1520 |
|
1497 |
|
| 1521 |
$item_object->issues( ( $item_object->issues || 0 ) + 1); |
1498 |
$item_object->issues( ( $item_object->issues || 0 ) + 1); |
|
Lines 2093-2124
sub AddReturn {
Link Here
|
| 2093 |
if ( $item->itemlost ) { |
2070 |
if ( $item->itemlost ) { |
| 2094 |
$messages->{'WasLost'} = 1; |
2071 |
$messages->{'WasLost'} = 1; |
| 2095 |
unless ( C4::Context->preference("BlockReturnOfLostItems") ) { |
2072 |
unless ( C4::Context->preference("BlockReturnOfLostItems") ) { |
| 2096 |
my $refund = 1; |
2073 |
my $refunded = $item->set_found( |
| 2097 |
my $no_refund_after_days = C4::Context->preference('NoRefundOnLostReturnedItemsAge'); |
2074 |
{ |
| 2098 |
if ($no_refund_after_days) { |
2075 |
holdingbranch => $item_holding_branch, |
| 2099 |
my $today = dt_from_string(); |
2076 |
borrowernumber => $borrowernumber |
| 2100 |
my $lost_age_in_days = |
2077 |
} |
| 2101 |
dt_from_string( $item->itemlost_on ) |
2078 |
); |
| 2102 |
->delta_days($today) |
|
|
| 2103 |
->in_units('days'); |
| 2104 |
|
| 2105 |
$refund = 0 unless ( $lost_age_in_days < $no_refund_after_days ); |
| 2106 |
} |
| 2107 |
|
2079 |
|
| 2108 |
if ( |
2080 |
$messages->{'LostItemFeeRefunded'} = $refunded; |
| 2109 |
$refund && |
|
|
| 2110 |
Koha::CirculationRules->get_lostreturn_policy( |
| 2111 |
{ |
| 2112 |
return_branch => C4::Context->userenv->{branch}, |
| 2113 |
item => $item, |
| 2114 |
} |
| 2115 |
) |
| 2116 |
) |
| 2117 |
{ |
| 2118 |
_FixAccountForLostAndFound( $item->itemnumber, |
| 2119 |
$borrowernumber, $barcode ); |
| 2120 |
$messages->{'LostItemFeeRefunded'} = 1; |
| 2121 |
} |
| 2122 |
} |
2081 |
} |
| 2123 |
} |
2082 |
} |
| 2124 |
|
2083 |
|