From 5a38e26edb6133431471d317f716c40a4b50d0a8 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 16 Dec 2020 18:57:42 +1300 Subject: [PATCH] Bug 15348: Add estimated delivery date field to individual orders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch allows you to specify an estimated delivery date per order. Work to do: - Make the Late Orders page check the estimated delivery date field - Make the Late Orders export functionality handle this - Edit the estimated delivery date from Late Orders page Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ) --- acqui/addorder.pl | 5 ++++- acqui/basket.pl | 3 ++- acqui/neworderempty.pl | 3 ++- .../bug_15348-add_aqorders.estimated_delivery_date.perl | 9 +++++++++ installer/data/mysql/kohastructure.sql | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt | 4 ++++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt | 7 +++++++ 7 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_15348-add_aqorders.estimated_delivery_date.perl diff --git a/acqui/addorder.pl b/acqui/addorder.pl index b9915e6aec..c91a9d60fb 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -126,9 +126,10 @@ use C4::Biblio; # AddBiblio TransformKohaToMarc use C4::Budgets; use C4::Items; use C4::Output; +use C4::Barcodes; +use Koha::DateUtils; use Koha::Acquisition::Currencies; use Koha::Acquisition::Orders; -use C4::Barcodes; ### "-------------------- addorder.pl ----------" @@ -290,6 +291,8 @@ if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { } ); + $orderinfo->{estimated_delivery_date} = dt_from_string($orderinfo->{estimated_delivery_date}); + # if we already have $ordernumber, then it's an ordermodif my $order = Koha::Acquisition::Order->new($orderinfo); if ( $orderinfo->{ordernumber} ) { diff --git a/acqui/basket.pl b/acqui/basket.pl index f77d86b88c..c88643452d 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -501,12 +501,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}); diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 75624751fe..3cc77eaad4 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -474,7 +474,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; diff --git a/installer/data/mysql/atomicupdate/bug_15348-add_aqorders.estimated_delivery_date.perl b/installer/data/mysql/atomicupdate/bug_15348-add_aqorders.estimated_delivery_date.perl new file mode 100644 index 0000000000..81b7297774 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_15348-add_aqorders.estimated_delivery_date.perl @@ -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 and pre-fill with calculated dates" ); + } +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index ef3bff04b0..49cd889934 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3319,6 +3319,7 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items suppliers_reference_number varchar(35) default NULL, -- Suppliers unique edifact quote ref suppliers_reference_qualifier varchar(3) default NULL, -- Type of number above usually 'QLI' `suppliers_report` MEDIUMTEXT COLLATE utf8mb4_unicode_ci, -- reports received from suppliers + `estimated_delivery_date` date default null, PRIMARY KEY (`ordernumber`), KEY `basketno` (`basketno`), KEY `biblionumber` (`biblionumber`), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index ddd8df99ae..9025c6d97b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -412,6 +412,7 @@ GST Fund Supplier report + Estimated delivery date [% IF ( active ) %] [% UNLESS ( closedate ) %] Modify @@ -439,6 +440,7 @@ [% foot_loo.tax_value | $Price %]     + [% foot_loo.estimated_delivery_date | $KohaDates | html %] [% IF ( active ) %] [% UNLESS ( closedate ) %]   @@ -464,6 +466,7 @@ [% total_tax_value | $Price %]     + [% estimated_delivery_date | $KohaDates | html %] [% IF ( active ) %] [% UNLESS ( closedate ) %]   @@ -548,6 +551,7 @@ [% books_loo.tax_value | $Price %] [% books_loo.budget_name | html %] [% books_loo.suppliers_report | html %] + [% books_loo.estimated_delivery_date | $KohaDates | html %] [% IF ( active ) %] [% UNLESS ( closedate ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 37d4f99cce..69329405d8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -448,6 +448,11 @@ +
  • + + +
    [% INCLUDE 'date-format.inc' %]
    +
  • The 2 following fields are available for your own usage. They can be useful for statistical purposes
    @@ -647,6 +652,8 @@ getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 ); }); $("#budget_id").change(); + + $("#estimated_delivery_date").datepicker(); }); function UserSearchPopup(f) { -- 2.11.0