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

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 1178-1184 sub GetOrder { Link Here
1178
                aqbooksellers.name        AS supplier,
1178
                aqbooksellers.name        AS supplier,
1179
                aqbooksellers.id          AS supplierid,
1179
                aqbooksellers.id          AS supplierid,
1180
                biblioitems.publishercode AS publisher,
1180
                biblioitems.publishercode AS publisher,
1181
                ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate,
1181
                ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS calculateddeliverydate,
1182
                DATE(aqbasket.closedate)  AS orderdate,
1182
                DATE(aqbasket.closedate)  AS orderdate,
1183
                aqorders.quantity - COALESCE(aqorders.quantityreceived,0)                 AS quantity_to_receive,
1183
                aqorders.quantity - COALESCE(aqorders.quantityreceived,0)                 AS quantity_to_receive,
1184
                (aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * aqorders.rrp AS subtotal,
1184
                (aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * aqorders.rrp AS subtotal,
(-)a/Koha/Acquisition/Orders.pm (-3 / +20 lines)
Lines 69-85 sub filter_by_lates { Link Here
69
69
70
    my @delivery_time_conditions;
70
    my @delivery_time_conditions;
71
    my $date_add = "DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)";
71
    my $date_add = "DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)";
72
    my @estimated_delivery_time_conditions;
72
    if ( defined $estimated_from or defined $estimated_to ) {
73
    if ( defined $estimated_from or defined $estimated_to ) {
73
        push @delivery_time_conditions, \[ "$date_add IS NOT NULL" ];
74
        push @delivery_time_conditions, \[ "$date_add IS NOT NULL" ];
75
        push @estimated_delivery_time_conditions, \[ "estimated_delivery_date IS NOT NULL" ];
74
    }
76
    }
75
    if ( defined $estimated_from ) {
77
    if ( defined $estimated_from ) {
76
        push @delivery_time_conditions, \[ "$date_add >= ?", $dtf->format_date($estimated_from) ];
78
        push @delivery_time_conditions, \[ "$date_add >= ?", $dtf->format_date($estimated_from) ];
79
        push @estimated_delivery_time_conditions, \[ "estimated_delivery_date >= ?", $dtf->format_date($estimated_from) ];
77
    }
80
    }
78
    if ( defined $estimated_to ) {
81
    if ( defined $estimated_to ) {
79
        push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date($estimated_to) ];
82
        push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date($estimated_to) ];
83
        push @estimated_delivery_time_conditions, \[ "estimated_delivery_date <= ?", $dtf->format_date($estimated_to) ];
80
    }
84
    }
81
    if ( defined $estimated_from and not defined $estimated_to ) {
85
    if ( defined $estimated_from and not defined $estimated_to ) {
82
        push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date(dt_from_string) ];
86
        push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date(dt_from_string) ];
87
        push @estimated_delivery_time_conditions, \[ "estimated_delivery_date <= ?", $dtf->format_date(dt_from_string) ];
83
    }
88
    }
84
89
85
    $self->search(
90
    $self->search(
Lines 110-116 sub filter_by_lates { Link Here
110
115
111
            # ( $branchcode ? ('borrower.branchcode')) # FIXME branch is not a filter we may not need to implement this
116
            # ( $branchcode ? ('borrower.branchcode')) # FIXME branch is not a filter we may not need to implement this
112
117
113
            ( @delivery_time_conditions ? ( -and => \@delivery_time_conditions ) : ()),
118
            ( ( @delivery_time_conditions and @estimated_delivery_time_conditions ) ?
119
                ( -or =>
120
                    [
121
                        -and => \@delivery_time_conditions,
122
                        -and => \@estimated_delivery_time_conditions
123
                    ]
124
                )
125
                : ()
126
            ),
114
            (
127
            (
115
                C4::Context->preference('IndependentBranches')
128
                C4::Context->preference('IndependentBranches')
116
                  && !C4::Context->IsSuperLibrarian
129
                  && !C4::Context->IsSuperLibrarian
Lines 122-129 sub filter_by_lates { Link Here
122
135
123
        },
136
        },
124
        {
137
        {
125
            '+select' => [\"DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)"],
138
            '+select' => [
126
            '+as' => ['estimated_delivery_date'],
139
                \"DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)",
140
            ],
141
            '+as' => [qw/
142
                calculated_estimated_delivery_date
143
            /],
127
            join => { 'basketno' => 'booksellerid' },
144
            join => { 'basketno' => 'booksellerid' },
128
            prefetch => {'basketno' => 'booksellerid'},
145
            prefetch => {'basketno' => 'booksellerid'},
129
        }
146
        }
(-)a/acqui/addorder.pl (-1 / +4 lines)
Lines 126-134 use C4::Biblio; # AddBiblio TransformKohaToMarc Link Here
126
use C4::Budgets;
126
use C4::Budgets;
127
use C4::Items;
127
use C4::Items;
128
use C4::Output;
128
use C4::Output;
129
use C4::Barcodes;
130
use Koha::DateUtils;
129
use Koha::Acquisition::Currencies;
131
use Koha::Acquisition::Currencies;
130
use Koha::Acquisition::Orders;
132
use Koha::Acquisition::Orders;
131
use C4::Barcodes;
132
133
133
### "-------------------- addorder.pl ----------"
134
### "-------------------- addorder.pl ----------"
134
135
Lines 290-295 if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { Link Here
290
        }
291
        }
291
    );
292
    );
292
293
294
    $orderinfo->{estimated_delivery_date} = $orderinfo->{estimated_delivery_date} ? dt_from_string($orderinfo->{estimated_delivery_date}) : undef;
295
293
    # if we already have $ordernumber, then it's an ordermodif
296
    # if we already have $ordernumber, then it's an ordermodif
294
    my $order = Koha::Acquisition::Order->new($orderinfo);
297
    my $order = Koha::Acquisition::Order->new($orderinfo);
295
    if ( $orderinfo->{ordernumber} ) {
298
    if ( $orderinfo->{ordernumber} ) {
(-)a/acqui/basket.pl (-1 / +2 lines)
Lines 501-512 sub get_order_infos { Link Here
501
        $line{order_object}         = $order;
501
        $line{order_object}         = $order;
502
    }
502
    }
503
503
504
505
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
504
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
506
    $line{suggestionid}         = $$suggestion{suggestionid};
505
    $line{suggestionid}         = $$suggestion{suggestionid};
507
    $line{surnamesuggestedby}   = $$suggestion{surnamesuggestedby};
506
    $line{surnamesuggestedby}   = $$suggestion{surnamesuggestedby};
508
    $line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby};
507
    $line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby};
509
508
509
    $line{estimated_delivery_date} = $order->{estimated_delivery_date};
510
510
    foreach my $key (qw(transferred_from transferred_to)) {
511
    foreach my $key (qw(transferred_from transferred_to)) {
511
        if ($line{$key}) {
512
        if ($line{$key}) {
512
            my $order = GetOrder($line{$key});
513
            my $order = GetOrder($line{$key});
(-)a/acqui/lateorders-export.pl (-1 / +1 lines)
Lines 44-50 unless ( $csv_profile_id ) { Link Here
44
        push @orders, {
44
        push @orders, {
45
                orderdate => $order->{orderdate},
45
                orderdate => $order->{orderdate},
46
                latesince => $order->{latesince},
46
                latesince => $order->{latesince},
47
                estimateddeliverydate => $order->{estimateddeliverydate},
47
                estimateddeliverydate => $order->{estimated_delivery_date} ? $order->{estimated_delivery_date} : $order->{calculateddeliverydate},
48
                supplier => $order->{supplier},
48
                supplier => $order->{supplier},
49
                supplierid => $order->{supplierid},
49
                supplierid => $order->{supplierid},
50
                title => $order->{title},
50
                title => $order->{title},
(-)a/acqui/moddeliverydate.pl (+83 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2021 Aleisha Amohia <aleisha@catalyst.net.nz>
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
=head1 NAME
21
22
moddeliverydate.pl
23
24
=head1 DESCRIPTION
25
26
Modify just the estimated delivery date of an individual order when
27
its basket is closed.
28
29
=cut
30
31
use Modern::Perl;
32
33
use CGI qw ( -utf8 );
34
use C4::Auth;
35
use C4::Output;
36
use C4::Acquisition;
37
38
use Koha::Acquisition::Booksellers;
39
use Koha::DateUtils;
40
41
my $input = CGI->new;
42
my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
43
    template_name   => 'acqui/moddeliverydate.tt',
44
    query           => $input,
45
    type            => 'intranet',
46
    flagsrequired   => { 'acquisition' => '*' },
47
    debug           => 1,
48
} );
49
50
my $op = $input->param('op');
51
my $ordernumber = $input->param('ordernumber');
52
my $referrer = $input->param('referrer') || $input->referer();
53
my $order = GetOrder($ordernumber);
54
my $basket = GetBasket($order->{basketno});
55
my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
56
57
if($op and $op eq 'save') {
58
    my $estimated_delivery_date = $input->param('estimated_delivery_date');
59
    $order->{'estimated_delivery_date'} = dt_from_string( $estimated_delivery_date );
60
    ModOrder($order);
61
    print $input->redirect($referrer);
62
    exit;
63
} else {
64
    $template->param(
65
        estimated_delivery_date => $order->{'estimated_delivery_date'}
66
    );
67
}
68
69
if($op) {
70
    $template->param($op => 1);
71
}
72
73
$template->param(
74
    basketname           => $basket->{'basketname'},
75
    basketno             => $order->{basketno},
76
    booksellerid         => $bookseller->id,
77
    booksellername       => $bookseller->name,
78
    ordernumber => $ordernumber,
79
    referrer => $referrer,
80
);
81
82
83
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/neworderempty.pl (-1 / +2 lines)
Lines 474-480 $template->param( Link Here
474
    acqcreate        => $basketobj->effective_create_items eq "ordering" ? 1 : "",
474
    acqcreate        => $basketobj->effective_create_items eq "ordering" ? 1 : "",
475
    users_ids        => join(':', @order_user_ids),
475
    users_ids        => join(':', @order_user_ids),
476
    users            => \@order_users,
476
    users            => \@order_users,
477
    (uc(C4::Context->preference("marcflavour"))) => 1
477
    (uc(C4::Context->preference("marcflavour"))) => 1,
478
    estimated_delivery_date => $data->{estimated_delivery_date},
478
);
479
);
479
480
480
output_html_with_http_headers $input, $cookie, $template->output;
481
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/installer/data/mysql/atomicupdate/bug_15348-add_aqorders.estimated_delivery_date.perl (+9 lines)
Line 0 Link Here
1
use Date::Calc qw( Add_Delta_Days );
2
$DBversion = 'XXX';
3
if( CheckVersion( $DBversion ) ) {
4
    unless( column_exists( 'aqorders', 'estimated_delivery_date' ) ) {
5
        $dbh->do(q{ ALTER TABLE aqorders ADD estimated_delivery_date date default null AFTER suppliers_report });
6
7
        NewVersion( $DBversion, 15348, "Add new column aqorders.estimated_delivery_date" );
8
    }
9
}
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 3319-3324 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
3319
  suppliers_reference_number varchar(35) default NULL, -- Suppliers unique edifact quote ref
3319
  suppliers_reference_number varchar(35) default NULL, -- Suppliers unique edifact quote ref
3320
  suppliers_reference_qualifier varchar(3) default NULL, -- Type of number above usually 'QLI'
3320
  suppliers_reference_qualifier varchar(3) default NULL, -- Type of number above usually 'QLI'
3321
  `suppliers_report` MEDIUMTEXT COLLATE utf8mb4_unicode_ci, -- reports received from suppliers
3321
  `suppliers_report` MEDIUMTEXT COLLATE utf8mb4_unicode_ci, -- reports received from suppliers
3322
  `estimated_delivery_date` date default null,
3322
  PRIMARY KEY  (`ordernumber`),
3323
  PRIMARY KEY  (`ordernumber`),
3323
  KEY `basketno` (`basketno`),
3324
  KEY `basketno` (`basketno`),
3324
  KEY `biblionumber` (`biblionumber`),
3325
  KEY `biblionumber` (`biblionumber`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (+4 lines)
Lines 412-417 Link Here
412
                        <th>GST</th>
412
                        <th>GST</th>
413
                        <th>Fund</th>
413
                        <th>Fund</th>
414
                        <th>Supplier report</th>
414
                        <th>Supplier report</th>
415
                        <th>Estimated delivery date</th>
415
                        [% IF ( active ) %]
416
                        [% IF ( active ) %]
416
                            [% UNLESS ( closedate ) %]
417
                            [% UNLESS ( closedate ) %]
417
                                <th class="NoSort">Modify</th>
418
                                <th class="NoSort">Modify</th>
Lines 439-444 Link Here
439
                        <th>[% foot_loo.tax_value | $Price %]</th>
440
                        <th>[% foot_loo.tax_value | $Price %]</th>
440
                        <th>&nbsp;</th>
441
                        <th>&nbsp;</th>
441
                        <th>&nbsp;</th>
442
                        <th>&nbsp;</th>
443
                        <th>[% foot_loo.estimated_delivery_date | $KohaDates | html %]</th>
442
                        [% IF ( active ) %]
444
                        [% IF ( active ) %]
443
                            [% UNLESS ( closedate ) %]
445
                            [% UNLESS ( closedate ) %]
444
                                <th>&nbsp;</th>
446
                                <th>&nbsp;</th>
Lines 464-469 Link Here
464
                    <th>[% total_tax_value | $Price %]</th>
466
                    <th>[% total_tax_value | $Price %]</th>
465
                    <th>&nbsp;</th>
467
                    <th>&nbsp;</th>
466
                    <th>&nbsp;</th>
468
                    <th>&nbsp;</th>
469
                    <th>[% estimated_delivery_date | $KohaDates | html %]</th>
467
                    [% IF ( active ) %]
470
                    [% IF ( active ) %]
468
                        [% UNLESS ( closedate ) %]
471
                        [% UNLESS ( closedate ) %]
469
                            <th>&nbsp;</th>
472
                            <th>&nbsp;</th>
Lines 548-553 Link Here
548
                        <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
551
                        <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
549
                        <td>[% books_loo.budget_name | html %]</td>
552
                        <td>[% books_loo.budget_name | html %]</td>
550
                        <td>[% books_loo.suppliers_report | html %]</td>
553
                        <td>[% books_loo.suppliers_report | html %]</td>
554
                        <td>[% books_loo.estimated_delivery_date | $KohaDates | html %]</td>
551
                        [% IF ( active ) %]
555
                        [% IF ( active ) %]
552
                            [% UNLESS ( closedate ) %]
556
                            [% UNLESS ( closedate ) %]
553
                            <td>
557
                            <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt (-7 / +58 lines)
Lines 89-98 Link Here
89
                <span title="[% lateorder.basket.closedate | html %]">[% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)</span>
89
                <span title="[% lateorder.basket.closedate | html %]">[% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)</span>
90
            </td>
90
            </td>
91
            <td>
91
            <td>
92
                [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
92
                [% IF lateorder.get_column('estimated_delivery_date') %]
93
                [% IF estimated_delivery_date %]
93
                    [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
94
                    <span title="[% estimated_delivery_date | html %]">[% estimated_delivery_date | $KohaDates  %]</span>
94
                [% ELSIF lateorder.get_column('calculated_estimated_delivery_date') %]
95
                    [% SET estimated_delivery_date = lateorder.get_column('calculated_estimated_delivery_date') %]
95
                [% END %]
96
                [% END %]
97
                <p class="delivery_date">
98
                    <span id="delivery_date_[% estimated_delivery_date | html %]">[% estimated_delivery_date | $KohaDates %]</span>
99
                    <a class="edit_delivery_date noExport" data-ordernumber="[% lateorder.ordernumber | html %]" href="/cgi-bin/koha/acqui/moddeliverydate.pl?ordernumber=[% lateorder.ordernumber | html %]" title="Edit delivery date">
100
                        <i class="fa fa-pencil"></i> Edit
101
                    </a>
102
                </p>
96
            </td>
103
            </td>
97
            <td>
104
            <td>
98
                [% lateorder.basket.bookseller.name | html %]
105
                [% lateorder.basket.bookseller.name | html %]
Lines 175-181 Link Here
175
      </tbody>
182
      </tbody>
176
      <tfoot>
183
      <tfoot>
177
        <tr>
184
        <tr>
178
            <th colspan="6">Total</th>
185
            <th colspan="7">Total</th>
179
            <th>[% total | $Price %]</th>
186
            <th>[% total | $Price %]</th>
180
            <th colspan="10">&nbsp;</th>
187
            <th colspan="10">&nbsp;</th>
181
        </tr>
188
        </tr>
Lines 256-262 Link Here
256
                </div>
263
                </div>
257
                <div class="modal-body">
264
                <div class="modal-body">
258
                <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
265
                <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
259
                <input type="hidden" id="ordernumber" name="ordernumber" value="" />
266
                <input type="hidden" id="notes_ordernumber" name="ordernumber" value="" />
260
                <input type="hidden" name="op" value="save" />
267
                <input type="hidden" name="op" value="save" />
261
                <input type="hidden" id="type" name="type" value="" />
268
                <input type="hidden" id="type" name="type" value="" />
262
            </div>
269
            </div>
Lines 269-274 Link Here
269
    </div>
276
    </div>
270
</div>
277
</div>
271
278
279
<!-- Modal for editing estimated delivery date -->
280
<div class="modal" id="dateEditor" tabindex="-1" role="dialog" aria-labelledby="dateEditorLabel">
281
    <div class="modal-dialog" role="document">
282
        <form id="modify_estimated_delivery_date" action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
283
            <div class="modal-content">
284
                <div class="modal-header">
285
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
286
                    <h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
287
                </div>
288
                <div class="modal-body">
289
                <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
290
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
291
                <input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
292
                <input type="hidden" name="op" value="save" />
293
            </div>
294
            <div class="modal-footer">
295
                <button type="submit" class="btn btn-default">Save</button>
296
                <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
297
            </div>
298
            </div>
299
        </form>
300
    </div>
301
</div>
302
272
[% MACRO jsinclude BLOCK %]
303
[% MACRO jsinclude BLOCK %]
273
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
304
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
274
    [% INCLUDE 'datatables.inc' %]
305
    [% INCLUDE 'datatables.inc' %]
Lines 340-346 Link Here
340
                var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
371
                var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
341
                var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
372
                var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
342
                $("#noteEditor .modal-title").text(modalTitle);
373
                $("#noteEditor .modal-title").text(modalTitle);
343
                $("#ordernumber").val( ordernumber );
374
                $("#notes_ordernumber").val( ordernumber );
344
                $("#ordernotes").html( note_text );
375
                $("#ordernotes").html( note_text );
345
                $("#type").val( note_type );
376
                $("#type").val( note_type );
346
                $("#noteEditor").modal("show");
377
                $("#noteEditor").modal("show");
Lines 351-359 Link Here
351
                $("#noteEditorLabel").html("");
382
                $("#noteEditorLabel").html("");
352
                $("#noteEditor .modal-title").text("");
383
                $("#noteEditor .modal-title").text("");
353
                $("#ordernotes").html( "" );
384
                $("#ordernotes").html( "" );
354
                $("#ordernumber").val("");
385
                $("#notes_ordernumber").val("");
355
                $("#type").val("");
386
                $("#type").val("");
356
            });
387
            });
388
389
             $("#estimated_delivery_date").datepicker();
390
391
            $(".edit_delivery_date").on("click", function(e) {
392
                e.preventDefault();
393
                var ordernumber = $(this).data("ordernumber");
394
                var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
395
                var date_text = $( "#delivery_date_" + ordernumber ).html();
396
                $("#dateEditor .modal-title").text(modalTitle);
397
                $("#date_ordernumber").val(ordernumber);
398
                $("#estimated_delivery_date").html( date_text );
399
                $("#dateEditor").modal("show");
400
            });
401
402
             $("#dateEditor").on('hidden.bs.modal', function (e) {
403
                $("#dateEditorLabel").html("");
404
                $("#dateEditor .modal-title").text("");
405
                $("#estimated_delivery_date").html( "" );
406
                $("#date_ordernumber").val("");
407
            });
357
        });
408
        });
