invoice create issue : GWM

This commit is contained in:
Gowtham M 2025-12-19 10:55:42 +05:30
parent d52c746b4f
commit 5df47b9908
2 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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',
];