mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Convert and Archive #1916
This commit is contained in:
parent
fb30fcd4ed
commit
2028932a94
@ -976,6 +976,7 @@ class AccountController extends BaseController
|
|||||||
$account->invoice_footer = Input::get('invoice_footer');
|
$account->invoice_footer = Input::get('invoice_footer');
|
||||||
$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_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');
|
||||||
$account->recurring_invoice_number_prefix = Input::get('recurring_invoice_number_prefix');
|
$account->recurring_invoice_number_prefix = Input::get('recurring_invoice_number_prefix');
|
||||||
|
@ -134,6 +134,7 @@ class Account extends Eloquent
|
|||||||
'header_font_id',
|
'header_font_id',
|
||||||
'body_font_id',
|
'body_font_id',
|
||||||
'auto_convert_quote',
|
'auto_convert_quote',
|
||||||
|
'auto_archive_quote',
|
||||||
'auto_archive_invoice',
|
'auto_archive_invoice',
|
||||||
'auto_email_invoice',
|
'auto_email_invoice',
|
||||||
'all_pages_footer',
|
'all_pages_footer',
|
||||||
|
@ -369,7 +369,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
*/
|
*/
|
||||||
public function quote()
|
public function quote()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Invoice');
|
return $this->belongsTo('App\Models\Invoice')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -237,6 +237,7 @@ class AccountTransformer extends EntityTransformer
|
|||||||
'header_font_id' => (int) $account->header_font_id,
|
'header_font_id' => (int) $account->header_font_id,
|
||||||
'body_font_id' => (int) $account->body_font_id,
|
'body_font_id' => (int) $account->body_font_id,
|
||||||
'auto_convert_quote' => (bool) $account->auto_convert_quote,
|
'auto_convert_quote' => (bool) $account->auto_convert_quote,
|
||||||
|
'auto_archive_quote' => (bool) $account->auto_archive_quote,
|
||||||
'auto_archive_invoice' => (bool) $account->auto_archive_invoice,
|
'auto_archive_invoice' => (bool) $account->auto_archive_invoice,
|
||||||
'auto_email_invoice' => (bool) $account->auto_email_invoice,
|
'auto_email_invoice' => (bool) $account->auto_email_invoice,
|
||||||
'all_pages_footer' => (bool) $account->all_pages_footer,
|
'all_pages_footer' => (bool) $account->all_pages_footer,
|
||||||
|
@ -110,7 +110,14 @@ class InvoiceService extends BaseService
|
|||||||
*/
|
*/
|
||||||
public function convertQuote($quote)
|
public function convertQuote($quote)
|
||||||
{
|
{
|
||||||
return $this->invoiceRepo->cloneInvoice($quote, $quote->id);
|
$account = $quote->account;
|
||||||
|
$invoice = $this->invoiceRepo->cloneInvoice($quote, $quote->id);
|
||||||
|
|
||||||
|
if ($account->auto_archive_quote) {
|
||||||
|
$this->invoiceRepo->archive($quote);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,6 +148,10 @@ class InvoiceService extends BaseService
|
|||||||
$quote->markApproved();
|
$quote->markApproved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($account->auto_archive_quote) {
|
||||||
|
$this->invoiceRepo->archive($quote);
|
||||||
|
}
|
||||||
|
|
||||||
return $invitation->invitation_key;
|
return $invitation->invitation_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ class AddSlackNotifications extends Migration
|
|||||||
|
|
||||||
Schema::table('accounts', function ($table) {
|
Schema::table('accounts', function ($table) {
|
||||||
$table->boolean('auto_archive_invoice')->default(false)->nullable();
|
$table->boolean('auto_archive_invoice')->default(false)->nullable();
|
||||||
|
$table->boolean('auto_archive_quote')->default(false)->nullable();
|
||||||
$table->boolean('auto_email_invoice')->default(true)->nullable();
|
$table->boolean('auto_email_invoice')->default(true)->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -42,6 +43,7 @@ class AddSlackNotifications extends Migration
|
|||||||
|
|
||||||
Schema::table('accounts', function ($table) {
|
Schema::table('accounts', function ($table) {
|
||||||
$table->dropColumn('auto_archive_invoice');
|
$table->dropColumn('auto_archive_invoice');
|
||||||
|
$table->dropColumn('auto_archive_quote');
|
||||||
$table->dropColumn('auto_email_invoice');
|
$table->dropColumn('auto_email_invoice');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -980,7 +980,7 @@ $LANG = array(
|
|||||||
'bank_account_error' => 'Failed to retreive account details, please check your credentials.',
|
'bank_account_error' => 'Failed to retreive account details, please check your credentials.',
|
||||||
'status_approved' => 'Approved',
|
'status_approved' => 'Approved',
|
||||||
'quote_settings' => 'Quote Settings',
|
'quote_settings' => 'Quote Settings',
|
||||||
'auto_convert_quote' => 'Auto Convert Quote',
|
'auto_convert_quote' => 'Auto Convert',
|
||||||
'auto_convert_quote_help' => 'Automatically convert a quote to an invoice when approved by a client.',
|
'auto_convert_quote_help' => 'Automatically convert a quote to an invoice when approved by a client.',
|
||||||
'validate' => 'Validate',
|
'validate' => 'Validate',
|
||||||
'info' => 'Info',
|
'info' => 'Info',
|
||||||
@ -2777,10 +2777,14 @@ $LANG = array(
|
|||||||
'accepted_terms' => 'Successfully accepted the latest terms of service',
|
'accepted_terms' => 'Successfully accepted the latest terms of service',
|
||||||
'invalid_url' => 'Invalid URL',
|
'invalid_url' => 'Invalid URL',
|
||||||
'workflow_settings' => 'Workflow Settings',
|
'workflow_settings' => 'Workflow Settings',
|
||||||
'auto_email_invoice' => 'Auto Email Invoice',
|
'auto_email_invoice' => 'Auto Email',
|
||||||
'auto_email_invoice_help' => 'Automatically email recurring invoices when they are created.',
|
'auto_email_invoice_help' => 'Automatically email recurring invoices when they are created.',
|
||||||
'auto_archive_invoice' => 'Auto Archive Invoice',
|
'auto_archive_invoice' => 'Auto Archive',
|
||||||
'auto_archive_invoice_help' => 'Automatically archive invoices once they are paid.',
|
'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.',
|
||||||
|
'invoice_workflow' => 'Invoice Workflow',
|
||||||
|
'quote_workflow' => 'Quote Workflow',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -23,8 +23,9 @@
|
|||||||
{!! Former::open()->rules(['iframe_url' => 'url'])->addClass('warn-on-exit') !!}
|
{!! Former::open()->rules(['iframe_url' => 'url'])->addClass('warn-on-exit') !!}
|
||||||
{{ Former::populate($account) }}
|
{{ Former::populate($account) }}
|
||||||
{{ Former::populateField('auto_convert_quote', intval($account->auto_convert_quote)) }}
|
{{ Former::populateField('auto_convert_quote', intval($account->auto_convert_quote)) }}
|
||||||
{{ Former::populateField('auto_archive_invoice', intval($account->auto_archive_invoice)) }}
|
{{ Former::populateField('auto_archive_quote', intval($account->auto_archive_quote)) }}
|
||||||
{{ Former::populateField('auto_email_invoice', intval($account->auto_email_invoice)) }}
|
{{ Former::populateField('auto_email_invoice', intval($account->auto_email_invoice)) }}
|
||||||
|
{{ Former::populateField('auto_archive_invoice', intval($account->auto_archive_invoice)) }}
|
||||||
{{ Former::populateField('custom_invoice_taxes1', intval($account->custom_invoice_taxes1)) }}
|
{{ Former::populateField('custom_invoice_taxes1', intval($account->custom_invoice_taxes1)) }}
|
||||||
{{ Former::populateField('custom_invoice_taxes2', intval($account->custom_invoice_taxes2)) }}
|
{{ Former::populateField('custom_invoice_taxes2', intval($account->custom_invoice_taxes2)) }}
|
||||||
{{ Former::populateField('share_counter', intval($account->share_counter)) }}
|
{{ Former::populateField('share_counter', intval($account->share_counter)) }}
|
||||||
@ -321,20 +322,46 @@
|
|||||||
<h3 class="panel-title">{!! trans('texts.workflow_settings') !!}</h3>
|
<h3 class="panel-title">{!! trans('texts.workflow_settings') !!}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body form-padding-right">
|
<div class="panel-body form-padding-right">
|
||||||
{!! Former::checkbox('auto_email_invoice')
|
|
||||||
->text(trans('texts.enable'))
|
|
||||||
->blockHelp(trans('texts.auto_email_invoice_help'))
|
|
||||||
->value(1) !!}
|
|
||||||
|
|
||||||
{!! Former::checkbox('auto_archive_invoice')
|
<div role="tabpanel">
|
||||||
->text(trans('texts.enable'))
|
<ul class="nav nav-tabs" role="tablist" style="border: none">
|
||||||
->blockHelp(trans('texts.auto_archive_invoice_help'))
|
<li role="presentation" class="active">
|
||||||
->value(1) !!}
|
<a href="#invoice_workflow" aria-controls="invoice_workflow" role="tab" data-toggle="tab">{{ trans('texts.invoice_workflow') }}</a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation">
|
||||||
|
<a href="#quote_workflow" aria-controls="quote_workflow" role="tab" data-toggle="tab">{{ trans('texts.quote_workflow') }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div role="tabpanel" class="tab-pane active" id="invoice_workflow">
|
||||||
|
<div class="panel-body">
|
||||||
|
{!! Former::checkbox('auto_email_invoice')
|
||||||
|
->text(trans('texts.enable'))
|
||||||
|
->blockHelp(trans('texts.auto_email_invoice_help'))
|
||||||
|
->value(1) !!}
|
||||||
|
|
||||||
|
{!! Former::checkbox('auto_archive_invoice')
|
||||||
|
->text(trans('texts.enable'))
|
||||||
|
->blockHelp(trans('texts.auto_archive_invoice_help'))
|
||||||
|
->value(1) !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div role="tabpanel" class="tab-pane" id="quote_workflow">
|
||||||
|
<div class="panel-body">
|
||||||
|
{!! Former::checkbox('auto_convert_quote')
|
||||||
|
->text(trans('texts.enable'))
|
||||||
|
->blockHelp(trans('texts.auto_convert_quote_help'))
|
||||||
|
->value(1) !!}
|
||||||
|
|
||||||
|
{!! Former::checkbox('auto_archive_quote')
|
||||||
|
->text(trans('texts.enable'))
|
||||||
|
->blockHelp(trans('texts.auto_archive_quote_help'))
|
||||||
|
->value(1) !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{!! Former::checkbox('auto_convert_quote')
|
|
||||||
->text(trans('texts.enable'))
|
|
||||||
->blockHelp(trans('texts.auto_convert_quote_help'))
|
|
||||||
->value(1) !!}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user