From 61f7cefae67233aa6e4be8a3be499ec9b2f128c6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 27 Jan 2022 16:15:30 +1100 Subject: [PATCH] Fixes for client statements where no products / invoices are present --- .../Authorize/AuthorizePaymentMethod.php | 3 ++- app/Services/Client/Statement.php | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php b/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php index ba359b2594..26a1b9d6aa 100644 --- a/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php +++ b/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php @@ -156,7 +156,8 @@ class AuthorizePaymentMethod $paymentOne = new PaymentType(); $paymentOne->setOpaqueData($op); - $contact = $this->authorize->client->primary_contact()->first(); + $contact = $this->authorize->client->primary_contact()->first() ?: $this->authorize->client->contacts()->first(); + $billto = false; if ($contact) { diff --git a/app/Services/Client/Statement.php b/app/Services/Client/Statement.php index 886579d8a3..c93ca1264d 100644 --- a/app/Services/Client/Statement.php +++ b/app/Services/Client/Statement.php @@ -174,15 +174,17 @@ class Statement $item->tax_rate1 = 5; } - $product = Product::first(); + //$product = Product::first(); - $item->cost = (float) $product->cost; - $item->product_key = $product->product_key; - $item->notes = $product->notes; - $item->custom_value1 = $product->custom_value1; - $item->custom_value2 = $product->custom_value2; - $item->custom_value3 = $product->custom_value3; - $item->custom_value4 = $product->custom_value4; + $product = new \stdClass; + + $item->cost = (float) 10; + $item->product_key = 'test'; + $item->notes = 'test notes'; + $item->custom_value1 = 'custom value1'; + $item->custom_value2 = 'custom value2'; + $item->custom_value3 = 'custom value3'; + $item->custom_value4 = 'custom value4'; $line_items[] = $item; }