Auto increment invoice number counter
This commit is contained in:
parent
68bb3c8a82
commit
72d906d6d2
3 changed files with 16 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue