From 865c9f18c49e9cc36d788df5bff8cd3f84d9508a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 12 Apr 2024 08:38:55 +1000 Subject: [PATCH] Fixes for imports --- app/Import/Providers/BaseImport.php | 13 +++++++---- app/Models/Quote.php | 10 ++++----- app/PaymentDrivers/StripePaymentDriver.php | 2 +- .../Subscription/SubscriptionCalculator.php | 4 ++-- composer.lock | 22 +++++++++---------- 5 files changed, 28 insertions(+), 23 deletions(-) diff --git a/app/Import/Providers/BaseImport.php b/app/Import/Providers/BaseImport.php index 07b29aed0b66..2a54c24923ac 100644 --- a/app/Import/Providers/BaseImport.php +++ b/app/Import/Providers/BaseImport.php @@ -892,12 +892,17 @@ class BaseImport ksort($keys); $data = array_map(function ($row) use ($keys) { - $row_count = count($row); - $key_count = count($keys); - if ($key_count > $row_count) { - $row = array_pad($row, $key_count, ' '); + /** 12-04-2024 If we do not have matching keys - then this row import is _not_ valid */ + $row_keys = array_keys($row); + $key_keys = array_keys($keys); + + $diff = array_diff($key_keys, $row_keys); + + if(!empty($diff)) { + return false; } + /** 12-04-2024 If we do not have matching keys - then this row import is _not_ valid */ return array_combine($keys, array_intersect_key($row, $keys)); }, $data); diff --git a/app/Models/Quote.php b/app/Models/Quote.php index 3cf8a071ac23..a7b5a977c8e2 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -165,7 +165,7 @@ class Quote extends BaseModel protected $casts = [ // 'date' => 'date:Y-m-d', 'due_date' => 'date:Y-m-d', - // 'partial_due_date' => 'date:Y-m-d', + 'partial_due_date' => 'date:Y-m-d', 'line_items' => 'object', 'backup' => 'object', 'updated_at' => 'timestamp', @@ -200,10 +200,10 @@ class Quote extends BaseModel return $value ? $this->dateMutator($value) : null; } - public function getPartialDueDateAttribute($value) - { - return $this->dateMutator($value); - } + // public function getPartialDueDateAttribute($value) + // { + // return $this->dateMutator($value); + // } public function getStatusIdAttribute($value) { diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index ce5be245554a..a764863a1767 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -492,7 +492,7 @@ class StripePaymentDriver extends BaseDriver return $customer; } - return false; + return null; } /** diff --git a/app/Services/Subscription/SubscriptionCalculator.php b/app/Services/Subscription/SubscriptionCalculator.php index ad730d1677d4..326d5a6bc5bb 100644 --- a/app/Services/Subscription/SubscriptionCalculator.php +++ b/app/Services/Subscription/SubscriptionCalculator.php @@ -83,7 +83,7 @@ class SubscriptionCalculator $line_item->quantity = (float) $item['quantity']; $line_item->cost = (float) $item['product']['price']; $line_item->notes = $item['product']['notes']; - $line_item->tax_id = $item['product']['tax_id'] ?? '1'; + $line_item->tax_id = (string)$item['product']['tax_id'] ?? '1'; $items[] = $line_item; } @@ -99,7 +99,7 @@ class SubscriptionCalculator $line_item->quantity = (float) $item['quantity']; $line_item->cost = (float) $item['product']['price']; $line_item->notes = $item['product']['notes']; - $line_item->tax_id = $item['product']['tax_id'] ?? '1'; + $line_item->tax_id = (string)$item['product']['tax_id'] ?? '1'; $items[] = $line_item; } diff --git a/composer.lock b/composer.lock index 3d889d48e247..3f234bf47648 100644 --- a/composer.lock +++ b/composer.lock @@ -1384,16 +1384,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.304.1", + "version": "3.304.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "6dac9b3257873a807ac73f6dc4418bdc49a5d9db" + "reference": "2435079c3e1a08148d955de15ec090018114f35a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/6dac9b3257873a807ac73f6dc4418bdc49a5d9db", - "reference": "6dac9b3257873a807ac73f6dc4418bdc49a5d9db", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2435079c3e1a08148d955de15ec090018114f35a", + "reference": "2435079c3e1a08148d955de15ec090018114f35a", "shasum": "" }, "require": { @@ -1473,9 +1473,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.304.1" + "source": "https://github.com/aws/aws-sdk-php/tree/3.304.2" }, - "time": "2024-04-09T19:25:27+00:00" + "time": "2024-04-10T18:05:32+00:00" }, { "name": "bacon/bacon-qr-code", @@ -5526,16 +5526,16 @@ }, { "name": "laravel/framework", - "version": "v10.48.5", + "version": "v10.48.7", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "a8b682e1371338848637f638aedaef2f7607d36f" + "reference": "118c686992f4b90d4da6deaf0901315c337bbaf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/a8b682e1371338848637f638aedaef2f7607d36f", - "reference": "a8b682e1371338848637f638aedaef2f7607d36f", + "url": "https://api.github.com/repos/laravel/framework/zipball/118c686992f4b90d4da6deaf0901315c337bbaf9", + "reference": "118c686992f4b90d4da6deaf0901315c337bbaf9", "shasum": "" }, "require": { @@ -5729,7 +5729,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-04-09T14:48:50+00:00" + "time": "2024-04-10T14:57:20+00:00" }, { "name": "laravel/prompts",