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 276-282 Link Here
276
    [% INCLUDE 'calendar.inc' %]
290
    [% INCLUDE 'calendar.inc' %]
277
    <script type="text/javascript">
291
    <script type="text/javascript">
278
        function checkForm() {
292
        function checkForm() {
279
            if ( $('#uploadbarcodes').val() ) {
293
            if ( $('#uploadbarcodes').val() && $('#barcodelist').val() ) {
294
                alert(_("You have uploaded a barcode file and scanned barcodes at the same time. Please choose one of the options before."));
295
                return false;
296
            }
297
            if ( $('#uploadbarcodes').val() || $('#barcodelist').val() ) {
280
                if ( !(
298
                if ( !(
281
                    $('#branchloop').val()   ||
299
                    $('#branchloop').val()   ||
282
                    $('#locationloop').val() ||
300
                    $('#locationloop').val() ||
Lines 295-300 Link Here
295
            return true;
313
            return true;
296
        }
314
        }
297
315
316
        function barcodesProvided() {
317
            if( $("#uploadbarcodes").val() || $("#barcodelist").val() ) {
318
                $("#setdate").prop('disabled',false);
319
                $("#compareinv2barcd").prop('disabled',false);
320
                $("#compareinv2barcd").attr('checked',true); // default
321
                $("#dont_checkin").prop('disabled',false);
322
                $("#out_of_order").prop('disabled',false);
323
                if( $("#compareinv2barcd").attr('checked') ) {
324
                    $("fieldset#optionalfilters").show();
325
                    $("#ignoreissued").attr('checked',true); // default
326
                } else {
327
                    $("fieldset#optionalfilters").hide();
328
                    $("#ignoreissued").attr('checked',false);
329
                }
330
            } else {
331
                $("#setdate").prop('disabled',true);
332
                $("#compareinv2barcd").prop('disabled',true);
333
                $("#compareinv2barcd").attr('checked',false);
334
                $("#dont_checkin").prop('disabled',true);
335
                $("#dont_checkin").attr('checked',false);
336
                $("#out_of_order").prop('disabled',true);
337
                $("#out_of_order").attr('checked',false);
338
                $("fieldset#optionalfilters").show();
339
            }
340
        }
341
298
        $(document).ready(function(){
342
        $(document).ready(function(){
299
            inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, {
343
            inventorydt = $('#inventoryt').dataTable($.extend(true, {}, dataTablesDefaults, {
300
                'sPaginationType': 'full_numbers',
344
                'sPaginationType': 'full_numbers',
Lines 367-399 Link Here
367
                return checkForm();
411
                return checkForm();
368
            });
412
            });
369
413
414
            $("#resetuploadbarcodes").click(function() {
415
                $("#uploadbarcodes").val("");
416
                barcodesProvided();
417
            });
418
370
            // #uploadbarcodes and #compareinv2barcd determine the behavior of
419
            // #uploadbarcodes and #compareinv2barcd determine the behavior of
371
            // the controls within the barcode fieldset and the optional filters
420
            // the controls within the barcode fieldset and the optional filters
372
            $("#uploadbarcodes").change(function() {
421
            $("#uploadbarcodes").change(barcodesProvided);
373
                if( $("#uploadbarcodes").val() ) {
422
            $("#barcodelist").on("change keyup paste", barcodesProvided);
374
                    $("#setdate").prop('disabled',false);
423
375
                    $("#compareinv2barcd").prop('disabled',false);
376
                    $("#compareinv2barcd").attr('checked',true); // default
377
                    $("#dont_checkin").prop('disabled',false);
378
                    $("#out_of_order").prop('disabled',false);
379
                    if( $("#compareinv2barcd").attr('checked') ) {
380
                        $("fieldset#optionalfilters").show();
381
                        $("#ignoreissued").attr('checked',true); // default
382
                    } else {
383
                        $("fieldset#optionalfilters").hide();
384
                        $("#ignoreissued").attr('checked',false);
385
                    }
386
                } else {
387
                    $("#setdate").prop('disabled',true);
388
                    $("#compareinv2barcd").prop('disabled',true);
389
                    $("#compareinv2barcd").attr('checked',false);
390
                    $("#dont_checkin").prop('disabled',true);
391
                    $("#dont_checkin").attr('checked',false);
392
                    $("#out_of_order").prop('disabled',true);
393
                    $("#out_of_order").attr('checked',false);
394
                    $("fieldset#optionalfilters").show();
395
                }
396
            });
397
            $("#compareinv2barcd").click(function() {
424
            $("#compareinv2barcd").click(function() {
398
                if( $("#compareinv2barcd").attr('checked') ) {
425
                if( $("#compareinv2barcd").attr('checked') ) {
399
                    $("fieldset#optionalfilters").show();
426
                    $("fieldset#optionalfilters").show();
(-)a/tools/inventory.pl (-7 / +12 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 133-139 $template->param( Link Here
133
    branch                   => $branch,
134
    branch                   => $branch,
134
    datelastseen             => $datelastseen,
135
    datelastseen             => $datelastseen,
135
    compareinv2barcd         => $compareinv2barcd,
136
    compareinv2barcd         => $compareinv2barcd,
136
    uploadedbarcodesflag     => $uploadbarcodes ? 1 : 0,
137
    uploadedbarcodesflag     => ($uploadbarcodes || $barcodelist) ? 1 : 0,
137
    ignore_waiting_holds     => $ignore_waiting_holds,
138
    ignore_waiting_holds     => $ignore_waiting_holds,
138
    class_sources            => \@class_sources,
139
    class_sources            => \@class_sources,
139
    pref_class               => $pref_class
140
    pref_class               => $pref_class
Lines 144-150 my $results = {}; Link Here
144
my @scanned_items;
145
my @scanned_items;
145
my @errorloop;
146
my @errorloop;
146
my $moddatecount = 0;
147
my $moddatecount = 0;
147
if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) {
148
if ( ($uploadbarcodes && length($uploadbarcodes) > 0) || ($barcodelist && length($barcodelist) > 0) ) {
148
    my $dbh = C4::Context->dbh;
149
    my $dbh = C4::Context->dbh;
149
    my $date = dt_from_string( scalar $input->param('setdate') );
150
    my $date = dt_from_string( scalar $input->param('setdate') );
150
    $date = output_pref ( { dt => $date, dateformat => 'iso' } );
151
    $date = output_pref ( { dt => $date, dateformat => 'iso' } );
Lines 163-172 if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) { Link Here
163
    my $err_length=0;
164
    my $err_length=0;
164
    my $err_data=0;
165
    my $err_data=0;
165
    my $lines_read=0;
166
    my $lines_read=0;
166
    binmode($uploadbarcodes, ":encoding(UTF-8)");
167
    if ($uploadbarcodes && length($uploadbarcodes) > 0) {
167
    while (my $barcode=<$uploadbarcodes>) {
168
        binmode($uploadbarcodes, ":encoding(UTF-8)");
168
        my $split_chars = C4::Context->preference('BarcodeSeparators');
169
        while (my $barcode=<$uploadbarcodes>) {
169
        push @uploadedbarcodes, grep { /\S/ } split( /[$split_chars]/, $barcode );
170
            my $split_chars = C4::Context->preference('BarcodeSeparators');
171
            push @uploadedbarcodes, grep { /\S/ } split( /[$split_chars]/, $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