From 57999441a85369b312ae41a030700b38641d4b9a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 31 Mar 2015 14:13:03 +0200 Subject: [PATCH] Bug 8417: Make the order receive date editable Currently the date of the order reception is the date of shipping date, which is wrong. This patch makes this date editable (with default is today). Test plan: 1/ Create an order and receive it 2/ Confirm that you can edit the reception date and it's take into account as the datereceived. Signed-off-by: Aleisha Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- C4/Acquisition.pm | 8 +++++++- acqui/finishreceive.pl | 2 +- acqui/orderreceive.pl | 12 ++++-------- .../prog/en/modules/acqui/orderreceive.tt | 10 +++++++--- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 4a7cad0b0a..0f2b1612a8 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1392,7 +1392,13 @@ sub ModReceiveOrder { my $order_vendornote = $params->{order_vendornote}; my $dbh = C4::Context->dbh; - $datereceived = output_pref({ dt=>dt_from_string, dateonly=>1, dateformat=>'iso' }) unless $datereceived; + $datereceived = output_pref( + { + dt => ( $datereceived ? dt_from_string( $datereceived ) : dt_from_string ), + dateformat => 'iso', + dateonly => 1, + } + ); my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber ); if ($suggestionid) { ModSuggestion( {suggestionid=>$suggestionid, diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 6402a5bc1f..cc022b33e6 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -48,10 +48,10 @@ my $origquantityrec = $input->param('origquantityrec'); my $quantityrec = $input->param('quantityrec'); my $quantity = $input->param('quantity'); my $unitprice = $input->param('cost'); +my $datereceived = $input->param('datereceived'), my $invoiceid = $input->param('invoiceid'); my $invoice = GetInvoice($invoiceid); my $invoiceno = $invoice->{invoicenumber}; -my $datereceived = $invoice->{shipmentdate}; my $booksellerid = $input->param('booksellerid'); my $cnt = 0; my $ecost = $input->param('ecost'); diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index 202e8cee2f..a75a624560 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -67,7 +67,6 @@ use C4::Koha; # GetKohaAuthorisedValues GetItemTypes use C4::Acquisition; use C4::Auth; use C4::Output; -use C4::Dates qw/format_date/; use C4::Budgets qw/ GetBudget GetBudgetHierarchy CanUserUseBudget GetBudgetPeriods /; use C4::Members; use C4::Branch; # GetBranches @@ -76,7 +75,7 @@ use C4::Biblio; use C4::Suggestions; use Koha::Acquisition::Bookseller; - +use Koha::DateUtils qw( dt_from_string ); my $input = new CGI; @@ -85,11 +84,8 @@ my $invoiceid = $input->param('invoiceid'); my $invoice = GetInvoice($invoiceid); my $booksellerid = $invoice->{booksellerid}; my $freight = $invoice->{shipmentcost}; -my $datereceived = $invoice->{shipmentdate}; my $ordernumber = $input->param('ordernumber'); -$datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new(); - my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); my $results; $results = SearchOrders({ @@ -196,6 +192,8 @@ my $member = GetMember( borrowernumber => $authorisedby ); my $budget = GetBudget( $order->{budget_id} ); +my $datereceived = $order->{datereceived} ? dt_from_string( $order->{datereceived} ) : dt_from_string; + $template->param( AcqCreateItem => $AcqCreateItem, count => 1, @@ -205,7 +203,6 @@ $template->param( booksellerid => $order->{'booksellerid'}, freight => $freight, name => $bookseller->{'name'}, - date => format_date($order->{entrydate}), title => $order->{'title'}, author => $order->{'author'}, copyrightdate => $order->{'copyrightdate'}, @@ -221,8 +218,7 @@ $template->param( membersurname => $member->{surname} || "", invoiceid => $invoice->{invoiceid}, invoice => $invoice->{invoicenumber}, - datereceived => $datereceived->output(), - datereceived_iso => $datereceived->output('iso'), + datereceived => $datereceived, order_internalnote => $order->{order_internalnote}, order_vendornote => $order->{order_vendornote}, suggestionid => $suggestion->{suggestionid}, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 08565a630f..31b08c513a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -1,6 +1,8 @@ +[% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › Receipt summary for : [% name %] [% IF ( invoice ) %]invoice, [% invoice %][% END %] [% INCLUDE 'doc-head-close.inc' %] +[% INCLUDE 'calendar.inc' %] [% INCLUDE 'additem.js.inc' %] @@ -259,14 +261,16 @@ -
Accounting details -
    -
  1. [% datereceived %]
  2. +
      +
    1. + + +