Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Apr 29, 2023
1 parent 678bc84 commit d2109f4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/Abstracts/View/Components/Documents/Form.php
Expand Up @@ -267,7 +267,6 @@ abstract class Form extends Component
* @return void
*/
public function __construct(
protected DocumentNumber $documentNumberUtility,
string $type, $model = false, $document = false, $currencies = false, $currency = false, $currency_code = false,
string $formId = 'document', $formRoute = '', $formMethod = '',
bool $hideCompany = false, string $textSectionCompaniesTitle = '', string $textSectionCompaniesDescription = '',
Expand Down Expand Up @@ -817,12 +816,14 @@ protected function getDocumentNumber($type, $document, $documentNumber)
return $document->document_number;
}

$contact = ($this->contact instanceof \stdClass) ? null : $this->contact;
$contact = ($this->contact instanceof Contact) ? $this->contact : null;

$document_number = $this->documentNumberUtility->getNextNumber($type, $contact);
$utility = app(DocumentNumber::class);

$document_number = $utility->getNextNumber($type, $contact);

if (empty($document_number)) {
$document_number = $this->documentNumberUtility->getNextNumber(Document::INVOICE_TYPE, $contact);
$document_number = $utility->getNextNumber(Document::INVOICE_TYPE, $contact);
}

return $document_number;
Expand Down

0 comments on commit d2109f4

Please sign in to comment.