From 3613a0e2d519ad7b7c4f1d5b3edaf07f99bcab78 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 10 Sep 2022 09:44:43 +1000 Subject: [PATCH] Improve client imports --- .../ValidationRules/Account/BlackListRule.php | 1 + app/Import/Providers/BaseImport.php | 20 ++--- composer.lock | 75 ++++++++++--------- 3 files changed, 49 insertions(+), 47 deletions(-) diff --git a/app/Http/ValidationRules/Account/BlackListRule.php b/app/Http/ValidationRules/Account/BlackListRule.php index 0a2a681f0f..1735708800 100644 --- a/app/Http/ValidationRules/Account/BlackListRule.php +++ b/app/Http/ValidationRules/Account/BlackListRule.php @@ -26,6 +26,7 @@ class BlackListRule implements Rule 'arxxwalls.com', 'superhostforumla.com', 'wnpop.com', + 'dataservices.space', ]; /** diff --git a/app/Import/Providers/BaseImport.php b/app/Import/Providers/BaseImport.php index e63bffe6cb..1ec4151e88 100644 --- a/app/Import/Providers/BaseImport.php +++ b/app/Import/Providers/BaseImport.php @@ -173,18 +173,18 @@ class BaseImport $is_free_hosted_client = $this->company->account->isFreeHostedClient(); $hosted_client_count = $this->company->account->hosted_client_count; + if($this->factory_name instanceof ClientFactory && $is_free_hosted_client && (count($data) > $hosted_client_count)) + { + $this->error_array[$entity_type][] = [ + $entity_type => 'client', + 'error' => 'Error, you are attempting to import more clients than your plan allows', + ]; + + return $count; + } + foreach ($data as $key => $record) { - if($this->factory_name instanceof ClientFactory && $is_free_hosted_client && ($this->company->clients()->count() > $hosted_client_count)) - { - $this->error_array[$entity_type][] = [ - $entity_type => $record, - 'error' => 'Client limit reached', - ]; - - return $count; - } - try { $entity = $this->transformer->transform($record); // $validator = $this->request_name::runFormRequest($entity); diff --git a/composer.lock b/composer.lock index 725da7645b..33dfd47e41 100644 --- a/composer.lock +++ b/composer.lock @@ -378,16 +378,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.235.3", + "version": "3.235.5", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "d14bf468240f5bd8a0754b8a8248ff219ebada02" + "reference": "3b002b92369dbcb8d86f32546cb324eabcd19a4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d14bf468240f5bd8a0754b8a8248ff219ebada02", - "reference": "d14bf468240f5bd8a0754b8a8248ff219ebada02", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3b002b92369dbcb8d86f32546cb324eabcd19a4e", + "reference": "3b002b92369dbcb8d86f32546cb324eabcd19a4e", "shasum": "" }, "require": { @@ -464,9 +464,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.235.3" + "source": "https://github.com/aws/aws-sdk-php/tree/3.235.5" }, - "time": "2022-09-07T18:17:39+00:00" + "time": "2022-09-09T18:19:38+00:00" }, { "name": "bacon/bacon-qr-code", @@ -3481,16 +3481,16 @@ }, { "name": "laravel/framework", - "version": "v9.28.0", + "version": "v9.29.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "396a89e1f3654123d1c7f56306051212e5c75bc0" + "reference": "585da0913e907fd54941260860ae3d7d4be8e8cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/396a89e1f3654123d1c7f56306051212e5c75bc0", - "reference": "396a89e1f3654123d1c7f56306051212e5c75bc0", + "url": "https://api.github.com/repos/laravel/framework/zipball/585da0913e907fd54941260860ae3d7d4be8e8cb", + "reference": "585da0913e907fd54941260860ae3d7d4be8e8cb", "shasum": "" }, "require": { @@ -3657,20 +3657,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-09-06T14:57:01+00:00" + "time": "2022-09-09T18:21:21+00:00" }, { "name": "laravel/serializable-closure", - "version": "v1.2.1", + "version": "v1.2.2", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "d78fd36ba031a1a695ea5a406f29996948d7011b" + "reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/d78fd36ba031a1a695ea5a406f29996948d7011b", - "reference": "d78fd36ba031a1a695ea5a406f29996948d7011b", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/47afb7fae28ed29057fdca37e16a84f90cc62fae", + "reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae", "shasum": "" }, "require": { @@ -3717,7 +3717,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2022-08-26T15:25:27+00:00" + "time": "2022-09-08T13:45:54+00:00" }, { "name": "laravel/slack-notification-channel", @@ -4387,16 +4387,16 @@ }, { "name": "league/flysystem", - "version": "3.2.1", + "version": "3.3.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "81aea9e5217084c7850cd36e1587ee4aad721c6b" + "reference": "d8295793b3e2f91aa39e1feb2d5bfce772891ae2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/81aea9e5217084c7850cd36e1587ee4aad721c6b", - "reference": "81aea9e5217084c7850cd36e1587ee4aad721c6b", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d8295793b3e2f91aa39e1feb2d5bfce772891ae2", + "reference": "d8295793b3e2f91aa39e1feb2d5bfce772891ae2", "shasum": "" }, "require": { @@ -4407,6 +4407,7 @@ "aws/aws-sdk-php": "3.209.31 || 3.210.0", "guzzlehttp/guzzle": "<7.0", "guzzlehttp/ringphp": "<1.1.1", + "phpseclib/phpseclib": "3.0.15", "symfony/http-client": "<5.2" }, "require-dev": { @@ -4420,7 +4421,7 @@ "friendsofphp/php-cs-fixer": "^3.5", "google/cloud-storage": "^1.23", "microsoft/azure-storage-blob": "^1.1", - "phpseclib/phpseclib": "^2.0", + "phpseclib/phpseclib": "^3.0.14", "phpstan/phpstan": "^0.12.26", "phpunit/phpunit": "^9.5.11", "sabre/dav": "^4.3.1" @@ -4457,11 +4458,11 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.2.1" + "source": "https://github.com/thephpleague/flysystem/tree/3.3.0" }, "funding": [ { - "url": "https://offset.earth/frankdejonge", + "url": "https://ecologi.com/frankdejonge", "type": "custom" }, { @@ -4473,20 +4474,20 @@ "type": "tidelift" } ], - "time": "2022-08-14T20:48:34+00:00" + "time": "2022-09-09T11:11:42+00:00" }, { "name": "league/flysystem-aws-s3-v3", - "version": "3.2.0", + "version": "3.3.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", - "reference": "257893ef7398b3c9255b26dff8b0118bb93fc5ff" + "reference": "c9402e0b8d89d36b1b88ecf88c2a80b6d61fd114" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/257893ef7398b3c9255b26dff8b0118bb93fc5ff", - "reference": "257893ef7398b3c9255b26dff8b0118bb93fc5ff", + "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/c9402e0b8d89d36b1b88ecf88c2a80b6d61fd114", + "reference": "c9402e0b8d89d36b1b88ecf88c2a80b6d61fd114", "shasum": "" }, "require": { @@ -4527,11 +4528,11 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues", - "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.2.0" + "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.3.0" }, "funding": [ { - "url": "https://offset.earth/frankdejonge", + "url": "https://ecologi.com/frankdejonge", "type": "custom" }, { @@ -4543,7 +4544,7 @@ "type": "tidelift" } ], - "time": "2022-07-26T07:22:40+00:00" + "time": "2022-09-09T10:03:42+00:00" }, { "name": "league/fractal", @@ -11988,16 +11989,16 @@ }, { "name": "turbo124/beacon", - "version": "v1.3.2", + "version": "v1.3.4", "source": { "type": "git", "url": "https://github.com/turbo124/beacon.git", - "reference": "e46e6122e28c2a7628ad40975bfd11a3ab883575" + "reference": "4a0c9c6af3d88142e89184e67e9f0547078d5ef0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/turbo124/beacon/zipball/e46e6122e28c2a7628ad40975bfd11a3ab883575", - "reference": "e46e6122e28c2a7628ad40975bfd11a3ab883575", + "url": "https://api.github.com/repos/turbo124/beacon/zipball/4a0c9c6af3d88142e89184e67e9f0547078d5ef0", + "reference": "4a0c9c6af3d88142e89184e67e9f0547078d5ef0", "shasum": "" }, "require": { @@ -12044,9 +12045,9 @@ "turbo124" ], "support": { - "source": "https://github.com/turbo124/beacon/tree/v1.3.2" + "source": "https://github.com/turbo124/beacon/tree/v1.3.4" }, - "time": "2022-09-08T08:08:59+00:00" + "time": "2022-09-09T23:30:23+00:00" }, { "name": "twilio/sdk",