diff --git a/app/Http/Middleware/StartupCheck.php b/app/Http/Middleware/StartupCheck.php index 5bc4d54320..8f42b9355c 100644 --- a/app/Http/Middleware/StartupCheck.php +++ b/app/Http/Middleware/StartupCheck.php @@ -34,7 +34,7 @@ class StartupCheck // Ensure all request are over HTTPS in production if (Utils::requireHTTPS() && !Request::secure()) { - return Redirect::secure(Request::getRequestUri()); + //return Redirect::secure(Request::getRequestUri()); } // If the database doens't yet exist we'll skip the rest diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index a6ded03507..4af034825d 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -232,6 +232,13 @@ class Utils return floatval($value); } + public static function parseInt($value) + { + $value = preg_replace('/[^0-9]/', '', $value); + + return intval($value); + } + public static function formatMoney($value, $currencyId = false, $showSymbol = true) { if (!$currencyId) { diff --git a/app/Models/Account.php b/app/Models/Account.php index 1a66909291..41edf7d759 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -443,7 +443,14 @@ class Account extends Eloquent if ($invoice->is_quote && !$this->share_counter) { $this->quote_number_counter += 1; } else { - $this->invoice_number_counter += 1; + $default = $this->invoice_number_counter; + $actual = Utils::parseInt($invoice->invoice_number); + + if ( ! $this->isPro() && $default != $actual) { + $this->invoice_number_counter = $actual + 1; + } else { + $this->invoice_number_counter += 1; + } } $this->save();