Bug 15348: Add estimated delivery date field to individual orders
This patch allows you to specify an estimated delivery date per order. The specified estimated delivery date is also considered when searching for late orders and exporting late orders. You can also edit the estimated delivery date from the late orders page. Test plan: 1. Update database, rebuild schema, restart services 2. Go to Acquisitions, search for a vendor, and create a new basket 3. Add an order to the basket. When filling in the accounting details, notice the new 'estimated delivery date' field, but don't add a date. Save the order. 4. Confirm no date shows in the estimated delivery date column in the orders table. 5. Modify the order. Add a date in the estimated delivery date field and save the order. 6. Confirm the date now shows in the orders table. 7. Close the basket. 8. Go to the Late Orders page. 9. Put estimated delivery date from and to parameters in the search filters on the left. Ensure the from and to dates encapsulate the date you entered in the estimated delivery date field for the order. 10. Click Filter and ensure the order shows. 11. Select the checkbox next to the order. Click the Export as CSV button. 12. Open the CSV and confirm the estimated delivery date that you entered shows as expected in the file. 13. Click Edit under the estimated delivery date. Confirm the estimated delivery date modal pops up with the correct order line number in the modal header. 14. Remove the estimated delivery date and click Save. 15. Confirm that the estimated delivery date calculated by Koha now shows in the late orders table. 16. Select the checkbox next to the order. Click the Export as CSV button. 17. Open the CSV and confirm the calculated estimated delivery date shows in the CSV. 18. Confirm tests pass: t/db_dependent/Koha/Acquisition/Order.t Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ) Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
88f63e01d2
commit
2a1d85fc32
|
|
@ -1242,7 +1242,7 @@ sub GetOrder {
|
|||
aqbooksellers.name AS supplier,
|
||||
aqbooksellers.id AS supplierid,
|
||||
biblioitems.publishercode AS publisher,
|
||||
ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate,
|
||||
ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS calculateddeliverydate,
|
||||
DATE(aqbasket.closedate) AS orderdate,
|
||||
aqorders.quantity - COALESCE(aqorders.quantityreceived,0) AS quantity_to_receive,
|
||||
(aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * aqorders.rrp AS subtotal,
|
||||
|
|
|
|||
|
|
@ -69,17 +69,22 @@ sub filter_by_lates {
|
|||
|
||||
my @delivery_time_conditions;
|
||||
my $date_add = "DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)";
|
||||
my @estimated_delivery_time_conditions;
|
||||
if ( defined $estimated_from or defined $estimated_to ) {
|
||||
push @delivery_time_conditions, \[ "$date_add IS NOT NULL" ];
|
||||
push @estimated_delivery_time_conditions, \[ "estimated_delivery_date IS NOT NULL" ];
|
||||
}
|
||||
if ( defined $estimated_from ) {
|
||||
push @delivery_time_conditions, \[ "$date_add >= ?", $dtf->format_date($estimated_from) ];
|
||||
push @estimated_delivery_time_conditions, \[ "estimated_delivery_date >= ?", $dtf->format_date($estimated_from) ];
|
||||
}
|
||||
if ( defined $estimated_to ) {
|
||||
push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date($estimated_to) ];
|
||||
push @estimated_delivery_time_conditions, \[ "estimated_delivery_date <= ?", $dtf->format_date($estimated_to) ];
|
||||
}
|
||||
if ( defined $estimated_from and not defined $estimated_to ) {
|
||||
push @delivery_time_conditions, \[ "$date_add <= ?", $dtf->format_date(dt_from_string) ];
|
||||
push @estimated_delivery_time_conditions, \[ "estimated_delivery_date <= ?", $dtf->format_date(dt_from_string) ];
|
||||
}
|
||||
|
||||
$self->search(
|
||||
|
|
@ -110,7 +115,15 @@ sub filter_by_lates {
|
|||
|
||||
# ( $branchcode ? ('borrower.branchcode')) # FIXME branch is not a filter we may not need to implement this
|
||||
|
||||
( @delivery_time_conditions ? ( -and => \@delivery_time_conditions ) : ()),
|
||||
( ( @delivery_time_conditions and @estimated_delivery_time_conditions ) ?
|
||||
( -or =>
|
||||
[
|
||||
-and => \@delivery_time_conditions,
|
||||
-and => \@estimated_delivery_time_conditions
|
||||
]
|
||||
)
|
||||
: ()
|
||||
),
|
||||
(
|
||||
C4::Context->preference('IndependentBranches')
|
||||
&& !C4::Context->IsSuperLibrarian
|
||||
|
|
@ -122,8 +135,12 @@ sub filter_by_lates {
|
|||
|
||||
},
|
||||
{
|
||||
'+select' => [\"DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)"],
|
||||
'+as' => ['estimated_delivery_date'],
|
||||
'+select' => [
|
||||
\"DATE_ADD(basketno.closedate, INTERVAL COALESCE(booksellerid.deliverytime, booksellerid.deliverytime, 0) day)",
|
||||
],
|
||||
'+as' => [qw/
|
||||
calculated_estimated_delivery_date
|
||||
/],
|
||||
join => { 'basketno' => 'booksellerid' },
|
||||
prefetch => {'basketno' => 'booksellerid'},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ use Koha::Acquisition::Currencies qw( get_active );
|
|||
use Koha::Acquisition::Orders;
|
||||
use Koha::Acquisition::Baskets;
|
||||
use C4::Barcodes;
|
||||
use Koha::DateUtils;
|
||||
|
||||
### "-------------------- addorder.pl ----------"
|
||||
|
||||
|
|
@ -326,9 +327,11 @@ if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) {
|
|||
}
|
||||
|
||||
$orderinfo->{unitprice} = $orderinfo->{ecost} if not defined $orderinfo->{unitprice} or $orderinfo->{unitprice} eq '';
|
||||
$orderinfo->{estimated_delivery_date} = $orderinfo->{estimated_delivery_date} ? dt_from_string($orderinfo->{estimated_delivery_date}) : undef;
|
||||
|
||||
my $order;
|
||||
my $log_action_name;
|
||||
|
||||
if ( $orderinfo->{ordernumber} ) {
|
||||
$order = Koha::Acquisition::Orders->find($orderinfo->{ordernumber});
|
||||
$order->set($orderinfo);
|
||||
|
|
|
|||
|
|
@ -496,12 +496,13 @@ sub get_order_infos {
|
|||
$line{order_object} = $order;
|
||||
}
|
||||
|
||||
|
||||
my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber});
|
||||
$line{suggestionid} = $$suggestion{suggestionid};
|
||||
$line{surnamesuggestedby} = $$suggestion{surnamesuggestedby};
|
||||
$line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby};
|
||||
|
||||
$line{estimated_delivery_date} = $order->{estimated_delivery_date};
|
||||
|
||||
foreach my $key (qw(transferred_from transferred_to)) {
|
||||
if ($line{$key}) {
|
||||
my $order = GetOrder($line{$key});
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ unless ( $csv_profile_id ) {
|
|||
push @orders, {
|
||||
orderdate => $order->{orderdate},
|
||||
latesince => $order->{latesince},
|
||||
estimateddeliverydate => $order->{estimateddeliverydate},
|
||||
estimateddeliverydate => $order->{estimated_delivery_date} ? $order->{estimated_delivery_date} : $order->{calculateddeliverydate},
|
||||
supplier => $order->{supplier},
|
||||
supplierid => $order->{supplierid},
|
||||
title => $order->{title},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Copyright 2021 Aleisha Amohia <aleisha@catalyst.net.nz>
|
||||
#
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
=head1 NAME
|
||||
|
||||
moddeliverydate.pl
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Modify just the estimated delivery date of an individual order when
|
||||
its basket is closed.
|
||||
|
||||
=cut
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use CGI qw ( -utf8 );
|
||||
use C4::Auth;
|
||||
use C4::Output;
|
||||
use C4::Acquisition;
|
||||
|
||||
use Koha::Acquisition::Booksellers;
|
||||
use Koha::DateUtils;
|
||||
|
||||
my $input = CGI->new;
|
||||
my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
|
||||
template_name => 'acqui/moddeliverydate.tt',
|
||||
query => $input,
|
||||
type => 'intranet',
|
||||
flagsrequired => { 'acquisition' => '*' },
|
||||
debug => 1,
|
||||
} );
|
||||
|
||||
my $op = $input->param('op');
|
||||
my $ordernumber = $input->param('ordernumber');
|
||||
my $referrer = $input->param('referrer') || $input->referer();
|
||||
my $order = GetOrder($ordernumber);
|
||||
my $basket = GetBasket($order->{basketno});
|
||||
my $bookseller = Koha::Acquisition::Booksellers->find( $basket->{booksellerid} );
|
||||
|
||||
if($op and $op eq 'save') {
|
||||
my $estimated_delivery_date = $input->param('estimated_delivery_date');
|
||||
$order->{'estimated_delivery_date'} = dt_from_string( $estimated_delivery_date );
|
||||
ModOrder($order);
|
||||
print $input->redirect($referrer);
|
||||
exit;
|
||||
} else {
|
||||
$template->param(
|
||||
estimated_delivery_date => $order->{'estimated_delivery_date'}
|
||||
);
|
||||
}
|
||||
|
||||
if($op) {
|
||||
$template->param($op => 1);
|
||||
}
|
||||
|
||||
$template->param(
|
||||
basketname => $basket->{'basketname'},
|
||||
basketno => $order->{basketno},
|
||||
booksellerid => $bookseller->id,
|
||||
booksellername => $bookseller->name,
|
||||
ordernumber => $ordernumber,
|
||||
referrer => $referrer,
|
||||
);
|
||||
|
||||
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
|
@ -480,7 +480,8 @@ $template->param(
|
|||
acqcreate => $basketobj->effective_create_items eq "ordering" ? 1 : "",
|
||||
users_ids => join(':', @order_user_ids),
|
||||
users => \@order_users,
|
||||
(uc(C4::Context->preference("marcflavour"))) => 1
|
||||
(uc(C4::Context->preference("marcflavour"))) => 1,
|
||||
estimated_delivery_date => $data->{estimated_delivery_date},
|
||||
);
|
||||
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
use Date::Calc qw( Add_Delta_Days );
|
||||
$DBversion = 'XXX';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
unless( column_exists( 'aqorders', 'estimated_delivery_date' ) ) {
|
||||
$dbh->do(q{ ALTER TABLE aqorders ADD estimated_delivery_date date default null AFTER suppliers_report });
|
||||
|
||||
NewVersion( $DBversion, 15348, "Add new column aqorders.estimated_delivery_date" );
|
||||
}
|
||||
}
|
||||
|
|
@ -693,6 +693,7 @@ CREATE TABLE `aqorders` (
|
|||
`suppliers_reference_number` varchar(35) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Suppliers unique edifact quote ref',
|
||||
`suppliers_reference_qualifier` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
|
||||
`suppliers_report` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'reports received from suppliers',
|
||||
`estimated_delivery_date` date default null,
|
||||
PRIMARY KEY (`ordernumber`),
|
||||
KEY `basketno` (`basketno`),
|
||||
KEY `biblionumber` (`biblionumber`),
|
||||
|
|
|
|||
|
|
@ -451,6 +451,7 @@
|
|||
[% IF Koha.Preference('EDIFACT') && ediaccount %]
|
||||
<th>Supplier report</th>
|
||||
[% END %]
|
||||
<th>Estimated delivery date</th>
|
||||
[% IF ( active ) %]
|
||||
[% UNLESS ( closedate ) %]
|
||||
<th class="NoSort">Modify</th>
|
||||
|
|
@ -480,6 +481,7 @@
|
|||
[% IF Koha.Preference('EDIFACT') && ediaccount %]
|
||||
<th> </th>
|
||||
[% END %]
|
||||
<th>[% foot_loo.estimated_delivery_date | $KohaDates | html %]</th>
|
||||
[% IF ( active ) %]
|
||||
[% UNLESS ( closedate ) %]
|
||||
<th> </th>
|
||||
|
|
@ -507,6 +509,7 @@
|
|||
[% IF Koha.Preference('EDIFACT') && ediaccount %]
|
||||
<th> </th>
|
||||
[% END %]
|
||||
<th>[% estimated_delivery_date | $KohaDates | html %]</th>
|
||||
[% IF ( active ) %]
|
||||
[% UNLESS ( closedate ) %]
|
||||
<th> </th>
|
||||
|
|
@ -593,6 +596,7 @@
|
|||
[% IF Koha.Preference('EDIFACT') && ediaccount %]
|
||||
<td>[% books_loo.suppliers_report | html %]</td>
|
||||
[% END %]
|
||||
<td>[% books_loo.estimated_delivery_date | $KohaDates | html %]</td>
|
||||
[% IF ( active ) %]
|
||||
[% UNLESS ( closedate ) %]
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -102,9 +102,18 @@
|
|||
<td data-order="[% lateorder.basket.closedate | html %]">
|
||||
[% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)
|
||||
</td>
|
||||
[% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
|
||||
[% IF lateorder.get_column('estimated_delivery_date') %]
|
||||
[% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
|
||||
[% ELSIF lateorder.get_column('calculated_estimated_delivery_date') %]
|
||||
[% SET estimated_delivery_date = lateorder.get_column('calculated_estimated_delivery_date') %]
|
||||
[% END %]
|
||||
<td data-order="[% estimated_delivery_date | html %]">
|
||||
[% estimated_delivery_date | $KohaDates %]
|
||||
<p class="delivery_date">
|
||||
<span id="delivery_date_[% estimated_delivery_date | html %]">[% estimated_delivery_date | $KohaDates %]</span>
|
||||
<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">
|
||||
<i class="fa fa-pencil"></i> Edit
|
||||
</a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
[% lateorder.basket.bookseller.name | html %]
|
||||
|
|
@ -190,7 +199,7 @@
|
|||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="6">Total</th>
|
||||
<th colspan="7">Total</th>
|
||||
<th>[% total_quantity | html %]</th>
|
||||
<th>[% total | $Price %]</th>
|
||||
<th colspan="10"> </th>
|
||||
|
|
@ -271,7 +280,7 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
|
||||
<input type="hidden" id="ordernumber" name="ordernumber" value="" />
|
||||
<input type="hidden" id="notes_ordernumber" name="ordernumber" value="" />
|
||||
<input type="hidden" name="op" value="save" />
|
||||
<input type="hidden" id="type" name="type" value="" />
|
||||
</div>
|
||||
|
|
@ -284,6 +293,30 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal for editing estimated delivery date -->
|
||||
<div class="modal" id="dateEditor" tabindex="-1" role="dialog" aria-labelledby="dateEditorLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form id="modify_estimated_delivery_date" action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
|
||||
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
|
||||
<input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
|
||||
<input type="hidden" name="op" value="save" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-default">Save</button>
|
||||
<button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% Asset.js("js/acquisitions-menu.js") | $raw %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
|
|
@ -355,7 +388,7 @@
|
|||
var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
|
||||
var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
|
||||
$("#noteEditor .modal-title").text(modalTitle);
|
||||
$("#ordernumber").val( ordernumber );
|
||||
$("#notes_ordernumber").val( ordernumber );
|
||||
$("#ordernotes").html( note_text );
|
||||
$("#type").val( note_type );
|
||||
$("#noteEditor").modal("show");
|
||||
|
|
@ -366,9 +399,29 @@
|
|||
$("#noteEditorLabel").html("");
|
||||
$("#noteEditor .modal-title").text("");
|
||||
$("#ordernotes").html( "" );
|
||||
$("#ordernumber").val("");
|
||||
$("#notes_ordernumber").val("");
|
||||
$("#type").val("");
|
||||
});
|
||||
|
||||
$("#estimated_delivery_date").datepicker();
|
||||
|
||||
$(".edit_delivery_date").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
var ordernumber = $(this).data("ordernumber");
|
||||
var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
|
||||
var date_text = $( "#delivery_date_" + ordernumber ).html();
|
||||
$("#dateEditor .modal-title").text(modalTitle);
|
||||
$("#date_ordernumber").val(ordernumber);
|
||||
$("#estimated_delivery_date").html( date_text );
|
||||
$("#dateEditor").modal("show");
|
||||
});
|
||||
|
||||
$("#dateEditor").on('hidden.bs.modal', function (e) {
|
||||
$("#dateEditorLabel").html("");
|
||||
$("#dateEditor .modal-title").text("");
|
||||
$("#estimated_delivery_date").html( "" );
|
||||
$("#date_ordernumber").val("");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
[% SET footerjs = 1 %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>Koha › Acquisition ›
|
||||
Change estimated delivery date
|
||||
</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
</head>
|
||||
|
||||
<body id="acq_moddeliverydate" class="acq">
|
||||
[% INCLUDE 'header.inc' %]
|
||||
|
||||
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisition</a> › <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> › <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Basket [% basketname | html %] ([% basketno | html %])</a> › Change estimated delivery date</div>
|
||||
|
||||
<div class="main container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
|
||||
|
||||
<h1>Change estimated delivery date</h1>
|
||||
<form action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
|
||||
<fieldset class="brief">
|
||||
<label for="estimated_delivery_date">Estimated delivery date:</label>
|
||||
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
|
||||
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
|
||||
</fieldset>
|
||||
<input type="hidden" name="referrer" value="[% referrer | html %]" />
|
||||
<input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
|
||||
<input type="hidden" name="op" value="save" />
|
||||
<fieldset class="action">
|
||||
<input type="submit" value="Save" />
|
||||
<a class="cancel" href="[% referrer | url %]">Cancel</a>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#estimated_delivery_date").datepicker();
|
||||
});
|
||||
</script>
|
||||
[% END %]
|
||||
|
||||
[% INCLUDE 'intranet-bottom.inc' %]
|
||||
|
|
@ -481,6 +481,11 @@
|
|||
<label for="order_vendornote">Vendor note: </label>
|
||||
<textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote" >[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
|
||||
</li>
|
||||
<li>
|
||||
<label for="estimated_delivery_date">Estimated delivery date: </label>
|
||||
<input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="datepicker" value="[% estimated_delivery_date | html %]"/>
|
||||
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
|
||||
</li>
|
||||
<li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
|
||||
<label for="sort1">Statistic 1: </label>
|
||||
<input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 | html %]" />
|
||||
|
|
@ -681,6 +686,8 @@
|
|||
getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
|
||||
});
|
||||
$("#budget_id").change();
|
||||
|
||||
$("#estimated_delivery_date").datepicker();
|
||||
});
|
||||
|
||||
function UserSearchPopup(f) {
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ subtest 'claim*' => sub {
|
|||
};
|
||||
|
||||
subtest 'filter_by_late' => sub {
|
||||
plan tests => 16;
|
||||
plan tests => 17;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
my $now = dt_from_string;
|
||||
|
|
@ -415,6 +415,7 @@ subtest 'filter_by_late' => sub {
|
|||
basketno => $basket_1->basketno,
|
||||
datereceived => undef,
|
||||
datecancellationprinted => undef,
|
||||
estimated_delivery_date => undef,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -434,6 +435,7 @@ subtest 'filter_by_late' => sub {
|
|||
basketno => $basket_2->basketno,
|
||||
datereceived => undef,
|
||||
datecancellationprinted => undef,
|
||||
estimated_delivery_date => undef,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -453,6 +455,7 @@ subtest 'filter_by_late' => sub {
|
|||
basketno => $basket_3->basketno,
|
||||
datereceived => undef,
|
||||
datecancellationprinted => undef,
|
||||
estimated_delivery_date => undef,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -472,6 +475,7 @@ subtest 'filter_by_late' => sub {
|
|||
basketno => $basket_4->basketno,
|
||||
datereceived => undef,
|
||||
datecancellationprinted => undef,
|
||||
estimated_delivery_date => undef,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -539,6 +543,34 @@ subtest 'filter_by_late' => sub {
|
|||
);
|
||||
is( $late_orders->count, 1 );
|
||||
|
||||
my $basket_5 = $builder->build_object( # closed today
|
||||
{
|
||||
class => 'Koha::Acquisition::Baskets',
|
||||
value => {
|
||||
booksellerid => $bookseller->id,
|
||||
closedate => $now,
|
||||
}
|
||||
}
|
||||
);
|
||||
my $order_5 = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Acquisition::Orders',
|
||||
value => {
|
||||
basketno => $basket_4->basketno,
|
||||
datereceived => undef,
|
||||
datecancellationprinted => undef,
|
||||
estimated_delivery_date => $now->clone->subtract( days => 2 ),
|
||||
}
|
||||
}
|
||||
);
|
||||
$late_orders = $orders->filter_by_lates(
|
||||
{
|
||||
estimated_from => $now->clone->subtract( days => 3 ),
|
||||
estimated_to => $now->clone->subtract( days => 2 )
|
||||
}
|
||||
);
|
||||
is( $late_orders->count, 1 );
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue