mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Clean up error logs from API
This commit is contained in:
parent
e4a7f4c614
commit
763c5e08a5
@ -121,6 +121,10 @@ class BaseAPIController extends Controller
|
|||||||
|
|
||||||
protected function itemResponse($item)
|
protected function itemResponse($item)
|
||||||
{
|
{
|
||||||
|
if (! $item) {
|
||||||
|
return $this->errorResponse('Record not found', 404);
|
||||||
|
}
|
||||||
|
|
||||||
$transformerClass = EntityModel::getTransformerName($this->entityType);
|
$transformerClass = EntityModel::getTransformerName($this->entityType);
|
||||||
$transformer = new $transformerClass(Auth::user()->account, Input::get('serializer'));
|
$transformer = new $transformerClass(Auth::user()->account, Input::get('serializer'));
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ class UpdateClientRequest extends ClientRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,6 +21,10 @@ class UpdateClientRequest extends ClientRequest
|
|||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
|
if (! $this->entity()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
$rules = [];
|
$rules = [];
|
||||||
|
|
||||||
if ($this->user()->account->client_number_counter) {
|
if ($this->user()->account->client_number_counter) {
|
||||||
|
@ -11,7 +11,7 @@ class UpdateContactRequest extends ContactRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,7 @@ class UpdateCreditRequest extends CreditRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,7 @@ class UpdateDocumentRequest extends DocumentRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,7 @@ class UpdateExpenseCategoryRequest extends ExpenseCategoryRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,6 +21,10 @@ class UpdateExpenseCategoryRequest extends ExpenseCategoryRequest
|
|||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
|
if (! $this->entity()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'name' => sprintf('required|unique:expense_categories,name,%s,id,account_id,%s', $this->entity()->id, $this->user()->account_id),
|
'name' => sprintf('required|unique:expense_categories,name,%s,id,account_id,%s', $this->entity()->id, $this->user()->account_id),
|
||||||
|
@ -11,7 +11,7 @@ class UpdateExpenseRequest extends ExpenseRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@ class UpdateInvoiceAPIRequest extends InvoiceRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,6 +23,10 @@ class UpdateInvoiceAPIRequest extends InvoiceRequest
|
|||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
|
if (! $this->entity()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->action == ACTION_ARCHIVE) {
|
if ($this->action == ACTION_ARCHIVE) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ class UpdateInvoiceRequest extends InvoiceRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,6 +23,10 @@ class UpdateInvoiceRequest extends InvoiceRequest
|
|||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
|
if (! $this->entity()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
$invoiceId = $this->entity()->id;
|
$invoiceId = $this->entity()->id;
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
|
@ -11,7 +11,7 @@ class UpdatePaymentRequest extends PaymentRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,7 @@ class UpdateProductRequest extends ProductRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,7 @@ class UpdateProjectRequest extends ProjectRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,6 +21,10 @@ class UpdateProjectRequest extends ProjectRequest
|
|||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
|
if (! $this->entity()) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => sprintf('required|unique:projects,name,%s,id,account_id,%s', $this->entity()->id, $this->user()->account_id),
|
'name' => sprintf('required|unique:projects,name,%s,id,account_id,%s', $this->entity()->id, $this->user()->account_id),
|
||||||
];
|
];
|
||||||
|
@ -11,7 +11,7 @@ class UpdateRecurringExpenseRequest extends RecurringExpenseRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,7 @@ class UpdateTaskRequest extends TaskRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,7 @@ class UpdateTaxRateRequest extends TaxRateRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +11,7 @@ class UpdateVendorRequest extends VendorRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return $this->user()->can('edit', $this->entity());
|
return $this->entity() && $this->user()->can('edit', $this->entity());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user