Merge pull request #658 from turbo124/master

Bug fixes
This commit is contained in:
David Bomba 2016-01-27 11:40:41 +11:00
commit 2db27caf90
2 changed files with 12 additions and 6 deletions

View File

@ -133,9 +133,19 @@ class ClientApiController extends BaseAPIController
public function update(UpdateClientRequest $request, $publicId) 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 = $request->input();
$data['public_id'] = $publicId; $data['public_id'] = $publicId;
$this->clientService->save($data); $this->clientRepo->save($data);
$client = Client::scope($publicId) $client = Client::scope($publicId)
->with('country', 'contacts', 'industry', 'size', 'currency') ->with('country', 'contacts', 'industry', 'size', 'currency')

View File

@ -297,11 +297,7 @@ class InvoiceApiController extends BaseAPIController
if ($request->action == ACTION_ARCHIVE) { if ($request->action == ACTION_ARCHIVE) {
$invoice = Invoice::scope($publicId)->firstOrFail(); $invoice = Invoice::scope($publicId)->firstOrFail();
$this->invoiceRepo->archive($invoice); $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')); $transformer = new InvoiceTransformer(\Auth::user()->account, Input::get('serializer'));
$data = $this->createItem($invoice, $transformer, 'invoice'); $data = $this->createItem($invoice, $transformer, 'invoice');