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

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 1244-1250 sub GetOrder { Link Here
1244
                aqbooksellers.name        AS supplier,
1244
                aqbooksellers.name        AS supplier,
1245
                aqbooksellers.id          AS supplierid,
1245
                aqbooksellers.id          AS supplierid,
1246
                biblioitems.publishercode AS publisher,
1246
                biblioitems.publishercode AS publisher,
1247
                ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate,
1247
                ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS calculateddeliverydate,
1248
                DATE(aqbasket.closedate)  AS orderdate,
1248
                DATE(aqbasket.closedate)  AS orderdate,
1249
                aqorders.quantity - COALESCE(aqorders.quantityreceived,0)                 AS quantity_to_receive,
1249
                aqorders.quantity - COALESCE(aqorders.quantityreceived,0)                 AS quantity_to_receive,
1250
                (aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * aqorders.rrp AS subtotal,
1250
                (aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * aqorders.rrp AS subtotal,
(-)a/Koha/Acquisition/Orders.pm (-3 / +20 lines)
Lines 70-86 sub filter_by_lates { Link Here
70
70
71
    my @delivery_time_conditions;
71
    my @delivery_time_conditions;
72
    my $date_add = "DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)";
72
    my $date_add = "DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)";
73
    my @estimated_delivery_time_conditions;
73
    if ( defined $estimated_from or defined $estimated_to ) {
74
    if ( defined $estimated_from or defined $estimated_to ) {
74
        push @delivery_time_conditions, \[ "$date_add IS NOT NULL" ];
75
        push @delivery_time_conditions, \[ "$date_add IS NOT NULL" ];
76
        push @estimated_delivery_time_conditions, \[ "estimated_delivery_date IS NOT NULL" ];
75
    }
77
    }
76
    if ( defined $estimated_from ) {
78
    if ( defined $estimated_from ) {
77
        push @delivery_time_conditions, \[ "$date_add >= ?", $dtf->format_date($estimated_from) ];
79
        push @delivery_time_conditions, \[ "$date_add >= ?", $dtf->format_date($estimated_from) ];
80
        push @estimated_delivery_time_conditions, \[ "estimated_delivery_date >= ?", $dtf->format_date($estimated_from) ];
78
    }
81
    }
79
    if ( defined $estimated_to ) {
82
    if ( defined $estimated_to ) {
80
        push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date($estimated_to) ];
83
        push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date($estimated_to) ];
84
        push @estimated_delivery_time_conditions, \[ "estimated_delivery_date <= ?", $dtf->format_date($estimated_to) ];
81
    }
85
    }
82
    if ( defined $estimated_from and not defined $estimated_to ) {
86
    if ( defined $estimated_from and not defined $estimated_to ) {
83
        push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date(dt_from_string) ];
87
        push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date(dt_from_string) ];
88
        push @estimated_delivery_time_conditions, \[ "estimated_delivery_date <= ?", $dtf->format_date(dt_from_string) ];
84
    }
89
    }
