Add batch limits for hosted imports

This commit is contained in:
Hillel Coren 2016-07-19 18:57:01 +03:00
parent d534b5595b
commit bd70b4596c
3 changed files with 7 additions and 0 deletions

View File

@ -475,6 +475,7 @@ if (!defined('CONTACT_EMAIL')) {
define('LOGGED_ERROR_LIMIT', 100); define('LOGGED_ERROR_LIMIT', 100);
define('RANDOM_KEY_LENGTH', 32); define('RANDOM_KEY_LENGTH', 32);
define('MAX_NUM_USERS', 20); define('MAX_NUM_USERS', 20);
define('MAX_IMPORT_ROWS', 500);
define('MAX_SUBDOMAIN_LENGTH', 30); define('MAX_SUBDOMAIN_LENGTH', 30);
define('MAX_IFRAME_URL_LENGTH', 250); define('MAX_IFRAME_URL_LENGTH', 250);
define('MAX_LOGO_FILE_SIZE', 200); // KB define('MAX_LOGO_FILE_SIZE', 200); // KB

View File

@ -6,6 +6,7 @@ use Excel;
use Cache; use Cache;
use Exception; use Exception;
use Auth; use Auth;
use Utils;
use parsecsv; use parsecsv;
use Session; use Session;
use Validator; use Validator;
@ -332,6 +333,10 @@ class ImportService
*/ */
private function checkData($entityType, $count) 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) { if ($entityType === ENTITY_CLIENT) {
$this->checkClientCount($count); $this->checkClientCount($count);
} }

View File

@ -2042,6 +2042,7 @@ $LANG = array(
'wepay_account_description' => 'Payment gateway for Invoice Ninja', 'wepay_account_description' => 'Payment gateway for Invoice Ninja',
'payment_error_code' => 'There was an error processing your payment [:code]. Please try again later.', '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.', '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',
); );