diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php index cedd12e10b25..a46df2de6012 100755 --- a/app/controllers/InvoiceController.php +++ b/app/controllers/InvoiceController.php @@ -477,7 +477,6 @@ class InvoiceController extends \BaseController $clone = $this->invoiceRepo->cloneInvoice($invoice, $invoice->id); Session::flash('message', trans('texts.converted_to_invoice')); - return Redirect::to('invoices/'.$clone->public_id); } diff --git a/app/controllers/QuoteController.php b/app/controllers/QuoteController.php index 409adb327993..9a12dc7fa54d 100644 --- a/app/controllers/QuoteController.php +++ b/app/controllers/QuoteController.php @@ -135,6 +135,15 @@ class QuoteController extends \BaseController public function bulk() { $action = Input::get('action'); + + if ($action == 'convert') { + $invoice = Invoice::with('invoice_items')->scope(Input::get('id'))->firstOrFail(); + $clone = $this->invoiceRepo->cloneInvoice($invoice, $invoice->id); + + Session::flash('message', trans('texts.converted_to_invoice')); + return Redirect::to('invoices/'.$clone->public_id); + } + $statusId = Input::get('statusId'); $ids = Input::get('id') ? Input::get('id') : Input::get('ids'); $count = $this->invoiceRepo->bulk($ids, $action, $statusId); diff --git a/app/ninja/repositories/InvoiceRepository.php b/app/ninja/repositories/InvoiceRepository.php index e74927157646..f59044f578b5 100755 --- a/app/ninja/repositories/InvoiceRepository.php +++ b/app/ninja/repositories/InvoiceRepository.php @@ -162,6 +162,8 @@ class InvoiceRepository } elseif ($entityType == ENTITY_QUOTE) { if ($model->quote_invoice_id) { $str .= '
  • quote_invoice_id}/edit").'">'.trans("texts.view_invoice").'
  • '; + } else { + $str .= '
  • '.trans("texts.convert_to_invoice").'
  • '; } } diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php index c4f2dcb6d094..f9e489f03e08 100755 --- a/app/views/invoices/edit.blade.php +++ b/app/views/invoices/edit.blade.php @@ -289,9 +289,13 @@
  • {{ trans("texts.save_{$entityType}") }}
  • {{ trans("texts.clone_{$entityType}") }}
  • public_id}") }}">{{ trans("texts.view_history") }}
  • +
  • + + @if ($invoice->invoice_status_id < INVOICE_STATUS_SENT) +
  • {{ trans("texts.mark_sent") }}
  • + @endif @if ($invoice && $entityType == ENTITY_QUOTE) -
  • @if ($invoice->quote_invoice_id)
  • quote_invoice_id}/edit") }}">{{ trans("texts.view_invoice") }}
  • @else @@ -299,16 +303,10 @@ @endif @elseif ($invoice && $entityType == ENTITY_INVOICE) @if ($invoice->quote_id) -
  • quote_id}/edit") }}">{{ trans("texts.view_quote") }}
  • @endif @endif - @if ($invoice->invoice_status_id < INVOICE_STATUS_SENT) -
  • -
  • {{ trans("texts.mark_sent") }}
  • - @endif -
  • {{ trans("texts.archive_{$entityType}") }}
  • {{ trans("texts.delete_{$entityType}") }}
  • diff --git a/app/views/list.blade.php b/app/views/list.blade.php index 26631d5ee172..e0e473917ca7 100755 --- a/app/views/list.blade.php +++ b/app/views/list.blade.php @@ -68,10 +68,14 @@ submitForm('archive'); } - function restoreEntity(id) { - $('#id').val(id); - submitForm('restore'); - } + function restoreEntity(id) { + $('#id').val(id); + submitForm('restore'); + } + function convertEntity(id) { + $('#id').val(id); + submitForm('convert'); + } function markEntity(id, statusId) { $('#id').val(id);