View | Details | Raw Unified | Return to bug 23114
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt (-32 / +59 lines)
Lines 42-55 Link Here
42
        <fieldset class="rows">
42
        <fieldset class="rows">
43
          <legend>Use a barcode file</legend>
43
          <legend>Use a barcode file</legend>
44
          <ol>
44
          <ol>
45
            <li><label for="uploadbarcodes">Barcode file: </label> <input type="file" id="uploadbarcodes" name="uploadbarcodes" /></li>
45
            <li><label for="uploadbarcodes">Barcode file: </label> <input type="file" id="uploadbarcodes" name="uploadbarcodes" />
46
            <li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | $KohaDates %]" class="datepicker" disabled /></li>
46
            <input type="button" id="resetuploadbarcodes" name="resetuploadbarcodes" value="Reset" /></li>
47
            <li><label for="compareinv2barcd">Compare barcodes list to results: </label><input type="checkbox" name="compareinv2barcd" id="compareinv2barcd" disabled /></li>
48
            <li><label for="dont_checkin">Do not check in items scanned during inventory: </label><input type="checkbox" name="dont_checkin" id="dont_checkin" disabled /></li>
49
            <li><label for="out_of_order">Check barcodes list for items shelved out of order: </label><input type="checkbox" name="out_of_order" id="out_of_order" disabled /></li>
50
          </ol>
47
          </ol>
51
        </fieldset>
48
        </fieldset>
52
49
        <fieldset class="rows">
50
            <legend>Or scan items one by one</legend>
51
            <ol>
52
                <li>
53
                  <label for="barcodelist">Barcode list (one barcode per line): </label>
54
                  <textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
55
                </li>
56
            </ol>
57
        </fieldset>
58
        <fieldset class="rows">
59
            <legend>Parameters</legend>
60
            <ol>
61
                <li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | $KohaDates %]" class="datepicker" disabled /></li>
62
                <li><label for="compareinv2barcd">Compare barcodes list to results: </label><input type="checkbox" name="compareinv2barcd" id="compareinv2barcd" disabled /></li>
63
                <li><label for="dont_checkin">Do not check in items scanned during inventory: </label><input type="checkbox" name="dont_checkin" id="dont_checkin" disabled /></li>
64
                <li><label for="out_of_order">Check barcodes list for items shelved out of order: </label><input type="checkbox" name="out_of_order" id="out_of_order" disabled /></li>
65
            </ol>
66
        </fieldset>
53
        <fieldset class="rows">
67
        <fieldset class="rows">
54
        <legend>Item location filters</legend>
68
        <legend>Item location filters</legend>
55
        <ol><li>
69
        <ol><li>
