[Vtigercrm-developers] v6 basic ajax

Daniel Thompson developingdanny at gmail.com
Mon Feb 10 15:23:24 GMT 2014


Hi All,

Ran into this within my dev enviroment

foreach($records as $moduleName=>$recordModels) {
foreach($recordModels as $recordModel) {
$result[] = array('label'=>decode_html($recordModel->getName()),
'value'=>decode_html($recordModel->getName()), 'id'=>$recordModel->getId());
}
}

returns an error if no results are returned due to $records is not being
checked before emit.


Should be something like this.

if(is_array($records))
{
foreach($records as $moduleName=>$recordModels) {
foreach($recordModels as $recordModel) {
$result[] = array('label'=>decode_html($recordModel->getName()),
'value'=>decode_html($recordModel->getName()), 'id'=>$recordModel->getId());
}
}
}

Regards,

Danny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140210/8f333b26/attachment.html>


More information about the vtigercrm-developers mailing list