diff --git a/app/Http/routes.php b/app/Http/routes.php index d7928bae37..0c759ecd43 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -475,6 +475,7 @@ if (!defined('CONTACT_EMAIL')) { define('LOGGED_ERROR_LIMIT', 100); define('RANDOM_KEY_LENGTH', 32); define('MAX_NUM_USERS', 20); + define('MAX_IMPORT_ROWS', 500); define('MAX_SUBDOMAIN_LENGTH', 30); define('MAX_IFRAME_URL_LENGTH', 250); define('MAX_LOGO_FILE_SIZE', 200); // KB diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index 4f08976871..9872066bdb 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -6,6 +6,7 @@ use Excel; use Cache; use Exception; use Auth; +use Utils; use parsecsv; use Session; use Validator; @@ -332,6 +333,10 @@ class ImportService */ private function checkData($entityType, $count) { + if (Utils::isNinja() && $count > MAX_IMPORT_ROWS) { + throw new Exception(trans('texts.limit_import_rows', ['count' => MAX_IMPORT_ROWS])); + } + if ($entityType === ENTITY_CLIENT) { $this->checkClientCount($count); } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 6c8fd3cb68..d2a83f399d 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2042,6 +2042,7 @@ $LANG = array( 'wepay_account_description' => 'Payment gateway for Invoice Ninja', 'payment_error_code' => 'There was an error processing your payment [:code]. Please try again later.', 'standard_fees_apply' => 'Standard fees apply: 2.9% + $0.30 per successful charge.', + 'limit_import_rows' => 'Data needs to be imported in batches of :count rows or less', );