Merge branch 'master' of github.com:hillelcoren/invoice-ninja

This commit is contained in:
Hillel Coren 2016-02-11 17:12:34 +02:00
commit a30153cabe
6 changed files with 78 additions and 9 deletions

View File

@ -67,7 +67,7 @@ class ClientApiController extends BaseAPIController
$clients = $clients->paginate(); $clients = $clients->paginate();
$transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer')); $transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer'));
$paginator = Client::scope()->paginate(); $paginator = Client::scope()->withTrashed()->paginate();
$data = $this->createCollection($clients, $transformer, ENTITY_CLIENT, $paginator); $data = $this->createCollection($clients, $transformer, ENTITY_CLIENT, $paginator);
@ -158,5 +158,45 @@ class ClientApiController extends BaseAPIController
} }
/**
* @SWG\Delete(
* path="/clients/{client_id}",
* tags={"client"},
* summary="Delete a client",
* @SWG\Parameter(
* in="body",
* name="body",
* @SWG\Schema(ref="#/definitions/Client")
* ),
* @SWG\Response(
* response=200,
* description="Delete client",
* @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Client"))
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
public function destroy($publicId)
{
$client = Client::scope($publicId)->withTrashed()->first();
$this->clientRepo->delete($client);
$client = Client::scope($publicId)
->with('country', 'contacts', 'industry', 'size', 'currency')
->withTrashed()
->first();
$transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer'));
$data = $this->createItem($client, $transformer, ENTITY_CLIENT);
return $this->response($data);
}
} }

View File

@ -7,6 +7,11 @@ class DuplicateSubmissionCheck
// Prevent users from submitting forms twice // Prevent users from submitting forms twice
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if ($request->is('api/v1/*')) {
return $next($request);
}
$path = $request->path(); $path = $request->path();
if (strpos($path, 'charts_and_reports') !== false) { if (strpos($path, 'charts_and_reports') !== false) {

View File

@ -32,7 +32,7 @@ class UpdateInvoiceRequest extends Request
$invoiceId = Invoice::getPrivateId($publicId); $invoiceId = Invoice::getPrivateId($publicId);
$rules = [ $rules = [
'invoice_items' => 'required|valid_invoice_items', 'invoice_items' => 'valid_invoice_items',
'invoice_number' => 'unique:invoices,invoice_number,'.$invoiceId.',id,account_id,'.Auth::user()->account_id, 'invoice_number' => 'unique:invoices,invoice_number,'.$invoiceId.',id,account_id,'.Auth::user()->account_id,
'discount' => 'positive', 'discount' => 'positive',
]; ];

View File

@ -75,21 +75,21 @@ class AccountRepository
->where('clients.deleted_at', '=', null) ->where('clients.deleted_at', '=', null)
->where('clients.account_id', '=', \Auth::user()->account_id) ->where('clients.account_id', '=', \Auth::user()->account_id)
->whereRaw("clients.name <> ''") ->whereRaw("clients.name <> ''")
->select(\DB::raw("'Clients' as type, clients.public_id, clients.name, '' as token")); ->select(\DB::raw("'" . trans('texts.clients') . "' as type, clients.public_id, clients.name, '' as token"));
$contacts = \DB::table('clients') $contacts = \DB::table('clients')
->join('contacts', 'contacts.client_id', '=', 'clients.id') ->join('contacts', 'contacts.client_id', '=', 'clients.id')
->where('clients.deleted_at', '=', null) ->where('clients.deleted_at', '=', null)
->where('clients.account_id', '=', \Auth::user()->account_id) ->where('clients.account_id', '=', \Auth::user()->account_id)
->whereRaw("CONCAT(contacts.first_name, contacts.last_name, contacts.email) <> ''") ->whereRaw("CONCAT(contacts.first_name, contacts.last_name, contacts.email) <> ''")
->select(\DB::raw("'Contacts' as type, clients.public_id, CONCAT(contacts.first_name, ' ', contacts.last_name, ' ', contacts.email) as name, '' as token")); ->select(\DB::raw("'" . trans('texts.contacts') . "' as type, clients.public_id, CONCAT(contacts.first_name, ' ', contacts.last_name, ' ', contacts.email) as name, '' as token"));
$invoices = \DB::table('clients') $invoices = \DB::table('clients')
->join('invoices', 'invoices.client_id', '=', 'clients.id') ->join('invoices', 'invoices.client_id', '=', 'clients.id')
->where('clients.account_id', '=', \Auth::user()->account_id) ->where('clients.account_id', '=', \Auth::user()->account_id)
->where('clients.deleted_at', '=', null) ->where('clients.deleted_at', '=', null)
->where('invoices.deleted_at', '=', null) ->where('invoices.deleted_at', '=', null)
->select(\DB::raw("'Invoices' as type, invoices.public_id, CONCAT(invoices.invoice_number, ': ', clients.name) as name, invoices.invoice_number as token")); ->select(\DB::raw("'" . trans('texts.invoices') . "' as type, invoices.public_id, CONCAT(invoices.invoice_number, ': ', clients.name) as name, invoices.invoice_number as token"));
$data = []; $data = [];

View File

@ -120,6 +120,14 @@
"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
] ]
}, },
'fr-CA': { //French - Canada
months: [
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
],
dayOfWeek: [
"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
]
},
es: { // Spanish es: { // Spanish
months: [ months: [
"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
@ -128,6 +136,14 @@
"Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
] ]
}, },
'es-ES': { // Spanish - Spain
months: [
"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
],
dayOfWeek: [
"Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
]
},
th: { // Thai th: { // Thai
months: [ months: [
'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม' 'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'
@ -200,6 +216,14 @@
"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
] ]
}, },
'nb_NO': { // Norwegian
months: [
"Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
],
dayOfWeek: [
"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
]
},
ja: { // Japanese ja: { // Japanese
months: [ months: [
"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"

View File

@ -77,11 +77,11 @@
} }
} ); } );
/* var appLocale = '{{App::getLocale()}}';
$.extend( true, $.fn.datepicker.defaults, { $.extend( true, $.fn.datepicker.defaults, {
language:'{{App::getLocale()}}' language: appLocale.replace("_", "-")
}); });
*/
@if (env('FACEBOOK_PIXEL')) @if (env('FACEBOOK_PIXEL'))
<!-- Facebook Pixel Code --> <!-- Facebook Pixel Code -->
@ -202,4 +202,4 @@
</body> </body>
</html> </html>