diff --git a/Dockerfile b/Dockerfile index b5b7bff..59c689d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,9 @@ RUN apt-get install -y software-properties-common python-software-properties \ && apt-get -y update \ && apt-get -y install openjdk-7-jdk -CMD chmod 777 /home/portabilis/ieducar/modules/Reports/ReportSources/Portabilis/ +CMD update-alternatives --config java + +CMD chmod 777 /home/portabilis/ieducar/modules/Reports/ReportSources/ CMD /usr/sbin/apache2ctl -D FOREGROUND diff --git a/ieducar/configuration/ieducar.ini b/ieducar/configuration/ieducar.ini index f094c15..889bd0c 100644 --- a/ieducar/configuration/ieducar.ini +++ b/ieducar/configuration/ieducar.ini @@ -54,7 +54,7 @@ ; Configurações de banco de dados app.database.dbname = ieducar app.database.username = postgres -app.database.hostname = localhost +app.database.hostname = postgres95 app.database.password = postgres app.database.port = 5432 diff --git a/ieducar/lib/Portabilis/Controller/ReportCoreController.php b/ieducar/lib/Portabilis/Controller/ReportCoreController.php index dc9f94e..529501d 100644 --- a/ieducar/lib/Portabilis/Controller/ReportCoreController.php +++ b/ieducar/lib/Portabilis/Controller/ReportCoreController.php @@ -1,7 +1,7 @@ acao_executa_submit = false; $this->acao_enviar = 'printReport()'; + header('Content-Type: text/html; charset=utf-8'); + parent::__construct(); } @@ -83,6 +85,11 @@ class Portabilis_Controller_ReportCoreController extends Core_Controller_Page_Ed $this->report = $this->report(); $this->beforeValidation(); + + $this->report->addArg('SUBREPORT_DIR', "modules/Reports/ReportSources/"); + + $this->report->addArg('database', $GLOBALS['coreExt']['Config']->app->database->dbname); + $this->validatesPresenseOfRequiredArgsInReport(); $this->aftervalidation(); @@ -96,7 +103,7 @@ class Portabilis_Controller_ReportCoreController extends Core_Controller_Page_Ed function headers($result) { - header('Content-type: application/pdf'); + header('Content-type: application/pdf; charset=utf-8'); header('Content-Length: ' . strlen($result)); header('Content-Disposition: inline; filename=report.pdf'); } @@ -172,14 +179,14 @@ class Portabilis_Controller_ReportCoreController extends Core_Controller_Page_Ed function onValidationError() { - $msg = Portabilis_String_Utils::toLatin1('O relatório não pode ser emitido, dica(s):\n\n'); + $msg = Portabilis_String_Utils::toLatin1('O relatório não pode ser emitido, dica(s):').'\n\n'; foreach ($this->validationErrors as $e) { - $error = Portabilis_String_Utils::escape($e['message']); + $error = $e['message']; $msg .= '- ' . $error . '\n'; } - $msg .= '\nPor favor, verifique esta(s) situação(s) e tente novamente.'; + $msg .= '\n'.Portabilis_String_Utils::toLatin1('Por favor, verifique esta(s) situação(s) e tente novamente.'); $msg = Portabilis_String_Utils::toLatin1($msg, array('escape' => false)); echo " "; diff --git a/ieducar/lib/Portabilis/Report/ReportFactoryPHPJasper.php b/ieducar/lib/Portabilis/Report/ReportFactoryPHPJasper.php index 423afa5..ebed728 100644 --- a/ieducar/lib/Portabilis/Report/ReportFactoryPHPJasper.php +++ b/ieducar/lib/Portabilis/Report/ReportFactoryPHPJasper.php @@ -31,7 +31,6 @@ require_once 'lib/Portabilis/Report/ReportFactory.php'; require_once 'vendor/autoload.php'; - use JasperPHP\JasperPHP; /** @@ -55,7 +54,7 @@ class Portabilis_Report_ReportFactoryPHPJasper extends Portabilis_Report_ReportF function getReportsPath() { $rootPath = dirname(dirname(dirname(dirname(__FILE__)))); - $reportsPath = $rootPath . "/modules/Reports/ReportSources/Portabilis/"; + $reportsPath = $rootPath . "/modules/Reports/ReportSources/"; return $reportsPath; } @@ -131,4 +130,4 @@ class Portabilis_Report_ReportFactoryPHPJasper extends Portabilis_Report_ReportF function destroyPDF($file){ unlink($file); } -} \ No newline at end of file +} diff --git a/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jasper b/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jasper new file mode 100755 index 0000000..b4f73d4 Binary files /dev/null and b/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jasper differ diff --git a/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml b/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml index 0220d3b..0536c3c 100644 --- a/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml +++ b/ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml @@ -14,6 +14,9 @@ + + + executable; - + $command .= " cp "; $command .= $input_file; @@ -46,14 +46,14 @@ class JasperPHP return $this; } - public function process($input_file, $output_file = false, $format = array("pdf"), $parameters = array(), $db_connection = array(), $background = true, $redirect_output = true) + public function process($input_file, $output_file = false, $format = array("pdf"), $parameters = array(), $db_connection = array(), $background = true, $redirect_output = true, $filter_params = true) { if(is_null($input_file) || empty($input_file)) throw new \Exception("No input file", 1); if( is_array($format) ) { - foreach ($format as $key) + foreach ($format as $key) { if( !in_array($key, $this->formats)) throw new \Exception("Invalid format!", 1); @@ -61,10 +61,20 @@ class JasperPHP } else { if( !in_array($format, $this->formats)) throw new \Exception("Invalid format!", 1); - } - - $command = __DIR__ . $this->executable; - + } + + $params_command = $command = __DIR__ . $this->executable; + + $params_command .= " params " . $input_file . " 2>&1 "; + + if($filter_params){ + exec($params_command, $params_output); + foreach ($params_output as $key => &$param) { + $exploded = explode(" ", $param); + $param = $exploded[1]; + } + } + $command .= " pr "; $command .= $input_file; @@ -83,29 +93,33 @@ class JasperPHP if( count($parameters) > 0 ) { $command .= " -P"; - foreach ($parameters as $key => $value) + foreach ($parameters as $key => $value) { - $command .= " " . $key . "=" . $value; + if(!$filter_params || in_array($key, $params_output)) + $command .= " " . $key . "=\"" . $value."\""; } - } + } if( count($db_connection) > 0 ) { $command .= " -t " . $db_connection['driver']; $command .= " -u " . $db_connection['username']; - + if( isset($db_connection['password']) && !empty($db_connection['password']) ) $command .= " -p " . $db_connection['password']; if( isset($db_connection['host']) && !empty($db_connection['host']) ) $command .= " -H " . $db_connection['host']; - + if( isset($db_connection['database']) && !empty($db_connection['database']) ) $command .= " -n " . $db_connection['database']; - + + if( isset($db_connection['port']) && !empty($db_connection['port']) ) + $command .= " --db-port " . $db_connection['port']; + if( isset($db_connection['jdbc_driver']) && !empty($db_connection['jdbc_driver']) ) $command .= " --db-driver " . $db_connection['jdbc_driver']; - + if( isset($db_connection['jdbc_url']) && !empty($db_connection['jdbc_url']) ) $command .= " --db-url " . $db_connection['jdbc_url']; } @@ -125,8 +139,8 @@ class JasperPHP public function execute($run_as_user = false) { if( $this->redirect_output && !$this->windows) - $this->the_command .= " > /dev/null 2>&1"; - + $this->the_command .= " 2>&1"; + if( $this->background && !$this->windows ) $this->the_command .= " &"; @@ -138,8 +152,8 @@ class JasperPHP exec($this->the_command, $output, $return_var); - if($return_var != 0) - throw new \Exception("There was and error executing the report! Time to check the logs!", 1); + if($return_var != 0) + throw new \Exception("Erro ao executar o relatorio! Detalhes: " . join($output, " "), 1); return $output; } diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/bin/jasperstarter.exe b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/bin/jasperstarter.exe old mode 100755 new mode 100644 index b7fda7f..b7fda7f Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/bin/jasperstarter.exe and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/bin/jasperstarter.exe differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/cs/usage.html b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/cs/usage.html index 24bb121..bb7a080 100644 --- a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/cs/usage.html +++ b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/cs/usage.html @@ -407,7 +407,7 @@ $ jasperstarter -f view -t mysql myreport.jasper -H localhost -u myuser -n mydb<
$ jasperstarter pr myreport.jrprint -f view

Reporty se zdrojem dat ve formátu CSV

-

Znaková sada souborů CSV je defaultně UTF-8. Další často používané znakové sady jsou cp1252 (Windows), ISO-8859-1 or ISO-8859-15 (Linux). Znakovou sadu CSV souboru lze specifikovat parametrem --csv-charset.

+

Znaková sada souborů CSV je defaultně UTF-8. Další často používané znakové sady jsou cp1252 (Windows), or 5 (Linux). Znakovou sadu CSV souboru lze specifikovat parametrem --csv-charset.

Jednotlivé údaje jsou obvykle odděleny novým řádkem, nemusí tak tomu ale být. separátor je závislý na defaultním separátoru celého systému a ten se v každém operačním systému liší. Pokud používáte CSV soubory z jiného systému, musíte tedy zadat správný separátor pomocí parametru --csv-record-del:

  • Windows: \r\n
  • diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/de/usage.html b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/de/usage.html index 93f1e36..47b4808 100644 --- a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/de/usage.html +++ b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/de/usage.html @@ -408,7 +408,7 @@ $ jasperstarter -f view -t mysql myreport.jasper -H localhost -u myuser -n mydb<
    $ jasperstarter pr myreport.jrprint -f view

Reports mit einer CSV Datenquelle

-

Der CSV Datei Zeichensatz ist auf UTF-8 voreingestellt. Andere übliche Zeichensätze sind cp1252 (Windows), ISO-8859-1 oder ISO-8859-15 (Linux). Sie können den CSV Zeichensatz mit dem Parameter --csv-charset angeben.

+

Der CSV Datei Zeichensatz ist auf UTF-8 voreingestellt. Andere übliche Zeichensätze sind cp1252 (Windows), oder 5 (Linux). Sie können den CSV Zeichensatz mit dem Parameter --csv-charset angeben.

Datensätze werden üblicherweise mit einem Zeilenumbruch getrennt, aber dies muss nicht so sein. Das Datensatz-Trennzeichen ist auf den System Zeilenumbruch voreingestellt, welcher abhängig von Ihrem Betriebssystem unterschiedlich ist. Wenn Sie CSV Dateien von einem anderen System verwenden, müssen Sie den richtigen Zeilenumbruch mit dem Parameter --csv-record-del einstellen:

  • Windows: \r\n
  • diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/usage.html b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/usage.html index ae8815e..7789d3c 100644 --- a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/usage.html +++ b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/docs/usage.html @@ -409,7 +409,7 @@ $ jasperstarter -f view -t mysql myreport.jasper -H localhost -u myuser -n mydb<
    $ jasperstarter pr myreport.jrprint -f view

Reports with a CSV datasource

-

The CSV file charset defaults to UTF-8. Other common used charsets are cp1252 (Windows), ISO-8859-1 or ISO-8859-15 (Linux). You can specify the csv file charset with the --csv-charset parameter.

+

The CSV file charset defaults to UTF-8. Other common used charsets are cp1252 (Windows), or 5 (Linux). You can specify the csv file charset with the --csv-charset parameter.

Records are usually delimited by a newline but this is not a must. The record delimiter defaults to the system line separator which is different depending on your operating system. If you use CSV files from other systems you must provide the correct line ending with the --csv-record-del parameter:

  • Windows: \r\n
  • diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/jdbc/postgresql-9.4-1203.jdbc4.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/jdbc/postgresql-9.4-1203.jdbc4.jar new file mode 100644 index 0000000..d58b628 Binary files /dev/null and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/jdbc/postgresql-9.4-1203.jdbc4.jar differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/argparse4j-0.4.3.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/argparse4j-0.4.3.jar old mode 100755 new mode 100644 index 73fc574..73fc574 Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/argparse4j-0.4.3.jar and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/argparse4j-0.4.3.jar differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/itext-4.2.1.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/itext-4.2.1.jar old mode 100755 new mode 100644 index 818d692..818d692 Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/itext-4.2.1.jar and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/itext-4.2.1.jar differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/jcalendar-1.4.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/jcalendar-1.4.jar old mode 100755 new mode 100644 index 617a335..617a335 Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/jcalendar-1.4.jar and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/jcalendar-1.4.jar differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-analyzers-common-4.5.1.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-analyzers-common-4.5.1.jar old mode 100755 new mode 100644 index b44fae3..b44fae3 Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-analyzers-common-4.5.1.jar and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-analyzers-common-4.5.1.jar differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-core-4.5.1.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-core-4.5.1.jar old mode 100755 new mode 100644 index b452cdd..b452cdd Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-core-4.5.1.jar and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-core-4.5.1.jar differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-queries-4.5.1.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-queries-4.5.1.jar old mode 100755 new mode 100644 index c230f02..c230f02 Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-queries-4.5.1.jar and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-queries-4.5.1.jar differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-queryparser-4.5.1.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-queryparser-4.5.1.jar old mode 100755 new mode 100644 index 6d53d47..6d53d47 Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-queryparser-4.5.1.jar and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-queryparser-4.5.1.jar differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-sandbox-4.5.1.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-sandbox-4.5.1.jar old mode 100755 new mode 100644 index 7301af2..7301af2 Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-sandbox-4.5.1.jar and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-sandbox-4.5.1.jar differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/olap4j-0.9.7.309-JS-3.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/olap4j-0.9.7.309-JS-3.jar old mode 100755 new mode 100644 index 66b5f4d..66b5f4d Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/olap4j-0.9.7.309-JS-3.jar and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/olap4j-0.9.7.309-JS-3.jar differ diff --git a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/poi-3.10-FINAL.jar b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/poi-3.10-FINAL.jar old mode 100755 new mode 100644 index 8862e21..8862e21 Binary files a/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/poi-3.10-FINAL.jar and b/ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/poi-3.10-FINAL.jar differ diff --git a/phinx.yml b/phinx.yml index b21c3ac..9b983a5 100644 --- a/phinx.yml +++ b/phinx.yml @@ -10,5 +10,5 @@ environments: name: ieducar user: postgres pass: postgres - port: 5432 + port: 5430 charset: utf8 -- libgit2 0.21.2