<!-- TMPL_UNLESS name="op" -->
<form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batchMod.pl">
<fieldset class="rows">
- <legend>Use a barcode file</legend>
+ <legend>Use a file</legend>
<ol>
- <li><label for="uploadbarcodes">Barcode file: </label> <input type="file" id="uploadbarcodes" name="uploadbarcodes"></input></li>
+ <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">
<ol>
<li>
<label for="barcodelist">Barcodes list (one barcode per line): </label>
- <textarea rows="10" cols="30" name="barcodelist"></textarea>
+ <textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
</li>
</ol>
</fieldset>
use C4::Dates;
use C4::Debug;
use YAML;
+use Switch;
use MARC::File::XML;
sub find_value {
#-------------------------------------------------------------------------------
if ($op eq "show"){
- my $barcodefh = $input->upload('uploadbarcodes');
- my @barcodelist;
- if ( $barcodefh){
- while (my $barcode=<$barcodefh>){
- chomp $barcode;
- push @barcodelist, $barcode;
+ my $filefh = $input->upload('uploadfile');
+ my $filecontent = $input->{'filecontent'};
+
+ my @contentlist;
+ if ($filefh){
+ while (my $content=<$filefh>){
+ chomp $content;
+ push @contentlist, $content;
}
- }
- if ( my $list=$input->param('barcodelist')){
- push @barcodelist, split(/\s\n/, $list);
- }
- push @itemnumbers,map{GetItemnumberFromBarcode($_)} @barcodelist;
- warn Dump(@itemnumbers);
+ switch ($filecontent) {
+ case "barcode_file" {
+ push @itemnumbers,map{GetItemnumberFromBarcode($_)} @contentlist;
+ }
+
+ case "itemid_file" {
+ @itemnumbers = @contentlist;
+ }
+ }
+ } else {
+ if ( my $list=$input->param('barcodelist')){
+ push my @barcodelist, split(/\s\n/, $list);
+ push @itemnumbers,map{GetItemnumberFromBarcode($_)} @barcodelist;
+ }
+}
$items_display_hashref=BuildItemsData(@itemnumbers);
- warn Dump($items_display_hashref);
# now, build the item form for entering a new item
my @loop_data =();
# And $tag>10
sub UpdateMarcWith($$){
my ($marcfrom,$marcto)=@_;
- warn "FROM :",$marcfrom->as_formatted;
+ #warn "FROM :",$marcfrom->as_formatted;
my ( $itemtag, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", "");
my $fieldfrom=$marcfrom->field($itemtag);
my @fields_to=$marcto->field($itemtag);
$field_to_update->update($$subfield[0]=>$$subfield[1]) if ($$subfield[1]);
}
}
- warn "TO edited:",$marcto->as_formatted;
+ #warn "TO edited:",$marcto->as_formatted;
}