358
    </script>
409
    </script>
359
[% END %]
410
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/moddeliverydate.tt (+45 lines)
Line 0 Link Here
1
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Acquisition &rsaquo;
4
    Change estimated delivery date
5
</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
</head>
8
9
<body id="acq_moddeliverydate" class="acq">
10
[% INCLUDE 'header.inc' %]
11
12
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisition</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Basket [% basketname | html %] ([% basketno | html %])</a> &rsaquo; Change estimated delivery date</div>
13
14
<div class="main container-fluid">
15
    <div class="row">
16
        <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
17
18
      <h1>Change estimated delivery date</h1>
19
      <form action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
20
        <fieldset class="brief">
21
          <label for="estimated_delivery_date">Estimated delivery date:</label>
22
          <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
23
          <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
24
        </fieldset>
25
        <input type="hidden" name="referrer" value="[% referrer | html %]" />
26
        <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
27
        <input type="hidden" name="op" value="save" />
28
        <fieldset class="action">
29
          <input type="submit" value="Save" />
30
          <a class="cancel" href="[% referrer | url %]">Cancel</a>
31
        </fieldset>
32
      </form>
33
  </div>
34
</div>
35
36
[% MACRO jsinclude BLOCK %]
37
    [% INCLUDE 'calendar.inc' %]
38
    <script>
39
        $(document).ready(function(){
40
            $("#estimated_delivery_date").datepicker();
41
        });
42
    </script>
43
[% END %]
44
45
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (+7 lines)
Lines 448-453 Link Here
448
                <label for="order_vendornote">Vendor note: </label>
448
                <label for="order_vendornote">Vendor note: </label>
449
                <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote" >[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
449
                <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote" >[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
450
            </li>
450
            </li>
451
            <li>
452
                <label for="estimated_delivery_date">Estimated delivery date: </label>
453
                <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
454
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
455
            </li>
451
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
456
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
452
                <label for="sort1">Statistic 1: </label>
457
                <label for="sort1">Statistic 1: </label>
453
                <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 | html %]" />
458
                <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 | html %]" />
Lines 647-652 Link Here
647
                getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
652
                getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
648
            });
653
            });
649
            $("#budget_id").change();
654
            $("#budget_id").change();
655
656
            $("#estimated_delivery_date").datepicker();
650
        });
657
        });
651
658
652
        function UserSearchPopup(f) {
659
        function UserSearchPopup(f) {
(-)a/t/db_dependent/Koha/Acquisition/Order.t (-2 / +33 lines)
Lines 389-395 subtest 'claim*' => sub { Link Here
389
};
389
};
390
390
391
subtest 'filter_by_late' => sub {
391
subtest 'filter_by_late' => sub {
392
    plan tests => 16;
392
    plan tests => 17;
393
393
394
    $schema->storage->txn_begin;
394
    $schema->storage->txn_begin;
395
    my $now        = dt_from_string;
395
    my $now        = dt_from_string;
Lines 415-420 subtest 'filter_by_late' => sub { Link Here
415
                basketno                => $basket_1->basketno,
415
                basketno                => $basket_1->basketno,
416
                datereceived            => undef,
416
                datereceived            => undef,
417
                datecancellationprinted => undef,
417
                datecancellationprinted => undef,
418
                estimated_delivery_date => undef,
418
            }
419
            }
419
        }
420
        }
