Adjustments for forte import customers

This commit is contained in:
David Bomba 2025-04-23 11:36:14 +10:00
parent abc3ae7314
commit c8eb2bc8c3
3 changed files with 42 additions and 36 deletions

View File

@ -125,11 +125,13 @@ class InvoiceExport extends BaseExport
if ($tax_amount_position = array_search('invoice.total_taxes', $this->input['report_keys'])) { if ($tax_amount_position = array_search('invoice.total_taxes', $this->input['report_keys'])) {
$first_part = array_slice($this->input['report_keys'], 0, $tax_amount_position + 1); $first_part = array_slice($this->input['report_keys'], 0, $tax_amount_position + 1);
$second_part = array_slice($this->input['report_keys'], $tax_amount_position + 1); $second_part = array_slice($this->input['report_keys'], $tax_amount_position + 1);
$labels = [];
$this->tax_names = $query->get() $this->tax_names = $query->get()
->flatMap(function ($invoice) { ->flatMap(function ($invoice) {
$taxes = []; $taxes = [];
/** @var \App\Models\Invoice $invoice */
// Invoice level taxes // Invoice level taxes
if (!empty($invoice->tax_name1) && !empty($invoice->tax_rate1)) { if (!empty($invoice->tax_name1) && !empty($invoice->tax_rate1)) {
$taxes[] = trim($invoice->tax_name1) . ' ' . \App\Utils\Number::formatValueNoTrailingZeroes(floatval($invoice->tax_rate1), $invoice->client) . '%'; $taxes[] = trim($invoice->tax_name1) . ' ' . \App\Utils\Number::formatValueNoTrailingZeroes(floatval($invoice->tax_rate1), $invoice->client) . '%';

View File

@ -93,7 +93,7 @@ class ForteCustomerFactory
private function getBillingAddress(array $customer): array private function getBillingAddress(array $customer): array
{ {
nlog($customer);
if (isset($customer['default_billing_address_token']) && isset($customer['addresses'])) { if (isset($customer['default_billing_address_token']) && isset($customer['addresses'])) {
foreach ($customer['addresses'] as $address) { foreach ($customer['addresses'] as $address) {
@ -141,7 +141,7 @@ class ForteCustomerFactory
private function getShippingAddress(array $customer): array private function getShippingAddress(array $customer): array
{ {
if (isset($customer['default_shipping_address_token'])) { if (isset($customer['default_shipping_address_token']) && isset($customer['addresses'])) {
foreach ($customer['addresses'] as $address) { foreach ($customer['addresses'] as $address) {

72
composer.lock generated
View File

@ -252,16 +252,16 @@
}, },
{ {
"name": "apimatic/unirest-php", "name": "apimatic/unirest-php",
"version": "4.0.5", "version": "4.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/apimatic/unirest-php.git", "url": "https://github.com/apimatic/unirest-php.git",
"reference": "e16754010c16be5473289470f129d87a0f41b55e" "reference": "df38c93ffa71e8a1b7a075c2322c28cdfe8fe1f5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/apimatic/unirest-php/zipball/e16754010c16be5473289470f129d87a0f41b55e", "url": "https://api.github.com/repos/apimatic/unirest-php/zipball/df38c93ffa71e8a1b7a075c2322c28cdfe8fe1f5",
"reference": "e16754010c16be5473289470f129d87a0f41b55e", "reference": "df38c93ffa71e8a1b7a075c2322c28cdfe8fe1f5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -311,9 +311,9 @@
"support": { "support": {
"email": "opensource@apimatic.io", "email": "opensource@apimatic.io",
"issues": "https://github.com/apimatic/unirest-php/issues", "issues": "https://github.com/apimatic/unirest-php/issues",
"source": "https://github.com/apimatic/unirest-php/tree/4.0.5" "source": "https://github.com/apimatic/unirest-php/tree/4.0.6"
}, },
"time": "2023-04-25T14:19:45+00:00" "time": "2025-04-22T09:12:12+00:00"
}, },
{ {
"name": "asm/php-ansible", "name": "asm/php-ansible",
@ -1192,16 +1192,16 @@
}, },
{ {
"name": "checkout/checkout-sdk-php", "name": "checkout/checkout-sdk-php",
"version": "3.2.7", "version": "3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/checkout/checkout-sdk-php.git", "url": "https://github.com/checkout/checkout-sdk-php.git",
"reference": "4b9438214a4777b343ff145eadefb5b5aa5c25a7" "reference": "61a9d9e8b7d64f39ee58cc625c48eebd5d22c058"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/checkout/checkout-sdk-php/zipball/4b9438214a4777b343ff145eadefb5b5aa5c25a7", "url": "https://api.github.com/repos/checkout/checkout-sdk-php/zipball/61a9d9e8b7d64f39ee58cc625c48eebd5d22c058",
"reference": "4b9438214a4777b343ff145eadefb5b5aa5c25a7", "reference": "61a9d9e8b7d64f39ee58cc625c48eebd5d22c058",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1254,9 +1254,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/checkout/checkout-sdk-php/issues", "issues": "https://github.com/checkout/checkout-sdk-php/issues",
"source": "https://github.com/checkout/checkout-sdk-php/tree/3.2.7" "source": "https://github.com/checkout/checkout-sdk-php/tree/3.2.8"
}, },
"time": "2024-11-20T09:31:05+00:00" "time": "2025-04-22T08:03:18+00:00"
}, },
{ {
"name": "clue/stream-filter", "name": "clue/stream-filter",
@ -5740,16 +5740,16 @@
}, },
{ {
"name": "laravel/socialite", "name": "laravel/socialite",
"version": "v5.19.0", "version": "v5.20.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/socialite.git", "url": "https://github.com/laravel/socialite.git",
"reference": "c40f843c5643fb6b089e46ce9794b8408bf08319" "reference": "30972c12a41f71abeb418bc9ff157da8d9231519"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/socialite/zipball/c40f843c5643fb6b089e46ce9794b8408bf08319", "url": "https://api.github.com/repos/laravel/socialite/zipball/30972c12a41f71abeb418bc9ff157da8d9231519",
"reference": "c40f843c5643fb6b089e46ce9794b8408bf08319", "reference": "30972c12a41f71abeb418bc9ff157da8d9231519",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5808,7 +5808,7 @@
"issues": "https://github.com/laravel/socialite/issues", "issues": "https://github.com/laravel/socialite/issues",
"source": "https://github.com/laravel/socialite" "source": "https://github.com/laravel/socialite"
}, },
"time": "2025-03-27T17:26:42+00:00" "time": "2025-04-21T14:21:34+00:00"
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
@ -18140,16 +18140,16 @@
}, },
{ {
"name": "larastan/larastan", "name": "larastan/larastan",
"version": "v2.10.0", "version": "v2.11.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/larastan/larastan.git", "url": "https://github.com/larastan/larastan.git",
"reference": "05519d721277604487a3ca71bdee87739d8d8716" "reference": "484dabe3d75c7573b08c6a946d40b26211374396"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/larastan/larastan/zipball/05519d721277604487a3ca71bdee87739d8d8716", "url": "https://api.github.com/repos/larastan/larastan/zipball/484dabe3d75c7573b08c6a946d40b26211374396",
"reference": "05519d721277604487a3ca71bdee87739d8d8716", "reference": "484dabe3d75c7573b08c6a946d40b26211374396",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -18166,7 +18166,7 @@
"phpstan/phpstan": "^1.12.17" "phpstan/phpstan": "^1.12.17"
}, },
"require-dev": { "require-dev": {
"doctrine/coding-standard": "^12.0", "doctrine/coding-standard": "^13",
"laravel/framework": "^9.52.20 || ^10.48.28 || ^11.41.3", "laravel/framework": "^9.52.20 || ^10.48.28 || ^11.41.3",
"mockery/mockery": "^1.5.1", "mockery/mockery": "^1.5.1",
"nikic/php-parser": "^4.19.1", "nikic/php-parser": "^4.19.1",
@ -18202,10 +18202,6 @@
{ {
"name": "Can Vural", "name": "Can Vural",
"email": "can9119@gmail.com" "email": "can9119@gmail.com"
},
{
"name": "Nuno Maduro",
"email": "enunomaduro@gmail.com"
} }
], ],
"description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel", "description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel",
@ -18221,7 +18217,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/larastan/larastan/issues", "issues": "https://github.com/larastan/larastan/issues",
"source": "https://github.com/larastan/larastan/tree/v2.10.0" "source": "https://github.com/larastan/larastan/tree/v2.11.0"
}, },
"funding": [ "funding": [
{ {
@ -18229,7 +18225,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-03-14T21:52:58+00:00" "time": "2025-04-21T20:12:00+00:00"
}, },
{ {
"name": "mockery/mockery", "name": "mockery/mockery",
@ -18984,16 +18980,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "11.5.17", "version": "11.5.18",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "fd2e863a2995cdfd864fb514b5e0b28b09895b5c" "reference": "fc3e887c7f3f9917e1bf61e523413d753db00a17"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fd2e863a2995cdfd864fb514b5e0b28b09895b5c", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc3e887c7f3f9917e1bf61e523413d753db00a17",
"reference": "fd2e863a2995cdfd864fb514b5e0b28b09895b5c", "reference": "fc3e887c7f3f9917e1bf61e523413d753db00a17",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -19065,7 +19061,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy", "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.17" "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.18"
}, },
"funding": [ "funding": [
{ {
@ -19076,12 +19072,20 @@
"url": "https://github.com/sebastianbergmann", "url": "https://github.com/sebastianbergmann",
"type": "github" "type": "github"
}, },
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{ {
"url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit",
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-04-08T07:59:11+00:00" "time": "2025-04-22T06:09:49+00:00"
}, },
{ {
"name": "react/cache", "name": "react/cache",