Commit 3a9bebc71e959b14e3a720b850d5c35eb609ee83

Authored by Caroline Salib
1 parent dba3e6a0
Exists in master

Ajustes na biblioteca de relatórios;

* Ajustado arquivo dockerfile;
* Ajustado relatório ficha de aluno;
Refs #193
Showing 23 changed files with 58 additions and 33 deletions   Show diff stats
Dockerfile
... ... @@ -27,7 +27,9 @@ RUN apt-get install -y software-properties-common python-software-properties \
27 27 && apt-get -y update \
28 28 && apt-get -y install openjdk-7-jdk
29 29  
30   -CMD chmod 777 /home/portabilis/ieducar/modules/Reports/ReportSources/Portabilis/
  30 +CMD update-alternatives --config java
  31 +
  32 +CMD chmod 777 /home/portabilis/ieducar/modules/Reports/ReportSources/
31 33  
32 34 CMD /usr/sbin/apache2ctl -D FOREGROUND
33 35  
... ...
ieducar/configuration/ieducar.ini
... ... @@ -54,7 +54,7 @@
54 54 ; Configurações de banco de dados
55 55 app.database.dbname = ieducar
56 56 app.database.username = postgres
57   -app.database.hostname = localhost
  57 +app.database.hostname = postgres95
58 58 app.database.password = postgres
59 59 app.database.port = 5432
60 60  
... ...
ieducar/lib/Portabilis/Controller/ReportCoreController.php
1 1 <?php
2 2  
3   -error_reporting(E_ALL);
4   -ini_set("display_errors", 1);
  3 +#error_reporting(E_ALL);
  4 +#ini_set("display_errors", 1);
5 5  
6 6 /**
7 7 * i-Educar - Sistema de gestão escolar
... ... @@ -70,6 +70,8 @@ class Portabilis_Controller_ReportCoreController extends Core_Controller_Page_Ed
70 70 $this->acao_executa_submit = false;
71 71 $this->acao_enviar = 'printReport()';
72 72  
  73 + header('Content-Type: text/html; charset=utf-8');
  74 +
73 75 parent::__construct();
74 76 }
75 77  
... ... @@ -83,6 +85,11 @@ class Portabilis_Controller_ReportCoreController extends Core_Controller_Page_Ed
83 85 $this->report = $this->report();
84 86  
85 87 $this->beforeValidation();
  88 +
  89 + $this->report->addArg('SUBREPORT_DIR', "modules/Reports/ReportSources/");
  90 +
  91 + $this->report->addArg('database', $GLOBALS['coreExt']['Config']->app->database->dbname);
  92 +
86 93 $this->validatesPresenseOfRequiredArgsInReport();
87 94 $this->aftervalidation();
88 95  
... ... @@ -96,7 +103,7 @@ class Portabilis_Controller_ReportCoreController extends Core_Controller_Page_Ed
96 103  
97 104  
98 105 function headers($result) {
99   - header('Content-type: application/pdf');
  106 + header('Content-type: application/pdf; charset=utf-8');
100 107 header('Content-Length: ' . strlen($result));
101 108 header('Content-Disposition: inline; filename=report.pdf');
102 109 }
... ... @@ -172,14 +179,14 @@ class Portabilis_Controller_ReportCoreController extends Core_Controller_Page_Ed
172 179  
173 180  
174 181 function onValidationError() {
175   - $msg = Portabilis_String_Utils::toLatin1('O relatório não pode ser emitido, dica(s):\n\n');
  182 + $msg = Portabilis_String_Utils::toLatin1('O relatório não pode ser emitido, dica(s):').'\n\n';
176 183  
177 184 foreach ($this->validationErrors as $e) {
178   - $error = Portabilis_String_Utils::escape($e['message']);
  185 + $error = $e['message'];
179 186 $msg .= '- ' . $error . '\n';
180 187 }
181 188  
182   - $msg .= '\nPor favor, verifique esta(s) situação(s) e tente novamente.';
  189 + $msg .= '\n'.Portabilis_String_Utils::toLatin1('Por favor, verifique esta(s) situação(s) e tente novamente.');
183 190  
184 191 $msg = Portabilis_String_Utils::toLatin1($msg, array('escape' => false));
185 192 echo "<script type='text/javascript'>alert('$msg'); close();</script> ";
... ...
ieducar/lib/Portabilis/Report/ReportFactoryPHPJasper.php
... ... @@ -31,7 +31,6 @@
31 31  
32 32 require_once 'lib/Portabilis/Report/ReportFactory.php';
33 33 require_once 'vendor/autoload.php';
34   -
35 34 use JasperPHP\JasperPHP;
36 35  
37 36 /**
... ... @@ -55,7 +54,7 @@ class Portabilis_Report_ReportFactoryPHPJasper extends Portabilis_Report_ReportF
55 54  
56 55 function getReportsPath() {
57 56 $rootPath = dirname(dirname(dirname(dirname(__FILE__))));
58   - $reportsPath = $rootPath . "/modules/Reports/ReportSources/Portabilis/";
  57 + $reportsPath = $rootPath . "/modules/Reports/ReportSources/";
59 58  
60 59 return $reportsPath;
61 60 }
... ... @@ -131,4 +130,4 @@ class Portabilis_Report_ReportFactoryPHPJasper extends Portabilis_Report_ReportF
131 130 function destroyPDF($file){
132 131 unlink($file);
133 132 }
134   -}
135 133 \ No newline at end of file
  134 +}
... ...
ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jasper 0 → 100755
No preview for this file type
ieducar/modules/Reports/ReportSources/portabilis_ficha_aluno.jrxml
... ... @@ -14,6 +14,9 @@
14 14 </parameter>
15 15 <parameter name="logo" class="java.lang.String"/>
16 16 <parameter name="foto" class="java.lang.String"/>
  17 + <parameter name="database" class="java.lang.String"/>
  18 + <parameter name="SUBREPORT_DIR" class="java.lang.String"/>
  19 + <parameter name="data_emissao" class="java.lang.String"/>
17 20 <queryString>
18 21 <![CDATA[SELECT public.fcn_upper(nm_instituicao) AS nome_instituicao,
19 22 public.fcn_upper(nm_responsavel) AS nome_secretaria,
... ...
ieducar/vendor/cossou/jasperphp/src/JasperPHP/JasperPHP.php
... ... @@ -31,7 +31,7 @@ class JasperPHP
31 31 throw new \Exception("No input file", 1);
32 32  
33 33 $command = __DIR__ . $this->executable;
34   -
  34 +
35 35 $command .= " cp ";
36 36  
37 37 $command .= $input_file;
... ... @@ -46,14 +46,14 @@ class JasperPHP
46 46 return $this;
47 47 }
48 48  
49   - public function process($input_file, $output_file = false, $format = array("pdf"), $parameters = array(), $db_connection = array(), $background = true, $redirect_output = true)
  49 + public function process($input_file, $output_file = false, $format = array("pdf"), $parameters = array(), $db_connection = array(), $background = true, $redirect_output = true, $filter_params = true)
50 50 {
51 51 if(is_null($input_file) || empty($input_file))
52 52 throw new \Exception("No input file", 1);
53 53  
54 54 if( is_array($format) )
55 55 {
56   - foreach ($format as $key)
  56 + foreach ($format as $key)
57 57 {
58 58 if( !in_array($key, $this->formats))
59 59 throw new \Exception("Invalid format!", 1);
... ... @@ -61,10 +61,20 @@ class JasperPHP
61 61 } else {
62 62 if( !in_array($format, $this->formats))
63 63 throw new \Exception("Invalid format!", 1);
64   - }
65   -
66   - $command = __DIR__ . $this->executable;
67   -
  64 + }
  65 +
  66 + $params_command = $command = __DIR__ . $this->executable;
  67 +
  68 + $params_command .= " params " . $input_file . " 2>&1 ";
  69 +
  70 + if($filter_params){
  71 + exec($params_command, $params_output);
  72 + foreach ($params_output as $key => &$param) {
  73 + $exploded = explode(" ", $param);
  74 + $param = $exploded[1];
  75 + }
  76 + }
  77 +
68 78 $command .= " pr ";
69 79  
70 80 $command .= $input_file;
... ... @@ -83,29 +93,33 @@ class JasperPHP
83 93 if( count($parameters) > 0 )
84 94 {
85 95 $command .= " -P";
86   - foreach ($parameters as $key => $value)
  96 + foreach ($parameters as $key => $value)
87 97 {
88   - $command .= " " . $key . "=" . $value;
  98 + if(!$filter_params || in_array($key, $params_output))
  99 + $command .= " " . $key . "=\"" . $value."\"";
89 100 }
90   - }
  101 + }
91 102  
92 103 if( count($db_connection) > 0 )
93 104 {
94 105 $command .= " -t " . $db_connection['driver'];
95 106 $command .= " -u " . $db_connection['username'];
96   -
  107 +
97 108 if( isset($db_connection['password']) && !empty($db_connection['password']) )
98 109 $command .= " -p " . $db_connection['password'];
99 110  
100 111 if( isset($db_connection['host']) && !empty($db_connection['host']) )
101 112 $command .= " -H " . $db_connection['host'];
102   -
  113 +
103 114 if( isset($db_connection['database']) && !empty($db_connection['database']) )
104 115 $command .= " -n " . $db_connection['database'];
105   -
  116 +
  117 + if( isset($db_connection['port']) && !empty($db_connection['port']) )
  118 + $command .= " --db-port " . $db_connection['port'];
  119 +
106 120 if( isset($db_connection['jdbc_driver']) && !empty($db_connection['jdbc_driver']) )
107 121 $command .= " --db-driver " . $db_connection['jdbc_driver'];
108   -
  122 +
109 123 if( isset($db_connection['jdbc_url']) && !empty($db_connection['jdbc_url']) )
110 124 $command .= " --db-url " . $db_connection['jdbc_url'];
111 125 }
... ... @@ -125,8 +139,8 @@ class JasperPHP
125 139 public function execute($run_as_user = false)
126 140 {
127 141 if( $this->redirect_output && !$this->windows)
128   - $this->the_command .= " > /dev/null 2>&1";
129   -
  142 + $this->the_command .= " 2>&1";
  143 +
130 144 if( $this->background && !$this->windows )
131 145 $this->the_command .= " &";
132 146  
... ... @@ -138,8 +152,8 @@ class JasperPHP
138 152  
139 153 exec($this->the_command, $output, $return_var);
140 154  
141   - if($return_var != 0)
142   - throw new \Exception("There was and error executing the report! Time to check the logs!", 1);
  155 + if($return_var != 0)
  156 + throw new \Exception("Erro ao executar o relatorio! Detalhes: " . join($output, " "), 1);
143 157  
144 158 return $output;
145 159 }
... ...
ieducar/vendor/cossou/jasperphp/src/JasperStarter/bin/jasperstarter.exe 100755 → 100644
No preview for this file type
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&lt;
407 407 <pre>$ jasperstarter pr myreport.jrprint -f view</pre></div></div>
408 408 <div class="section">
409 409 <h4>Reporty se zdrojem dat ve form&#xe1;tu CSV<a name="Reporty_se_zdrojem_dat_ve_formtu_CSV"></a></h4>
410   -<p>Znakov&#xe1; sada soubor&#x16f; CSV je defaultn&#x11b; UTF-8. Dal&#x161;&#xed; &#x10d;asto pou&#x17e;&#xed;van&#xe9; znakov&#xe9; sady jsou cp1252 (Windows), ISO-8859-1 or ISO-8859-15 (Linux). Znakovou sadu CSV souboru lze specifikovat parametrem <b>--csv-charset</b>.</p>
  410 +<p>Znakov&#xe1; sada soubor&#x16f; CSV je defaultn&#x11b; UTF-8. Dal&#x161;&#xed; &#x10d;asto pou&#x17e;&#xed;van&#xe9; znakov&#xe9; sady jsou cp1252 (Windows), or 5 (Linux). Znakovou sadu CSV souboru lze specifikovat parametrem <b>--csv-charset</b>.</p>
411 411 <p>Jednotliv&#xe9; &#xfa;daje jsou obvykle odd&#x11b;leny nov&#xfd;m &#x159;&#xe1;dkem, nemus&#xed; tak tomu ale b&#xfd;t. separ&#xe1;tor je z&#xe1;visl&#xfd; na defaultn&#xed;m separ&#xe1;toru cel&#xe9;ho syst&#xe9;mu a ten se v ka&#x17e;d&#xe9;m opera&#x10d;n&#xed;m syst&#xe9;mu li&#x161;&#xed;. Pokud pou&#x17e;&#xed;v&#xe1;te CSV soubory z jin&#xe9;ho syst&#xe9;mu, mus&#xed;te tedy zadat spr&#xe1;vn&#xfd; separ&#xe1;tor pomoc&#xed; parametru <b>--csv-record-del</b>:</p>
412 412 <ul>
413 413 <li>Windows: <b>\r\n</b></li>
... ...
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&lt;
408 408 <pre>$ jasperstarter pr myreport.jrprint -f view</pre></div></div>
409 409 <div class="section">
410 410 <h4>Reports mit einer CSV Datenquelle<a name="Reports_mit_einer_CSV_Datenquelle"></a></h4>
411   -<p>Der CSV Datei Zeichensatz ist auf UTF-8 voreingestellt. Andere &#xfc;bliche Zeichens&#xe4;tze sind cp1252 (Windows), ISO-8859-1 oder ISO-8859-15 (Linux). Sie k&#xf6;nnen den CSV Zeichensatz mit dem Parameter <b>--csv-charset</b> angeben.</p>
  411 +<p>Der CSV Datei Zeichensatz ist auf UTF-8 voreingestellt. Andere &#xfc;bliche Zeichens&#xe4;tze sind cp1252 (Windows), oder 5 (Linux). Sie k&#xf6;nnen den CSV Zeichensatz mit dem Parameter <b>--csv-charset</b> angeben.</p>
412 412 <p>Datens&#xe4;tze werden &#xfc;blicherweise mit einem Zeilenumbruch getrennt, aber dies muss nicht so sein. Das Datensatz-Trennzeichen ist auf den System Zeilenumbruch voreingestellt, welcher abh&#xe4;ngig von Ihrem Betriebssystem unterschiedlich ist. Wenn Sie CSV Dateien von einem anderen System verwenden, m&#xfc;ssen Sie den richtigen Zeilenumbruch mit dem Parameter <b>--csv-record-del</b> einstellen:</p>
413 413 <ul>
414 414 <li>Windows: <b>\r\n</b></li>
... ...
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&lt;
409 409 <pre>$ jasperstarter pr myreport.jrprint -f view</pre></div></div>
410 410 <div class="section">
411 411 <h4>Reports with a CSV datasource<a name="Reports_with_a_CSV_datasource"></a></h4>
412   -<p>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 <b>--csv-charset</b> parameter.</p>
  412 +<p>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 <b>--csv-charset</b> parameter.</p>
413 413 <p>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 <b>--csv-record-del</b> parameter:</p>
414 414 <ul>
415 415 <li>Windows: <b>\r\n</b></li>
... ...
ieducar/vendor/cossou/jasperphp/src/JasperStarter/jdbc/postgresql-9.4-1203.jdbc4.jar 0 → 100644
No preview for this file type
ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/argparse4j-0.4.3.jar 100755 → 100644
No preview for this file type
ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/itext-4.2.1.jar 100755 → 100644
No preview for this file type
ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/jcalendar-1.4.jar 100755 → 100644
No preview for this file type
ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-analyzers-common-4.5.1.jar 100755 → 100644
No preview for this file type
ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-core-4.5.1.jar 100755 → 100644
No preview for this file type
ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-queries-4.5.1.jar 100755 → 100644
No preview for this file type
ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-queryparser-4.5.1.jar 100755 → 100644
No preview for this file type
ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/lucene-sandbox-4.5.1.jar 100755 → 100644
No preview for this file type
ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/olap4j-0.9.7.309-JS-3.jar 100755 → 100644
No preview for this file type
ieducar/vendor/cossou/jasperphp/src/JasperStarter/lib/poi-3.10-FINAL.jar 100755 → 100644
No preview for this file type
phinx.yml
... ... @@ -10,5 +10,5 @@ environments:
10 10 name: ieducar
11 11 user: postgres
12 12 pass: postgres
13   - port: 5432
  13 + port: 5430
14 14 charset: utf8
... ...