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

Support cloning an archvied invoice

This commit is contained in:
Hillel Coren 2017-02-20 13:47:25 +02:00
parent 7a152e8877
commit 6b6c9c4fdf
3 changed files with 18 additions and 13 deletions

View File

@ -104,6 +104,7 @@ class InvoiceController extends BaseController
$invoice->balance = $invoice->amount;
$invoice->invoice_status_id = 0;
$invoice->invoice_date = date_create()->format('Y-m-d');
$invoice->deleted_at = null;
$method = 'POST';
$url = "{$entityType}s";
} else {

View File

@ -225,7 +225,7 @@ class InvoicePresenter extends EntityPresenter
$actions[] = ['url' => url("quotes/{$invoice->quote_id}/edit"), 'label' => trans('texts.view_quote')];
}
if (! $invoice->is_recurring && $invoice->balance > 0) {
if (!$invoice->deleted_at && ! $invoice->is_recurring && $invoice->balance > 0) {
$actions[] = ['url' => 'javascript:submitBulkAction("markPaid")', 'label' => trans('texts.mark_paid')];
$actions[] = ['url' => 'javascript:onPaymentClick()', 'label' => trans('texts.enter_payment')];
}
@ -243,8 +243,12 @@ class InvoicePresenter extends EntityPresenter
$actions[] = DropdownButton::DIVIDER;
}
if (! $invoice->trashed()) {
$actions[] = ['url' => 'javascript:onArchiveClick()', 'label' => trans("texts.archive_{$entityType}")];
}
if (! $invoice->is_deleted) {
$actions[] = ['url' => 'javascript:onDeleteClick()', 'label' => trans("texts.delete_{$entityType}")];
}
return $actions;
}

View File

@ -565,19 +565,19 @@
{!! Button::success(trans("texts.save_{$entityType}"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))->appendIcon(Icon::create('floppy-disk')) !!}
@else
{!! Button::normal(trans("texts.save_draft"))->withAttributes(array('id' => 'draftButton', 'onclick' => 'onSaveDraftClick()'))->appendIcon(Icon::create('floppy-disk')) !!}
@if (! $invoice->trashed())
{!! Button::success(trans($invoice->is_recurring ? "texts.mark_active" : "texts.mark_sent"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onMarkSentClick()'))->appendIcon(Icon::create('globe')) !!}
@endif
{!! Button::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!}
@endif
@if (! $invoice->trashed())
{!! Button::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!}
@endif
@if ($invoice->id)
{!! DropdownButton::normal(trans('texts.more_actions'))
->withContents($invoice->present()->moreActions())
->dropup() !!}
{!! DropdownButton::normal(trans('texts.more_actions'))->withContents($invoice->present()->moreActions())->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
@if ($invoice->trashed())
{!! Button::primary(trans('texts.restore'))->withAttributes(['onclick' => 'submitBulkAction("restore")'])->appendIcon(Icon::create('cloud-download')) !!}
@endif