Commit 8198c6125273d47824bfb04a153ffac0410ac80c

Authored by Nei Jobson da Costa Carneiro
1 parent 80e690c0

Atualizações de códigos da versão BETA corrigidos.

sei/web/modulos/peticionamento/PeticionamentoIntegracao.php
... ... @@ -245,7 +245,22 @@ class PeticionamentoIntegracao extends SeiIntegracao {
245 245 return false;
246 246 }
247 247  
248   - public function processarControladorExterno($strAcao){
  248 + public function processarControladorAjaxExterno($strAcaoAjax)
  249 + {
  250 + $xml = null;
  251 + switch ($strAcaoAjax){
  252 + case 'md_pet_intercorrente_usu_ext_remover_upload_arquivo':
  253 + $xml = MdPetIntercorrenteProcessoRN::removerArquivoIntecorrenteTemp($_POST['hdnTbDocumento']);
  254 + break;
  255 + case 'md_pet_usu_ext_remover_upload_arquivo':
  256 + $xml = MdPetIntercorrenteProcessoRN::removerArquivoTemp($_POST['hdnTbDocumento']);
  257 + break;
  258 + }
  259 +
  260 + return $xml;
  261 + }
  262 +
  263 + public function processarControladorExterno($strAcao){
249 264  
250 265 switch($strAcao) {
251 266  
... ...
sei/web/modulos/peticionamento/int/MdPetExtensoesArquivoINT.php
... ... @@ -37,10 +37,11 @@ public static function montarSelectExtensoes($strPrimeiroItemValor, $strPrimeiro
37 37 $tamanho = count($arrObjMdPetExtensoesArquivoDTO);
38 38 $arrExtPerm = "";
39 39 for($i=0;$i<$tamanho;$i++){
  40 + $nomeExtensao = strtolower($arrObjMdPetExtensoesArquivoDTO[$i]->get('Extensao'));
40 41 if($i<$tamanho-1){
41   - $arrExtPerm .= "'".$arrObjMdPetExtensoesArquivoDTO[$i]->get('Extensao')."'".",";
  42 + $arrExtPerm .= "'".$nomeExtensao."'".",";
42 43 }else{
43   - $arrExtPerm .= "'".$arrObjMdPetExtensoesArquivoDTO[$i]->get('Extensao')."'";
  44 + $arrExtPerm .= "'".$nomeExtensao."'";
44 45 }
45 46 }
46 47 return $arrExtPerm;
... ...
sei/web/modulos/peticionamento/md_pet_intercorrente_usu_ext_cadastro_js.php
... ... @@ -5,6 +5,7 @@
5 5  
6 6 $strUrlAjaxNumeroProcesso = SessaoSEIExterna::getInstance()->assinarLink('controlador_externo.php?acao=md_pet_processo_validar_numero');
7 7 $strUrlSubmit = SessaoSEIExterna::getInstance()->assinarLink('controlador_externo.php?acao=md_pet_intercorrente_usu_ext_cadastrar');
  8 + $strUrlMdPetUsuExtRemoverUploadArquivo = SessaoSEIExterna::getInstance()->assinarLink('controlador_ajax_externo.php?acao_ajax=md_pet_intercorrente_usu_ext_remover_upload_arquivo');
8 9 ?>
9 10  
10 11 <script type="text/javascript">
... ... @@ -452,8 +453,22 @@
452 453 function iniciarTabelaDinamicaDocumento() {
453 454 objTabelaDinamicaDocumento = new infraTabelaDinamica('tbDocumento', 'hdnTbDocumento', false, true);
454 455 objTabelaDinamicaDocumento.gerarEfeitoTabela = true;
455   - objTabelaDinamicaDocumento.remover = function () {
456   - verificarTabelaVazia(2);
  456 + objTabelaDinamicaDocumento.remover = function (arrLinha) {
  457 + //remove o arquivo da pasta temp
  458 + $.ajax({
  459 + url: '<?=$strUrlMdPetUsuExtRemoverUploadArquivo?>',
  460 + type: 'POST',
  461 + async: false,
  462 + dataType: 'XML',
  463 + data: {hdnTbDocumento:arrLinha},
  464 + success: function (r) {
  465 + verificarTabelaVazia(2);
  466 + },
  467 + error: function (e) {
  468 + console.error('Erro ao processar o XML do SEI: ' + e.responseText);
  469 + }
  470 + });
  471 +
457 472 return true;
458 473 };
459 474 }
... ... @@ -462,7 +477,7 @@
462 477 function validarArquivo(input) {
463 478 if (input.value != '') {
464 479 var tamanhoArquivo = input.files[0].size;
465   - var ext = input.files[0].name.split('.').pop();
  480 + var ext = input.files[0].name.split('.').pop().toLowerCase();
466 481  
467 482 var tamanhoConfigurado = parseInt(TAMANHO_MAXIMO) > 0;
468 483 if (!tamanhoConfigurado) {
... ... @@ -695,6 +710,20 @@
695 710 }
696 711  
697 712 if (remover) {
  713 + //remove os arquivos da pasta temp
  714 + $.ajax({
  715 + url: '<?=$strUrlMdPetUsuExtRemoverUploadArquivo?>',
  716 + type: 'POST',
  717 + async: false,
  718 + dataType: 'XML',
  719 + data: {hdnTbDocumento:objTabelaDinamicaDocumento.hdn.value},
  720 + success: function (r) {
  721 + verificarTabelaVazia(2);
  722 + },
  723 + error: function (e) {
  724 + console.error('Erro ao processar o XML do SEI: ' + e.responseText);
  725 + }
  726 + });
698 727 location.href=location.href;
699 728 }
700 729 return false;
... ... @@ -754,7 +783,7 @@
754 783  
755 784 objUploadArquivo.validar = function () {
756 785 var fileArquivo = document.getElementById('fileArquivo');
757   - var ext = fileArquivo.value.split('.').pop();
  786 + var ext = fileArquivo.value.split('.').pop().toLowerCase();
758 787 var extensaoConfigurada = arrExtensoesPermitidas.length > 0;
759 788 var tamanhoConfigurado = parseInt(TAMANHO_MAXIMO) > 0;
760 789 if (!tamanhoConfigurado) {
... ...
sei/web/modulos/peticionamento/md_pet_usu_ext_cadastro_js.php
... ... @@ -26,6 +26,9 @@ $strLinkUploadDocEssencial = SessaoSEIExterna::getInstance()-&gt;assinarLink(&#39;contr
26 26 //Acao para upload de documento complementar
27 27 $strLinkUploadDocComplementar = SessaoSEIExterna::getInstance()->assinarLink('controlador_externo.php?acao=md_pet_usu_ext_upload_doc_complementar');
28 28  
  29 +//Acao para apagar o arquivo temp
  30 +$strUrlMdPetUsuExtRemoverUploadArquivo = SessaoSEIExterna::getInstance()->assinarLink('controlador_ajax_externo.php?acao_ajax=md_pet_usu_ext_remover_upload_arquivo');
  31 +
29 32 //==================================================================
30 33 //saber se o documento principal é externo ou gerado
31 34 //==================================================================
... ... @@ -1392,7 +1395,7 @@ function carregarCamposDocPrincipalUpload(){
1392 1395  
1393 1396 //INICIO VALIDACAO EXTENSOES
1394 1397 var arrExtensoesPermitidas = [<?=$strSelExtensoesPrin?>];
1395   - if ( $("#fileArquivoPrincipal").val().replace(/^.*\./, '')!='' && $.inArray( $("#fileArquivoPrincipal").val().replace(/^.*\./, '') , arrExtensoesPermitidas ) == -1 ) {
  1398 + if ( $("#fileArquivoPrincipal").val().replace(/^.*\./, '')!='' && $.inArray( $("#fileArquivoPrincipal").val().replace(/^.*\./, '').toLowerCase() , arrExtensoesPermitidas ) == -1 ) {
1396 1399 alert("O arquivo selecionado não é permitido.\nSomente são permitidos arquivos com as extensões:\n<?=preg_replace("%'%"," ",$strSelExtensoesPrin)?> .");
1397 1400 return false;
1398 1401 }
... ... @@ -1426,6 +1429,24 @@ function carregarCamposDocPrincipalUpload(){
1426 1429 //Monta tabela de anexos
1427 1430 objTabelaDocPrincipal = new infraTabelaDinamica('tbDocumentoPrincipal','hdnDocPrincipal',false,false);
1428 1431 objTabelaDocPrincipal.gerarEfeitoTabela=true;
  1432 +
  1433 + objTabelaDocPrincipal.remover = function (arrLinha) {
  1434 + //remove o arquivo da pasta temp
  1435 + $.ajax({
  1436 + url: '<?=$strUrlMdPetUsuExtRemoverUploadArquivo?>',
  1437 + type: 'POST',
  1438 + async: false,
  1439 + dataType: 'XML',
  1440 + data: {hdnTbDocumento:arrLinha},
  1441 + success: function (r) {
  1442 + },
  1443 + error: function (e) {
  1444 + console.error('Erro ao processar o XML do SEI: ' + e.responseText);
  1445 + }
  1446 + });
  1447 +
  1448 + return true;
  1449 + };
1429 1450  
1430 1451 } catch(err){
1431 1452 alert(' ERRO ' + err);
... ... @@ -1543,7 +1564,7 @@ function carregarCamposDocEssencialUpload(){
1543 1564  
1544 1565 //INICIO VALIDACAO EXTENSOES
1545 1566 var arrExtensoesPermitidas = [<?=$strSelExtensoesComp?>];
1546   - if ( $("#fileArquivoEssencial").val().replace(/^.*\./, '')!='' && $.inArray( $("#fileArquivoEssencial").val().replace(/^.*\./, '') , arrExtensoesPermitidas ) == -1 ) {
  1567 + if ( $("#fileArquivoEssencial").val().replace(/^.*\./, '')!='' && $.inArray( $("#fileArquivoEssencial").val().replace(/^.*\./, '').toLowerCase() , arrExtensoesPermitidas ) == -1 ) {
1547 1568 alert("O arquivo selecionado não é permitido.\nSomente são permitidos arquivos com as extensões:\n<?=preg_replace("%'%"," ",$strSelExtensoesComp)?> .");
1548 1569 return false;
1549 1570 }
... ... @@ -1575,6 +1596,24 @@ function carregarCamposDocEssencialUpload(){
1575 1596 //Monta tabela de anexos
1576 1597 objTabelaDocEssencial = new infraTabelaDinamica('tbDocumentoEssencial','hdnDocEssencial',false,false);
1577 1598 objTabelaDocEssencial.gerarEfeitoTabela=true;
  1599 +
  1600 + objTabelaDocEssencial.remover = function (arrLinha) {
  1601 + //remove o arquivo da pasta temp
  1602 + $.ajax({
  1603 + url: '<?=$strUrlMdPetUsuExtRemoverUploadArquivo?>',
  1604 + type: 'POST',
  1605 + async: false,
  1606 + dataType: 'XML',
  1607 + data: {hdnTbDocumento:arrLinha},
  1608 + success: function (r) {
  1609 + },
  1610 + error: function (e) {
  1611 + console.error('Erro ao processar o XML do SEI: ' + e.responseText);
  1612 + }
  1613 + });
  1614 +
  1615 + return true;
  1616 + };
1578 1617  
1579 1618 }
1580 1619  
... ... @@ -1680,7 +1719,7 @@ function carregarCamposDocComplementarUpload(){
1680 1719  
1681 1720 //INICIO VALIDACAO EXTENSOES
1682 1721 var arrExtensoesPermitidas = [<?=$strSelExtensoesComp?>];
1683   - if ( $("#fileArquivoComplementar").val().replace(/^.*\./, '')!='' && $.inArray( $("#fileArquivoComplementar").val().replace(/^.*\./, '') , arrExtensoesPermitidas ) == -1 ) {
  1722 + if ( $("#fileArquivoComplementar").val().replace(/^.*\./, '')!='' && $.inArray( $("#fileArquivoComplementar").val().replace(/^.*\./, '').toLowerCase() , arrExtensoesPermitidas ) == -1 ) {
1684 1723 alert("O arquivo selecionado não é permitido.\nSomente são permitidos arquivos com as extensões:\n<?=preg_replace("%'%"," ",$strSelExtensoesComp)?> .");
1685 1724 return false;
1686 1725 }
... ... @@ -1712,6 +1751,24 @@ function carregarCamposDocComplementarUpload(){
1712 1751 //Monta tabela de anexos
1713 1752 objTabelaDocComplementar = new infraTabelaDinamica('tbDocumentoComplementar','hdnDocComplementar',false,false);
1714 1753 objTabelaDocComplementar.gerarEfeitoTabela=true;
  1754 +
  1755 + objTabelaDocComplementar.remover = function (arrLinha) {
  1756 + //remove o arquivo da pasta temp
  1757 + $.ajax({
  1758 + url: '<?=$strUrlMdPetUsuExtRemoverUploadArquivo?>',
  1759 + type: 'POST',
  1760 + async: false,
  1761 + dataType: 'XML',
  1762 + data: {hdnTbDocumento:arrLinha},
  1763 + success: function (r) {
  1764 + },
  1765 + error: function (e) {
  1766 + console.error('Erro ao processar o XML do SEI: ' + e.responseText);
  1767 + }
  1768 + });
  1769 +
  1770 + return true;
  1771 + };
1715 1772  
1716 1773 }
1717 1774  
... ...
sei/web/modulos/peticionamento/rn/MdPetAtualizadorRN.php
... ... @@ -765,7 +765,7 @@ ATENÇÃO: As informações contidas neste e-mail, incluindo seus anexos, podem ser
765 765 $objMdPetTamanhoArquivoDTO->retTodos();
766 766 $objMdPetTamanhoArquivoDTO->setNumValorDocPrincipal('5');
767 767 $objMdPetTamanhoArquivoDTO->setNumValorDocComplementar('10');
768   - $objMdPetTamanhoArquivoDTO->setNumIdTamanhoArquivo(MdPetTamanhoArquivo::$ID_FIXO_TAMANHO_ARQUIVO);
  768 + $objMdPetTamanhoArquivoDTO->setNumIdTamanhoArquivo(MdPetTamanhoArquivoRN::$ID_FIXO_TAMANHO_ARQUIVO);
769 769 $objMdPetTamanhoArquivoDTO->setStrSinAtivo('S');
770 770 $objMdPetTamanhoArquivoRN->cadastrar($objMdPetTamanhoArquivoDTO);
771 771  
... ...
sei/web/modulos/peticionamento/rn/MdPetIntercorrenteProcessoRN.php
... ... @@ -191,7 +191,29 @@ class MdPetIntercorrenteProcessoRN extends MdPetProcessoRN {
191 191 $arrProcedimentoRelacionado = array($objProcedimentoDTO->getDblIdProcedimento());
192 192  
193 193 $objProcedimentoAPI = new ProcedimentoAPI();
194   - $objProcedimentoAPI->setIdTipoProcedimento($objCriterioIntercorrenteDTO->getNumIdTipoProcedimento());
  194 +
  195 + //Tipo Procedimento
  196 + $objTipoProcedimentoDTO = new TipoProcedimentoDTO();
  197 + $objTipoProcedimentoDTO->setBolExclusaoLogica(false);
  198 + $objTipoProcedimentoDTO->setDistinct(true);
  199 + $objTipoProcedimentoDTO->retStrSinAtivo();
  200 + $objTipoProcedimentoDTO->setNumIdTipoProcedimento($objProcedimentoDTO->getNumIdTipoProcedimento());
  201 +
  202 + $objTipoProcedimentoRN = new TipoProcedimentoRN();
  203 + $arrObjTipoProcedimentoDTO = $objTipoProcedimentoRN->listarRN0244($objTipoProcedimentoDTO);
  204 +
  205 + if (count($arrObjTipoProcedimentoDTO)==1) {
  206 + $objTipoProcedimentoDTO = $arrObjTipoProcedimentoDTO[0];
  207 + if ($objTipoProcedimentoDTO->getStrSinAtivo()=='S'){
  208 + $objProcedimentoAPI->setIdTipoProcedimento($objProcedimentoDTO->getNumIdTipoProcedimento());
  209 + }else{
  210 + $objProcedimentoAPI->setIdTipoProcedimento($objCriterioIntercorrenteDTO->getNumIdTipoProcedimento());
  211 + }
  212 + }else{
  213 + $objProcedimentoAPI->setIdTipoProcedimento($objCriterioIntercorrenteDTO->getNumIdTipoProcedimento());
  214 + }
  215 + // Tipo Procedimento - fim
  216 +
195 217 if ($especificacao!=null){
196 218 $objProcedimentoAPI->setEspecificacao( $especificacao );
197 219 }
... ... @@ -1077,5 +1099,74 @@ class MdPetIntercorrenteProcessoRN extends MdPetProcessoRN {
1077 1099 return $contatoDTO;
1078 1100 }
1079 1101  
  1102 + /** $arquivos_enviados[0] recebe idLinha
  1103 + * $arquivos_enviados[1] recebe idTipoDocumento
  1104 + * $arquivos_enviados[2] recebe complementoTipoDocumento
  1105 + * $arquivos_enviados[3] recebe idNivelAcesso
  1106 + * $arquivos_enviados[4] recebe idHipoteseLegal
  1107 + * $arquivos_enviados[5] recebe idFormato
  1108 + * $arquivos_enviados[6] recebe idTipoConferencia
  1109 + * $arquivos_enviados[7] recebe nomeArquivoHash
  1110 + * $arquivos_enviados[8] recebe tamanhoArquivo
  1111 + * $arquivos_enviados[9] recebe nomeArquivo
  1112 + * $arquivos_enviados[10] recebe dataHora
  1113 + * $arquivos_enviados[11] recebe tamanhoArquivoFormatado
  1114 + * $arquivos_enviados[12] recebe documento
  1115 + * $arquivos_enviados[13] recebe nivelAcesso
  1116 + * $arquivos_enviados[14] recebe formato
  1117 + */
  1118 + public static function removerArquivoIntecorrenteTemp($arquivos_enviado){
  1119 + //se for varios mandado pelo hdn
  1120 + if(is_string($arquivos_enviado)){
  1121 + $arquivos_enviados = PaginaSEIExterna::getInstance()->getArrItensTabelaDinamica($arquivos_enviado);
  1122 +
  1123 + $xml = null;
  1124 + foreach ($arquivos_enviados as $arquivo_enviado) {
  1125 + $arquivo = DIR_SEI_TEMP.'/'.$arquivo_enviado[7];
  1126 + if(file_exists($arquivo)){
  1127 + unlink($arquivo);
  1128 + $xml = "<success>true</success>";
  1129 + }
  1130 + }
  1131 + }else{
  1132 + $arquivo = DIR_SEI_TEMP.'/'.$arquivos_enviado[7];
  1133 + if(file_exists($arquivo)){
  1134 + unlink($arquivo);
  1135 + $xml = "<success>true</success>";
  1136 + }
  1137 + }
  1138 +
  1139 + if($xml)
  1140 + return $xml;
  1141 +
  1142 + return "<success>false</success>";
  1143 + }
  1144 +
  1145 +
  1146 + /**
  1147 + * $arquivos_enviados[0] recebe nome,
  1148 + * $arquivos_enviados[1] recebe dataHora,
  1149 + * $arquivos_enviados[2] recebe tamanhoFormatado,
  1150 + * $arquivos_enviados[3] recebe documento,
  1151 + * $arquivos_enviados[4] recebe nivelAcesso,
  1152 + * $arquivos_enviados[5] recebe hipoteseLegal,
  1153 + * $arquivos_enviados[6] recebe formatoDocumento,
  1154 + * $arquivos_enviados[7] recebe tipoConferencia,
  1155 + * $arquivos_enviados[8] recebe nomeUpload,
  1156 + * $arquivos_enviados[9] recebe idTpoPrincipal,
  1157 + * $arquivos_enviados[10] recebe strComplemento,
  1158 + * $arquivos_enviados[11] recebe formatoDocumentoLbl,
  1159 + * $arquivos_enviados[12] recebe ''
  1160 + */
  1161 + public static function removerArquivoTemp($arquivos_enviado){
  1162 + $arquivo = DIR_SEI_TEMP.'/'.$arquivos_enviado[8];
  1163 + if(file_exists($arquivo)){
  1164 + unlink($arquivo);
  1165 + return "<success>true</success>";
  1166 + }
  1167 +
  1168 + return "<success>false</success>";
  1169 + }
  1170 +
1080 1171 }
1081 1172 ?>
1082 1173 \ No newline at end of file
... ...