teoyh
Member
If i want to do a check for the csv import ;
I have this php code which i call from the Import Row PHP Code to do the check if there is already a record in the table I return false but the return false does not seem to prevent the record from being inserted.
Is there any other way to prevent the record from being inserted. I cannot choose overide as there may be other data already being added to the previous record.
class importStates
{
function Cleanup($importModel)
{
$db = FabrikWorker::getDbo(false, 3);
$listModel = $importModel->getModel();
$formModel = $listModel->getFormModel();
$sapno = $formModel->formData['stm_single_clocking___sapno'];
$wdate = $formModel->formData['stm_single_clocking___workdate'];
$recid = $formModel->formData['stm_single_clocking___id'];
$db->setQuery("SELECT id FROM single_clocking where sapno='$sapno' and workdate='$wdate'");
$id = $db->loadResult();
if($id!==''){
return false;
}
}
}
Thanks in advance
I have this php code which i call from the Import Row PHP Code to do the check if there is already a record in the table I return false but the return false does not seem to prevent the record from being inserted.
Is there any other way to prevent the record from being inserted. I cannot choose overide as there may be other data already being added to the previous record.
class importStates
{
function Cleanup($importModel)
{
$db = FabrikWorker::getDbo(false, 3);
$listModel = $importModel->getModel();
$formModel = $listModel->getFormModel();
$sapno = $formModel->formData['stm_single_clocking___sapno'];
$wdate = $formModel->formData['stm_single_clocking___workdate'];
$recid = $formModel->formData['stm_single_clocking___id'];
$db->setQuery("SELECT id FROM single_clocking where sapno='$sapno' and workdate='$wdate'");
$id = $db->loadResult();
if($id!==''){
return false;
}
}
}
Thanks in advance