420
    );
421
    );
Lines 434-439 subtest 'filter_by_late' => sub { Link Here
434
                basketno                => $basket_2->basketno,
435
                basketno                => $basket_2->basketno,
435
                datereceived            => undef,
436
                datereceived            => undef,
436
                datecancellationprinted => undef,
437
                datecancellationprinted => undef,
438
                estimated_delivery_date => undef,
437
            }
439
            }
438
        }
440
        }
439
    );
441
    );
Lines 453-458 subtest 'filter_by_late' => sub { Link Here
453
                basketno                => $basket_3->basketno,
455
                basketno                => $basket_3->basketno,
454
                datereceived            => undef,
456
                datereceived            => undef,
455
                datecancellationprinted => undef,
457
                datecancellationprinted => undef,
458
                estimated_delivery_date => undef,
456
            }
459
            }
457
        }
460
        }
458
    );
461
    );
Lines 472-477 subtest 'filter_by_late' => sub { Link Here
472
                basketno                => $basket_4->basketno,
475
                basketno                => $basket_4->basketno,
473
                datereceived            => undef,
476
                datereceived            => undef,
474
                datecancellationprinted => undef,
477
                datecancellationprinted => undef,
478
                estimated_delivery_date => undef,
475
            }
479
            }
476
        }
480
        }
477
    );
481
    );
Lines 539-544 subtest 'filter_by_late' => sub { Link Here
539
    );
543
    );
540
    is( $late_orders->count, 1 );
544
    is( $late_orders->count, 1 );
541
545
546
    my $basket_5 = $builder->build_object(    # closed today
547
        {
548
            class => 'Koha::Acquisition::Baskets',
549
            value => {
550
                booksellerid => $bookseller->id,
551
                closedate    => $now,
552
            }
553
        }
554
    );
555
    my $order_5 = $builder->build_object(
556
        {
557
            class => 'Koha::Acquisition::Orders',
558
            value => {
559
                basketno                => $basket_4->basketno,
560
                datereceived            => undef,
561
                datecancellationprinted => undef,
562
                estimated_delivery_date => $now->clone->subtract( days => 2 ),
563
            }
564
        }
565
    );
566
    $late_orders = $orders->filter_by_lates(
567
        {
568
            estimated_from => $now->clone->subtract( days => 3 ),
569
            estimated_to   => $now->clone->subtract( days => 2 )
570
        }
571
    );
572
    is( $late_orders->count, 1 );
573
542
    $schema->storage->txn_rollback;
574
    $schema->storage->txn_rollback;
543
};
575
};
544
576
545
- 

Return to bug 15348