Invoice Locking Feature #173

This commit is contained in:
Hillel Coren 2017-10-18 14:01:53 +03:00
parent f34cc7ef4e
commit 85cf468d97
4 changed files with 17 additions and 1 deletions

View File

@ -402,6 +402,8 @@ class InvoiceRepository extends BaseRepository
if ($invoice->is_deleted) {
return $invoice;
} elseif ($invoice->isSent() && config('ninja.lock_sent_invoices')) {
return $invoice;
}
if (isset($data['has_tasks']) && filter_var($data['has_tasks'], FILTER_VALIDATE_BOOLEAN)) {

View File

@ -2,6 +2,9 @@
return [
// invoice locking feature
'lock_sent_invoices' => env('LOCK_SENT_INVOICES'),
// Marketing links
'time_tracker_web_url' => env('TIME_TRACKER_WEB_URL', 'https://www.invoiceninja.com/time-tracker'),

View File

@ -123,6 +123,11 @@ You'll also need to set the following values in the .env file.
MSBOT_LUIS_APP_ID=...
MSBOT_LUIS_SUBSCRIPTION_KEY=...
Lock Invoices
"""""""""""""
Adding ``LOCK_SENT_INVOICES=true`` to the .env file will prevent changing an invoice once it has been sent.
Using a Proxy
"""""""""""""

View File

@ -522,6 +522,8 @@
@if (Auth::user()->canCreateOrEdit(ENTITY_INVOICE, $invoice))
@if ($invoice->isClientTrashed())
<!-- do nothing -->
@elseif ($invoice->isSent() && config('ninja.lock_sent_invoices'))
<!-- do nothing -->
@else
@if (!$invoice->is_deleted)
@if ($invoice->isSent())
@ -1375,6 +1377,10 @@
return false;
}
@if ($invoice->isSent() && config('ninja.lock_sent_invoices'))
return false;
@endif
@if ($invoice->is_deleted || $invoice->isClientTrashed())
if ($('#bulk_action').val() != 'restore') {
return false;