mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
remove legacy setting option
This commit is contained in:
parent
c8eb191bb2
commit
9ed31be17e
@ -25,7 +25,6 @@ class CompanySettings extends BaseSettings
|
||||
|
||||
/*Invoice*/
|
||||
public $auto_archive_invoice = false;
|
||||
public $lock_sent_invoices = false;
|
||||
|
||||
public $lock_invoices = 'off'; //off,when_sent,when_paid
|
||||
|
||||
@ -391,7 +390,6 @@ class CompanySettings extends BaseSettings
|
||||
'show_currency_code' => 'bool',
|
||||
'send_reminders' => 'bool',
|
||||
'enable_client_portal_tasks' => 'bool',
|
||||
'lock_sent_invoices' => 'bool',
|
||||
'auto_archive_invoice' => 'bool',
|
||||
'auto_archive_quote' => 'bool',
|
||||
'auto_convert_quote' => 'bool',
|
||||
|
@ -392,6 +392,9 @@ class InvoiceController extends BaseController
|
||||
return $request->disallowUpdate();
|
||||
}
|
||||
|
||||
if($invoice->isLocked())
|
||||
return response()->json(['message' => 'Invoice is locked, no modifications allowed']);
|
||||
|
||||
$invoice = $this->invoice_repo->save($request->all(), $invoice);
|
||||
|
||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars()));
|
||||
|
@ -30,7 +30,7 @@
|
||||
* @OA\Property(property="custom_message_unpaid_invoice", type="string", example="Please pay invoices immediately", description="____________"),
|
||||
* @OA\Property(property="custom_message_paid_invoice", type="string", example="Thanks for paying this invoice!", description="____________"),
|
||||
* @OA\Property(property="custom_message_unapproved_quote", type="string", example="Please approve quote", description="____________"),
|
||||
* @OA\Property(property="lock_sent_invoices", type="boolean", example=true, description="____________"),
|
||||
* @OA\Property(property="lock_invoices", type="boolean", example=true, description="____________"),
|
||||
* @OA\Property(property="auto_archive_invoice", type="boolean", example=true, description="____________"),
|
||||
* @OA\Property(property="auto_archive_quote", type="boolean", example=true, description="____________"),
|
||||
* @OA\Property(property="auto_convert_quote", type="boolean", example=true, description="____________"),
|
||||
|
@ -266,17 +266,6 @@ class Invoice extends BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If True, prevents an invoice from being
|
||||
* modified once it has been marked as sent
|
||||
*
|
||||
* @return boolean isLocked
|
||||
*/
|
||||
public function isLocked(): bool
|
||||
{
|
||||
return $this->client->getSetting('lock_sent_invoices');
|
||||
}
|
||||
|
||||
public function isPayable(): bool
|
||||
{
|
||||
if($this->status_id == Invoice::STATUS_DRAFT && $this->is_deleted == false){
|
||||
@ -437,6 +426,32 @@ class Invoice extends BaseModel
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filtering logic to determine
|
||||
* whether an invoice is locked
|
||||
* based on the current status of the invoice
|
||||
* @return boolean [description]
|
||||
*/
|
||||
public function isLocked() :bool
|
||||
{
|
||||
$locked_status = $this->client->getSetting('lock_invoices');
|
||||
|
||||
switch ($locked_status) {
|
||||
case 'off':
|
||||
return false;
|
||||
break;
|
||||
case 'when_sent':
|
||||
return $this->status_id == self::STATUS_DRAFT;
|
||||
break;
|
||||
case 'when_paid':
|
||||
return $this->status_id == self::STATUS_PAID || $this->status_id == self::STATUS_PARTIAL;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Graveyard */
|
||||
|
||||
// /**
|
||||
|
Loading…
x
Reference in New Issue
Block a user