85
90
86
    $self->search(
91
    $self->search(
Lines 111-117 sub filter_by_lates { Link Here
111
116
112
            # ( $branchcode ? ('borrower.branchcode')) # FIXME branch is not a filter we may not need to implement this
117
            # ( $branchcode ? ('borrower.branchcode')) # FIXME branch is not a filter we may not need to implement this
113
118
114
            ( @delivery_time_conditions ? ( -and => \@delivery_time_conditions ) : ()),
119
            ( ( @delivery_time_conditions and @estimated_delivery_time_conditions ) ?
120
                ( -or =>
121
                    [
122
                        -and => \@delivery_time_conditions,
123
                        -and => \@estimated_delivery_time_conditions
124
                    ]
125
                )
126
                : ()
127
            ),
115
            (
128
            (
116
                C4::Context->preference('IndependentBranches')
129
                C4::Context->preference('IndependentBranches')
117
                  && !C4::Context->IsSuperLibrarian
130
                  && !C4::Context->IsSuperLibrarian
Lines 123-130 sub filter_by_lates { Link Here
123
136
124
        },
137
        },
125
        {
138
        {
126
            '+select' => [\"DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)"],
139
            '+select' => [
127
            '+as' => ['estimated_delivery_date'],
140
                \"DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)",
141
            ],
142
            '+as' => [qw/
143
                calculated_estimated_delivery_date
144
            /],
128
            join => { 'basketno' => 'booksellerid' },
145
            join => { 'basketno' => 'booksellerid' },
129
            prefetch => {'basketno' => 'booksellerid'},
146
            prefetch => {'basketno' => 'booksellerid'},
130
        }
147
        }
(-)a/acqui/addorder.pl (+3 lines)
Lines 132-137 use Koha::Acquisition::Currencies; Link Here
132
use Koha::Acquisition::Orders;
132
use Koha::Acquisition::Orders;
133
use Koha::Acquisition::Baskets;
133
use Koha::Acquisition::Baskets;
134
use C4::Barcodes;
134
use C4::Barcodes;
135
use Koha::DateUtils;
135
136
136
### "-------------------- addorder.pl ----------"
137
### "-------------------- addorder.pl ----------"
137
138
Lines 293-298 if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { Link Here
293
        }
294
        }
294
    );
295
    );
295
296
297
    $orderinfo->{estimated_delivery_date} = $orderinfo->{estimated_delivery_date} ? dt_from_string($orderinfo->{estimated_delivery_date}) : undef;
298
296
    # if we already have $ordernumber, then it's an ordermodif
299
    # if we already have $ordernumber, then it's an ordermodif
297
    my $order = Koha::Acquisition::Order->new($orderinfo);
300
    my $order = Koha::Acquisition::Order->new($orderinfo);
298
    if ( $orderinfo->{ordernumber} ) {
301
    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 476-482 $template->param( Link Here
476
    acqcreate        => $basketobj->effective_create_items eq "ordering" ? 1 : "",
476
    acqcreate        => $basketobj->effective_create_items eq "ordering" ? 1 : "",
477
    users_ids        => join(':', @order_user_ids),
477
    users_ids        => join(':', @order_user_ids),
478
    users            => \@order_users,
478
    users            => \@order_users,
479
    (uc(C4::Context->preference("marcflavour"))) => 1
479
    (uc(C4::Context->preference("marcflavour"))) => 1,
480
    estimated_delivery_date => $data->{estimated_delivery_date},
480
);
481
);
481
482
482
output_html_with_http_headers $input, $cookie, $template->output;
483
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 671-676 CREATE TABLE `aqorders` ( Link Here
671
  `suppliers_reference_number` varchar(35) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
671
  `suppliers_reference_number` varchar(35) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
672
  `suppliers_reference_qualifier` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
672
  `suppliers_reference_qualifier` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
673
  `suppliers_report` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'reports received from suppliers',
673
  `suppliers_report` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'reports received from suppliers',
674
  `estimated_delivery_date` date default null,
674
  PRIMARY KEY (`ordernumber`),
675
  PRIMARY KEY (`ordernumber`),
675
  KEY `basketno` (`basketno`),
676
  KEY `basketno` (`basketno`),
676
  KEY `biblionumber` (`biblionumber`),
677
  KEY `biblionumber` (`biblionumber`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (+4 lines)
Lines 434-439 Link Here
434
                        <th>GST</th>
434
                        <th>GST</th>
435
                        <th>Fund</th>
435
                        <th>Fund</th>
436
                        <th>Supplier report</th>
436
                        <th>Supplier report</th>
437
                        <th>Estimated delivery date</th>
437
                        [% IF ( active ) %]
438
                        [% IF ( active ) %]
438
                            [% UNLESS ( closedate ) %]
439
                            [% UNLESS ( closedate ) %]
439
                                <th class="NoSort">Modify</th>
440
                                <th class="NoSort">Modify</th>
Lines 461-466 Link Here
461
                        <th>[% foot_loo.tax_value | $Price %]</th>
462
                        <th>[% foot_loo.tax_value | $Price %]</th>
462
                        <th>&nbsp;</th>
463
                        <th>&nbsp;</th>
463
                        <th>&nbsp;</th>
464
                        <th>&nbsp;</th>
465
                        <th>[% foot_loo.estimated_delivery_date | $KohaDates | html %]</th>
464
                        [% IF ( active ) %]
466
                        [% IF ( active ) %]
465
                            [% UNLESS ( closedate ) %]
467
                            [% UNLESS ( closedate ) %]
466
                                <th>&nbsp;</th>
468
                                <th>&nbsp;</th>
Lines 486-491 Link Here
486
                    <th>[% total_tax_value | $Price %]</th>
488
                    <th>[% total_tax_value | $Price %]</th>
487
                    <th>&nbsp;</th>
489
                    <th>&nbsp;</th>
488
                    <th>&nbsp;</th>
490
                    <th>&nbsp;</th>
491
                    <th>[% estimated_delivery_date | $KohaDates | html %]</th>
489
                    [% IF ( active ) %]
492
                    [% IF ( active ) %]
490
                        [% UNLESS ( closedate ) %]
493
                        [% UNLESS ( closedate ) %]
491
                            <th>&nbsp;</th>
494
                            <th>&nbsp;</th>
Lines 570-575 Link Here
570
                        <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
573
                        <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
571
                        <td>[% books_loo.budget_name | html %]</td>
574
                        <td>[% books_loo.budget_name | html %]</td>
572
                        <td>[% books_loo.suppliers_report | html %]</td>
575
                        <td>[% books_loo.suppliers_report | html %]</td>
576
                        <td>[% books_loo.estimated_delivery_date | $KohaDates | html %]</td>
573
                        [% IF ( active ) %]
577
                        [% IF ( active ) %]
574
                            [% UNLESS ( closedate ) %]
578
                            [% UNLESS ( closedate ) %]
575
                            <td>
579
                            <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt (-6 / +59 lines)
Lines 102-110 Link Here
102
            <td data-order="[% lateorder.basket.closedate | html %]">
102
            <td data-order="[% lateorder.basket.closedate | html %]">
103
                [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)
103
                [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)
104
            </td>
104
            </td>
105
            [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
105
            [% IF lateorder.get_column('estimated_delivery_date') %]
106
                [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
107
            [% ELSIF lateorder.get_column('calculated_estimated_delivery_date') %]
108
                [% SET estimated_delivery_date = lateorder.get_column('calculated_estimated_delivery_date') %]
109
            [% END %]
106
            <td data-order="[% estimated_delivery_date | html %]">
110
            <td data-order="[% estimated_delivery_date | html %]">
107
                [% estimated_delivery_date | $KohaDates  %]
111
                <p class="delivery_date">
112
                    <span id="delivery_date_[% estimated_delivery_date | html %]">[% estimated_delivery_date | $KohaDates %]</span>
113
                    <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">
114
                        <i class="fa fa-pencil"></i> Edit
115
                    </a>
116
                </p>
108
            </td>
117
            </td>
109
            <td>
118
            <td>
110
                [% lateorder.basket.bookseller.name | html %]
119
                [% lateorder.basket.bookseller.name | html %]
Lines 190-196 Link Here
190
      </tbody>
199
      </tbody>
191
      <tfoot>
200
      <tfoot>
192
        <tr>
201
        <tr>
193
            <th colspan="6">Total</th>
202
            <th colspan="7">Total</th>
194
            <th>[% total_quantity | html %]</th>
203
            <th>[% total_quantity | html %]</th>
195
            <th>[% total | $Price %]</th>
204
            <th>[% total | $Price %]</th>
196
            <th colspan="10">&nbsp;</th>
205
            <th colspan="10">&nbsp;</th>
Lines 271-277 Link Here
271
                </div>
280
                </div>
272
                <div class="modal-body">
281
                <div class="modal-body">
273
                <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
282
                <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
274
                <input type="hidden" id="ordernumber" name="ordernumber" value="" />
283
                <input type="hidden" id="notes_ordernumber" name="ordernumber" value="" />
275
                <input type="hidden" name="op" value="save" />
284
                <input type="hidden" name="op" value="save" />
276
                <input type="hidden" id="type" name="type" value="" />
285
                <input type="hidden" id="type" name="type" value="" />
277
            </div>
286
            </div>
Lines 284-289 Link Here
284
    </div>
293
    </div>
285
</div>
294
</div>
286
295
296
<!-- Modal for editing estimated delivery date -->
297
<div class="modal" id="dateEditor" tabindex="-1" role="dialog" aria-labelledby="dateEditorLabel">
298
    <div class="modal-dialog" role="document">
299
        <form id="modify_estimated_delivery_date" action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
300
            <div class="modal-content">
301
                <div class="modal-header">
302
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
303
                    <h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
304
                </div>
305
                <div class="modal-body">
306
                <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
307
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
308
                <input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
309
                <input type="hidden" name="op" value="save" />
310
            </div>
311
            <div class="modal-footer">
312
                <button type="submit" class="btn btn-default">Save</button>
313
                <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
314
            </div>
315
            </div>
316
        </form>
317
    </div>
318
</div>
319
287
[% MACRO jsinclude BLOCK %]
320
[% MACRO jsinclude BLOCK %]
288
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
321
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
289
    [% INCLUDE 'datatables.inc' %]
322
    [% INCLUDE 'datatables.inc' %]
Lines 355-361 Link Here
355
                var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
388
                var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
356
                var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
389
                var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
357
                $("#noteEditor .modal-title").text(modalTitle);
390
                $("#noteEditor .modal-title").text(modalTitle);
358
                $("#ordernumber").val( ordernumber );
391
                $("#notes_ordernumber").val( ordernumber );
359
                $("#ordernotes").html( note_text );
392
                $("#ordernotes").html( note_text );
360
                $("#type").val( note_type );
393
                $("#type").val( note_type );
361
                $("#noteEditor").modal("show");
394
                $("#noteEditor").modal("show");
Lines 366-374 Link Here
366
                $("#noteEditorLabel").html("");
399
                $("#noteEditorLabel").html("");
367
                $("#noteEditor .modal-title").text("");
400
                $("#noteEditor .modal-title").text("");
368
                $("#ordernotes").html( "" );
401
                $("#ordernotes").html( "" );
369
                $("#ordernumber").val("");
402
                $("#notes_ordernumber").val("");
370
                $("#type").val("");
403
                $("#type").val("");
371
            });
404
            });
405
406
             $("#estimated_delivery_date").datepicker();
407
408
            $(".edit_delivery_date").on("click", function(e) {
409
                e.preventDefault();
410
                var ordernumber = $(this).data("ordernumber");
411
                var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
412
                var date_text = $( "#delivery_date_" + ordernumber ).html();
413
                $("#dateEditor .modal-title").text(modalTitle);
414
                $("#date_ordernumber").val(ordernumber);
415
                $("#estimated_delivery_date").html( date_text );
416
                $("#dateEditor").modal("show");
417
            });
418
419
             $("#dateEditor").on('hidden.bs.modal', function (e) {
420
                $("#dateEditorLabel").html("");
421
                $("#dateEditor .modal-title").text("");
422
                $("#estimated_delivery_date").html( "" );
423
                $("#date_ordernumber").val("");
424
            });
372
        });
425
        });
373
    </script>
426
    </script>
374
[% END %]
427
[% 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 477-482 Link Here
477
                <label for="order_vendornote">Vendor note: </label>
477
                <label for="order_vendornote">Vendor note: </label>
478
                <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote" >[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
478
                <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote" >[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
479
            </li>
479
            </li>
480
            <li>
481
                <label for="estimated_delivery_date">Estimated delivery date: </label>
482
                <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
483
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
484
            </li>
480
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
485
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
481
                <label for="sort1">Statistic 1: </label>
486
                <label for="sort1">Statistic 1: </label>
482
                <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 | html %]" />
487
                <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 | html %]" />
Lines 676-681 Link Here
676
                getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
681
                getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
677
            });
682
            });
678
            $("#budget_id").change();
683
            $("#budget_id").change();
684
685
            $("#estimated_delivery_date").datepicker();
679
        });
686
        });
680
687
681
        function UserSearchPopup(f) {
688
        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