refs #1753 move trait for setting number..
This commit is contained in:
parent
da99ff2d0a
commit
6822763d3c
@ -550,17 +550,7 @@ abstract class DocumentForm extends Base
|
||||
return $document->document_number;
|
||||
}
|
||||
|
||||
$next = $type;
|
||||
|
||||
if ($alias = config('type.' . $type . '.alias')) {
|
||||
$next = $alias . '.' . str_replace('-', '_', $type);
|
||||
}
|
||||
|
||||
$document_number = $this->getNextDocumentNumber($next);
|
||||
|
||||
if (empty($document_number)) {
|
||||
$document_number = $this->getNextDocumentNumber($type);
|
||||
}
|
||||
|
||||
if (empty($document_number)) {
|
||||
$document_number = $this->getNextDocumentNumber(Document::INVOICE_TYPE);
|
||||
|
@ -11,6 +11,10 @@ trait Documents
|
||||
{
|
||||
public function getNextDocumentNumber(string $type): string
|
||||
{
|
||||
if ($alias = config('type.' . $type . '.alias')) {
|
||||
$type = $alias . '.' . str_replace('-', '_', $type);
|
||||
}
|
||||
|
||||
$prefix = setting("$type.number_prefix");
|
||||
$next = setting("$type.number_next");
|
||||
$digit = setting("$type.number_digit");
|
||||
@ -20,6 +24,10 @@ trait Documents
|
||||
|
||||
public function increaseNextDocumentNumber(string $type): void
|
||||
{
|
||||
if ($alias = config('type.' . $type . '.alias')) {
|
||||
$type = $alias . '.' . str_replace('-', '_', $type);
|
||||
}
|
||||
|
||||
$next = setting("$type.number_next", 1) + 1;
|
||||
|
||||
setting(["$type.number_next" => $next]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user