Bug 20303: Do not explode when receiving an order if authorisedby not set
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 27 Feb 2018 18:54:38 +0000 (15:54 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 15 Mar 2018 08:36:48 +0000 (08:36 +0000)
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

acqui/orderreceive.pl

index e876942..c88a533 100755 (executable)
@@ -185,6 +185,12 @@ my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber});
 
 my $authorisedby = $order->{authorisedby};
 my $authorised_patron = Koha::Patrons->find( $authorisedby );
+if ( $authorised_patron ) { # This should not happen unless there was a migration issue (or very old install?)
+    $template->param(
+        memberfirstname  => $authorised_patron->firstname || "",
+        membersurname    => $authorised_patron->surname || "",
+    );
+}
 
 my $budget = GetBudget( $order->{budget_id} );
 
@@ -217,8 +223,6 @@ $template->param(
     ecost                 => $ecost,
     unitprice             => $unitprice,
     tax_rate              => $tax_rate,
-    memberfirstname       => $authorised_patron->firstname || "",
-    membersurname         => $authorised_patron->surname || "",
     invoiceid             => $invoice->{invoiceid},
     invoice               => $invoice->{invoicenumber},
     datereceived          => $datereceived,