@@ -, +, @@ modification 1 - Apply patches 2 - Restart all 3 - Set 'MarkLostItemsAsReturned' system preferences to 'None' 4 - Check out some items that have replacement fees set 5 - Mark them lost 6 - Check out more items, mark them withdrawn 7 - Set system preference 'BlockReturnOfWithdrawnItems' to block 8 - Enter item barcodes into batch modification 9 - Leave 'Mark items returned as blank --- Koha/BackgroundJob/BatchUpdateItem.pm | 3 +++ Koha/Items.pm | 26 +++++++++++++++++-- .../prog/en/modules/tools/batchMod-edit.tt | 16 ++++++++++++ tools/batchMod.pl | 6 +++++ 4 files changed, 49 insertions(+), 2 deletions(-) --- a/Koha/BackgroundJob/BatchUpdateItem.pm +++ a/Koha/BackgroundJob/BatchUpdateItem.pm @@ -98,6 +98,8 @@ sub process { my $new_values = $args->{new_values}; my $exclude_from_local_holds_priority = $args->{exclude_from_local_holds_priority}; + my $mark_items_returned = + $args->{mark_items_returned}; my $report = { total_records => scalar @record_ids, @@ -113,6 +115,7 @@ sub process { new_values => $new_values, exclude_from_local_holds_priority => $exclude_from_local_holds_priority, + mark_items_returned => $mark_items_returned, callback => sub { my ($progress) = @_; $self->progress($progress)->store; --- a/Koha/Items.pm +++ a/Koha/Items.pm @@ -227,6 +227,10 @@ Allows to modify existing subfield's values using a regular expression Set the passed boolean value to items.exclude_from_local_holds_priority +=item mark_items_returned + +Move issues on these items to the old issues table, do not mark items found or adjust statuses or fines + =item callback Callback function to call after an item has been modified @@ -241,6 +245,7 @@ sub batch_update { my $regex_mod = $params->{regex_mod} || {}; my $new_values = $params->{new_values} || {}; my $exclude_from_local_holds_priority = $params->{exclude_from_local_holds_priority}; + my $mark_items_returned = $params->{mark_items_returned}; my $callback = $params->{callback}; my (@modified_itemnumbers, $modified_fields); @@ -250,6 +255,7 @@ sub batch_update { try {$schema->txn_do(sub { my $modified_holds_priority = 0; + my $item_returned = 0; if ( defined $exclude_from_local_holds_priority ) { if(!defined $item->exclude_from_local_holds_priority || $item->exclude_from_local_holds_priority != $exclude_from_local_holds_priority) { $item->exclude_from_local_holds_priority($exclude_from_local_holds_priority)->store; @@ -336,9 +342,25 @@ sub batch_update { ) if $item->itemlost and not $itemlost_pre; } + if ( $mark_items_returned ){ + my $issue = $item->checkout; + if( $issue ){ + $item_returned = 1; + C4::Circulation::MarkIssueReturned( + $issue->borrowernumber, + $item->itemnumber, + undef, + $issue->patron->privacy, + { + skip_record_index => 1, + skip_holds_queue => 1, + } + ); + } + } - push @modified_itemnumbers, $item->itemnumber if $modified || $modified_holds_priority; - $modified_fields += $modified + $modified_holds_priority; + push @modified_itemnumbers, $item->itemnumber if $modified || $modified_holds_priority || $item_returned; + $modified_fields += $modified + $modified_holds_priority + $item_returned; })} catch { warn $_ --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -196,6 +196,22 @@ +