Topic: Error notification
We have a couple of reporting iforms which are generating an error notification on load;
Notice: Undefined index: explore-ownData in iform_map_explorer::get_form() (line 230 of /sites/all/modules/iform/client_helpers/prebuilt_forms/map_explorer.php).
The iform in question allows the user to query all records or filter the report to include only their own records. When filtering to their own records i would like them to have the option of downloading the data.
The error notification is being triggered when the user is viewing all records (and so cannot download the report). There is no actual error here but i don't want normal users to be seeing this message. Can anyone;
1 - Suggest an amendment to the code so it accounts for a null value on the filter (see below).
2 - Suggest a way that prevents the notification appearing to non-admin users. Preferably without installing yet another module.
Current code;
$olOptions = iform_map_get_ol_options($args);
$r .= map_helper::map_panel($options, $olOptions);
$allowDownload = !isset($args['downloadOwnDataOnly']) || !$args['downloadOwnDataOnly']
|| (isset($reportOptions['extraParams']['ownData']) && $reportOptions['extraParams']['ownData']===1)
|| (isset($_POST['explore-ownData']) && $_POST['explore-ownData']==='1')
|| (!(isset($_POST['explore-ownData']) || $_POST['explore-ownData']==='0')
&& isset($reportOptions['paramDefaults']['ownData']) && $reportOptions['paramDefaults']['ownData']===1);
$reportOptions = array_merge(
$reportOptions,
array(
'id'=>'explore-records',
'paramsOnly'=>false,
'autoParamsForm'=>false,
'downloadLink'=>$allowDownload,
'rowClass'=>'certainty{certainty}'
)
);