@@ -, +, @@ modification/deletion - Create a file with barcodes, itemnumbers and random lines - Use the batch item modification and deletion tools with this file --- .../prog/en/modules/tools/batchMod-del.tt | 50 ++++++++++++++------ .../prog/en/modules/tools/batchMod-edit.tt | 54 +++++++++++++++------- tools/batchMod.pl | 16 ++++--- 3 files changed, 82 insertions(+), 38 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt @@ -28,26 +28,48 @@ [% UNLESS ( action ) %] - [% IF ( notfoundbarcodes ) %] + [% IF ( notfoundbarcodes.size ) %]
- [% IF ( itemresults ) %]

Warning, the following barcodes were not found:

[% ELSE %]

Warning: no barcodes were found

[% END %] + [% IF ( itemresults ) %]

Warning, the following barcodes were not found:

[% ELSE %]

Warning: no barcodes were found

[% END %]
- - - - - - - [% FOREACH notfoundbarcode IN notfoundbarcodes %] - + + + + + [% FOREACH notfoundbarcode IN notfoundbarcodes %] + + [% END %] + +
Barcode
[% notfoundbarcode.barcode |html %]
Barcodes not found
[% notfoundbarcode |html %]
+ [% IF ( item_loop ) %] + [% UNLESS ( too_many_items ) %] +

The following barcodes were found:

[% END %] - + [% END %] + [% END %] + [% IF ( notfounditemnumbers.size ) %] +
+ [% IF ( itemresults ) %]

Warning, the following itemnumbers were not found:

[% ELSE %]

Warning: no itemnumbers were found

[% END %] +
+ + + + + + [% FOREACH notfounditemnumber IN notfounditemnumbers %] + + [% END %] +
Itemnumbers not found
[% notfounditemnumber |html %]
- [% UNLESS ( too_many_items ) %] - [% IF ( item_loop ) %]

The following barcodes were found:

[% END %] + [% IF ( item_loop ) %] + [% UNLESS ( too_many_items ) %] +

The following itemnumbers were found:

+ [% END %] [% END %] - [% END %] + [% END %] + +
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -90,24 +90,44 @@ $(document).ready(function(){ [% IF ( book_on_loan ) %]
Cannot Delete: item is checked out.
[% END %] [% IF ( book_reserved ) %]
Cannot Delete: item has a waiting hold.
[% END %] - [% IF ( notfoundbarcodes ) %] -

Warning, the following barcodes were not found:

- - - - - - [% FOREACH notfoundbarcode IN notfoundbarcodes %] - + [% IF ( notfoundbarcodes.size ) %] +

Warning, the following barcodes were not found:

+
Barcodes not found
[% notfoundbarcode.barcode |html %]
+ + + + + [% FOREACH notfoundbarcode IN notfoundbarcodes %] + + [% END %] + +
Barcodes not found
[% notfoundbarcode |html %]
+ [% IF ( item_loop ) %] + [% UNLESS ( too_many_items ) %] +

The following barcodes were found:

+ [% END %] [% END %] - - - [% IF ( item_loop ) %] - [% UNLESS ( too_many_items ) %] -

The following barcodes were found:

- [% END %] - [% END %] - [% END %] + [% END %] + [% IF ( notfounditemnumbers.size ) %] +

Warning, the following itemnumbers were not found:

+ + + + + + [% FOREACH notfounditemnumber IN notfounditemnumbers %] + + [% END %] + +
Itemnumbers not found
[% notfounditemnumber |html %]
+ [% IF ( item_loop ) %] + [% UNLESS ( too_many_items ) %] +

The following itemnumbers were found:

+ [% END %] + [% END %] + [% END %] + + --- a/tools/batchMod.pl +++ a/tools/batchMod.pl @@ -233,7 +233,7 @@ if ($op eq "action") { if ($op eq "show"){ my $filefh = $input->upload('uploadfile'); my $filecontent = $input->param('filecontent'); - my @notfoundbarcodes; + my ( @notfoundbarcodes, @notfounditemnumbers); my @contentlist; if ($filefh){ @@ -255,7 +255,9 @@ if ($op eq "show"){ } } elsif ( $filecontent eq 'itemid_file') { - @itemnumbers = @contentlist; + @itemnumbers = Koha::Items->search({ itemnumber => \@contentlist })->get_column('itemnumber'); + my %exists = map {$_=>1} @itemnumbers; + @notfounditemnumbers = grep { !$exists{$_} } @contentlist; } } else { if (defined $biblionumber){ @@ -496,11 +498,11 @@ $authorised_values_sth->finish; # what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. - $template->param(item => \@loop_data); - if (@notfoundbarcodes) { - my @notfoundbarcodesloop = map{{barcode=>$_}}@notfoundbarcodes; - $template->param(notfoundbarcodes => \@notfoundbarcodesloop); - } + $template->param( + item => \@loop_data, + notfoundbarcodes => \@notfoundbarcodes, + notfounditemnumbers => \@notfounditemnumbers + ); $nextop="action" } # -- End action="show" --