mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for single route actions
This commit is contained in:
parent
e1fd87d174
commit
b7a5c055a8
@ -587,21 +587,21 @@ class CreditController extends BaseController
|
||||
$this->credit_repository->archive($credit);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($credit);
|
||||
return $this->itemResponse($credit);
|
||||
}
|
||||
break;
|
||||
case 'restore':
|
||||
$this->credit_repository->restore($credit);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($credit);
|
||||
return $this->itemResponse($credit);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
$this->credit_repository->delete($credit);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($credit);
|
||||
return $this->itemResponse($credit);
|
||||
}
|
||||
break;
|
||||
case 'email':
|
||||
|
@ -722,14 +722,14 @@ class InvoiceController extends BaseController
|
||||
$this->invoice_repo->restore($invoice);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($invoice);
|
||||
return $this->itemResponse($invoice);
|
||||
}
|
||||
break;
|
||||
case 'archive':
|
||||
$this->invoice_repo->archive($invoice);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($invoice);
|
||||
return $this->itemResponse($invoice);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
@ -737,7 +737,7 @@ class InvoiceController extends BaseController
|
||||
$this->invoice_repo->delete($invoice);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($invoice);
|
||||
return $this->itemResponse($invoice);
|
||||
}
|
||||
break;
|
||||
case 'cancel':
|
||||
|
@ -623,14 +623,14 @@ class PurchaseOrderController extends BaseController
|
||||
$this->purchase_order_repository->restore($purchase_order);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($purchase_order);
|
||||
return $this->itemResponse($purchase_order);
|
||||
}
|
||||
break;
|
||||
case 'archive':
|
||||
$this->purchase_order_repository->archive($purchase_order);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($purchase_order);
|
||||
return $this->itemResponse($purchase_order);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
@ -638,7 +638,7 @@ class PurchaseOrderController extends BaseController
|
||||
$this->purchase_order_repository->delete($purchase_order);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($purchase_order);
|
||||
return $this->itemResponse($purchase_order);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -684,7 +684,7 @@ class PurchaseOrderController extends BaseController
|
||||
}
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($purchase_order);
|
||||
return $this->itemResponse($purchase_order);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -728,7 +728,7 @@ class QuoteController extends BaseController
|
||||
$this->quote_repo->restore($quote);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($quote);
|
||||
return $this->itemResponse($quote);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -736,7 +736,7 @@ class QuoteController extends BaseController
|
||||
$this->quote_repo->archive($quote);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($quote);
|
||||
return $this->itemResponse($quote);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -744,7 +744,7 @@ class QuoteController extends BaseController
|
||||
$this->quote_repo->delete($quote);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($quote);
|
||||
return $this->itemResponse($quote);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -511,21 +511,21 @@ class RecurringExpenseController extends BaseController
|
||||
$this->recurring_expense_repo->archive($recurring_expense);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($recurring_expense);
|
||||
return $this->itemResponse($recurring_expense);
|
||||
}
|
||||
break;
|
||||
case 'restore':
|
||||
$this->recurring_expense_repo->restore($recurring_expense);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($recurring_expense);
|
||||
return $this->itemResponse($recurring_expense);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
$this->recurring_expense_repo->delete($recurring_expense);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($recurring_expense);
|
||||
return $this->itemResponse($recurring_expense);
|
||||
}
|
||||
break;
|
||||
case 'email':
|
||||
|
@ -662,21 +662,21 @@ class RecurringInvoiceController extends BaseController
|
||||
$this->recurring_invoice_repo->archive($recurring_invoice);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($recurring_invoice);
|
||||
return $this->itemResponse($recurring_invoice);
|
||||
}
|
||||
break;
|
||||
case 'restore':
|
||||
$this->recurring_invoice_repo->restore($recurring_invoice);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($recurring_invoice);
|
||||
return $this->itemResponse($recurring_invoice);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
$this->recurring_invoice_repo->delete($recurring_invoice);
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->listResponse($recurring_invoice);
|
||||
return $this->itemResponse($recurring_invoice);
|
||||
}
|
||||
break;
|
||||
case 'email':
|
||||
|
@ -46,6 +46,18 @@ class InvoiceTest extends TestCase
|
||||
$this->makeTestData();
|
||||
}
|
||||
|
||||
|
||||
public function testInvoiceArchiveAction()
|
||||
{
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->get('/api/v1/invoices/'.$this->invoice->hashed_id.'/archive',)
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
|
||||
public function testMarkingDeletedInvoiceAsSent()
|
||||
{
|
||||
Client::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
|
||||
@ -290,4 +302,6 @@ class InvoiceTest extends TestCase
|
||||
])->post('/api/v1/invoices/', $data)
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user