1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Add option to disable requiring quote approving

Signed-off-by: Kristián Feldsam <feldsam@gmail.com>
This commit is contained in:
Kristián Feldsam 2019-04-29 10:57:45 +02:00
parent e6cb3dc5e7
commit f119a6f74c
8 changed files with 54 additions and 3 deletions

View File

@ -1065,6 +1065,7 @@ class AccountController extends BaseController
$account->quote_terms = Input::get('quote_terms');
$account->auto_convert_quote = Input::get('auto_convert_quote');
$account->auto_archive_quote = Input::get('auto_archive_quote');
$account->require_approve_quote = Input::get('require_approve_quote');
$account->allow_approve_expired_quote = Input::get('allow_approve_expired_quote');
$account->auto_archive_invoice = Input::get('auto_archive_invoice');
$account->auto_email_invoice = Input::get('auto_email_invoice');

View File

@ -146,13 +146,14 @@ class ClientPortalController extends BaseController
}
}
$showApprove = $invoice->quote_invoice_id ? false : true;
$showApprove = ($invoice->isQuote() && $account->require_approve_quote) ? true: false;
if ($invoice->invoice_status_id >= INVOICE_STATUS_APPROVED) {
$showApprove = false;
}
$data += [
'account' => $account,
'approveRequired' => $account->require_approve_quote,
'showApprove' => $showApprove,
'showBreadcrumbs' => false,
'invoice' => $invoice->hidePrivateFields(),

View File

@ -109,6 +109,8 @@ class Account extends Eloquent
'body_font_id',
'auto_convert_quote',
'auto_archive_quote',
'require_approve_quote',
'allow_approve_expired_quote',
'auto_archive_invoice',
'auto_email_invoice',
'all_pages_footer',

View File

@ -787,7 +787,15 @@ class Invoice extends EntityModel implements BalanceAffecting
public function canBePaid()
{
return ! $this->isPaid() && ! $this->is_deleted && $this->isStandard();
// already paid or deleted
if ($this->isPaid() || $this->is_deleted) return false;
// if quote approve is required, them only standard invoices can be paid
if ($this->account->require_approve_quote) {
return $this->isStandard();
}
return true;
}
public static function calcStatusLabel($status, $class, $entityType, $quoteInvoiceId)

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRequireApproveQuote extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('accounts', function ($table) {
$table->boolean('require_approve_quote')->default(1);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('accounts', function ($table) {
$table->dropColumn('require_approve_quote');
});
}
}

View File

@ -2842,6 +2842,8 @@ $LANG = array(
'auto_archive_invoice_help' => 'Automatically archive invoices when they are paid.',
'auto_archive_quote' => 'Auto Archive',
'auto_archive_quote_help' => 'Automatically archive quotes when they are converted.',
'require_approve_quote' => 'Require approve quote',
'require_approve_quote_help' => 'Require clients to approve quotes.',
'allow_approve_expired_quote' => 'Allow approve expired quote',
'allow_approve_expired_quote_help' => 'Allow clients to approve expired quotes.',
'invoice_workflow' => 'Invoice Workflow',

View File

@ -415,6 +415,11 @@
->blockHelp(trans('texts.auto_archive_quote_help'))
->value(1) !!}
{!! Former::checkbox('require_approve_quote')
->text(trans('texts.enable'))
->blockHelp(trans('texts.require_approve_quote'))
->value(1) !!}
{!! Former::checkbox('allow_approve_expired_quote')
->text(trans('texts.enable'))
->blockHelp(trans('texts.allow_approve_expired_quote_help'))

View File

@ -160,7 +160,7 @@
@include($partialView)
@else
<div id="paymentButtons" class="pull-right" style="text-align:right">
@if ($invoice->isQuote())
@if ($invoice->isQuote() && $approveRequired)
{!! Button::normal(trans('texts.download'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}&nbsp;&nbsp;
@if ($showApprove)
{!! Button::success(trans('texts.approve'))->withAttributes(['id' => 'approveButton', 'onclick' => 'onApproveClick()', 'class' => 'require-authorization'])->large() !!}