mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Implement workflow options
This commit is contained in:
parent
e7c61e9c0b
commit
fb30fcd4ed
@ -115,7 +115,7 @@ class SendRecurringInvoices extends Command
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
|
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
|
||||||
if ($invoice && ! $invoice->isPaid()) {
|
if ($invoice && ! $invoice->isPaid() && $account->auto_email_invoice) {
|
||||||
$this->info('Not billed - Sending Invoice');
|
$this->info('Not billed - Sending Invoice');
|
||||||
$this->mailer->sendInvoice($invoice);
|
$this->mailer->sendInvoice($invoice);
|
||||||
} elseif ($invoice) {
|
} elseif ($invoice) {
|
||||||
|
@ -976,6 +976,8 @@ 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_invoice = Input::get('auto_archive_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');
|
||||||
|
|
||||||
$account->client_number_prefix = trim(Input::get('client_number_prefix'));
|
$account->client_number_prefix = trim(Input::get('client_number_prefix'));
|
||||||
|
@ -90,6 +90,11 @@ class InvoiceListener
|
|||||||
->first();
|
->first();
|
||||||
$activity->json_backup = $invoice->hidePrivateFields()->toJSON();
|
$activity->json_backup = $invoice->hidePrivateFields()->toJSON();
|
||||||
$activity->save();
|
$activity->save();
|
||||||
|
|
||||||
|
if ($invoice->balance == 0 && $payment->account->auto_archive_invoice) {
|
||||||
|
$invoiceRepo = app('App\Ninja\Repositories\InvoiceRepository');
|
||||||
|
$invoiceRepo->archive($invoice);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,6 +134,8 @@ class Account extends Eloquent
|
|||||||
'header_font_id',
|
'header_font_id',
|
||||||
'body_font_id',
|
'body_font_id',
|
||||||
'auto_convert_quote',
|
'auto_convert_quote',
|
||||||
|
'auto_archive_invoice',
|
||||||
|
'auto_email_invoice',
|
||||||
'all_pages_footer',
|
'all_pages_footer',
|
||||||
'all_pages_header',
|
'all_pages_header',
|
||||||
'show_currency_code',
|
'show_currency_code',
|
||||||
|
@ -237,6 +237,8 @@ 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_invoice' => (bool) $account->auto_archive_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,
|
||||||
'all_pages_header' => (bool) $account->all_pages_header,
|
'all_pages_header' => (bool) $account->all_pages_header,
|
||||||
'show_currency_code' => (bool) $account->show_currency_code,
|
'show_currency_code' => (bool) $account->show_currency_code,
|
||||||
|
@ -15,11 +15,15 @@ class AddSlackNotifications extends Migration
|
|||||||
{
|
{
|
||||||
Schema::table('users', function ($table) {
|
Schema::table('users', function ($table) {
|
||||||
$table->string('slack_webhook_url')->nullable();
|
$table->string('slack_webhook_url')->nullable();
|
||||||
|
|
||||||
$table->string('accepted_terms_version')->nullable();
|
$table->string('accepted_terms_version')->nullable();
|
||||||
$table->timestamp('accepted_terms_timestamp')->nullable();
|
$table->timestamp('accepted_terms_timestamp')->nullable();
|
||||||
$table->string('accepted_terms_ip')->nullable();
|
$table->string('accepted_terms_ip')->nullable();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Schema::table('accounts', function ($table) {
|
||||||
|
$table->boolean('auto_archive_invoice')->default(false)->nullable();
|
||||||
|
$table->boolean('auto_email_invoice')->default(true)->nullable();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,10 +35,14 @@ class AddSlackNotifications extends Migration
|
|||||||
{
|
{
|
||||||
Schema::table('users', function ($table) {
|
Schema::table('users', function ($table) {
|
||||||
$table->dropColumn('slack_webhook_url');
|
$table->dropColumn('slack_webhook_url');
|
||||||
|
|
||||||
$table->dropColumn('accepted_terms_version');
|
$table->dropColumn('accepted_terms_version');
|
||||||
$table->dropColumn('accepted_terms_timestamp');
|
$table->dropColumn('accepted_terms_timestamp');
|
||||||
$table->dropColumn('accepted_terms_ip');
|
$table->dropColumn('accepted_terms_ip');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Schema::table('accounts', function ($table) {
|
||||||
|
$table->dropColumn('auto_archive_invoice');
|
||||||
|
$table->dropColumn('auto_email_invoice');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,6 +366,7 @@ $LANG = array(
|
|||||||
'confirm_email_invoice' => 'Are you sure you want to email this invoice?',
|
'confirm_email_invoice' => 'Are you sure you want to email this invoice?',
|
||||||
'confirm_email_quote' => 'Are you sure you want to email this quote?',
|
'confirm_email_quote' => 'Are you sure you want to email this quote?',
|
||||||
'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?',
|
'confirm_recurring_email_invoice' => 'Are you sure you want this invoice emailed?',
|
||||||
|
'confirm_recurring_email_invoice_not_sent' => 'Are you sure you want to start the recurrence?',
|
||||||
'cancel_account' => 'Delete Account',
|
'cancel_account' => 'Delete Account',
|
||||||
'cancel_account_message' => 'Warning: This will permanently delete your account, there is no undo.',
|
'cancel_account_message' => 'Warning: This will permanently delete your account, there is no undo.',
|
||||||
'go_back' => 'Go Back',
|
'go_back' => 'Go Back',
|
||||||
@ -614,6 +615,7 @@ $LANG = array(
|
|||||||
'or' => 'or',
|
'or' => 'or',
|
||||||
'email_error' => 'There was a problem sending the email',
|
'email_error' => 'There was a problem sending the email',
|
||||||
'confirm_recurring_timing' => 'Note: emails are sent at the start of the hour.',
|
'confirm_recurring_timing' => 'Note: emails are sent at the start of the hour.',
|
||||||
|
'confirm_recurring_timing_not_sent' => 'Note: invoices are created at the start of the hour.',
|
||||||
'payment_terms_help' => 'Sets the default <b>invoice due date</b>',
|
'payment_terms_help' => 'Sets the default <b>invoice due date</b>',
|
||||||
'unlink_account' => 'Unlink Account',
|
'unlink_account' => 'Unlink Account',
|
||||||
'unlink' => 'Unlink',
|
'unlink' => 'Unlink',
|
||||||
@ -978,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 Quote',
|
||||||
'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',
|
||||||
@ -1327,6 +1329,7 @@ $LANG = array(
|
|||||||
'debit_cards' => 'Debit Cards',
|
'debit_cards' => 'Debit Cards',
|
||||||
|
|
||||||
'warn_start_date_changed' => 'The next invoice will be sent on the new start date.',
|
'warn_start_date_changed' => 'The next invoice will be sent on the new start date.',
|
||||||
|
'warn_start_date_changed_not_sent' => 'The next invoice will be created on the new start date.',
|
||||||
'original_start_date' => 'Original start date',
|
'original_start_date' => 'Original start date',
|
||||||
'new_start_date' => 'New start date',
|
'new_start_date' => 'New start date',
|
||||||
'security' => 'Security',
|
'security' => 'Security',
|
||||||
@ -2773,6 +2776,11 @@ $LANG = array(
|
|||||||
'accept' => 'Accept',
|
'accept' => 'Accept',
|
||||||
'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',
|
||||||
|
'auto_email_invoice' => 'Auto Email Invoice',
|
||||||
|
'auto_email_invoice_help' => 'Automatically email recurring invoices when they are created.',
|
||||||
|
'auto_archive_invoice' => 'Auto Archive Invoice',
|
||||||
|
'auto_archive_invoice_help' => 'Automatically archive invoices once they are paid.',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
{!! 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_email_invoice', intval($account->auto_email_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)) }}
|
||||||
@ -316,9 +318,19 @@
|
|||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">{!! trans('texts.quote_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')
|
||||||
|
->text(trans('texts.enable'))
|
||||||
|
->blockHelp(trans('texts.auto_archive_invoice_help'))
|
||||||
|
->value(1) !!}
|
||||||
|
|
||||||
{!! Former::checkbox('auto_convert_quote')
|
{!! Former::checkbox('auto_convert_quote')
|
||||||
->text(trans('texts.enable'))
|
->text(trans('texts.enable'))
|
||||||
->blockHelp(trans('texts.auto_convert_quote_help'))
|
->blockHelp(trans('texts.auto_convert_quote_help'))
|
||||||
|
@ -1340,13 +1340,22 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var title = "{!! trans("texts.confirm_recurring_email_invoice") !!}";
|
@if ($account->auto_email_invoice)
|
||||||
|
var title = "{!! trans("texts.confirm_recurring_email_invoice") !!}";
|
||||||
|
@else
|
||||||
|
var title = "{!! trans("texts.confirm_recurring_email_invoice_not_sent") !!}";
|
||||||
|
@endif
|
||||||
|
|
||||||
var text = '\n' + getSendToEmails();
|
var text = '\n' + getSendToEmails();
|
||||||
var startDate = moment($('#start_date').datepicker('getDate'));
|
var startDate = moment($('#start_date').datepicker('getDate'));
|
||||||
|
|
||||||
// warn invoice will be emailed when saving new recurring invoice
|
// warn invoice will be emailed when saving new recurring invoice
|
||||||
if (model.invoice().start_date() == "{{ Utils::fromSqlDate(date('Y-m-d')) }}") {
|
if (model.invoice().start_date() == "{{ Utils::fromSqlDate(date('Y-m-d')) }}") {
|
||||||
text += '\n\n' + "{!! trans("texts.confirm_recurring_timing") !!}";
|
@if ($account->auto_email_invoice)
|
||||||
|
text += '\n\n' + "{!! trans("texts.confirm_recurring_timing") !!}";
|
||||||
|
@else
|
||||||
|
text += '\n\n' + "{!! trans("texts.confirm_recurring_timing_not_sent") !!}";
|
||||||
|
@endif
|
||||||
// check if the start date is in the future
|
// check if the start date is in the future
|
||||||
} else if (startDate.isAfter(moment(), 'day')) {
|
} else if (startDate.isAfter(moment(), 'day')) {
|
||||||
var message = "{!! trans("texts.email_will_be_sent_on") !!}";
|
var message = "{!! trans("texts.email_will_be_sent_on") !!}";
|
||||||
@ -1370,7 +1379,11 @@
|
|||||||
if (model.invoice().start_date() != model.invoice().start_date_orig()) {
|
if (model.invoice().start_date() != model.invoice().start_date_orig()) {
|
||||||
var text = "{!! trans("texts.original_start_date") !!}: " + model.invoice().start_date_orig() + '\n'
|
var text = "{!! trans("texts.original_start_date") !!}: " + model.invoice().start_date_orig() + '\n'
|
||||||
+ "{!! trans("texts.new_start_date") !!}: " + model.invoice().start_date();
|
+ "{!! trans("texts.new_start_date") !!}: " + model.invoice().start_date();
|
||||||
var title = "{!! trans("texts.warn_start_date_changed") !!}";
|
@if ($account->auto_email_invoice)
|
||||||
|
var title = "{!! trans("texts.warn_start_date_changed") !!}";
|
||||||
|
@else
|
||||||
|
var title = "{!! trans("texts.warn_start_date_changed_not_sent") !!}";
|
||||||
|
@endif
|
||||||
sweetConfirm(function() {
|
sweetConfirm(function() {
|
||||||
submitAction('');
|
submitAction('');
|
||||||
}, text, title);
|
}, text, title);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user