mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Validation rules
This commit is contained in:
parent
accd7ae348
commit
5b0cb2a218
@ -33,6 +33,12 @@ class UpdateClientRequest extends Request
|
|||||||
/* Ensure we have a client name, and that all emails are unique*/
|
/* Ensure we have a client name, and that all emails are unique*/
|
||||||
$rules['name'] = 'required';
|
$rules['name'] = 'required';
|
||||||
|
|
||||||
|
$rules['industry_id'] = 'integer|nullable';
|
||||||
|
$rules['size_id'] = 'integer|nullable';
|
||||||
|
$rules['currency_id'] = 'integer|nullable';
|
||||||
|
$rules['country_id'] = 'integer|nullable';
|
||||||
|
$rules['shipping_country_id'] = 'integer|nullable';
|
||||||
|
|
||||||
$contacts = request('contacts');
|
$contacts = request('contacts');
|
||||||
|
|
||||||
if(is_array($contacts))
|
if(is_array($contacts))
|
||||||
|
@ -34,32 +34,11 @@ class StoreInvoiceRequest extends Request
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'client_id' => 'required',
|
'client_id' => 'required',
|
||||||
|
'invoice_type_id' => 'integer',
|
||||||
|
|
||||||
// 'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
// 'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have an email address instead of a client_id - harvest the client_id here
|
|
||||||
public function sanitize()
|
|
||||||
{
|
|
||||||
$input = $this->all();
|
|
||||||
|
|
||||||
|
|
||||||
if(isset($input['email']) && !$input['client_id'])
|
|
||||||
{
|
|
||||||
$contact = ClientContact::company(auth()->user()->company()->id)->whereEmail($input['email'])->first();
|
|
||||||
|
|
||||||
if($contact)
|
|
||||||
$input['client_id'] = $contact->client_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->replace($input);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function messages()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ class UpdateInvoiceRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
|
'client_id' => 'required|integer',
|
||||||
|
'invoice_type_id' => 'integer',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,10 @@ class StorePaymentRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
|
'client_id' => 'integer|nullable',
|
||||||
|
'payment_type_id' => 'integer|nullable',
|
||||||
|
'amount' => 'numeric',
|
||||||
|
'payment_date' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,10 @@ class UpdatePaymentRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
|
'client_id' => 'integer|nullable',
|
||||||
|
'payment_type_id' => 'integer|nullable',
|
||||||
|
'amount' => 'numeric',
|
||||||
|
'payment_date' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,9 @@ class StoreProductRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'product_key' => 'required|unique:products,product_key,null,null,company_id,'.auth()->user()->companyId(),
|
'product_key' => 'required|unique:products,product_key,null,null,company_id,'.auth()->user()->companyId(),
|
||||||
|
'cost' => 'numeric',
|
||||||
|
'price' => 'numeric',
|
||||||
|
'qty' => 'numeric',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,9 @@ class UpdateProductRequest extends Request
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'product_key' => 'unique:products,product_key,'.$this->product->id.',id,company_id,'.auth()->user()->companyId(),
|
'product_key' => 'unique:products,product_key,'.$this->product->id.',id,company_id,'.auth()->user()->companyId(),
|
||||||
|
'cost' => 'numeric',
|
||||||
|
'price' => 'numeric',
|
||||||
|
'qty' => 'numeric',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ class StoreQuoteRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
|
'client_id' => 'required|integer',
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ class UpdateQuoteRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
|
'client_id' => 'required|integer',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ class StoreRecurringInvoiceRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
|
'client_id' => 'required|integer',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ class UpdateRecurringInvoiceRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
|
'client_id' => 'required|integer',
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ class StoreRecurringQuoteRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
|
'client_id' => 'required|integer',
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ class UpdateRecurringQuoteRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
|
'client_id' => 'required|integer',
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user