Lines 277-283 Link Here
277
    [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
291
    [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
278
    <script type="text/javascript">
292
    <script type="text/javascript">
279
        function checkForm() {
293
        function checkForm() {
280
            if ( $('#uploadbarcodes').val() ) {
294
            if ( $('#uploadbarcodes').val() && $('#barcodelist').val() ) {
295
                alert(_("You have uploaded a barcode file and scanned barcodes at the same time. Please choose one of the options before."));
296
                return false;
297
            }
298
            if ( $('#uploadbarcodes').val() || $('#barcodelist').val() ) {
281
                if ( !(
299
                if ( !(
282
                    $('#branchloop').val()   ||
300
                    $('#branchloop').val()   ||
283
                    $('#locationloop').val() ||
301
                    $('#locationloop').val() ||
Lines 296-301 Link Here
296
            return true;
314
            return true;
297
        }
315
        }
298
316
317
        function barcodesProvided() {
318
            if( $("#uploadbarcodes").val() || $("#barcodelist").val() ) {
319
                $("#setdate").prop('disabled',false);
320
                $("#compareinv2barcd").prop('disabled',false);
321
                $("#compareinv2barcd").attr('checked',true); // default
322
                $("#dont_checkin").prop('disabled',false);
323
                $("#out_of_order").prop('disabled',false);
324
                if( $("#compareinv2barcd").attr('checked') ) {
325
                    $("fieldset#optionalfilters").show();
326
                    $("#ignoreissued").attr('checked',true); // default
327
                } else {
328
                    $("fieldset#optionalfilters").hide();
329
                    $("#ignoreissued").attr('checked',false);
330
                }
331
            } else {
332
                $("#setdate").prop('disabled',true);
333
                $("#compareinv2barcd").prop('disabled',true);
334
                $("#compareinv2barcd").attr('checked',false);
335
                $("#dont_checkin").prop('disabled',true);
336
                $("#dont_checkin").attr('checked',false);
337
                $("#out_of_order").prop('disabled',true);
338
                $("#out_of_order").attr('checked',false);
339
                $("fieldset#optionalfilters").show();
340
            }
341
        }
342
299
        $(document).ready(function(){
343
        $(document).ready(function(){
300
            inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, {
344
            inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, {
301
                'sPaginationType': 'full_numbers',
345
                'sPaginationType': 'full_numbers',
Lines 363-395 Link Here
363
                return checkForm();
407
                return checkForm();
364
            });
408
            });
365
409
410
            $("#resetuploadbarcodes").click(function() {
411
                $("#uploadbarcodes").val("");
412
                barcodesProvided();
413
            });
414
366
            // #uploadbarcodes and #compareinv2barcd determine the behavior of
415
            // #uploadbarcodes and #compareinv2barcd determine the behavior of
367
            // the controls within the barcode fieldset and the optional filters
416
            // the controls within the barcode fieldset and the optional filters
368
            $("#uploadbarcodes").change(function() {
417
            $("#uploadbarcodes").change(barcodesProvided);
369
                if( $("#uploadbarcodes").val() ) {
418
            $("#barcodelist").on("change keyup paste", barcodesProvided);
370
                    $("#setdate").prop('disabled',false);
419
371
                    $("#compareinv2barcd").prop('disabled',false);
372
                    $("#compareinv2barcd").attr('checked',true); // default
373
                    $("#dont_checkin").prop('disabled',false);
374
                    $("#out_of_order").prop('disabled',false);
375
                    if( $("#compareinv2barcd").attr('checked') ) {
376
                        $("fieldset#optionalfilters").show();
377
                        $("#ignoreissued").attr('checked',true); // default
378
                    } else {
379
                        $("fieldset#optionalfilters").hide();
380
                        $("#ignoreissued").attr('checked',false);
381
                    }
382
                } else {
383
                    $("#setdate").prop('disabled',true);
384
                    $("#compareinv2barcd").prop('disabled',true);
385
                    $("#compareinv2barcd").attr('checked',false);
386
                    $("#dont_checkin").prop('disabled',true);
387
                    $("#dont_checkin").attr('checked',false);
388
                    $("#out_of_order").prop('disabled',true);
389
                    $("#out_of_order").attr('checked',false);
390
                    $("fieldset#optionalfilters").show();
391
                }
392
            });
393
            $("#compareinv2barcd").click(function() {
420
            $("#compareinv2barcd").click(function() {
394
                if( $("#compareinv2barcd").attr('checked') ) {
421
                if( $("#compareinv2barcd").attr('checked') ) {
395
                    $("fieldset#optionalfilters").show();
422
                    $("fieldset#optionalfilters").show();
(-)a/tools/inventory.pl (-6 / +11 lines)
Lines 24-29 use Modern::Perl; Link Here
24
use CGI qw ( -utf8 );
24
use CGI qw ( -utf8 );
25
my $input = CGI->new;
25
my $input = CGI->new;
26
my $uploadbarcodes = $input->param('uploadbarcodes');
26
my $uploadbarcodes = $input->param('uploadbarcodes');
27
my $barcodelist = $input->param('barcodelist');
27
28
28
use C4::Auth;
29
use C4::Auth;
29
use C4::Context;
30
use C4::Context;
Lines 134-140 $template->param( Link Here
134
    branch                   => $branch,
135
    branch                   => $branch,
135
    datelastseen             => $datelastseen,
136
    datelastseen             => $datelastseen,
136
    compareinv2barcd         => $compareinv2barcd,
137
    compareinv2barcd         => $compareinv2barcd,
137
    uploadedbarcodesflag     => $uploadbarcodes ? 1 : 0,
138
    uploadedbarcodesflag     => ($uploadbarcodes || $barcodelist) ? 1 : 0,
138
    ignore_waiting_holds     => $ignore_waiting_holds,
139
    ignore_waiting_holds     => $ignore_waiting_holds,
139
    class_sources            => \@class_sources,
140
    class_sources            => \@class_sources,
140
    pref_class               => $pref_class
141
    pref_class               => $pref_class
Lines 145-151 my $results = {}; Link Here
145
my @scanned_items;
146
my @scanned_items;
146
my @errorloop;
147
my @errorloop;
147
my $moddatecount = 0;
148
my $moddatecount = 0;
148
if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) {
149
if ( ($uploadbarcodes && length($uploadbarcodes) > 0) || ($barcodelist && length($barcodelist) > 0) ) {
149
    my $dbh = C4::Context->dbh;
150
    my $dbh = C4::Context->dbh;
150
    my $date = dt_from_string( scalar $input->param('setdate') );
151
    my $date = dt_from_string( scalar $input->param('setdate') );
151
    $date = output_pref ( { dt => $date, dateformat => 'iso' } );
152
    $date = output_pref ( { dt => $date, dateformat => 'iso' } );
Lines 164-172 if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) { Link Here
164
    my $err_length=0;
165
    my $err_length=0;
165
    my $err_data=0;
166
    my $err_data=0;
166
    my $lines_read=0;
167
    my $lines_read=0;
167
    binmode($uploadbarcodes, ":encoding(UTF-8)");
168
    if ($uploadbarcodes && length($uploadbarcodes) > 0) {
168
    while (my $barcode=<$uploadbarcodes>) {
169
        binmode($uploadbarcodes, ":encoding(UTF-8)");
169
        push @uploadedbarcodes, grep { /\S/ } split( /[\n\r,;|-]/, $barcode );
170
        while (my $barcode=<$uploadbarcodes>) {
171
            push @uploadedbarcodes, grep { /\S/ } split( /[\n\r,;|-]/, $barcode );
172
        }
173
    } else {
174
        push @uploadedbarcodes, split(/\s\n/, $input->param('barcodelist') );
175
        $uploadbarcodes = $barcodelist;
170
    }
176
    }
171
    for my $barcode (@uploadedbarcodes) {
177
    for my $barcode (@uploadedbarcodes) {
172
        next unless $barcode;
178
        next unless $barcode;
173
- 

Return to bug 23114