invoice create issue : GWM
This commit is contained in:
parent
d52c746b4f
commit
5df47b9908
@ -123,8 +123,10 @@ class InvoiceController extends ResourceController
|
||||
|
||||
$invoiceId = $this->InvoiceModel->insert($invoiceData);
|
||||
|
||||
if (!$invoiceId) { throw new DataException("Failed to create invoice"); }
|
||||
|
||||
if ($invoiceId === false) {
|
||||
log_message('error', json_encode($this->InvoiceModel->errors()));
|
||||
return $this->respond(['status' => 'failed', 'message' => 'Failed to create invoice', 'error' => json_encode($this->InvoiceModel->errors())], 500);
|
||||
}
|
||||
} else {
|
||||
|
||||
// Invoice number should NOT change on update
|
||||
|
||||
@ -36,9 +36,8 @@ class InvoiceModel extends Model
|
||||
|
||||
// Validation (optional)
|
||||
protected $validationRules = [
|
||||
'invoice_no' => 'required|max_length[100]',
|
||||
'invoice_no' => 'required',
|
||||
'invoice_amount' => 'decimal',
|
||||
'agent_id' => 'required|integer',
|
||||
'invoice_date' => 'required|valid_date',
|
||||
];
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user