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

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 1243-1249 sub GetOrder { Link Here
1243
                aqbooksellers.name        AS supplier,
1243
                aqbooksellers.name        AS supplier,
1244
                aqbooksellers.id          AS supplierid,
1244
                aqbooksellers.id          AS supplierid,
1245
                biblioitems.publishercode AS publisher,
1245
                biblioitems.publishercode AS publisher,
1246
                ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate,
1246
                ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS calculateddeliverydate,
1247
                DATE(aqbasket.closedate)  AS orderdate,
1247
                DATE(aqbasket.closedate)  AS orderdate,
1248
                aqorders.quantity - COALESCE(aqorders.quantityreceived,0)                 AS quantity_to_receive,
1248
                aqorders.quantity - COALESCE(aqorders.quantityreceived,0)                 AS quantity_to_receive,
1249
                (aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * aqorders.rrp AS subtotal,
1249
                (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 (+3 lines)
Lines 137-142 use Koha::Acquisition::Currencies qw( get_active ); Link Here
137
use Koha::Acquisition::Orders;
137
use Koha::Acquisition::Orders;
138
use Koha::Acquisition::Baskets;
138
use Koha::Acquisition::Baskets;
139
use C4::Barcodes;
139
use C4::Barcodes;
140
use Koha::DateUtils;
140
141
141
### "-------------------- addorder.pl ----------"
142
### "-------------------- addorder.pl ----------"
142
143
Lines 314-319 if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { Link Here
314
        }
315
        }
315
    );
316
    );
316
317
318
    $orderinfo->{estimated_delivery_date} = $orderinfo->{estimated_delivery_date} ? dt_from_string($orderinfo->{estimated_delivery_date}) : undef;
319
317
    # if we already have $ordernumber, then it's an ordermodif
320
    # if we already have $ordernumber, then it's an ordermodif
318
    my $order = Koha::Acquisition::Order->new($orderinfo);
321
    my $order = Koha::Acquisition::Order->new($orderinfo);
319
    if ( $orderinfo->{ordernumber} ) {
322
    if ( $orderinfo->{ordernumber} ) {
(-)a/acqui/basket.pl (-1 / +2 lines)
Lines 496-507 sub get_order_infos { Link Here
496
        $line{order_object}         = $order;
496
        $line{order_object}         = $order;
497
    }
497
    }
498
498
499
500
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
499
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
501
    $line{suggestionid}         = $$suggestion{suggestionid};
500
    $line{suggestionid}         = $$suggestion{suggestionid};
502
    $line{surnamesuggestedby}   = $$suggestion{surnamesuggestedby};
501
    $line{surnamesuggestedby}   = $$suggestion{surnamesuggestedby};
503
    $line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby};
502
    $line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby};
504
503
504
    $line{estimated_delivery_date} = $order->{estimated_delivery_date};
