diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index a2785e1e0930..d4a358ebcfc9 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -476,7 +476,11 @@ class AccountController extends BaseController { if (Auth::user()->account->isPro()) { - $rules = []; + $rules = [ + 'invoice_number_pattern' => 'has_counter', + 'quote_number_pattern' => 'has_counter', + ]; + $user = Auth::user(); $iframeURL = preg_replace('/[^a-zA-Z0-9_\-\:\/\.]/', '', substr(strtolower(Input::get('iframe_url')), 0, MAX_IFRAME_URL_LENGTH)); $iframeURL = rtrim($iframeURL, "/"); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 8cf422da913d..07e5f03134da 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -144,6 +144,10 @@ class AppServiceProvider extends ServiceProvider { Validator::replacer('less_than', function($message, $attribute, $rule, $parameters) { return str_replace(':value', $parameters[0], $message); }); + + Validator::extend('has_counter', function($attribute, $value, $parameters) { + return !$value || strstr($value, '{$counter}'); + }); } /** diff --git a/resources/lang/da/validation.php b/resources/lang/da/validation.php index 4fb673d7b1c5..6162f3f14e40 100644 --- a/resources/lang/da/validation.php +++ b/resources/lang/da/validation.php @@ -77,6 +77,7 @@ return array( "has_credit" => "The client does not have enough credit.", "notmasked" => "The values are masked", "less_than" => 'The :attribute must be less than :value', + "has_counter" => 'The value must contain {$counter}', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/de/validation.php b/resources/lang/de/validation.php index e5199303c2a9..2290a944af39 100644 --- a/resources/lang/de/validation.php +++ b/resources/lang/de/validation.php @@ -75,7 +75,8 @@ return array( "has_credit" => "Der Kunde hat nicht genug Guthaben.", "notmasked" => "The values are masked", "less_than" => 'The :attribute must be less than :value', - + "has_counter" => 'The value must contain {$counter}', + /* |-------------------------------------------------------------------------- | Custom Validation Language Lines diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index c43c94cbd2ae..bd46a6106bfd 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -73,6 +73,7 @@ return array( "has_credit" => "The client does not have enough credit.", "notmasked" => "The values are masked", "less_than" => 'The :attribute must be less than :value', + "has_counter" => 'The value must contain {$counter}', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/es/validation.php b/resources/lang/es/validation.php index d46abe4a1972..9d1c2e724c41 100644 --- a/resources/lang/es/validation.php +++ b/resources/lang/es/validation.php @@ -74,7 +74,8 @@ return array( "has_credit" => "el cliente no tiene crédito suficiente.", "notmasked" => "The values are masked", "less_than" => 'The :attribute must be less than :value', - + "has_counter" => 'The value must contain {$counter}', + /* |-------------------------------------------------------------------------- | Custom Validation Language Lines diff --git a/resources/lang/es_ES/validation.php b/resources/lang/es_ES/validation.php index d46abe4a1972..407fe133ee95 100644 --- a/resources/lang/es_ES/validation.php +++ b/resources/lang/es_ES/validation.php @@ -74,6 +74,7 @@ return array( "has_credit" => "el cliente no tiene crédito suficiente.", "notmasked" => "The values are masked", "less_than" => 'The :attribute must be less than :value', + "has_counter" => 'The value must contain {$counter}', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index ad7961b570b1..b32593461114 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -75,6 +75,7 @@ return array( "has_credit" => "The client does not have enough credit.", "notmasked" => "The values are masked", "less_than" => 'The :attribute must be less than :value', + "has_counter" => 'The value must contain {$counter}', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/fr_CA/validation.php b/resources/lang/fr_CA/validation.php index 13f6df0d6f7d..ec100938893a 100644 --- a/resources/lang/fr_CA/validation.php +++ b/resources/lang/fr_CA/validation.php @@ -75,6 +75,7 @@ return array( "has_credit" => "Le client n'a pas un crédit suffisant.", "notmasked" => "Les valeurs sont masquées", "less_than" => 'The :attribute must be less than :value', + "has_counter" => 'The value must contain {$counter}', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/it/validation.php b/resources/lang/it/validation.php index f30a246e29f0..e250da743d17 100644 --- a/resources/lang/it/validation.php +++ b/resources/lang/it/validation.php @@ -74,6 +74,7 @@ return array( "has_credit" => "The client does not have enough credit.", "notmasked" => "The values are masked", "less_than" => 'The :attribute must be less than :value', + "has_counter" => 'The value must contain {$counter}', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/nb_NO/validation.php b/resources/lang/nb_NO/validation.php index dc38eebec36f..75d5ca3a27d7 100644 --- a/resources/lang/nb_NO/validation.php +++ b/resources/lang/nb_NO/validation.php @@ -73,6 +73,7 @@ return array( "has_credit" => "Klienten har ikke høy nok kreditt.", "notmasked" => "Verdiene er skjult", "less_than" => 'The :attribute must be less than :value', + "has_counter" => 'The value must contain {$counter}', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/nl/validation.php b/resources/lang/nl/validation.php index 8cd5c1f111c5..38e3e49adb26 100644 --- a/resources/lang/nl/validation.php +++ b/resources/lang/nl/validation.php @@ -75,6 +75,7 @@ return array( "has_credit" => "De klant heeft niet voldoende krediet.", "notmasked" => "De waarden zijn verborgen", "less_than" => 'Het :attribute moet minder zijn dan :value', + "has_counter" => 'The value must contain {$counter}', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/pt_BR/validation.php b/resources/lang/pt_BR/validation.php index d998f3fb2b67..93a51c8211e8 100644 --- a/resources/lang/pt_BR/validation.php +++ b/resources/lang/pt_BR/validation.php @@ -73,6 +73,7 @@ return array( "has_credit" => "O cliente não possui crédito suficiente.", "notmasked" => "The values are masked", "less_than" => 'The :attribute must be less than :value', +"has_counter" => 'The value must contain {$counter}', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/sv/validation.php b/resources/lang/sv/validation.php index 6d0ee4e756ca..6110162bf9be 100644 --- a/resources/lang/sv/validation.php +++ b/resources/lang/sv/validation.php @@ -77,6 +77,7 @@ return [ "has_credit" => "The client does not have enough credit.", "notmasked" => "The values are masked", "less_than" => 'The :attribute must be less than :value', + "has_counter" => 'The value must contain {$counter}', /* |-------------------------------------------------------------------------- diff --git a/resources/views/accounts/invoice_settings.blade.php b/resources/views/accounts/invoice_settings.blade.php index 5f05ff4445e0..f7f2ed174678 100644 --- a/resources/views/accounts/invoice_settings.blade.php +++ b/resources/views/accounts/invoice_settings.blade.php @@ -241,9 +241,9 @@