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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_extend_due_dates.tt (+6 lines)
Lines 123-128 Link Here
123
                        <input type="text" size="10" id="to" name="to_due_date" class="flatpickr" />
123
                        <input type="text" size="10" id="to" name="to_due_date" class="flatpickr" />
124
                    </li>
124
                    </li>
125
                </ol>
125
                </ol>
126
                <ol>
127
                    <li>
128
                        <label for="barcodelist">Barcode list (one barcode per line): </label>
129
                        <textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
130
                    </li>
131
                </ol>
126
            </fieldset>
132
            </fieldset>
127
            <fieldset class="rows">
133
            <fieldset class="rows">
128
                <legend>New due date:</legend>
134
                <legend>New due date:</legend>
(-)a/tools/batch_extend_due_dates.pl (-3 / +25 lines)
Lines 22-32 use Modern::Perl; Link Here
22
22
23
use CGI;
23
use CGI;
24
24
25
use C4::Auth   qw( get_template_and_user );
25
use C4::Auth        qw( get_template_and_user );
26
use C4::Output qw( output_html_with_http_headers );
26
use C4::Output      qw( output_html_with_http_headers );
27
use C4::Circulation qw( barcodedecode );
28
use C4::Context;
27
use Koha::Checkouts;
29
use Koha::Checkouts;
28
use Koha::DateUtils qw( dt_from_string );
30
use Koha::DateUtils qw( dt_from_string );
29
use Koha::Items;
31
use Koha::Items;
32
use List::MoreUtils qw( uniq );
30
33
31
my $input           = CGI->new;
34
my $input           = CGI->new;
32
my $op              = $input->param('op') // q|form|;
35
my $op              = $input->param('op') // q|form|;
Lines 50-55 if ( $op eq 'form' ) { Link Here
50
    my @categorycodes     = $input->multi_param('categorycodes');
53
    my @categorycodes     = $input->multi_param('categorycodes');
51
    my @itemtypecodes     = $input->multi_param('itemtypecodes');
54
    my @itemtypecodes     = $input->multi_param('itemtypecodes');
52
    my @branchcodes       = $input->multi_param('branchcodes');
55
    my @branchcodes       = $input->multi_param('branchcodes');
56
    my $list              = $input->param('barcodelist');
53
    my $from_due_date     = $input->param('from_due_date');
57
    my $from_due_date     = $input->param('from_due_date');
54
    my $to_due_date       = $input->param('to_due_date');
58
    my $to_due_date       = $input->param('to_due_date');
55
    my $new_hard_due_date = $input->param('new_hard_due_date');
59
    my $new_hard_due_date = $input->param('new_hard_due_date');
Lines 71-76 if ( $op eq 'form' ) { Link Here
71
    if (@branchcodes) {
75
    if (@branchcodes) {
72
        $search_params->{'me.branchcode'} = { -in => \@branchcodes };
76
        $search_params->{'me.branchcode'} = { -in => \@branchcodes };
73
    }
77
    }
78
    if ($list) {
79
        my $split_chars = C4::Context->preference('BarcodeSeparators');
80
        my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list );
81
        @barcodelist = uniq @barcodelist;
82
83
        @barcodelist = map { barcodedecode($_) } @barcodelist;
84
85
        # Note: adding lc for case insensitivity
86
        my %itemdata =
87
            map { lc( $_->{barcode} ) => $_->{itemnumber} } @{ Koha::Items->search(
88
                { barcode => { -in => \@barcodelist } },
89
                { columns => [ 'itemnumber', 'barcode' ] }
90
            )->unblessed
91
            };
92
        my @itemnumbers      = map  { exists $itemdata{ lc $_ } ? $itemdata{ lc $_ } : () } @barcodelist;
93
        my @notfoundbarcodes = grep { !exists $itemdata{ lc $_ } } @barcodelist;
94
95
        $search_params->{'itemnumber'} = { -in => \@itemnumbers };
96
    }
74
97
75
    if ( $from_due_date and $to_due_date ) {
98
    if ( $from_due_date and $to_due_date ) {
76
        my $to_due_date_endday = dt_from_string($to_due_date);
99
        my $to_due_date_endday = dt_from_string($to_due_date);
77
- 

Return to bug 27248