<div id="bd">
<div id="yui-main">
<div class="yui-b">
- show : <!-- TMPL_VAR NAME="show" --> <br />
- action : <!-- TMPL_VAR NAME="action" --><br />
- results : <!-- TMPL_VAR NAME="results" --><br />
- nextop : <!-- TMPL_VAR NAME="op" -->
<h1>Batch deletion</h1>
<!-- TMPL_IF NAME="barcode_not_unique" --><div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="no_next_barcode" --><div class="dialog alert"><strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.</div><!-- /TMPL_IF -->
<!-- TMPL_IF name="item_loop" -->
<!-- TMPL_UNLESS name="action" -->
+
+ <!-- TMPL_IF name="notfoundbarcodes" -->
+ <div class="error"><p>Warning, the following barcodes were not found :</p>
+ <table>
+ <thead>
+ <tr>
+ <th>Barcode</th>
+ </tr>
+ </thead>
+ <tbody>
+ <!-- TMPL_LOOP name="notfoundbarcodes" -->
+ <tr><td><!-- TMPL_VAR name="barcode" --></td></tr>
+ <!-- /TMPL_LOOP -->
+ </tbody>
+ </table></div>
+ <p>The following barcodes were found : </p>
+ <!-- /TMPL_IF -->
+
+
<form name="f" action="batchMod.pl" method="post">
<div id="cataloguing_additem_itemlist">
<div style="overflow:auto">
</div>
</div>
<!-- TMPL_IF name="show" -->
- <div id="cataloguing_additem_newitem">
+ <div id="cataloguing_additem_newitem">
<input type="hidden" name="op" value="<!-- TMPL_VAR NAME="op" -->" />
<p>This will delete the selected items.</p>
<input type="hidden" name="del" value="1" />
<!-- TMPL_IF name="action" -->
<p><!-- TMPL_VAR NAME="deleted_items" --> item(s) deleted.</p>
- <!-- TMPL_IF NAME="not_deleted_items" --><p><!-- TMPL_VAR NAME="not_deleted_items" --> item(s) could not be deleted : <!-- TMPL_LOOP NAME="not_deleted_itemnumbers" --><!-- TMPL_VAR NAME="itemnumber" --></p>
+ <!-- TMPL_IF NAME="not_deleted_items" -->
+ <p><!-- TMPL_VAR NAME="not_deleted_items" --> item(s) could not be deleted : <!-- TMPL_LOOP NAME="not_deleted_itemnumbers" --><!-- TMPL_VAR NAME="itemnumber" --><!-- /TMPL_LOOP --></p>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="not_deleted_loop" -->
+ <table id="itemst">
+ <thead>
+ <tr>
+ <th>Itemnumber</th>
+ <th>Barcode</th>
+ <th>Reason</th>
+ </tr>
+ </thead>
+ <tbody>
+ <!-- TMPL_LOOP name="not_deleted_loop" -->
+ <tr>
+ <td><!-- TMPL_VAR name="itemnumber" --></td>
+ <td><!-- TMPL_VAR name="barcode" --></td>
+ <td><!-- TMPL_IF name="book_on_loan" -->Item is checked out<!-- TMPL_ELSIF name="book_reserved" -->Item has a waiting hold<!-- /TMPL_IF --></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </tbody>
+ </table>
+
+ <!-- /TMPL_IF -->
+
+ <p><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Back</a></p>
<!-- /TMPL_IF -->
</div>
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
- <!-- TMPL_IF name="del" -->
- <a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Delete batches of notices</a>
- <!-- TMPL_ELSE -->
<a href="/cgi-bin/koha/tools/batchMod.pl">Modify batches of notices</a>
- <!-- /TMPL_IF -->
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
- <h1>Batch <!-- TMPL_IF name="del" -->deletion<!-- TMPL_ELSE -->modification<!-- /TMPL_IF --></h1>
- <!-- TMPL_UNLESS name="op" -->
- <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batchMod.pl">
- <fieldset class="rows">
- <legend>Use a file</legend>
- <ol>
- <li>
- <label for="barcode_file">Barcodes file</label><input type="radio" name="filecontent" value="barcode_file" id="barcode_file" checked="checked" /><br />
- <label for="itemid_file">Item Id's file</label><input type="radio" name="filecontent" value="itemid_file" id="itemid_file" />
- </li>
- <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile"></input></li>
- </ol>
- </fieldset>
- <fieldset class="rows">
- <legend>Or scan items one-by-one</legend>
- <ol>
- <li>
- <label for="barcodelist">Barcodes list (one barcode per line): </label>
- <textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
- </li>
- </ol>
- </fieldset>
- <input type="hidden" name="op" value="show" />
- <!-- TMPL_IF name="del" --><input type="hidden" name="del" value="1" /><!-- /TMPL_IF -->
- <fieldset class="action">
- <input type="submit" value="Continue" class="button" />
- </fieldset>
- </form>
- </div>
- <!-- /TMPL_UNLESS -->
+ <h1>Batch modification</h1>
<!-- TMPL_IF NAME="barcode_not_unique" --><div class="dialog alert"><strong>Error saving item</strong>: Barcode must be unique.</div><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="no_next_barcode" --><div class="dialog alert"><strong>Error saving items</strong>: Unable to automatically determine values for barcodes. No item has been inserted.</div><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="book_on_loan" --><div class="dialog alert"><strong>Cannot Delete</strong>: item is checked out.</div><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="book_reserved" --><div class="dialogalert"><strong>Cannot Delete</strong>: item has a waiting hold.</div><!-- /TMPL_IF -->
+ <!-- TMPL_IF name="notfoundbarcodes" -->
+ <div class="error"><p>Warning, the following barcodes were not found :</p>
+ <table>
+ <thead>
+ <tr>
+ <th>Barcode</th>
+ </tr>
+ </thead>
+ <tbody>
+ <!-- TMPL_LOOP name="notfoundbarcodes" -->
+ <tr><td><!-- TMPL_VAR name="barcode" --></td></td>
+ <!-- /TMPL_LOOP -->
+ </tbody>
+ </table></div>
+ <p>The following barcodes were found : </p>
+ <!-- /TMPL_IF -->
+
<!-- TMPL_IF name="item_loop" -->
<form name="f" action="batchMod.pl" method="post">
<div id="cataloguing_additem_itemlist">
<!-- TMPL_IF name="show" -->
<div id="cataloguing_additem_newitem">
<input type="hidden" name="op" value="<!-- TMPL_VAR NAME="op" -->" />
- <!-- TMPL_IF name="del" -->
- <p>This will delete the selected items.</p>
- <input type="hidden" name="del" value="1" />
- <!-- TMPL_ELSE -->
<h2>Edit Items</h2>
<fieldset class="rows">
<ol>
<!-- /TMPL_LOOP -->
</ol>
</fieldset>
- <!-- /TMPL_IF -->
<fieldset class="action">
<input type="submit" name="submit" value="Go" />
</fieldset>
</div>
<!-- TMPL_ELSE --> <!-- // ACTION -->
- <!-- TMPL_IF NAME="del" -->
- <p><!-- TMPL_VAR NAME="deleted_items" --> item(s) deleted.</p>
- <!-- TMPL_IF NAME="not_deleted_items" --><p><!-- TMPL_VAR NAME="not_deleted_items" --> item(s) could not be deleted.<p>
- <!-- TMPL_ELSE -->
<h3>No results!</h3>
<a href="javascript:window.history.back()">Go back</a>
- <!-- /TMPL_IF -->
<!-- /TMPL_IF -->
</div>
$deleted_items++;
} else {
$not_deleted_items++;
- push @not_deleted, $itemdata->{'itemnumber'};
+ push @not_deleted, { itemnumber => $itemdata->{'itemnumber'}, barcode => $itemdata->{'barcode'}, title => $itemdata->{'title'}, $return => 1 };
}
} else {
my $localmarcitem=Item2Marc($itemdata);
if ($op eq "show"){
my $filefh = $input->upload('uploadfile');
my $filecontent = $input->param('filecontent');
+ my @notfoundbarcodes;
my @contentlist;
if ($filefh){
switch ($filecontent) {
case "barcode_file" {
- push @itemnumbers,map{GetItemnumberFromBarcode($_)} @contentlist;
- # Remove not found barcodes
- @itemnumbers = grep(!/^$/, @itemnumbers);
+ foreach my $barcode (@contentlist) {
+
+ my $itemnumber = GetItemnumberFromBarcode($barcode);
+ if ($itemnumber) {
+ push @itemnumbers,$itemnumber;
+ } else {
+ push @notfoundbarcodes, $barcode;
+ }
+ }
+
}
case "itemid_file" {
} else {
if ( my $list=$input->param('barcodelist')){
push my @barcodelist, split(/\s\n/, $list);
- push @itemnumbers,map{GetItemnumberFromBarcode($_)} @barcodelist;
- # Remove not found barcodes
- @itemnumbers = grep(!/^$/, @itemnumbers);
+
+ foreach my $barcode (@barcodelist) {
+
+ my $itemnumber = GetItemnumberFromBarcode($barcode);
+ if ($itemnumber) {
+ push @itemnumbers,$itemnumber;
+ } else {
+ push @notfoundbarcodes, $barcode;
+ }
+ }
}
}
# 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);
+ }
$nextop="action"
} # -- End action="show"
if ($op eq "action") {
- my @not_deleted_loop = map{{itemnumber=>$_}}@not_deleted;
+ #my @not_deleted_loop = map{{itemnumber=>$_}}@not_deleted;
$template->param(
not_deleted_items => $not_deleted_items,
deleted_items => $deleted_items,
- not_deleted_itemnumbers => \@not_deleted_loop
+ not_deleted_loop => \@not_deleted
);
}