mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 10:44:29 -04:00
Enable recurring for a cloned invoice
This commit is contained in:
parent
394cb1ad7e
commit
078527443f
@ -272,7 +272,6 @@ class InvoiceController extends BaseController
|
||||
$recurringDueDateHelp = '';
|
||||
$recurringDueDates = [];
|
||||
|
||||
if ($invoice->is_recurring) {
|
||||
foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_help')) as $line) {
|
||||
$parts = explode('=>', $line);
|
||||
if (count($parts) > 1) {
|
||||
@ -329,7 +328,6 @@ class InvoiceController extends BaseController
|
||||
$recurringDueDates[$str] = ['value' => "1998-02-$dayStr", 'data-num' => $day, 'class' => 'weekly'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tax rate $options
|
||||
$account = Auth::user()->account;
|
||||
|
@ -58,7 +58,17 @@ class RecurringInvoiceDatatable extends EntityDatatable
|
||||
function ($model) {
|
||||
return Auth::user()->can('editByOwner', [ENTITY_INVOICE, $model->user_id]);
|
||||
}
|
||||
]
|
||||
],
|
||||
[
|
||||
trans("texts.clone_invoice"),
|
||||
function ($model) {
|
||||
return URL::to("invoices/{$model->public_id}/clone");
|
||||
},
|
||||
function ($model) {
|
||||
return Auth::user()->can('create', ENTITY_INVOICE);
|
||||
}
|
||||
],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -2139,6 +2139,8 @@ $LANG = array(
|
||||
'restore_product' => 'Restore Product',
|
||||
'blank' => 'Blank',
|
||||
'invoice_error' => 'There was an error saving your invoice.',
|
||||
'enable_recurring' => 'Enable Recurring',
|
||||
'disable_recurring' => 'Disable Recurring',
|
||||
|
||||
);
|
||||
|
||||
|
@ -550,6 +550,8 @@
|
||||
{!! DropdownButton::normal(trans('texts.more_actions'))
|
||||
->withContents($actions)
|
||||
->dropup() !!}
|
||||
@elseif ( ! $invoice->isQuote() && Request::is('*/clone'))
|
||||
{!! Button::normal(trans($invoice->is_recurring ? 'texts.disable_recurring' : 'texts.enable_recurring'))->withAttributes(['id' => 'recurrButton', 'onclick' => 'onRecurrClick()'])->appendIcon(Icon::create('repeat')) !!}
|
||||
@endif
|
||||
@endif
|
||||
@endif
|
||||
@ -1212,6 +1214,19 @@
|
||||
doc.save(type +'-' + $('#invoice_number').val() + '.pdf');
|
||||
}
|
||||
|
||||
function onRecurrClick() {
|
||||
var invoice = model.invoice();
|
||||
if (invoice.is_recurring()) {
|
||||
var recurring = false;
|
||||
var label = "{{ trans('texts.enable_recurring')}}";
|
||||
} else {
|
||||
var recurring = true;
|
||||
var label = "{{ trans('texts.disable_recurring')}}";
|
||||
}
|
||||
invoice.is_recurring(recurring);
|
||||
$('#recurrButton').html(label + "<span class='glyphicon glyphicon-repeat'></span>");
|
||||
}
|
||||
|
||||
function onEmailClick() {
|
||||
if (!NINJA.isRegistered) {
|
||||
swal("{!! trans('texts.registration_required') !!}");
|
||||
|
Loading…
x
Reference in New Issue
Block a user