mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 22:22:32 +01:00
Add option to disable requiring quote approving
Signed-off-by: Kristián Feldsam <feldsam@gmail.com>
This commit is contained in:
parent
e6cb3dc5e7
commit
f119a6f74c
@ -1065,6 +1065,7 @@ class AccountController extends BaseController
|
|||||||
$account->quote_terms = Input::get('quote_terms');
|
$account->quote_terms = Input::get('quote_terms');
|
||||||
$account->auto_convert_quote = Input::get('auto_convert_quote');
|
$account->auto_convert_quote = Input::get('auto_convert_quote');
|
||||||
$account->auto_archive_quote = Input::get('auto_archive_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->allow_approve_expired_quote = Input::get('allow_approve_expired_quote');
|
||||||
$account->auto_archive_invoice = Input::get('auto_archive_invoice');
|
$account->auto_archive_invoice = Input::get('auto_archive_invoice');
|
||||||
$account->auto_email_invoice = Input::get('auto_email_invoice');
|
$account->auto_email_invoice = Input::get('auto_email_invoice');
|
||||||
|
@ -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) {
|
if ($invoice->invoice_status_id >= INVOICE_STATUS_APPROVED) {
|
||||||
$showApprove = false;
|
$showApprove = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data += [
|
$data += [
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
|
'approveRequired' => $account->require_approve_quote,
|
||||||
'showApprove' => $showApprove,
|
'showApprove' => $showApprove,
|
||||||
'showBreadcrumbs' => false,
|
'showBreadcrumbs' => false,
|
||||||
'invoice' => $invoice->hidePrivateFields(),
|
'invoice' => $invoice->hidePrivateFields(),
|
||||||
|
@ -109,6 +109,8 @@ class Account extends Eloquent
|
|||||||
'body_font_id',
|
'body_font_id',
|
||||||
'auto_convert_quote',
|
'auto_convert_quote',
|
||||||
'auto_archive_quote',
|
'auto_archive_quote',
|
||||||
|
'require_approve_quote',
|
||||||
|
'allow_approve_expired_quote',
|
||||||
'auto_archive_invoice',
|
'auto_archive_invoice',
|
||||||
'auto_email_invoice',
|
'auto_email_invoice',
|
||||||
'all_pages_footer',
|
'all_pages_footer',
|
||||||
|
@ -787,7 +787,15 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
|
|
||||||
public function canBePaid()
|
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)
|
public static function calcStatusLabel($status, $class, $entityType, $quoteInvoiceId)
|
||||||
|
@ -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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -2842,6 +2842,8 @@ $LANG = array(
|
|||||||
'auto_archive_invoice_help' => 'Automatically archive invoices when they are paid.',
|
'auto_archive_invoice_help' => 'Automatically archive invoices when they are paid.',
|
||||||
'auto_archive_quote' => 'Auto Archive',
|
'auto_archive_quote' => 'Auto Archive',
|
||||||
'auto_archive_quote_help' => 'Automatically archive quotes when they are converted.',
|
'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' => 'Allow approve expired quote',
|
||||||
'allow_approve_expired_quote_help' => 'Allow clients to approve expired quotes.',
|
'allow_approve_expired_quote_help' => 'Allow clients to approve expired quotes.',
|
||||||
'invoice_workflow' => 'Invoice Workflow',
|
'invoice_workflow' => 'Invoice Workflow',
|
||||||
|
@ -415,6 +415,11 @@
|
|||||||
->blockHelp(trans('texts.auto_archive_quote_help'))
|
->blockHelp(trans('texts.auto_archive_quote_help'))
|
||||||
->value(1) !!}
|
->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')
|
{!! Former::checkbox('allow_approve_expired_quote')
|
||||||
->text(trans('texts.enable'))
|
->text(trans('texts.enable'))
|
||||||
->blockHelp(trans('texts.allow_approve_expired_quote_help'))
|
->blockHelp(trans('texts.allow_approve_expired_quote_help'))
|
||||||
|
@ -160,7 +160,7 @@
|
|||||||
@include($partialView)
|
@include($partialView)
|
||||||
@else
|
@else
|
||||||
<div id="paymentButtons" class="pull-right" style="text-align:right">
|
<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() !!}
|
{!! Button::normal(trans('texts.download'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
|
||||||
@if ($showApprove)
|
@if ($showApprove)
|
||||||
{!! Button::success(trans('texts.approve'))->withAttributes(['id' => 'approveButton', 'onclick' => 'onApproveClick()', 'class' => 'require-authorization'])->large() !!}
|
{!! Button::success(trans('texts.approve'))->withAttributes(['id' => 'approveButton', 'onclick' => 'onApproveClick()', 'class' => 'require-authorization'])->large() !!}
|
||||||
|
Loading…
Reference in New Issue
Block a user