Skip to content
This repository was archived by the owner on Oct 25, 2022. It is now read-only.

Commit afda44a

Browse files
authored
Merge pull request #98 from cossou/allow-string-parameters
Allow string parameters
2 parents c4d9f7a + 44ff283 commit afda44a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/JasperPHP/JasperPHP.php

+8-6
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ public function process($input_file, $output_file = false, $format = array("pdf"
9595
$command .= " -P";
9696
foreach ($parameters as $key => $value)
9797
{
98-
$command .= " " . $key . "=" . $value;
98+
if( is_string($value) )
99+
$command .= " $key=\"$value\"";
100+
else
101+
$command .= " $key=$value";
99102
}
100103
}
101104

@@ -105,7 +108,7 @@ public function process($input_file, $output_file = false, $format = array("pdf"
105108

106109
if( isset($db_connection['username']) && !empty($db_connection['username']) )
107110
$command .= " -u " . $db_connection['username'];
108-
111+
109112
if( isset($db_connection['password']) && !empty($db_connection['password']) )
110113
$command .= " -p " . $db_connection['password'];
111114

@@ -129,10 +132,10 @@ public function process($input_file, $output_file = false, $format = array("pdf"
129132

130133
if ( isset($db_connection['db_sid']) && !empty($db_connection['db_sid']) )
131134
$command .= ' --db-sid ' . $db_connection['db_sid'];
132-
135+
133136
if ( isset($db_connection['json_query']) && !empty($db_connection['json_query']) )
134137
$command .= ' --json-query ' . $db_connection['json_query'];
135-
138+
136139
if ( isset($db_connection['data_file']) && !empty($db_connection['data_file']) )
137140
$command .= ' --data-file ' . $db_connection['data_file'];
138141

@@ -184,10 +187,9 @@ public function execute($run_as_user = false)
184187

185188
if( $return_var != 0 && isset($output[0]) )
186189
throw new \Exception($output[0], 1);
187-
188190
elseif( $return_var != 0 )
189191
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);
190-
192+
191193
return $output;
192194
}
193195
}

0 commit comments

Comments
 (0)