FIX_ISSUE_OF_LEAD_REMINDER_DATE

This commit is contained in:
VENKATESHWARAN 2026-02-17 10:27:12 +05:30
parent 7f292b687a
commit e2325e4ca3

View File

@ -447,7 +447,14 @@ class LeadsController extends BaseController
'status' => [
'rules' => 'required',
'errors' => ['required' => 'Status is required']
]
],
'next_reminder_date' => [
'label' => 'Next Reminder Date',
'rules' => 'permit_empty|valid_date[d/m/Y]',
'errors' => [
'valid_date' => 'The {field} must be in the format DD/MM/YYYY.'
]
],
];
foreach ($postData as $key => $value) {
@ -715,9 +722,13 @@ class LeadsController extends BaseController
$data['source_policy_end_date'] = null;
}
//convert the date
if (!empty($data['next_reminder_date'])) {
$data['next_reminder_date'] = change_date_format($data['next_reminder_date']);
// convert the date
// Clean the input and handle empty strings
$reminderDate = trim($data['next_reminder_date'] ?? '');
if ($reminderDate !== '' && $reminderDate != null && $reminderDate != 0) {
$convertedDate = change_date_format($reminderDate);
$data['next_reminder_date'] = $convertedDate ?: null;
} else {
$data['next_reminder_date'] = null;
}