Fixes for imports

This commit is contained in:
David Bomba 2024-04-12 08:38:55 +10:00
parent 65660fdc42
commit 865c9f18c4
5 changed files with 28 additions and 23 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -492,7 +492,7 @@ class StripePaymentDriver extends BaseDriver
return $customer;
}
return false;
return null;
}
/**

View File

@ -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;
}

22
composer.lock generated
View File

@ -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",