Bug 32019: Add option to mark items returned via batch modification
Ther are options that allow avoiding marking an issue returned when se tot lost. Libraries do this to tie a lost item to a patron clearly. Eventually, after the patron has paid, or after some time, the library may wish to delete the item. When doing so, they do not wish to check the item in and affect any statuses or fines. This is also true for withdrawn items It would be helpful to have a way to mark issues returned in bulk, when they have not been marked returned in the past To test: 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 10 - Verify nothing was checked in 11 - Repeat but set 'Mark items as returned' to 'No' 12 - Verify nothing was checked in 13 - Repeat, but set 'Mark items as returned' to 'Yes' 14 - Verify items are returned 15 - Verify no fines have been adjusted 16 - Verify withdrawn items are sitll withdrawn 17 - Verify you can now delete the items Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
356eb155bf
commit
78e144a9a0
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 $_
|
||||
|
|
|
|||
|
|
@ -195,6 +195,22 @@
|
|||
</li>
|
||||
</ol>
|
||||
</fieldset>
|
||||
<fieldset class="rows">
|
||||
<legend>Options</legend>
|
||||
<ol>
|
||||
<li>
|
||||
<div class="subfield_line">
|
||||
<p>This option allows returning items to remove them from patron accounts</br>Items are not marked found nor do statuses prevent this return. This feature is intended to allow removal and deletion of items without affecting fines or other statuses</p></br>
|
||||
<label for="mark_items_returned">Mark items returned:</label>
|
||||
<select id="mark_items_returned" name="mark_items_returned" class="input_marceditor select2" style="width: 50px">
|
||||
<option selected></option>
|
||||
<option value="1">Yes</option>
|
||||
<option value="0">No</option>
|
||||
</select>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="action">
|
||||
<input type="submit" id="mainformsubmit" class="btn btn-primary" value="Save" />
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ my $del_records = $input->param('del_records');
|
|||
my $src = $input->param('src');
|
||||
my $use_default_values = $input->param('use_default_values');
|
||||
my $exclude_from_local_holds_priority = $input->param('exclude_from_local_holds_priority');
|
||||
my $mark_items_returned = $input->param('mark_items_returned');
|
||||
|
||||
my $template_name;
|
||||
my $template_flag;
|
||||
|
|
@ -171,6 +172,11 @@ if ( $op eq "action" ) {
|
|||
)
|
||||
? $exclude_from_local_holds_priority
|
||||
: undef,
|
||||
mark_items_returned => (
|
||||
defined $mark_items_returned
|
||||
&& $mark_items_returned ne ""
|
||||
)
|
||||
? $mark_items_returned : undef,
|
||||
|
||||
};
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue