Skip to content

Commit 9fb54af

Browse files
author
Daniel Rodrigues Lima
committed
update multiple params
1 parent 0a9f80c commit 9fb54af

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/JasperPHP/JasperPHP.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function process($input_file, $output_file = false, $format = array('pdf'
8585
if( $output_file !== false )
8686
$command .= ' -o ' . "\"$output_file\"";
8787

88-
if( is_array($format) )
88+
if( is_array($format) )
8989
$command .= ' -f ' . join(' ', $format);
9090
else
9191
$command .= ' -f ' . $format;
@@ -96,11 +96,13 @@ public function process($input_file, $output_file = false, $format = array('pdf'
9696
if( count($parameters) > 0 )
9797
{
9898
$command .= ' -P ';
99+
99100
foreach ($parameters as $key => $value)
100101
{
101-
$param = $key . '=' . $value . ' ';
102-
$command .= "\"$param\"";
102+
$param = $key . '="' . $value . '" ';
103+
$command .= " " .$param. " ";
103104
}
105+
104106
}
105107

106108
if( count($db_connection) > 0 )
@@ -128,13 +130,16 @@ public function process($input_file, $output_file = false, $format = array('pdf'
128130
if( isset($db_connection['jdbc_url']) && !empty($db_connection['jdbc_url']) )
129131
$command .= ' --db-url ' . $db_connection['jdbc_url'];
130132

131-
if ( isset($db_connection['jdbc_dir']) && !empty($db_connection['jdbc_dir']) )
133+
if ( isset($db_connection['jdbc_dir']) && !empty($db_connection['jdbc_dir']) )
132134
$command .= ' --jdbc-dir ' . $db_connection['jdbc_dir'];
133135

134136
if ( isset($db_connection['db_sid']) && !empty($db_connection['db_sid']) )
135137
$command .= ' --db-sid ' . $db_connection['db_sid'];
136138

137-
if ( isset($db_connection['data_file']) )
139+
if ( isset($db_connection['xml_xpath']) )
140+
$command .= ' --xml-xpath ' . $db_connection['xml_xpath'];
141+
142+
if ( isset($db_connection['data_file']) )
138143
$command .= ' --data-file ' . $db_connection['data_file'];
139144

140145
}
@@ -185,7 +190,7 @@ public function execute($run_as_user = false)
185190

186191
if($return_var != 0)
187192
throw new \Exception('Your report has an error and couldn \'t be processed!\ Try to output the command using the function `output();` and run it manually in the console.', 1);
188-
193+
189194
return $output;
190195
}
191196
}

0 commit comments

Comments
 (0)