1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02:00
invoiceninja/app/Services/Quote/ApplyNumber.php
David Bomba 43e57d0117
Fixes for self-update (#3514)
* minor fix for payment notifications

* styleci

* Limit Self updating to self hosters only
:

* Fixes for designs

* Minor fixes for self-update
2020-03-21 16:37:30 +11:00

42 lines
893 B
PHP

<?php
namespace App\Services\Quote;
use App\Models\Quote;
use App\Utils\Traits\GeneratesCounter;
class ApplyNumber
{
use GeneratesCounter;
private $client;
public function __construct($client)
{
$this->client = $client;
}
public function run($quote)
{
if ($quote->number != '') {
return $quote;
}
switch ($this->client->getSetting('counter_number_applied')) {
case 'when_saved':
$quote->number = $this->getNextQuoteNumber($this->client);
break;
case 'when_sent':
if ($quote->status_id == Quote::STATUS_SENT) {
$quote->number = $this->getNextQuoteNumber($this->client);
}
break;
default:
# code...
break;
}
return $quote;
}
}