505
505
    foreach my $key (qw(transferred_from transferred_to)) {
506
    foreach my $key (qw(transferred_from transferred_to)) {
506
        if ($line{$key}) {
507
        if ($line{$key}) {
507
            my $order = GetOrder($line{$key});
508
            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 480-486 $template->param( Link Here
480
    acqcreate        => $basketobj->effective_create_items eq "ordering" ? 1 : "",
480
    acqcreate        => $basketobj->effective_create_items eq "ordering" ? 1 : "",
481
    users_ids        => join(':', @order_user_ids),
481
    users_ids        => join(':', @order_user_ids),
482
    users            => \@order_users,
482
    users            => \@order_users,
483
    (uc(C4::Context->preference("marcflavour"))) => 1
483
    (uc(C4::Context->preference("marcflavour"))) => 1,
484
    estimated_delivery_date => $data->{estimated_delivery_date},
484
);
485
);
485
486
486
output_html_with_http_headers $input, $cookie, $template->output;
487
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 692-697 CREATE TABLE `aqorders` ( Link Here
692
  `suppliers_reference_number` varchar(35) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
692
  `suppliers_reference_number` varchar(35) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
693
  `suppliers_reference_qualifier` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
693
  `suppliers_reference_qualifier` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
694
  `suppliers_report` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'reports received from suppliers',
694
  `suppliers_report` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'reports received from suppliers',
695
  `estimated_delivery_date` date default null,
695
  PRIMARY KEY (`ordernumber`),
696
  PRIMARY KEY (`ordernumber`),
696
  KEY `basketno` (`basketno`),
697
  KEY `basketno` (`basketno`),
697
  KEY `biblionumber` (`biblionumber`),
698
  KEY `biblionumber` (`biblionumber`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (+4 lines)
Lines 451-456 Link Here
451
                        [% IF Koha.Preference('EDIFACT') && ediaccount %]
451
                        [% IF Koha.Preference('EDIFACT') && ediaccount %]
452
                        <th>Supplier report</th>
452
                        <th>Supplier report</th>
453
                        [% END %]
453
                        [% END %]
454
                        <th>Estimated delivery date</th>
454
                        [% IF ( active ) %]
455
                        [% IF ( active ) %]
455
                            [% UNLESS ( closedate ) %]
456
                            [% UNLESS ( closedate ) %]
456
                                <th class="NoSort">Modify</th>
457
                                <th class="NoSort">Modify</th>
Lines 480-485 Link Here
480
                        [% IF Koha.Preference('EDIFACT') && ediaccount %]
481
                        [% IF Koha.Preference('EDIFACT') && ediaccount %]
481
                        <th>&nbsp;</th>
482
                        <th>&nbsp;</th>
482
                        [% END %]
483
                        [% END %]
484
                        <th>[% foot_loo.estimated_delivery_date | $KohaDates | html %]</th>
483
                        [% IF ( active ) %]
485
                        [% IF ( active ) %]
484
                            [% UNLESS ( closedate ) %]
486
                            [% UNLESS ( closedate ) %]
485
                                <th>&nbsp;</th>
487
                                <th>&nbsp;</th>
Lines 507-512 Link Here
507
                    [% IF Koha.Preference('EDIFACT') && ediaccount %]
509
                    [% IF Koha.Preference('EDIFACT') && ediaccount %]
508
                    <th>&nbsp;</th>
510
                    <th>&nbsp;</th>
509
                    [% END %]
511
                    [% END %]
512
                    <th>[% estimated_delivery_date | $KohaDates | html %]</th>
510
                    [% IF ( active ) %]
513
                    [% IF ( active ) %]
511
                        [% UNLESS ( closedate ) %]
514
                        [% UNLESS ( closedate ) %]
512
                            <th>&nbsp;</th>
515
                            <th>&nbsp;</th>
Lines 593-598 Link Here
593
                        [% IF Koha.Preference('EDIFACT') && ediaccount %]
596
                        [% IF Koha.Preference('EDIFACT') && ediaccount %]
594
                        <td>[% books_loo.suppliers_report | html %]</td>
597
                        <td>[% books_loo.suppliers_report | html %]</td>
595
                        [% END %]
598
                        [% END %]
599
                        <td>[% books_loo.estimated_delivery_date | $KohaDates | html %]</td>
596
                        [% IF ( active ) %]
600
                        [% IF ( active ) %]
597
                            [% UNLESS ( closedate ) %]
601
                            [% UNLESS ( closedate ) %]
598
                            <td>
602
                            <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 481-486 Link Here
481
                <label for="order_vendornote">Vendor note: </label>
481
                <label for="order_vendornote">Vendor note: </label>
482
                <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote" >[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
482
                <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote" >[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
483
            </li>
483
            </li>
484
            <li>
485
                <label for="estimated_delivery_date">Estimated delivery date: </label>
486
                <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
487
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
488
            </li>
484
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
489
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
485
                <label for="sort1">Statistic 1: </label>
490
                <label for="sort1">Statistic 1: </label>
486
                <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 | html %]" />
491
                <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 | html %]" />
Lines 680-685 Link Here
680
                getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
685
                getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
681
            });
686
            });
682
            $("#budget_id").change();
687
            $("#budget_id").change();
688
689
            $("#estimated_delivery_date").datepicker();
683
        });
690
        });
684
691
685
        function UserSearchPopup(f) {
692
        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