X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=labels%2Flabel-edit-batch.pl;h=8f8959760a5cbcede1b5f1828209f6cce702ecd1;hb=4669a10776ff958a3b2d51963b7c4ec90ec02f09;hp=94d56b4e726a8ca74e260dfffeb28f3718bab8fe;hpb=772ada9bf36677d335ba25f681062ef095415757;p=koha.git diff --git a/labels/label-edit-batch.pl b/labels/label-edit-batch.pl index 94d56b4e72..8f8959760a 100755 --- a/labels/label-edit-batch.pl +++ b/labels/label-edit-batch.pl @@ -27,6 +27,7 @@ use CGI; use C4::Auth qw(get_template_and_user); use C4::Output qw(output_html_with_http_headers); use C4::Branch qw(get_branch_code_from_name); +use C4::Items qw(GetItemnumberFromBarcode); use C4::Creators 1.000000; use C4::Labels 1.000000; @@ -58,6 +59,7 @@ my $op = $cgi->param('op') || 'edit'; my $batch_id = $cgi->param('element_id') || $cgi->param('batch_id') || undef; my @label_ids = $cgi->param('label_id') if $cgi->param('label_id'); my @item_numbers = $cgi->param('item_number') if $cgi->param('item_number'); +my $barcode = $cgi->param('barcode') if $cgi->param('barcode'); my $branch_code = get_branch_code_from_name($template->param('LoginBranchname')); @@ -76,6 +78,15 @@ elsif ($op eq 'delete') { $errstr = "batch $batch_id was not deleted." if $err; } elsif ($op eq 'add') { + if ($barcode) { + my @barcodes = split /\n/, $barcode; # $barcode is effectively passed in as a separated list + foreach my $number (@barcodes) { + $number =~ s/\r$//; # strip any naughty return chars + if (my $item_number = GetItemnumberFromBarcode($number)) { # we must test in case an invalid barcode is passed in; we effectively disgard them atm + push @item_numbers, $item_number; + } + } + } $batch = C4::Labels::Batch->retrieve(batch_id => $batch_id); $batch = C4::Labels::Batch->new(branch_code => $branch_code) if $batch == -2; if ($branch_code){