Commit 3e2503c0 authored by metzlerd's avatar metzlerd
Browse files

#1839942 Improved simplexml warning messages.

parent 6bcf35b7
......@@ -79,7 +79,11 @@ class FrxSyntaxEngine {
$retvar = $this->simplexml_evaluate($data, ltrim($key, '='));
}
else {
$rows = $data->xpath($key);
$rows = @$data->xpath($key);
if ($rows === FALSE) {
drupal_set_message(t('Invalid field: "%s"', array('%s' => $key)), 'error', FALSE);
}
$x ='';
if ($rows) $x = $rows[0];
......
......@@ -1551,7 +1551,12 @@ function forena_add_data_block_form($formid, &$form_state, $report_name) {
$xml = $form_state['storage']['xml'];
if ($xml) {
$xml = new SimpleXMLElement($xml);
try {
$xml = @new SimpleXMLElement($xml);
}
catch (Exception $e ) {
drupal_set_message(t('Could not create xml from %s. Verify that all columns names are valid XML tag names and have no spaces or other special characters.', array('%s' => $form_state['storage']['data_block'])), 'error', FALSE);
}
//create xml from template object
$template_obj = FrxReportGenerator::instance()->get_templates($template);
if ($template_obj) {
......
......@@ -1079,6 +1079,13 @@ function forena_report_path() {
return Frx::File()->dir;
}
/**
* Rename function for backwards compatibility
*/
function forena_current_user_uid() {
return forena_current_user_id();
}
/**
* Helper function for current user for the drupal instance
*
......
......@@ -35,6 +35,7 @@ class FrxTemplate {
public function columns($xml, $path='/*/*') {
//create an array of columns
if (!is_object($xml)) return array();
$rows = $xml->xpath($path);
$column_array = array();
$this->columns = array();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment