Bug 24277: Fix date received editing when receiving an order
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 23 Dec 2019 15:19:47 +0000 (16:19 +0100)
committerHayley Mapley <hayleymapley@catalyst.net.nz>
Sun, 9 Feb 2020 23:20:32 +0000 (12:20 +1300)
Bug 8417 added the ability to edit the date received, but a merge
conflict was wrongly resolved during a rebase of
  commit 20d9ed618fbe3cdcb9c04444a1f8a584b0364069
  Bug 13321: Rename variables

Test plan:
Create an order
Receive it
Set a date (different from today)
=> The date you picked should have been set in DB for the order

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 028a77abce1aa0c9dc9f1bab8fc3069df811c2a1)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a273c604db5ebad8aef2b1076a0a5870783ba06e)
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

C4/Acquisition.pm
acqui/finishreceive.pl
t/db_dependent/Acquisition.t

index 8627ed3..738dab7 100644 (file)
@@ -1394,8 +1394,8 @@ sub ModItemOrder {
             user                 => $user,
             invoice              => $invoice,
             budget_id            => $budget_id,
+            datereceived         => $datereceived,
             received_itemnumbers => \@received_itemnumbers,
-            order_internalnote   => $order_internalnote,
         }
     );
 
@@ -1418,10 +1418,18 @@ sub ModReceiveOrder {
     my $quantrec       = $params->{quantityreceived};
     my $user           = $params->{user};
     my $budget_id      = $params->{budget_id};
+    my $datereceived   = $params->{datereceived};
     my $received_items = $params->{received_items};
 
     my $dbh = C4::Context->dbh;
-    my $datereceived = ( $invoice and $invoice->{datereceived} ) ? $invoice->{datereceived} : dt_from_string;
+    $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,
index 90faed3..dac8461 100755 (executable)
@@ -123,6 +123,7 @@ if ($quantityrec > $origquantityrec ) {
                 user             => $user,
                 invoice          => $invoice,
                 budget_id        => $bookfund,
+                datereceived     => $datereceived,
                 received_items   => \@received_items,
             }
         );
index 5a5cf55..ddf224a 100755 (executable)
@@ -19,7 +19,7 @@ use Modern::Perl;
 
 use POSIX qw(strftime);
 
-use Test::More tests => 78;
+use Test::More tests => 77;
 use t::lib::Mocks;
 use Koha::Database;
 use Koha::DateUtils qw(dt_from_string output_pref);