From 9ce10b3d5458d91dd21fc9919c71d93beb9e1b3e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 24 Sep 2023 18:08:46 +1000 Subject: [PATCH 1/4] prune logging --- app/Mail/Admin/EntitySentObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Mail/Admin/EntitySentObject.php b/app/Mail/Admin/EntitySentObject.php index e1ae21c90d..1926184e9a 100644 --- a/app/Mail/Admin/EntitySentObject.php +++ b/app/Mail/Admin/EntitySentObject.php @@ -98,7 +98,7 @@ class EntitySentObject $mail_obj->markdown = 'email.admin.generic'; $mail_obj->tag = $this->company->company_key; } - nlog($mail_obj); + // nlog($mail_obj); return $mail_obj; } From 014cb749077fbf5f20c152d04465c20aee2d0dbe Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 24 Sep 2023 22:00:25 +1000 Subject: [PATCH 2/4] Fixes for one time tokens --- app/Http/Controllers/OneTimeTokenController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/OneTimeTokenController.php b/app/Http/Controllers/OneTimeTokenController.php index b51cfcc111..70d32d42cd 100644 --- a/app/Http/Controllers/OneTimeTokenController.php +++ b/app/Http/Controllers/OneTimeTokenController.php @@ -74,7 +74,7 @@ class OneTimeTokenController extends BaseController 'user_id' => $user->id, 'company_key'=> $user->company()->company_key, 'context' => $request->input('context'), - 'is_react' => $request->request()->hasHeader('X-REACT') ? true : false, + 'is_react' => $request->hasHeader('X-REACT') ? true : false, ]; Cache::put($hash, $data, 3600); From 52ad04dcc1922db661ef1dc72610d400b84829c3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 25 Sep 2023 05:54:39 +1000 Subject: [PATCH 3/4] Minor fixes for checkout response --- app/Http/Controllers/ClientPortal/InvoiceController.php | 1 + app/PaymentDrivers/CheckoutCom/Utilities.php | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index 80a51e0a66..3d7d11a2e1 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -94,6 +94,7 @@ class InvoiceController extends Controller 'quote' => $invitation = QuoteInvitation::withTrashed()->find($data['invitation_id']), 'credit' => $invitation = CreditInvitation::withTrashed()->find($data['invitation_id']), 'recurring_invoice' => $invitation = RecurringInvoiceInvitation::withTrashed()->find($data['invitation_id']), + false => $invitation = false, }; if (! $invitation) { diff --git a/app/PaymentDrivers/CheckoutCom/Utilities.php b/app/PaymentDrivers/CheckoutCom/Utilities.php index 860240e0a5..73b0710a62 100644 --- a/app/PaymentDrivers/CheckoutCom/Utilities.php +++ b/app/PaymentDrivers/CheckoutCom/Utilities.php @@ -98,11 +98,8 @@ trait Utilities $error_message = $_payment['actions'][0]['response_summary']; } - if(isset($_payment['actions'][0]['response_code']) ?? false) { - $error_code = $_payment['actions'][0]['response_code']; - } - else - $error_code = 400; + //checkout does not return a integer status code as an alias for a http status code. + $error_code = 400; $this->getParent()->sendFailureMail($error_message); From 3d309546902305b0bc21375aca18cdea4a8ef44d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 25 Sep 2023 06:52:14 +1000 Subject: [PATCH 4/4] Fixes for report previews --- app/Export/CSV/ClientExport.php | 2 +- .../PurchaseOrder/PurchaseOrderInventory.php | 18 ++++++++++++++---- phpstan.neon | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/Export/CSV/ClientExport.php b/app/Export/CSV/ClientExport.php index 79a59ddbd7..ce070b5db6 100644 --- a/app/Export/CSV/ClientExport.php +++ b/app/Export/CSV/ClientExport.php @@ -185,7 +185,7 @@ class ClientExport extends BaseExport $clean_row[$key]['id'] = $report_keys[1] ?? $report_keys[0]; $clean_row[$key]['hashed_id'] = $report_keys[0] == 'client' ? null : $resource->{$report_keys[0]}->hashed_id ?? null; $clean_row[$key]['value'] = $row[$column_key]; - $clean_row[$key]['identifier'] = $value; + $clean_row[$key]['identifier'] = $key; if(in_array($clean_row[$key]['id'], ['paid_to_date', 'balance', 'credit_balance','payment_balance'])) $clean_row[$key]['display_value'] = Number::formatMoney($row[$column_key], $resource); diff --git a/app/Services/PurchaseOrder/PurchaseOrderInventory.php b/app/Services/PurchaseOrder/PurchaseOrderInventory.php index e3e6036bf5..7954e0ae5a 100644 --- a/app/Services/PurchaseOrder/PurchaseOrderInventory.php +++ b/app/Services/PurchaseOrder/PurchaseOrderInventory.php @@ -16,11 +16,9 @@ use App\Models\PurchaseOrder; class PurchaseOrderInventory { - private PurchaseOrder $purchase_order; - public function __construct(PurchaseOrder $purchase_order) + public function __construct(private PurchaseOrder $purchase_order) { - $this->purchase_order = $purchase_order; } public function run() @@ -31,7 +29,19 @@ class PurchaseOrderInventory $p = Product::query()->where('product_key', $item->product_key)->where('company_id', $this->purchase_order->company_id)->first(); if (!$p) { - continue; + $p = new Product(); + $p->user_id = $this->purchase_order->user_id; + $p->company_id = $this->purchase_order->company_id; + $p->project_id = $this->purchase_order->project_id; + $p->vendor_id = $this->purchase_order->vendor_id; + $p->product_key = $item->product_key; + $p->notes = $item->notes ?? ''; + $p->price = $item->cost ?? 0; + $p->quantity = $item->quantity ?? 0; + $p->custom_value1 = $item->custom_value1 ?? ''; + $p->custom_value2 = $item->custom_value2 ?? ''; + $p->custom_value3 = $item->custom_value3 ?? ''; + $p->custom_value4 = $item->custom_value4 ?? ''; } $p->in_stock_quantity += $item->quantity; diff --git a/phpstan.neon b/phpstan.neon index 12c2ae3a3c..4ab5daf417 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -22,6 +22,7 @@ parameters: - App\DataMapper\Tax\RuleInterface - App\DataMapper\FeesAndLimits - \Postmark\Models\DynamicResponseModel + - \Stripe\Collection reportUnmatchedIgnoredErrors: false ignoreErrors: - '#Array has 2 duplicate keys with value#'