diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 6fc1595c03..4535567eb9 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -259,6 +259,7 @@ class AccountController extends \BaseController { $client->name = 'Sample Client'; + $invoice->invoice_number = Auth::user()->account->getNextInvoiceNumber(); $invoice->invoice_date = date_create()->format('Y-m-d'); $invoice->account = Auth::user()->account; $invoice->amount = $invoice->balance = 100; diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php index 18062f31a4..585a774f6e 100755 --- a/app/controllers/InvoiceController.php +++ b/app/controllers/InvoiceController.php @@ -271,7 +271,7 @@ class InvoiceController extends \BaseController { $action = Input::get('action'); $entityType = Input::get('entityType'); - if ($action == 'archive' || $action == 'delete') + if ($action == 'archive' || $action == 'delete' || $action == 'mark') { return InvoiceController::bulk($entityType); } @@ -413,12 +413,14 @@ class InvoiceController extends \BaseController { public function bulk($entityType = ENTITY_INVOICE) { $action = Input::get('action'); + $statusId = Input::get('statusId'); $ids = Input::get('id') ? Input::get('id') : Input::get('ids'); - $count = $this->invoiceRepo->bulk($ids, $action); + $count = $this->invoiceRepo->bulk($ids, $action, $statusId); if ($count > 0) { - $message = Utils::pluralize("{$action}d_{$entityType}", $count); + $key = $action == 'mark' ? "updated_{$entityType}" : "{$action}d_{$entityType}"; + $message = Utils::pluralize($key, $count); Session::flash('message', $message); } diff --git a/app/lang/de/texts.php b/app/lang/de/texts.php index eafe2549cf..76067bbccb 100644 --- a/app/lang/de/texts.php +++ b/app/lang/de/texts.php @@ -433,5 +433,6 @@ return array( 'share_invoice_counter' => 'Share invoice counter', 'invoice_issued_to' => 'Invoice issued to', 'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix', - + 'mark_sent' => 'Mark sent', + ); diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php index 2b60a01013..0b87b7cd9f 100644 --- a/app/lang/en/texts.php +++ b/app/lang/en/texts.php @@ -440,7 +440,9 @@ return array( 'quote_number_counter' => 'Quote Number Counter', 'share_invoice_counter' => 'Share invoice counter', 'invoice_issued_to' => 'Invoice issued to', - 'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix', + 'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix', + 'mark_sent' => 'Mark sent', + ); \ No newline at end of file diff --git a/app/lang/es/texts.php b/app/lang/es/texts.php index 30fd20b6c0..961b7bd1f6 100644 --- a/app/lang/es/texts.php +++ b/app/lang/es/texts.php @@ -431,5 +431,7 @@ return array( 'share_invoice_counter' => 'Share invoice counter', 'invoice_issued_to' => 'Invoice issued to', 'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix', + 'mark_sent' => 'Mark sent', + ); diff --git a/app/lang/fr/texts.php b/app/lang/fr/texts.php index f0bacd4218..72ec38a62e 100644 --- a/app/lang/fr/texts.php +++ b/app/lang/fr/texts.php @@ -434,5 +434,7 @@ return array( 'share_invoice_counter' => 'Share invoice counter', 'invoice_issued_to' => 'Invoice issued to', 'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix', + 'mark_sent' => 'Mark sent', + ); diff --git a/app/lang/it/texts.php b/app/lang/it/texts.php index 1d7890a569..a9720c5bf8 100644 --- a/app/lang/it/texts.php +++ b/app/lang/it/texts.php @@ -433,6 +433,8 @@ return array( 'share_invoice_counter' => 'Share invoice counter', 'invoice_issued_to' => 'Invoice issued to', 'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix', + 'mark_sent' => 'Mark sent', + ); diff --git a/app/lang/lt/texts.php b/app/lang/lt/texts.php index 9b6056163e..a6b6670089 100644 --- a/app/lang/lt/texts.php +++ b/app/lang/lt/texts.php @@ -441,6 +441,8 @@ return array( 'share_invoice_counter' => 'Share invoice counter', 'invoice_issued_to' => 'Invoice issued to', 'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix', + 'mark_sent' => 'Mark sent', + ); diff --git a/app/lang/nb_NO/texts.php b/app/lang/nb_NO/texts.php index 7bcba4ebcb..b292a6916d 100644 --- a/app/lang/nb_NO/texts.php +++ b/app/lang/nb_NO/texts.php @@ -441,6 +441,8 @@ return array( 'share_invoice_counter' => 'Share invoice counter', 'invoice_issued_to' => 'Invoice issued to', 'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix', + 'mark_sent' => 'Mark sent', + ); \ No newline at end of file diff --git a/app/lang/nl/texts.php b/app/lang/nl/texts.php index eab50cef2a..59f6d7b185 100644 --- a/app/lang/nl/texts.php +++ b/app/lang/nl/texts.php @@ -434,6 +434,8 @@ return array( 'share_invoice_counter' => 'Share invoice counter', 'invoice_issued_to' => 'Invoice issued to', 'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix', + 'mark_sent' => 'Mark sent', + ); diff --git a/app/lang/pt_BR/texts.php b/app/lang/pt_BR/texts.php index fccd9b2871..fe13583744 100644 --- a/app/lang/pt_BR/texts.php +++ b/app/lang/pt_BR/texts.php @@ -422,6 +422,8 @@ return array( 'share_invoice_counter' => 'Share invoice counter', 'invoice_issued_to' => 'Invoice issued to', 'invalid_counter' => 'To prevent a possible conflict please set either an invoice or quote number prefix', + 'mark_sent' => 'Mark sent', + ); diff --git a/app/ninja/repositories/InvoiceRepository.php b/app/ninja/repositories/InvoiceRepository.php index b462f2dff2..c4b3638dab 100755 --- a/app/ninja/repositories/InvoiceRepository.php +++ b/app/ninja/repositories/InvoiceRepository.php @@ -20,7 +20,7 @@ class InvoiceRepository ->where('contacts.deleted_at', '=', null) ->where('invoices.is_recurring', '=', false) ->where('contacts.is_primary', '=', true) - ->select('clients.public_id as client_public_id', 'invoice_number', 'clients.name as client_name', 'invoices.public_id', 'amount', 'invoices.balance', 'invoice_date', 'due_date', 'invoice_statuses.name as invoice_status_name', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'quote_id', 'quote_invoice_id'); + ->select('clients.public_id as client_public_id', 'invoice_number', 'invoice_status_id', 'clients.name as client_name', 'invoices.public_id', 'amount', 'invoices.balance', 'invoice_date', 'due_date', 'invoice_statuses.name as invoice_status_name', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'quote_id', 'quote_invoice_id'); if (!\Session::get('show_trash:invoice')) { @@ -121,32 +121,40 @@ class InvoiceRepository - '; - }) - ->make(); + else if ($entityType == ENTITY_QUOTE) + { + if ($model->quote_invoice_id) + { + $str .= '
  • quote_invoice_id}/edit") . '">' . trans("texts.view_invoice") . '
  • '; + } + } + + return $str . '
  • +
  • '.trans("texts.archive_{$entityType}").'
  • +
  • '.trans("texts.delete_{$entityType}").'
  • + + '; + }) + ->make(); } @@ -431,7 +439,7 @@ class InvoiceRepository } - public function bulk($ids, $action) + public function bulk($ids, $action, $statusId = false) { if (!$ids) { @@ -442,13 +450,21 @@ class InvoiceRepository foreach ($invoices as $invoice) { - if ($action == 'delete') - { - $invoice->is_deleted = true; - $invoice->save(); - } + if ($action == 'mark') + { + $invoice->invoice_status_id = $statusId; + $invoice->save(); + } + else + { + if ($action == 'delete') + { + $invoice->is_deleted = true; + $invoice->save(); + } - $invoice->delete(); + $invoice->delete(); + } } return count($invoices); diff --git a/app/views/header.blade.php b/app/views/header.blade.php index ca3619bd30..343a803aa5 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -8,8 +8,15 @@ @@ -35,8 +42,6 @@ @section('body') -

     

    -