Hello,
I need to update two fields with the current datetime, if a condition is met. The fields that need to be updated and the fields checked for existing values are in a repeat group.
Using the php form plugin, i've added this code but i can't make it work, no update is made in the database. The php form plugin run onBeforeStore.
The form is available here (login required, see My Sites for login data)
Joomla 3.4.8, Fabrik 3.4.2
Thank you
I need to update two fields with the current datetime, if a condition is met. The fields that need to be updated and the fields checked for existing values are in a repeat group.
Using the php form plugin, i've added this code but i can't make it work, no update is made in the database. The php form plugin run onBeforeStore.
The form is available here (login required, see My Sites for login data)
Joomla 3.4.8, Fabrik 3.4.2
Code:
$repeatcount = $formModel->formData['fabrik_repeat_group'][675];
for($i=0; $i<$repeatcount; $i++ ){
$solicitare = $formModel->formData['solicitare'][$i];
$raspuns = $formModel->formData['raspuns_solicitare'][$i];
$data_solicitare = $formModel->formData['data_solicitare'][$i];
$data_raspuns = $formModel->formData['data_raspuns_solicitare'][$i];
$data = (new \DateTime())->format('Y-m-d H:i:s');
if (!empty($solicitare) && empty($data_solicitare)) {
$formModel->updateFormData("aplicatii_cm_tickets_675_repeat___data_solicitare".$i,$data, true);
}
if (!empty($raspuns) && empty($data_raspuns)) {
$formModel->updateFormData("aplicatii_cm_tickets_675_repeat___data_raspuns_solicitare".$i,$data, true);
}
}
Thank you
Last edited: