diff --git a/app/Http/Controllers/ClientApiController.php b/app/Http/Controllers/ClientApiController.php index da270854c384..f5eda2371c0d 100644 --- a/app/Http/Controllers/ClientApiController.php +++ b/app/Http/Controllers/ClientApiController.php @@ -133,9 +133,19 @@ class ClientApiController extends BaseAPIController public function update(UpdateClientRequest $request, $publicId) { + if ($request->action == ACTION_ARCHIVE) { + $client = Client::scope($publicId)->firstOrFail(); + $this->clientRepo->archive($client); + + $transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer')); + $data = $this->createItem($client, $transformer, ENTITY_CLIENT); + + return $this->response($data); + } + $data = $request->input(); $data['public_id'] = $publicId; - $this->clientService->save($data); + $this->clientRepo->save($data); $client = Client::scope($publicId) ->with('country', 'contacts', 'industry', 'size', 'currency') diff --git a/app/Http/Controllers/InvoiceApiController.php b/app/Http/Controllers/InvoiceApiController.php index 52b1811ca21f..a168870dedfc 100644 --- a/app/Http/Controllers/InvoiceApiController.php +++ b/app/Http/Controllers/InvoiceApiController.php @@ -297,11 +297,7 @@ class InvoiceApiController extends BaseAPIController if ($request->action == ACTION_ARCHIVE) { $invoice = Invoice::scope($publicId)->firstOrFail(); $this->invoiceRepo->archive($invoice); - /* - $response = json_encode(RESULT_SUCCESS, JSON_PRETTY_PRINT); - $headers = Utils::getApiHeaders(); - return Response::make($response, 200, $headers); - */ + $transformer = new InvoiceTransformer(\Auth::user()->account, Input::get('serializer')); $data = $this->createItem($invoice, $transformer, 'invoice');