Bug 18657: Add the possibility to add lost items to the report

Currently the tool reports:
Incorrect not-for-loan values
Wrong place
Checked out

We should have:
Optional display of items w/o problems
Display of missing/lost items now marked found

TEST PLAN
1 - Mark an item as lost
2 - Go to tools->inventory
3 - Fill in the barcode list with the barcode of the item, notice there
  is one checkbox in "Additional options"
4 - Submit -> there should be no result
5 - Apply patches and redo 1,2&3
6 - Notice there are now 3 checkboxes in "Additional options"
7 - Click on "Add lost items to the report"
8 - Submit -> there is now one line in the report with problem "Item was lost and is now marked as found"
9 - Go to tools->inventory
10 - Click on "Add lost items to the report"
11 - Submit -> there is no line in the report
12 - Go to tools->inventory
13 - Click on "Add items without problem to the report"
11 - Submit -> there is now line in the report with an empty problem

Signed-off-by: Mathieu Saby <mathsabypro@gmail.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Baptiste Wojtkowski 2024-07-18 15:05:58 +02:00 committed by Katrin Fischer
parent 01071b2f1a
commit 175a715078
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 24 additions and 0 deletions

View file

@ -254,6 +254,10 @@
<label for="CSVexport">Export to CSV file: </label>
<input type="checkbox" name="CSVexport" id="CSVexport" />
</li>
<li>
<label for="ReportLostItems">Add losts items to the report: </label>
<input type="checkbox" name="ReportLostItems" id="ReportLostItems" />
</li>
</ol>
</fieldset>
@ -370,6 +374,8 @@
<span>No barcode</span><br/>
[% ELSIF problem.key == 'out_of_order' %]
<span>Item may be shelved out of order</span><br/>
[% ELSIF problem.key == 'lost' %]
<span>Item was lost and is now marked as found</span><br/>
[% END %]
[% END %]
</td>

View file

@ -123,6 +123,11 @@ for my $authvfield (@$statuses) {
}
}
my $report_lost_items;
if ( defined $input->param('ReportLostItems') && $input->param('ReportLostItems') eq 'on' ) {
$report_lost_items = "1";
}
# if there's a list of not for loans types selected use it rather than
# the full set.
@notforloans = @{$staton->{'items.notforloan'}} if defined $staton->{'items.notforloan'} and scalar @{$staton->{'items.notforloan'}} > 0;
@ -162,6 +167,7 @@ my $results = {};
my @scanned_items;
my @errorloop;
my $moddatecount = 0;
my @lost_items;
if ( $op eq 'cud-inventory'
&& ( ( $uploadbarcodes && length($uploadbarcodes) > 0 ) || ( $barcodelist && length($barcodelist) > 0 ) ) )
{
@ -225,6 +231,9 @@ if ( $op eq 'cud-inventory'
next;
}
# Modify date last seen for scanned items, remove lost status
if ( $item->unblessed->{itemlost} ) {
push @lost_items, $barcode;
}
$item->set({ itemlost => 0, datelastseen => $date_dt })->store;
my $item_unblessed = $item->unblessed;
$moddatecount++;
@ -335,6 +344,12 @@ for ( my $i = 0; $i < @scanned_items; $i++ ) {
$item->{problems}->{wrongplace} = 1;
additemtoresults( $item, $results );
}
# Report a lost item if asked
if ( @lost_items && ( scalar grep { $_ eq $item->{barcode} } @lost_items ) && $report_lost_items ) {
$item->{problems}->{lost} = 1;
additemtoresults( $item, $results );
}
}
# Compare barcodes with inventory list, report no_barcode and not_scanned.
@ -418,8 +433,11 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){
$errstr .= "checked out,";
} elsif( $key eq 'out_of_order' ) {
$errstr .= "shelved out of order,";
} elsif ( $key eq 'lost' ) {
$errstr .= "item was lost";
}
}
$errstr =~ s/,$//;
push @line, $errstr;
$csv->combine(@line);