From 6a3051f0807a73043b753f0d977de25875b95c18 Mon Sep 17 00:00:00 2001 From: "gabrielg.colab" Date: Wed, 6 Nov 2024 16:31:34 -0300 Subject: [PATCH] =?UTF-8?q?##=20Corre=C3=A7=C3=B5es=20desta=20Vers=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mudança em 3 colunas do contrato de char() para varchar(), atendendo regras do SQLSERVER e ORACLE. Remoção de colunas do contrato que não serão mais necessários após a mudança no uso para API REST dos Correios. ## Evoluções desta Versão Substituição da API dos Correios de SOAP para REST que são as seguintes: Token, Endereço - CEP, PMA - Pré Postagem, Rastro e Meu Contrato. Criação do Mapeamento de Integração, na Administração, para uso das novas API's dos Correios: Aviso Recebimento Cancelar Pré Postagem Consultar CEP Download Rótulo Emitir Rótulo Gerar Token Pré Postagem Nacional Rastrear Objeto Serviços Postais Utilização do layout gerado pela API dos Correios nas impressões de envelopes e AR. Alteração de leitura do AR de QR Code para Código de Barras no Processamento de Retorno do AR. Alterado o termo PLP nos títulos e menus para Pré-Postagem Alterado termo SRO nos títulos e menus para Rastreamento de Objetos. Criado modal, na tela de Expedir Pré-Postagem, para quando imprimir Envelope, antes selecionar o tipo de layout a ser impresso, de acordo com as opções informadas pelo Correio. --- .../sei_atualizar_versao_modulo_correios.php | 222 ++- .../modulos/correios/CorreiosIntegracao.php | 44 +- sei/web/modulos/correios/README.md | 41 +- .../correios/bd/MdCorAdmIntegracaoBD.php | 10 + .../correios/bd/MdCorParametroRastreioBD.php | 18 - .../correios/dto/MdCorAdmIntegracaoDTO.php | 33 + .../modulos/correios/dto/MdCorContratoDTO.php | 28 +- .../correios/dto/MdCorExpedicaoFormatoDTO.php | 4 +- .../dto/MdCorExpedicaoSolicitadaDTO.php | 19 +- .../dto/MdCorParametroRastreioDTO.php | 32 - .../correios/dto/MdCorServicoPostalDTO.php | 6 +- .../correios/int/MdCorAdmIntegracaoINT.php | 64 + .../int/MdCorExpedicaoSolicitadaINT.php | 142 +- .../modulos/correios/int/MdCorMensagemINT.php | 42 + .../modulos/correios/int/MdCorObjetoINT.php | 14 + .../int/MdCorParametroRastreioINT.php | 61 - sei/web/modulos/correios/int/MdCorPlpINT.php | 27 +- .../correios/int/MdCorServicoPostalINT.php | 73 +- .../modulos/correios/lib/zbar/composer.json | 5 + .../modulos/correios/lib/zbar/composer.lock | 133 ++ .../correios/lib/zbar/vendor/autoload.php | 25 + .../lib/zbar/vendor/composer/ClassLoader.php | 579 ++++++ .../vendor/composer/InstalledVersions.php | 359 ++++ .../correios/lib/zbar/vendor/composer/LICENSE | 21 + .../vendor/composer/autoload_classmap.php | 10 + .../vendor/composer/autoload_namespaces.php | 10 + .../zbar/vendor/composer/autoload_psr4.php | 10 + .../zbar/vendor/composer/autoload_real.php | 38 + .../zbar/vendor/composer/autoload_static.php | 47 + .../lib/zbar/vendor/composer/installed.json | 126 ++ .../lib/zbar/vendor/composer/installed.php | 41 + .../zbar/vendor/composer/platform_check.php | 26 + .../vendor/robbiep/zbar-qrdecoder/.gitignore | 7 + .../vendor/robbiep/zbar-qrdecoder/.travis.yml | 11 + .../vendor/robbiep/zbar-qrdecoder/README.md | 85 + .../robbiep/zbar-qrdecoder/composer.json | 26 + .../vendor/robbiep/zbar-qrdecoder/phpunit.xml | 18 + .../ZbarQrdecoder/Facades/ZbarDecoder.php | 16 + .../ZbarQrdecoder/Result/ErrorResult.php | 45 + .../Result/Parser/ParserInterface.php | 9 + .../ZbarQrdecoder/Result/Parser/ParserXML.php | 20 + .../RobbieP/ZbarQrdecoder/Result/Result.php | 85 + .../ZbarQrdecoder/Result/ResultInterface.php | 9 + .../src/RobbieP/ZbarQrdecoder/ZbarDecoder.php | 142 ++ .../ZbarQrdecoderServiceProvider.php | 81 + .../ZbarQrdecoderServiceProviderLaravel4.php | 41 + .../ZbarQrdecoderServiceProviderLaravel5.php | 42 + .../zbar-qrdecoder/src/config/.gitkeep} | 0 .../zbar-qrdecoder/src/config/config.php | 18 + .../robbiep/zbar-qrdecoder/tests/.gitkeep | 0 .../zbar-qrdecoder/tests/ErrorResultTest.php | 21 + .../zbar-qrdecoder/tests/ResultTest.php | 63 + .../zbar-qrdecoder/tests/ZbarDecoderTest.php | 240 +++ .../robbiep/zbar-qrdecoder/tests/stubs/tc.jpg | Bin 0 -> 86974 bytes .../zbar/vendor/symfony/process/.gitignore | 3 + .../zbar/vendor/symfony/process/CHANGELOG.md | 57 + .../process/Exception/ExceptionInterface.php | 21 + .../Exception/InvalidArgumentException.php | 21 + .../process/Exception/LogicException.php | 21 + .../Exception/ProcessFailedException.php | 54 + .../Exception/ProcessTimedOutException.php | 69 + .../process/Exception/RuntimeException.php | 21 + .../symfony/process/ExecutableFinder.php | 88 + .../vendor/symfony/process/InputStream.php | 92 + .../lib/zbar/vendor/symfony/process/LICENSE | 19 + .../symfony/process/PhpExecutableFinder.php | 94 + .../vendor/symfony/process/PhpProcess.php | 76 + .../symfony/process/Pipes/AbstractPipes.php | 182 ++ .../symfony/process/Pipes/PipesInterface.php | 67 + .../symfony/process/Pipes/UnixPipes.php | 153 ++ .../symfony/process/Pipes/WindowsPipes.php | 194 ++ .../zbar/vendor/symfony/process/Process.php | 1746 +++++++++++++++++ .../vendor/symfony/process/ProcessBuilder.php | 280 +++ .../vendor/symfony/process/ProcessUtils.php | 123 ++ .../lib/zbar/vendor/symfony/process/README.md | 13 + .../process/Tests/ErrorProcessInitiator.php | 36 + .../process/Tests/ExecutableFinderTest.php | 175 ++ .../process/Tests/NonStopableProcess.php | 47 + .../process/Tests/PhpExecutableFinderTest.php | 72 + .../symfony/process/Tests/PhpProcessTest.php | 48 + .../PipeStdinInStdoutStdErrStreamSelect.php | 72 + .../process/Tests/ProcessBuilderTest.php | 220 +++ .../Tests/ProcessFailedExceptionTest.php | 133 ++ .../symfony/process/Tests/ProcessTest.php | 1596 +++++++++++++++ .../process/Tests/ProcessUtilsTest.php | 53 + .../symfony/process/Tests/SignalListener.php | 21 + .../zbar/vendor/symfony/process/composer.json | 28 + .../vendor/symfony/process/phpunit.xml.dist | 30 + .../md_cor_adm_integracao_cadastro.php | 242 +++ .../md_cor_adm_integracao_cadastro_js.php | 42 + .../correios/md_cor_adm_integracao_lista.php | 356 ++++ .../correios/md_cor_contrato_cadastro.php | 145 +- .../correios/md_cor_contrato_cadastro_js.php | 141 +- .../correios/md_cor_contrato_lista.php | 12 +- .../correios/md_cor_contrato_lista_js.php | 2 +- .../md_cor_expedicao_solicitada_cadastro.php | 268 ++- ...d_cor_expedicao_solicitada_cadastro_js.php | 49 +- ...licitada_cadastro_validar_destinatario.php | 18 +- .../md_cor_extensao_midia_cadastro.php | 4 +- .../md_cor_extensao_midia_cadastro_js.php | 4 +- .../modulos/correios/md_cor_funcoes_js.php | 33 + .../correios/md_cor_geracao_plp_lista.php | 7 +- .../correios/md_cor_geracao_plp_lista_js.php | 6 +- .../md_cor_parametrizacao_rastreio_lista.php | 162 -- ...d_cor_parametrizacao_rastreio_lista_js.php | 77 - .../md_cor_parametrizacao_status_lista.php | 2 +- .../md_cor_parametrizacao_status_tabela.php | 8 +- .../modulos/correios/md_cor_plp_detalhada.php | 31 +- .../correios/md_cor_plp_detalhada_js.php | 34 +- .../correios/md_cor_plp_imprimir_ar.php | 417 +--- .../md_cor_plp_imprimir_rotulo_envelope.php | 472 ++--- .../correios/md_cor_plps_geradas_lista.php | 32 +- .../correios/md_cor_plps_geradas_lista_js.php | 45 + .../md_cor_selecionar_layout_envelope.php | 71 + .../correios/rn/MdCorAdmIntegracaoRN.php | 337 ++++ .../modulos/correios/rn/MdCorApiRestRN.php | 330 ++++ .../modulos/correios/rn/MdCorClientWsRN.php | 167 -- .../modulos/correios/rn/MdCorContratoRN.php | 85 +- .../correios/rn/MdCorExpedicaoAndamentoRN.php | 208 +- .../rn/MdCorExpedicaoSolicitadaRN.php | 3 + .../correios/rn/MdCorListaStatusRN.php | 23 +- .../correios/rn/MdCorParametroRastreioRN.php | 284 --- sei/web/modulos/correios/rn/MdCorPlpRN.php | 773 ++++---- .../correios/rn/MdCorRetornoArDocRN.php | 2 +- .../modulos/correios/rn/MdCorRetornoArRN.php | 48 +- .../modulos/correios/rn/MdCorUnidadeExpRN.php | 67 + .../modulos/correios/rn/MdCorWsRastreioRN.php | 136 +- .../sip_atualizar_versao_modulo_correios.php | 215 +- 128 files changed, 11942 insertions(+), 2630 deletions(-) create mode 100644 sei/web/modulos/correios/bd/MdCorAdmIntegracaoBD.php delete mode 100644 sei/web/modulos/correios/bd/MdCorParametroRastreioBD.php create mode 100644 sei/web/modulos/correios/dto/MdCorAdmIntegracaoDTO.php delete mode 100644 sei/web/modulos/correios/dto/MdCorParametroRastreioDTO.php create mode 100644 sei/web/modulos/correios/int/MdCorAdmIntegracaoINT.php create mode 100644 sei/web/modulos/correios/int/MdCorMensagemINT.php delete mode 100644 sei/web/modulos/correios/int/MdCorParametroRastreioINT.php create mode 100644 sei/web/modulos/correios/lib/zbar/composer.json create mode 100644 sei/web/modulos/correios/lib/zbar/composer.lock create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/autoload.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/ClassLoader.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/InstalledVersions.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/LICENSE create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_classmap.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_namespaces.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_psr4.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_real.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_static.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/installed.json create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/installed.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/composer/platform_check.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/.gitignore create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/.travis.yml create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/README.md create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/composer.json create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/phpunit.xml create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Facades/ZbarDecoder.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/ErrorResult.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/Parser/ParserInterface.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/Parser/ParserXML.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/Result.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/ResultInterface.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarDecoder.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProvider.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProviderLaravel4.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProviderLaravel5.php rename sei/web/modulos/correios/{md_cor_parametrizacao_rastreio_lista_css.php => lib/zbar/vendor/robbiep/zbar-qrdecoder/src/config/.gitkeep} (100%) create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/config/config.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/.gitkeep create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ErrorResultTest.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ResultTest.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ZbarDecoderTest.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/stubs/tc.jpg create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/.gitignore create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/CHANGELOG.md create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/ExceptionInterface.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/InvalidArgumentException.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/LogicException.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/ProcessFailedException.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/ProcessTimedOutException.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/RuntimeException.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ExecutableFinder.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/InputStream.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/LICENSE create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/PhpExecutableFinder.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/PhpProcess.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/AbstractPipes.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/PipesInterface.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/UnixPipes.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/WindowsPipes.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Process.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ProcessBuilder.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ProcessUtils.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/README.md create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ErrorProcessInitiator.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ExecutableFinderTest.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/NonStopableProcess.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PhpExecutableFinderTest.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PhpProcessTest.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessBuilderTest.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessTest.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessUtilsTest.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/SignalListener.php create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/composer.json create mode 100644 sei/web/modulos/correios/lib/zbar/vendor/symfony/process/phpunit.xml.dist create mode 100644 sei/web/modulos/correios/md_cor_adm_integracao_cadastro.php create mode 100644 sei/web/modulos/correios/md_cor_adm_integracao_cadastro_js.php create mode 100644 sei/web/modulos/correios/md_cor_adm_integracao_lista.php create mode 100644 sei/web/modulos/correios/md_cor_funcoes_js.php delete mode 100644 sei/web/modulos/correios/md_cor_parametrizacao_rastreio_lista.php delete mode 100644 sei/web/modulos/correios/md_cor_parametrizacao_rastreio_lista_js.php create mode 100644 sei/web/modulos/correios/md_cor_selecionar_layout_envelope.php create mode 100644 sei/web/modulos/correios/rn/MdCorAdmIntegracaoRN.php create mode 100644 sei/web/modulos/correios/rn/MdCorApiRestRN.php delete mode 100644 sei/web/modulos/correios/rn/MdCorClientWsRN.php delete mode 100644 sei/web/modulos/correios/rn/MdCorParametroRastreioRN.php diff --git a/sei/scripts/sei_atualizar_versao_modulo_correios.php b/sei/scripts/sei_atualizar_versao_modulo_correios.php index 64eced8..60d14cd 100644 --- a/sei/scripts/sei_atualizar_versao_modulo_correios.php +++ b/sei/scripts/sei_atualizar_versao_modulo_correios.php @@ -5,10 +5,10 @@ class MdCorAtualizadorSeiRN extends InfraRN { private $numSeg = 0; - private $versaoAtualDesteModulo = '2.2.0'; + private $versaoAtualDesteModulo = '2.3.0'; private $nomeDesteModulo = 'MÓDULO CORREIOS'; private $nomeParametroModulo = 'VERSAO_MODULO_CORREIOS'; - private $historicoVersoes = array('1.0.0', '2.0.0', '2.1.0','2.2.0'); + private $historicoVersoes = array('1.0.0', '2.0.0', '2.1.0','2.2.0','2.3.0'); public function __construct() { @@ -66,15 +66,6 @@ private function finalizar($strMsg = null, $bolErro = false) die; } - protected function normalizaVersao($versao) - { - $ultimoPonto = strrpos($versao, '.'); - if ($ultimoPonto !== false) { - $versao = substr($versao, 0, $ultimoPonto) . substr($versao, $ultimoPonto + 1); - } - return $versao; - } - protected function atualizarVersaoConectado() { @@ -90,7 +81,7 @@ protected function atualizarVersaoConectado() //testando versao do framework $numVersaoInfraRequerida = '2.0.18'; - if ($this->normalizaVersao(VERSAO_INFRA) < $this->normalizaVersao($numVersaoInfraRequerida)) { + if (version_compare(VERSAO_INFRA, $numVersaoInfraRequerida) < 0) { $this->finalizar('VERSÃO DO FRAMEWORK PHP INCOMPATÍVEL (VERSÃO ATUAL ' . VERSAO_INFRA . ', SENDO REQUERIDA VERSÃO IGUAL OU SUPERIOR A ' . $numVersaoInfraRequerida . ')', true); } @@ -116,6 +107,8 @@ protected function atualizarVersaoConectado() $this->instalarv210(); case '2.1.0': $this->instalarv220(); + case '2.2.0': + $this->instalarv230(); break; default: @@ -1261,6 +1254,211 @@ protected function instalarv220(){ $this->atualizarNumeroVersao($nmVersao); } + protected function instalarv230(){ + $nmVersao = '2.3.0'; + $objInfraParametro = new InfraParametro(BancoSEI::getInstance()); + $this->logar('EXECUTANDO A INSTALAÇÃO/ATUALIZAÇÃO DA VERSAO '. $nmVersao .' DO ' . $this->nomeDesteModulo . ' NA BASE DO SEI'); + + $objInfraMetaBD = new InfraMetaBD(BancoSEI::getInstance()); + $objMdCorAdmIntegRN = new MdCorAdmIntegracaoRN(); + + $this->logar('CRIANDO A TABELA md_cor_adm_integracao'); + BancoSEI::getInstance()->executarSql('CREATE TABLE md_cor_adm_integracao ( + id_md_cor_adm_integracao ' . $objInfraMetaBD->tipoNumero() . ' NOT NULL , + funcionalidade ' . $objInfraMetaBD->tipoNumero() . ' NOT NULL , + nome ' . $objInfraMetaBD->tipoTextoVariavel(200) . ' NOT NULL, + url_operacao '. $objInfraMetaBD->tipoTextoVariavel(500) .' NOT NULL, + usuario '. $objInfraMetaBD->tipoTextoVariavel(100) .' NULL, + senha '. $objInfraMetaBD->tipoTextoVariavel(1000) .' NULL, + token '. $objInfraMetaBD->tipoTextoVariavel(1500) .' NULL, + data_exp_token '. $objInfraMetaBD->tipoDataHora() .' NULL, + sin_ativo '. $objInfraMetaBD->tipoTextoFixo(1) .' NOT NULL + )' + ); + + $objInfraMetaBD->adicionarChavePrimaria('md_cor_adm_integracao', 'pk_md_cor_adm_integracao', array('id_md_cor_adm_integracao')); + + $this->logar('CRIANDO A SEQUENCE seq_md_cor_adm_integracao'); + BancoSEI::getInstance()->criarSequencialNativa('seq_md_cor_adm_integracao', 1); + + // GERAR TOKEN + $this->logar('CADASTRAR REGISTRO DE INTEGRAÇÃO: GERAR TOKEN'); + $objMdCorAdmIntegDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegDTO->retTodos(); + $objMdCorAdmIntegDTO->setNumFuncionalidade(1); + $objMdCorAdmIntegDTO->setStrNome('Gerar Token'); + $objMdCorAdmIntegDTO->setStrUrlOperacao('https://apihom.correios.com.br/token/v1/autentica/cartaopostagem'); + $objMdCorAdmIntegDTO->setStrUsuario(null); + $objMdCorAdmIntegDTO->setStrSenha(null); + $objMdCorAdmIntegDTO->setStrToken(null); + $objMdCorAdmIntegDTO->setDthDataExpiraToken(null); + $objMdCorAdmIntegDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegRN->cadastrar($objMdCorAdmIntegDTO); + + // RASTREAR OBJETO + $this->logar('CADASTRAR REGISTRO DE INTEGRAÇÃO: RASTREAR OBJETO'); + $objMdCorAdmIntegDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegDTO->retTodos(); + $objMdCorAdmIntegDTO->setNumFuncionalidade(2); + $objMdCorAdmIntegDTO->setStrNome('Rastrear Objeto'); + $objMdCorAdmIntegDTO->setStrUrlOperacao('https://apihom.correios.com.br/srorastro/v1'); + $objMdCorAdmIntegDTO->setStrUsuario(null); + $objMdCorAdmIntegDTO->setStrSenha(null); + $objMdCorAdmIntegDTO->setStrToken(null); + $objMdCorAdmIntegDTO->setDthDataExpiraToken(InfraData::getStrDataHoraAtual()); + $objMdCorAdmIntegDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegRN->cadastrar($objMdCorAdmIntegDTO); + + // CONSULTAR CEP + $this->logar('CADASTRAR REGISTRO DE INTEGRAÇÃO: CONSULTAR CEP'); + $objMdCorAdmIntegDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegDTO->retTodos(); + $objMdCorAdmIntegDTO->setNumFuncionalidade(3); + $objMdCorAdmIntegDTO->setStrNome('Consultar CEP'); + $objMdCorAdmIntegDTO->setStrUrlOperacao('https://apihom.correios.com.br/cep/v2'); + $objMdCorAdmIntegDTO->setStrUsuario(null); + $objMdCorAdmIntegDTO->setStrSenha(null); + $objMdCorAdmIntegDTO->setStrToken(null); + $objMdCorAdmIntegDTO->setDthDataExpiraToken(InfraData::getStrDataHoraAtual()); + $objMdCorAdmIntegDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegRN->cadastrar($objMdCorAdmIntegDTO); + + // CONTRATO - SERVICOS POSTAIS + $this->logar('CADASTRAR REGISTRO DE INTEGRAÇÃO: SERVICOS POSTAIS'); + $objMdCorAdmIntegDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegDTO->retTodos(); + $objMdCorAdmIntegDTO->setNumFuncionalidade(4); + $objMdCorAdmIntegDTO->setStrNome('Serviços Postais'); + $objMdCorAdmIntegDTO->setStrUrlOperacao('https://apihom.correios.com.br/meucontrato/v1'); + $objMdCorAdmIntegDTO->setStrUsuario(null); + $objMdCorAdmIntegDTO->setStrSenha(null); + $objMdCorAdmIntegDTO->setStrToken(null); + $objMdCorAdmIntegDTO->setDthDataExpiraToken(InfraData::getStrDataHoraAtual()); + $objMdCorAdmIntegDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegRN->cadastrar($objMdCorAdmIntegDTO); + + // SOLICITA ETIQUETAS + $this->logar('CADASTRAR REGISTRO DE INTEGRAÇÃO: PRE POSTAGEM - SOLICITA ETIQUETAS'); + $objMdCorAdmIntegDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegDTO->retTodos(); + $objMdCorAdmIntegDTO->setNumFuncionalidade(5); + $objMdCorAdmIntegDTO->setStrNome('Solicitar Etiquetas'); + $objMdCorAdmIntegDTO->setStrUrlOperacao('https://apihom.correios.com.br/prepostagem/v1/prepostagens/rotulo/range'); + $objMdCorAdmIntegDTO->setStrUsuario(null); + $objMdCorAdmIntegDTO->setStrSenha(null); + $objMdCorAdmIntegDTO->setStrToken(null); + $objMdCorAdmIntegDTO->setDthDataExpiraToken(InfraData::getStrDataHoraAtual()); + $objMdCorAdmIntegDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegRN->cadastrar($objMdCorAdmIntegDTO); + + // PRE POSTAGEM + $this->logar('CADASTRAR REGISTRO DE INTEGRAÇÃO: PRE POSTAGEM - SOLICITA PRE-POSTAGEM'); + $objMdCorAdmIntegDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegDTO->retTodos(); + $objMdCorAdmIntegDTO->setNumFuncionalidade(6); + $objMdCorAdmIntegDTO->setStrNome('Pré Postagem Nacional'); + $objMdCorAdmIntegDTO->setStrUrlOperacao('https://apihom.correios.com.br/prepostagem/v1/prepostagens'); + $objMdCorAdmIntegDTO->setStrUsuario(null); + $objMdCorAdmIntegDTO->setStrSenha(null); + $objMdCorAdmIntegDTO->setStrToken(null); + $objMdCorAdmIntegDTO->setDthDataExpiraToken(InfraData::getStrDataHoraAtual()); + $objMdCorAdmIntegDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegRN->cadastrar($objMdCorAdmIntegDTO); + + // EMITE ROTULO + $this->logar('CADASTRAR REGISTRO DE INTEGRAÇÃO: EMISSAO DE ROTULO'); + $objMdCorAdmIntegDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegDTO->retTodos(); + $objMdCorAdmIntegDTO->setNumFuncionalidade(7); + $objMdCorAdmIntegDTO->setStrNome('Emitir Rótulo'); + $objMdCorAdmIntegDTO->setStrUrlOperacao('https://apihom.correios.com.br/prepostagem/v1/prepostagens/rotulo/assincrono/pdf'); + $objMdCorAdmIntegDTO->setStrUsuario(null); + $objMdCorAdmIntegDTO->setStrSenha(null); + $objMdCorAdmIntegDTO->setStrToken(null); + $objMdCorAdmIntegDTO->setDthDataExpiraToken(InfraData::getStrDataHoraAtual()); + $objMdCorAdmIntegDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegRN->cadastrar($objMdCorAdmIntegDTO); + + // DOWNLOAD DO ROTULO + $this->logar('CADASTRAR REGISTRO DE INTEGRAÇÃO: DOWNLOAD DO ROTULO'); + $objMdCorAdmIntegDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegDTO->retTodos(); + $objMdCorAdmIntegDTO->setNumFuncionalidade(8); + $objMdCorAdmIntegDTO->setStrNome('Download Rótulo'); + $objMdCorAdmIntegDTO->setStrUrlOperacao('https://apihom.correios.com.br/prepostagem/v1/prepostagens/rotulo/download'); + $objMdCorAdmIntegDTO->setStrUsuario(null); + $objMdCorAdmIntegDTO->setStrSenha(null); + $objMdCorAdmIntegDTO->setStrToken(null); + $objMdCorAdmIntegDTO->setDthDataExpiraToken(InfraData::getStrDataHoraAtual()); + $objMdCorAdmIntegDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegRN->cadastrar($objMdCorAdmIntegDTO); + + // AVISO DE RECEBIMENTO + $this->logar('CADASTRAR REGISTRO DE INTEGRAÇÃO: AVISO DE RECEBIMENTO'); + $objMdCorAdmIntegDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegDTO->retTodos(); + $objMdCorAdmIntegDTO->setNumFuncionalidade(9); + $objMdCorAdmIntegDTO->setStrNome('Aviso de Recebimento'); + $objMdCorAdmIntegDTO->setStrUrlOperacao('https://apihom.correios.com.br/prepostagem/v1/prepostagens'); + $objMdCorAdmIntegDTO->setStrUsuario(null); + $objMdCorAdmIntegDTO->setStrSenha(null); + $objMdCorAdmIntegDTO->setStrToken(null); + $objMdCorAdmIntegDTO->setDthDataExpiraToken(InfraData::getStrDataHoraAtual()); + $objMdCorAdmIntegDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegRN->cadastrar($objMdCorAdmIntegDTO); + + // CANCELAR PRE POSTAGEM + $this->logar('CADASTRAR REGISTRO DE INTEGRAÇÃO: CANCELAR PRE POSTAGEM'); + $objMdCorAdmIntegDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegDTO->retTodos(); + $objMdCorAdmIntegDTO->setNumFuncionalidade(10); + $objMdCorAdmIntegDTO->setStrNome('Cancelar Pré Postagem'); + $objMdCorAdmIntegDTO->setStrUrlOperacao('https://apihom.correios.com.br/prepostagem/v1/prepostagens'); + $objMdCorAdmIntegDTO->setStrUsuario(null); + $objMdCorAdmIntegDTO->setStrSenha(null); + $objMdCorAdmIntegDTO->setStrToken(null); + $objMdCorAdmIntegDTO->setDthDataExpiraToken(InfraData::getStrDataHoraAtual()); + $objMdCorAdmIntegDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegRN->cadastrar($objMdCorAdmIntegDTO); + + $this->logar('ADICIONANDO COLUNA "id_pre_postagem" NA TABELA "md_cor_expedicao_solicitad"'); + $objInfraMetaBD->adicionarColuna('md_cor_expedicao_solicitad', 'id_pre_postagem', $objInfraMetaBD->tipoTextoVariavel(100), 'NULL'); + + // Remocao de colunas da tabela md_cor_contrato e alteração na coluna id_md_cor_diretoria para NULL + $this->logar('Removendo a COLUNA "url_webservice" NA TABELA "md_cor_contrato"'); + $objInfraMetaBD->excluirColuna('md_cor_contrato','url_webservice'); + + $this->logar('Removendo a COLUNA "codigo_administrativo" NA TABELA "md_cor_contrato"'); + $objInfraMetaBD->excluirColuna('md_cor_contrato','codigo_administrativo'); + + $this->logar('Removendo a COLUNA "usuario" NA TABELA "md_cor_contrato"'); + $objInfraMetaBD->excluirColuna('md_cor_contrato','usuario'); + + $this->logar('Removendo a COLUNA "senha" NA TABELA "md_cor_contrato"'); + $objInfraMetaBD->excluirColuna('md_cor_contrato','senha'); + + $this->logar('Removendo a COLUNA "numero_ano_contrato" NA TABELA "md_cor_contrato"'); + $objInfraMetaBD->excluirColuna('md_cor_contrato','numero_ano_contrato'); + + $objInfraMetaBD->alterarColuna('md_cor_contrato', 'id_md_cor_diretoria', $objInfraMetaBD->tipoNumero(), 'null'); + + // Drop na tabela md_cor_parametro_rastreio + $this->logar('Remover a sequence e tabela md_cor_parametro_rastreio'); + if (BancoSEI::getInstance() instanceof InfraOracle) { + BancoSEI::getInstance()->executarSql('drop sequence seq_md_cor_parametro_rastreio'); + } else { + BancoSEI::getInstance()->executarSql('DROP TABLE seq_md_cor_parametro_rastreio'); + } + BancoSEI::getInstance()->executarSql('DROP TABLE md_cor_parametro_rastreio'); + + $this->logar('Altera as colunas numero_contrato, numero_contrato_correio e numero_cartao_postagem de char() para varchar()'); + $objInfraMetaBD->alterarColuna('md_cor_contrato', 'numero_contrato', $objInfraMetaBD->tipoTextoVariavel(50), 'not null'); + $objInfraMetaBD->alterarColuna('md_cor_contrato', 'numero_contrato_correio', $objInfraMetaBD->tipoTextoVariavel(50), 'not null'); + $objInfraMetaBD->alterarColuna('md_cor_contrato', 'numero_cartao_postagem', $objInfraMetaBD->tipoTextoVariavel(50), 'not null'); + + $this->atualizarNumeroVersao($nmVersao); + } + protected function fixIndices(InfraMetaBD $objInfraMetaBD, $arrTabelas) { InfraDebug::getInstance()->setBolDebugInfra(true); diff --git a/sei/web/modulos/correios/CorreiosIntegracao.php b/sei/web/modulos/correios/CorreiosIntegracao.php index 3ea89b0..f42a857 100644 --- a/sei/web/modulos/correios/CorreiosIntegracao.php +++ b/sei/web/modulos/correios/CorreiosIntegracao.php @@ -15,7 +15,7 @@ public function getNome() public function getVersao() { - return '2.2.0'; + return '2.3.0'; } public function getInstituicao() @@ -279,10 +279,11 @@ public function processarControlador($strAcao) case 'md_cor_historico_visualizar' : require_once dirname(__FILE__) . '/md_cor_historico_visualiza.php'; return true; - + /* case 'md_cor_parametrizacao_rastreio_listar' : require_once dirname(__FILE__) . '/md_cor_parametrizacao_rastreio_lista.php'; return true; + */ //Parametrização de Status case 'md_cor_parametrizacao_status_cadastrar' : @@ -297,6 +298,7 @@ public function processarControlador($strAcao) require_once dirname(__FILE__) . '/md_cor_parametrizacao_status_lista.php'; return true; + //Destinatários não habilitados parra expedição case 'md_cor_rel_contato_justificativa_cadastrar' : case 'md_cor_rel_contato_justificativa_alterar' : @@ -321,6 +323,22 @@ public function processarControlador($strAcao) require_once dirname(__FILE__) . '/md_cor_justificativa_cadastro.php'; return true; + case 'md_cor_adm_integracao_cadastrar': + case 'md_cor_adm_integracao_alterar': + case 'md_cor_adm_integracao_consultar': + require_once dirname(__FILE__) . '/md_cor_adm_integracao_cadastro.php'; + return true; + + case 'md_cor_adm_integracao_listar': + case 'md_cor_adm_integracao_excluir': + case 'md_cor_adm_integracao_desativar': + case 'md_cor_adm_integracao_reativar': + require_once dirname(__FILE__) . '/md_cor_adm_integracao_lista.php'; + return true; + + case 'md_cor_selecionar_layout_envelope': + require_once dirname(__FILE__) . '/md_cor_selecionar_layout_envelope.php'; + return true; } return false; @@ -547,7 +565,8 @@ public function processarControladorAjax($strAcao) break; case 'md_cor_servicos_postais_buscar': - $xml = MdCorServicoPostalINT::retornarServicosPostais($_POST['txtNumeroContratoCorreio'], $_POST['txtNumeroCartaoPostagem'], $_POST['txtUrlWebservice'], $_POST['txtUsuario'], $_POST['txtSenha']); + $_POST['txtCNPJ'] = InfraUtil::retirarFormatacao($_POST['txtCNPJ']); + $xml = MdCorServicoPostalINT::retornarServicosPostais($_POST['txtNumeroContratoCorreio'], $_POST['txtCNPJ']); break; case 'md_cor_numero_processo_validar': @@ -678,6 +697,20 @@ public function processarControladorAjax($strAcao) $xml .= ""; break; + + case 'md_cor_plp_cancelar_plp': + $xml = ''; + $arr = ['idPlp' => $_POST['idPlp']]; + $rs = ( new MdCorPlpRN() )->cancelarPlp( $arr ); + if (is_array($rs)) { + $xml .= 'N'; + $xml .= ''.$rs['msg'].''; + } else { + $xml .= 'S'; + } + + $xml .= ''; + break; } return $xml; @@ -1261,8 +1294,9 @@ public function verificarDocumentoRetornado($idDocumento) $MdCorRetornoArDocDTO = new MdCorRetornoArDocDTO(); $MdCorRetornoArDocDTO->setNumIdDocumentoAr($idDocumento); $MdCorRetornoArDocDTO->retNumIdDocumentoPrincipal(); - $MdCorRetornoArDocDTO = $MdCorRetornoArDocRN->consultar($MdCorRetornoArDocDTO); + $MdCorRetornoArDocDTO = $MdCorRetornoArDocRN->contar($MdCorRetornoArDocDTO); + #$MdCorRetornoArDocDTO = $MdCorRetornoArDocRN->consultar($MdCorRetornoArDocDTO); - return $MdCorRetornoArDocDTO; + return $MdCorRetornoArDocDTO > 0 ? true : null; } } diff --git a/sei/web/modulos/correios/README.md b/sei/web/modulos/correios/README.md index dfa1a11..6805cd2 100644 --- a/sei/web/modulos/correios/README.md +++ b/sei/web/modulos/correios/README.md @@ -35,27 +35,30 @@ 8. Em caso de erro durante a execução do script, verificar (lendo as mensagens de erro e no menu Infra > Log do SEI e do SIP) se a causa é algum problema na infraestrutura local ou ajustes indevidos na estrutura de banco do core do sistema. Neste caso, após a correção, deve recuperar o backup do banco pertinente e repetir o procedimento, especialmente a execução dos scripts de banco indicados acima. - Caso não seja possível identificar a causa, entrar em contato com: Nei Jobson - neijobson@anatel.gov.br 9. Após a execução com sucesso, com um usuário com permissão de Administrador no SEI, seguir os passos dispostos no tópico "Orientações Negociais" mais abaixo. -10. Para o funcionamento correto do Módulo SEI Correios é necessária a instalação da biblioteca PHP "ImageMagick" e "ImageMagick-devel" em cada nó de aplicação do SEI, conforme comandos abaixo: +10. Para o funcionamento correto do Módulo SEI Correios é necessário a instalação da biblioteca PHP "ImageMagick" e "ImageMagick-devel" em cada nó de aplicação do SEI, conforme comandos abaixo: Execute a linha de comando "yum install -y ImageMagick ImageMagick-devel" Execute a linha de comando "pecl install imagick" Modifique o arquvivo "/etc/php.ini", incluindo a linha "extension=imagick.so" no final da seção "Dynamic Extensions" - - +11. Para o funcionamento do Processamento de Retorno do AR é necessário a instalação do kit de ferramenta Zbar. Para saber mais ver o link: [https://github.com/robbiepaul/zbar-qrdecoder](https://github.com/robbiepaul/zbar-qrdecoder) no tópico **Requirements**. Exemplo de instalação para uso no Sistema Operacional Centos: + + yum install zbar ## Orientações Negociais 1. Imediatamente após a instalação com sucesso, com usuário com permissão de "Administrador" do SEI, acessar os menus de administração do Módulo pelo seguinte caminho: Administração > Correios. Somente com tudo parametrizado adequadamente será possível o uso do módulo. -2. O script de banco do SIP já cria todos os Recursos e Menus e os associam automaticamente ao Perfil "Básico" ou ao Perfil "Administrador". - - Independente da criação de outros Perfis, os recursos indicados para o Perfil "Básico" ou "Administrador" devem manter correspondência com os Perfis dos Usuários internos que utilizarão o Módulo e dos Usuários Administradores do Módulo. - - Tão quanto ocorre com as atualizações do SEI, versões futuras deste Módulo continuarão a atualizar e criar Recursos e associá-los apenas aos Perfis "Básico" e "Administrador". +2. O script de banco do SIP já cria todos os Recursos e Menus e os associam automaticamente aos Perfis "Básico", "Administrador" e "Expedição Correios". + - Independente da criação de outros Perfis, os recursos indicados para o Perfil "Básico", "Administrador" e "Expedição Correios" devem manter correspondência com os Perfis dos Usuários internos que utilizarão o Módulo e dos Usuários Administradores do Módulo. + - Tão quanto ocorre com as atualizações do SEI, versões futuras deste Módulo continuarão a atualizar e criar Recursos e associá-los apenas aos Perfis "Básico", "Administrador" e "Expedição Correios". - Todos os recursos do Módulo iniciam pelo prefixo **"md_cor_"**. - Não foi possível ainda elaborar Manuais do módulo. Contudo, é importante ler o resumo sobre cada funcionalidade abaixo para poder entender o funcionamento do módulo e poder parametrizá-lo da forma correta. 3. Funcionalidades do Módulo SEI Correios: - 3.1. Administração: - Correios > Contratos e Serviços Postais: - Cadastra o Contrato que o órgão possui com os Correios e pelo menos o Tipo de Embalagem "Envelope". - - Na tela de Cadastro do Contrato deve informar todos os campos sobre o Contrato junto aos Correios, especialmente o Usuário e Senha do SIGEP-WEB informado pelos Correios ao Órgão para que as integrações funcionem. - - [Acesse o Manual dos Correios](https://www2.correios.com.br/sistemas/encomendas/sigepweb/doc/Manual_de_Implementacao_do_Web_Service_SIGEP_WEB.pdf "Acesse o Manual") para utilizar os dados para integração com o ambiente de Homologação do SIGEP WEB, disponíveis no tópico 3.1. - - Se ainda não tiver, deve solicitar ao contato comercial dos Correios que atende o Órgão o Usuário e Senha do SIGEP-WEB de produção para que o módulo funcione em produção. + - Na tela de Cadastro do Contrato deve informar todos os campos sobre o Contrato junto aos Correios, especialmente os Números de Contrato e Postagem informado pelos Correios ao Órgão para que as integrações funcionem. + - [Acesse o Link dos Correios](https://www.correios.com.br/atendimento/developers "Acesso à documentação das API's") para acesso à documentação sobre o uso das API's dos Correios. + - Caso não tenha usuário no ambiente de Homologação, acesse [https://cwshom.correios.com.br](https://cwshom.correios.com.br), clicar na opção "Cadastrar" e informar os dados solicitados. + - Caso não tenha usuário no ambiente de Produção, acesse [https://cws.correios.com.br](https://cws.correios.com.br) e realizar o mesmo procedimento feito no ambiente de Homologação. + - Caso tenha dúvidas, entrar em contato com o agente comercial dos Correios que atende o Órgão. - Deve deixar na lista de Serviços Postais somente os serviços que quer que fiquem disponíveis para uso, sendo o mais tradicional o serviço "CARTA COM A FATURAR SELO E SE", tipo "Carta Registrada", Expedido com AR "Sim", Descrição Amigável "Correspondência Registrada". - Remover os serviços que não for utilizar. - Os serviços mantidos na lista deverão depois serem mapeados com as unidades no menu Administração > Correios > Mapeamento Unidades e Serviços Postais. @@ -72,21 +75,23 @@ - Tela onde cadastra as Extensões Permitidas de Arquivos para Gravação em Mídia. - Parâmetros para Retorno da AR: - Tela onde indica os Parâmetros para Retorno da AR. - - Integração SRO: - - Tela de cadastro da Integração SRO onde deve informar todos os campos junto aos Correios, especialmente o Usuário e Senha e o Endereço do WSDL do Webservice do SRO. - - [Acesse o Manual Web Service de Rastreamento dos Correios (SRO)](https://www.correios.com.br/atendimento/ferramentas/sistemas/arquivos/web-service-de-rastreamento "Acesse o Manual"). - - Se ainda não tiver, deve solicitar ao contato comercial dos Correios que atende o Órgão o Usuário e Senha do SRO de produção para que o módulo funcione em produção. - - Inclusive, somente com códigos de rastreio já existentes/reais é que o rastreio de objetos funciona, inclusive em outros ambientes internos do Órgão. Assim, para testes, tem que pegar códigos de rastreios reais recentes (menos de 180 dias) e incluir manualmente pelo banco do módulo para que possa testar. - - Atenção: conforme disposto nos Manuais dos Correios, os códigos de Rastreio de Objeto ficam disponíveis para consulta apenas por 180 dias, inclusive na página na Internet de Rastrio de Objetos dos Correios. + - Mapeamento das Integrações: + - A Tela inicial é a listagem das integrações cadastradas após a execução do Script de instalação do módulo. + Para uso inicial das integrações é necessário cadastrar usuário, senha e token correspondente ao ambiente utilizado. + O Authorization a ser usado na API **Token** pode ser recuperado no ambiente de [Homologação](https://cwshom.correios.com.br) ou [Produção](https://cws.correios.com.br) após seguir as instruções da documentação do uso das API's mencionada no item + 3 > 3.1 Administração. + - Atenção: conforme disposto nos Manuais dos Correios, os códigos de Rastreio de Objeto ficam disponíveis para consulta apenas por 180 dias, inclusive na página na Internet de Rastreio de Objetos dos Correios. + - Inclusive, somente com códigos de rastreio já existentes/reais é que o rastreio de objetos funciona, inclusive em outros ambientes internos do Órgão. Assim, para testes, tem que pegar códigos de rastreios reais recentes (menos de 180 dias) e incluir manualmente pelo banco do módulo para que possa testar. - Tipos de Situações SRO: - - Tela onde lista os Tipos de Situações SRO vinculados ao Serviço WSDL cadastrado. + - Tela onde lista os Tipos de Situações SRO vinculados ao Serviço. - Destinatários não Habilitados para Expedição: - Tela onde cadastrado os Contatos que não são Destinatários Habilitados para Expedição. - 3.2. Unidade de Expedição: - Expedição pelos Correios: - - Gerar PLP: + - Nomenclatura PLP = Identificador para **Pré lista de Pré-Postagens** + - Gerar Pré-Postagem: - Tela onde lista as solicitações de expedições realizadas pelos Usuários e gera a PLP(pré-lista de postagem), sendo possível selecionar o "Formato de Expedição do Objeto" e visualizar a "Solicitação de Expedição" cadastrada. - - Expedir PLP: + - Expedir Pré-Postagem: - Lista as PLPs(pré-lista de postagem) geradas para expedição e realiza o "Expedir PLP". - Antes de "Concluir a Expedição da PLP" e possível Imprimir os Documentos, Envelopes, ARs e Voucher da PLP. - Consultar PLPs Geradas: diff --git a/sei/web/modulos/correios/bd/MdCorAdmIntegracaoBD.php b/sei/web/modulos/correios/bd/MdCorAdmIntegracaoBD.php new file mode 100644 index 0000000..c2e6c7e --- /dev/null +++ b/sei/web/modulos/correios/bd/MdCorAdmIntegracaoBD.php @@ -0,0 +1,10 @@ +adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdMdCorAdmIntegracao', 'id_md_cor_adm_integracao'); + + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'Funcionalidade', 'funcionalidade'); + + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Nome', 'nome'); + + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'UrlOperacao', 'url_operacao'); + + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Usuario', 'usuario'); + + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Senha', 'senha'); + + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Token', 'token'); + + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DTH, 'DataExpiraToken', 'data_exp_token'); + + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'SinAtivo', 'sin_ativo'); + + $this->configurarPK('IdMdCorAdmIntegracao',InfraDTO::$TIPO_PK_NATIVA); + } +} diff --git a/sei/web/modulos/correios/dto/MdCorContratoDTO.php b/sei/web/modulos/correios/dto/MdCorContratoDTO.php index 2279d5f..ce2da72 100644 --- a/sei/web/modulos/correios/dto/MdCorContratoDTO.php +++ b/sei/web/modulos/correios/dto/MdCorContratoDTO.php @@ -40,6 +40,20 @@ public function montar() 'NumeroCnpj', 'numero_cnpj'); + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, + 'IdProcedimento', + 'id_procedimento'); + + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, + 'SinAtivo', + 'sin_ativo'); + + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, + 'IdMdCorDiretoria', + 'id_md_cor_diretoria'); + + + /* Atributos a partir da versão 2.3 em desuso. Será mantido devido ao uso do Script de instalação */ $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'AnoContratoCorreio', 'numero_ano_contrato'); @@ -48,10 +62,6 @@ public function montar() 'UrlWebservice', 'url_webservice'); - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DBL, - 'IdProcedimento', - 'id_procedimento'); - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Usuario', 'usuario'); @@ -64,13 +74,9 @@ public function montar() 'CodigoAdministrativo', 'codigo_administrativo'); - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, - 'SinAtivo', - 'sin_ativo'); - - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, - 'IdMdCorDiretoria', - 'id_md_cor_diretoria'); + /* Atributos a partir da versão 2.3 em desuso. + * FIM + */ $this->configurarPK('IdMdCorContrato', InfraDTO::$TIPO_PK_NATIVA); diff --git a/sei/web/modulos/correios/dto/MdCorExpedicaoFormatoDTO.php b/sei/web/modulos/correios/dto/MdCorExpedicaoFormatoDTO.php index 7cb038e..59d42ce 100644 --- a/sei/web/modulos/correios/dto/MdCorExpedicaoFormatoDTO.php +++ b/sei/web/modulos/correios/dto/MdCorExpedicaoFormatoDTO.php @@ -40,8 +40,8 @@ public function montar() { //FKs e atributos relacionado - Procedimento $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_DBL, 'IdProcedimento', 'prot.id_protocolo', 'protocolo prot'); - $this->configurarFK('IdProcedimento', 'procedimento proc', 'proc.id_procedimento', InfraDTO::$TIPO_FK_OPCIONAL); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_DBL, 'IdTipoProcedimento', 'proc.id_tipo_procedimento', 'procedimento proc'); + $this->configurarFK('IdProcedimento', 'procedimento proced', 'proced.id_procedimento', InfraDTO::$TIPO_FK_OPCIONAL); + $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_DBL, 'IdTipoProcedimento', 'proced.id_tipo_procedimento', 'procedimento proced'); $this->configurarFK('IdTipoProcedimento', 'tipo_procedimento tip', 'tip.id_tipo_procedimento', InfraDTO::$TIPO_FK_OPCIONAL); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeProcedimento', 'tip.nome', 'tipo_procedimento tip'); diff --git a/sei/web/modulos/correios/dto/MdCorExpedicaoSolicitadaDTO.php b/sei/web/modulos/correios/dto/MdCorExpedicaoSolicitadaDTO.php index d22e404..30209ce 100644 --- a/sei/web/modulos/correios/dto/MdCorExpedicaoSolicitadaDTO.php +++ b/sei/web/modulos/correios/dto/MdCorExpedicaoSolicitadaDTO.php @@ -31,15 +31,14 @@ public function montar() $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_DTH, 'DataExpedicao', 'data_expedicao'); $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdUsuarioSolicitante', 'id_usuario_solicitante'); $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'SinRecebido', 'sin_recebido'); - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'SinObjetoAcessado', 'sin_objeto_acessado'); $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdMdCorPlp', 'id_md_cor_plp'); - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdUsuarioExpAutorizador', 'id_usuario_exp_autorizador'); $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'CodigoRastreamento', 'codigo_rastreamento'); $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'StatusCobranca', 'status_cobranca'); $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'SinDevolvido', 'sin_devolvido'); $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'JustificativaDevolucao', 'justificativa_devolucao'); + $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'IdPrePostagem', 'id_pre_postagem'); //Fk's Atributo Tabela $this->configurarPK('IdMdCorExpedicaoSolicitada', InfraDTO::$TIPO_PK_NATIVA); @@ -83,15 +82,12 @@ public function montar() //Atributos Relacionados $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_DBL, 'IdMdCorContrato', 'mdsp.id_md_cor_contrato', 'md_cor_servico_postal mdsp'); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'UrlWebService', 'contr.url_webservice', 'md_cor_contrato contr'); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'UrlWebService', 'contr.url_webservice', 'md_cor_contrato contr'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdSerie', 'doc.id_serie', 'documento doc'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'SiglaUnidade', 'und.sigla', 'unidade und'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'DescricaoUnidade', 'und.descricao', 'unidade und'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeSerie', 's.nome', 'serie s'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NomeServicoPostal', 'mdsp.nome', 'md_cor_servico_postal mdsp'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'DescricaoServicoPostal', 'mdsp.descricao', 'md_cor_servico_postal mdsp'); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdWsCorreios', 'mdsp.id_ws_correios', 'md_cor_servico_postal mdsp'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'CodigoWsCorreioServico', 'mdsp.codigo_ws_correios', 'md_cor_servico_postal mdsp'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'ExpedicaoAvisoRecebimentoServico', 'mdsp.expedicao_aviso_recebimento', 'md_cor_servico_postal mdsp'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdMdCorTipoCorrespondenc', 'mdsp.id_md_cor_tipo_correspondenc', 'md_cor_servico_postal mdsp'); @@ -113,22 +109,14 @@ public function montar() //Get Dados - Contrato Correio $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_DBL, 'IdMdCorContrato', 'mdsp.id_md_cor_contrato', 'md_cor_servico_postal mdsp'); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'UrlWebService', 'contr.url_webservice', 'md_cor_contrato contr'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'NumeroCnpj', 'contr.numero_cnpj', 'md_cor_contrato contr'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NumeroContratoCorreio', 'contr.numero_contrato_correio', 'md_cor_contrato contr'); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'NumeroCodigoAdministrativo', 'contr.codigo_administrativo', 'md_cor_contrato contr'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'CartaoPostagem', 'contr.numero_cartao_postagem', 'md_cor_contrato contr'); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'Usuario', 'contr.usuario', 'md_cor_contrato contr'); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'Senha', 'contr.senha', 'md_cor_contrato contr'); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'IdMdCorDiretoria', 'contr.id_md_cor_diretoria', 'md_cor_contrato contr'); - - $this->configurarFK('IdMdCorDiretoria', 'md_cor_diretoria dir', 'dir.id_md_cor_diretoria'); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'CodigoDiretoria', 'dir.codigo_diretoria', 'md_cor_diretoria dir'); //Get Dados - PLP $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'CodigoPlp', 'plp.codigo_plp', 'md_cor_plp plp'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'StaPlp', 'plp.sta_plp', 'md_cor_plp plp'); - $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdUnidadeGeradora', 'plp.id_unidade_geradora', 'md_cor_plp plp'); + $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdUnidadeGeradora', 'plp.id_unidade_geradora', 'md_cor_plp plp'); // Get Dados Protocolo - Processo $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_DBL, 'IdProtocolo', 'doc.id_procedimento', 'documento doc'); @@ -144,7 +132,6 @@ public function montar() //Get usuario - contato solicitante $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdContatoSolicitante', 'usu.id_contato', 'usuario usu'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'EmailSolicitante', 'contsoli.email', 'contato contsoli'); - //$this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'TelefoneFixoSolicitante', 'contsoli.telefone_fixo', 'contato contsoli'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'TelefoneCelularSolicitante', 'contsoli.telefone_celular', 'contato contsoli'); //Get usuario - contato contrato Orgão @@ -159,7 +146,6 @@ public function montar() $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, 'SiglaUfContratoOrgao', 'uforg.sigla', 'uf uforg'); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdContatoOrgao', 'contorg.id_contato', 'contato contorg'); - // Get Objeto envio $this->configurarFK('IdMdCorObjeto', 'md_cor_objeto obj', 'obj.id_md_cor_objeto', INFRADTO::$TIPO_FK_OPCIONAL); $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, 'IdMdCorObjeto', 'obj.id_md_cor_objeto', 'md_cor_objeto obj'); @@ -177,7 +163,6 @@ public function montar() $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'Anexos'); $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'DocSerieFormatados'); $this->adicionarAtributo(InfraDTO::$PREFIXO_STR, 'UltimoAndamento'); - $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'ProtocolosAnexos'); $this->adicionarAtributo(InfraDTO::$PREFIXO_ARR, 'MdCorExpedicaoFormatoDTO'); $this->adicionarAtributo(InfraDTO::$PREFIXO_NUM, 'QuantidadeAnexo'); diff --git a/sei/web/modulos/correios/dto/MdCorParametroRastreioDTO.php b/sei/web/modulos/correios/dto/MdCorParametroRastreioDTO.php deleted file mode 100644 index ba0af16..0000000 --- a/sei/web/modulos/correios/dto/MdCorParametroRastreioDTO.php +++ /dev/null @@ -1,32 +0,0 @@ -adicionarAtributoTabela(InfraDTO::$PREFIXO_NUM, 'IdMdCorParametroRastreio', 'id_md_cor_parametro_rastreio'); - - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Usuario', 'usuario'); - - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'Senha', 'senha'); - - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'EnderecoWsdl', 'endereco_wsdl'); - - $this->configurarPK('IdMdCorParametroRastreio', InfraDTO::$TIPO_PK_NATIVA); - - - } -} diff --git a/sei/web/modulos/correios/dto/MdCorServicoPostalDTO.php b/sei/web/modulos/correios/dto/MdCorServicoPostalDTO.php index 00b2321..e3cc6c2 100644 --- a/sei/web/modulos/correios/dto/MdCorServicoPostalDTO.php +++ b/sei/web/modulos/correios/dto/MdCorServicoPostalDTO.php @@ -33,10 +33,6 @@ public function montar() { 'Nome', 'nome'); - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, - 'IdWsCorreios', - 'id_ws_correios'); - $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'CodigoWsCorreios', 'codigo_ws_correios'); @@ -51,7 +47,7 @@ public function montar() { $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'SinServicoCobrar', - 'sin_servico_cobrar '); + 'sin_servico_cobrar'); $this->adicionarAtributoTabela(InfraDTO::$PREFIXO_STR, 'SinAnexarMidia', diff --git a/sei/web/modulos/correios/int/MdCorAdmIntegracaoINT.php b/sei/web/modulos/correios/int/MdCorAdmIntegracaoINT.php new file mode 100644 index 0000000..52bc149 --- /dev/null +++ b/sei/web/modulos/correios/int/MdCorAdmIntegracaoINT.php @@ -0,0 +1,64 @@ + MdCorAdmIntegracaoRN::$STR_GERAR_TOKEN, + MdCorAdmIntegracaoRN::$RASTREAR => MdCorAdmIntegracaoRN::$STR_RASTREAR, + MdCorAdmIntegracaoRN::$CEP => MdCorAdmIntegracaoRN::$STR_CEP, + MdCorAdmIntegracaoRN::$SERV_POSTAL => MdCorAdmIntegracaoRN::$STR_SERV_POSTAL, + MdCorAdmIntegracaoRN::$GERAR_ETIQUETAS => MdCorAdmIntegracaoRN::$STR_GERAR_ETIQUETAS, + MdCorAdmIntegracaoRN::$GERAR_PRE_POSTAGEM => MdCorAdmIntegracaoRN::$STR_PRE_POSTAGEM, + MdCorAdmIntegracaoRN::$EMITIR_ROTULO => MdCorAdmIntegracaoRN::$STR_EMITIR_ROTULO, + MdCorAdmIntegracaoRN::$DOWN_ROTULO => MdCorAdmIntegracaoRN::$STR_DOWN_ROTULO, + MdCorAdmIntegracaoRN::$AVISO_RECEB => MdCorAdmIntegracaoRN::$STR_AVISO_RECEB, + MdCorAdmIntegracaoRN::$CANCELAR_PRE_POSTAGEM => MdCorAdmIntegracaoRN::$STR_CANCELAR_PRE_POSTAGEM + ]; + } + + /* + * Funcionalidades + * */ + public static function montarSelectFuncionalidade($itemSelecionado = null , $retornaItem = false, $arrItensCadastrados = null){ + + $arrFuncionalidades = self::getDadosFuncionalidade(); + + if ( $retornaItem ) return $arrFuncionalidades[$retornaItem]; + + $strOptions = ''; + + foreach ( $arrFuncionalidades as $k => $v ) { + $selected = ''; + // Filtro para retirar a Funcionalidade que já está cadastrada e ativa + if ( !empty($arrItensCadastrados) ){ + if( !in_array($k,$arrItensCadastrados) ) { + if ($itemSelecionado && $itemSelecionado == $k) $selected = ' selected'; + $strOptions .= ""; + } + } else { + if ( $itemSelecionado && $itemSelecionado == $k ) $selected = ' selected'; + $strOptions .= ""; + } + } + return $strOptions; + } + + public static function gerenciaDadosRestritos($valor, $acao = 'C'){ + switch ( $acao ) { + case 'C': + return base64_encode( strrev( base64_encode( strrev( $valor ) ) ) ); + break; + + case 'D': + return strrev( base64_decode( strrev( base64_decode( $valor ) ) ) ); + break; + + default: + throw new InfraException('Tipo de Ação não declarado na função.'); + } + } +} +?> \ No newline at end of file diff --git a/sei/web/modulos/correios/int/MdCorExpedicaoSolicitadaINT.php b/sei/web/modulos/correios/int/MdCorExpedicaoSolicitadaINT.php index 46f76d3..2b29a02 100644 --- a/sei/web/modulos/correios/int/MdCorExpedicaoSolicitadaINT.php +++ b/sei/web/modulos/correios/int/MdCorExpedicaoSolicitadaINT.php @@ -290,9 +290,9 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) try { if($bolEntrada) { - $str_msg_validacao = 'O Destinatário deste documento está com dados cadastrais incompletos. \n\nAcesse o botão de ação sobre o documento \"Consultar/Alterar Documento\" para editar o Contato indicado como Destinatário e preencha os campos abaixo:\n'; + $str_msg_validacao = 'O Destinatário deste documento está com dados cadastrais incompletos.
Acesse o botão de ação sobre o documento "Consultar/Alterar Documento" para editar o Contato indicado como Destinatário e preencha os campos abaixo:
'; } else { - $str_msg_validacao = "O Destinatário deste documento está com dados cadastrais incompletos. \n\nAcesse o botão de ação sobre o documento \"Consultar/Alterar Documento\" para editar o Contato indicado como Destinatário e preencha os campos abaixo:\n"; + $str_msg_validacao = "O Destinatário deste documento está com dados cadastrais incompletos. \nAcesse o botão de ação sobre o documento \"Consultar/Alterar Documento\" para editar o Contato indicado como Destinatário e preencha os campos abaixo:\n"; } $erros = array(); $id_contato = $idContato; @@ -304,7 +304,11 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) $contatoDTO = $contatoRN->consultarRN0324($contatoDTO); if ( is_null($contatoDTO) ) { - throw new InfraException('O Destinatário deste documento está com cadastro de Contato desativado. \n\nAcesse o botão de ação \"Consultar/Alterar Documento\" sobre o documento para trocar o Contato indicado como Destinatário por um contato ativo.'); + if($bolEntrada) { + $str_msg_validacao = 'O Destinatário deste documento está com cadastro de Contato desativado.

Acesse o botão de ação "Consultar/Alterar Documento" sobre o documento para trocar o Contato indicado como Destinatário por um contato ativo.'; + } else { + $str_msg_validacao = "O Destinatário deste documento está com cadastro de Contato desativado. \n\nAcesse o botão de ação \"Consultar/Alterar Documento\" sobre o documento para trocar o Contato indicado como Destinatário por um contato ativo."; + } } self::validarDestinatarioIntimacaoEletronica($contatoDTO, $bolEntrada); @@ -316,15 +320,29 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) $contatoDTO = $contatoRN->consultarRN0324($contatoAssociadoDTO); } -// checar Natureza, Endereco, Bairro, Estado, Cidade, CEP + // checar Natureza, Endereco, Bairro, Estado, Cidade, CEP $nome = $contatoDTO->getStrNome(); $idCargo = $contatoDTO->getNumIdCargo(); $natureza = $contatoDTO->getStrStaNatureza(); $genero = $contatoDTO->getStrStaGenero(); $endereco = $contatoDTO->getStrEndereco(); $bairro = $contatoDTO->getStrBairro(); - $idCidade = $contatoDTO->getNumIdCidade(); + + // retorna o nome da UF $uf = $contatoDTO->getNumIdUf(); + $objUFDTO = new UfDTO(); + $objUFDTO->setNumIdUf($uf); + $objUFDTO->retStrNome(); + $objUFDTO->retStrSigla(); + $objUFDTO = ( new UfRN() )->consultarRN0400($objUFDTO); + + // retorna nome da Cidade + $idCidade = $contatoDTO->getNumIdCidade(); + $objCidadeDTO = new CidadeDTO(); + $objCidadeDTO->setNumIdCidade($idCidade); + $objCidadeDTO->retStrNome(); + $objCidadeDTO = ( new CidadeRN() )->consultarRN0409($objCidadeDTO); + $pais = $contatoDTO->getNumIdPais(); $cep = preg_replace("/[^0-9]+/", '', $contatoDTO->getStrCep()); @@ -351,8 +369,6 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) $cepOrgao = preg_replace("/[^0-9]+/", '', $contatoOrgaoDTO->getStrCep()); $enderecoOrgaoIncompleto = false; - $clienteWS = MdCorClientWsRN::gerarCliente(MdCorClientWsRN::URL_PRD); - $objRelContJustificativa = new MdCorRelContatoJustificativaDTO(); $objRelContJustificativa->retStrNomeJustificativa(); $objRelContJustificativa->setNumIdContato($idContato); @@ -368,7 +384,7 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) if ($qtdObjRelContJust > 0) { if($bolEntrada){ - $srt_msg_validacao_justificativa = 'O Destinatário do Documento não pode receber Expedições pelos Correios pelo seguinte motivo: \n\n- ' . $objRelContJust->getStrNomeJustificativa(); + $srt_msg_validacao_justificativa = 'O Destinatário do Documento não pode receber Expedições pelos Correios pelo seguinte motivo:

- ' . $objRelContJust->getStrNomeJustificativa(); return $srt_msg_validacao_justificativa; } else { $srt_msg_validacao_justificativa = "O Destinatário do Documento não pode receber Expedições pelos Correios pelo seguinte motivo: \n\n- " . $objRelContJust->getStrNomeJustificativa(); @@ -388,7 +404,7 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) if (in_array($contatoDTO->getNumIdTipoContato(), $arrIdTipoContato)) { if($bolEntrada){ - $str_msg_validacao_Tipo_contato = 'O Tipo de Contato do Destinatário ou da Pessoa Jurídica Associada não permite Expedição pelos Correios. Por exemplo, está utilizando o Tipo de Contato Temporário ou Usuário Externo. \n\nRevise o Contato para classificá-lo em Tipo de Contato adequado ou realize a expedição por meio de Intimação Eletrônica.'; + $str_msg_validacao_Tipo_contato = 'O Tipo de Contato do Destinatário ou da Pessoa Jurídica Associada não permite Expedição pelos Correios. Por exemplo, está utilizando o Tipo de Contato Temporário ou Usuário Externo.

Revise o Contato para classificá-lo em Tipo de Contato adequado ou realize a expedição por meio de Intimação Eletrônica.'; return $str_msg_validacao_Tipo_contato; } else { $str_msg_validacao_Tipo_contato = "O Tipo de Contato do Destinatário ou da Pessoa Jurídica Associada não permite Expedição pelos Correios. Por exemplo, está utilizando o Tipo de Contato Temporário ou Usuário Externo. \n\nRevise o Contato para classificá-lo em Tipo de Contato adequado ou realize a expedição por meio de Intimação Eletrônica."; @@ -405,12 +421,12 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) } else { if($bolEntrada){ - $str_msg_validacaoCorreios = self::validarCepBaseCorreios($clienteWS, $cepOrgao, 'O CEP do cadastro do órgão desta Unidade é inválido.\nFaça contato com a Gestão do SEI do seu órgão para corrigir o CEP do órgão.'); + $str_msg_validacaoCorreios = self::validarCepBaseCorreios($cepOrgao, 'O CEP do cadastro do órgão desta Unidade é inválido.
Faça contato com a Gestão do SEI do seu órgão para corrigir o CEP do órgão.'); if ($str_msg_validacaoCorreios != '') { - $str_msg_validacaoCorreios; + return $str_msg_validacaoCorreios; } } else { - $str_msg_validacaoCorreios = self::validarCepBaseCorreios($clienteWS, $cepOrgao, "O CEP do cadastro do órgão desta Unidade é inválido.\nFaça contato com a Gestão do SEI do seu órgão para corrigir o CEP do órgão."); + $str_msg_validacaoCorreios = self::validarCepBaseCorreios($cepOrgao, "O CEP do cadastro do órgão desta Unidade é inválido.\nFaça contato com a Gestão do SEI do seu órgão para corrigir o CEP do órgão."); if ($str_msg_validacaoCorreios != '') { return "false" . $str_msg_validacaoCorreios . ""; } @@ -458,7 +474,8 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) } } else { if($bolEntrada){ - $str_msg_validacaoCorreios = self::validarCepBaseCorreios($clienteWS, $cep, 'O CEP do Destinatário é inválido (não encontrado na base dos Correios).\nAltere o Contato do Destinatário para indicar um CEP válido.'); + $arrOpt = ['ufDest' => $objUFDTO->getStrSigla(),'cidadeDest' => $objCidadeDTO->getStrNome()]; + $str_msg_validacaoCorreios = self::validarCepBaseCorreios($cep, "O CEP do Destinatário é inválido (não encontrado na base dos Correios).
Altere o Contato do Destinatário para indicar um CEP válido.",$arrOpt); if ($str_msg_validacaoCorreios != '') { return $str_msg_validacaoCorreios; } @@ -467,7 +484,7 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) $str_msg_validacaoCep = "O CEP do Destinatário está com formato formato inválido.\nAltere o Contato do Destinatário para indicar o CEP no formato válido: XXXXX-YYY."; return "false" . $str_msg_validacaoCep . ""; } - $str_msg_validacaoCorreios = self::validarCepBaseCorreios($clienteWS, $cep, "O CEP do Destinatário é inválido, pois não existe na base de dados de CEPs dos Correios.\nAltere o Contato do Destinatário para indicar um CEP válido."); + $str_msg_validacaoCorreios = self::validarCepBaseCorreios($cep, "O CEP do Destinatário é inválido, pois não existe na base de dados de CEPs dos Correios.\nAltere o Contato do Destinatário para indicar um CEP válido."); if ($str_msg_validacaoCorreios != '') { return "false" . $str_msg_validacaoCorreios . ""; } @@ -475,7 +492,7 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) if ($enderecoOrgaoIncompleto) { if($bolEntrada){ - $str_msg_validacao_orgao = 'Os dados cadastrais do órgão desta Unidade estão incompletos.\nFaça contato com a Gestão do SEI do seu órgão para que preencham os dados cadastrais do órgão.'; + $str_msg_validacao_orgao = 'Os dados cadastrais do órgão desta Unidade estão incompletos.
Faça contato com a Gestão do SEI do seu órgão para que preencham os dados cadastrais do órgão.'; return $str_msg_validacao_orgao; } else { $str_msg_validacao_orgao = "Os dados cadastrais do órgão desta Unidade estão incompletos.\nFaça contato com a Gestão do SEI do seu órgão para que preencham os dados cadastrais do órgão."; @@ -484,7 +501,7 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) } } -//se for pessoa fisica checar ainda: Genero e Cargo + //se for pessoa fisica checar ainda: Genero e Cargo if ($natureza == ContatoRN::$TN_PESSOA_FISICA) { if ($idCargo == '') { @@ -516,25 +533,57 @@ public static function validaContatoPreeenchido($idContato, $bolEntrada = false) } return "false{$e->getMessage()}"; - } catch (SoapFault $soapFault) { - if($bolEntrada){ - return 'Problema ao acessar o Web Service dos Correios. Por Favor, tentar mais tarde.'; - } else { - return "falseProblema ao acessar o Web Service dos Correios. Por Favor, tentar mais tarde."; - } } } - public static function validarCepBaseCorreios($clienteWS, $cep, $msgErro) + public static function validarCepBaseCorreios($cep, $msgErro=null, $opt=null) { try { - $obj = $clienteWS->consultaCEP(['cep' => $cep])->return; - if (is_null($obj)) { - return $msgErro; + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + + $objMdCorIntegCEP = $objMdCorAdmIntegracaoRN->buscaIntegracaoPorFuncionalidade(MdCorAdmIntegracaoRN::$CEP); + if ( is_array( $objMdCorIntegCEP ) && isset( $objMdCorIntegCEP['suc'] ) && $objMdCorIntegCEP['suc'] === false ) + return 'Mapeamento de Integração '. MdCorAdmIntegracaoRN::$STR_CEP .' não existe ou está inativa.'; + + $arrParametro = [ + 'endpoint' => $objMdCorIntegCEP->getStrUrlOperacao(), + 'token' => $objMdCorIntegCEP->getStrToken(), + 'expiraEm' => $objMdCorIntegCEP->getDthDataExpiraToken(), + ]; + + $ret = $objMdCorAdmIntegracaoRN->verificaTokenExpirado($arrParametro, $objMdCorIntegCEP); + + // recupera algum erro sobre a validacao de token expirado + if ( is_array( $ret ) && isset( $ret['suc'] ) && $ret['suc'] === false ) + return "Falha na Integração: ". MdCorAdmIntegracaoRN::$STR_GERAR_TOKEN . ".\n". $ret['msg']; + + $objMdCorWsCEP = new MdCorApiRestRN($arrParametro); + + $ret = $objMdCorWsCEP->consultarCEP($cep); + + // recupera algum erro sobre o retorno do consultar CEP + if ( is_array( $ret ) && isset( $ret['suc'] ) && $ret['suc'] === false ) { + return "Falha na Integração: ". MdCorAdmIntegracaoRN::$STR_CEP . ".\n". $ret['msg']; } - return ''; + + //validacoes de dados do Endereço + if ( !empty( $opt ) ) { + if ( isset($opt['ufDest'] ) ) { + if ( $opt['ufDest'] != $ret['uf'] ) + return "Não foi possível iniciar ou alterar a Solicitação de Expedição, antes é necessário revisar o cadastro do Contato definido como Destinatário, pois a UF dele, \"{$opt['ufDest']}\", não está relacionada ao CEP " . self::criarMascara($cep,'#####-###'); + } + + if ( isset($opt['cidadeDest'] ) ) { + $cidadeREST = isset($ret['localidadeSuperior']) ? utf8_decode($ret['localidadeSuperior']) : utf8_decode($ret['localidade']); + if ( strcasecmp( InfraString::excluirAcentos($opt['cidadeDest']) , InfraString::excluirAcentos( $cidadeREST ) ) != 0 ) + return "Não foi possível iniciar ou alterar a Solicitação de Expedição, antes é necessário revisar o cadastro do Contato definido como Destinatário, pois a Cidade dele, \"{$opt['cidadeDest']}\", não está relacionada ao CEP " . self::criarMascara($cep,'#####-###'); + } + } + + return ''; + } catch (Exception $e) { - return $msgErro; + return $e->getMessage(); } } @@ -581,7 +630,7 @@ public static function validarDestinatarioIntimacaoEletronica($contatoDTO, $bolE if (count($listaContato) > 0) { if($bolEntrada){ - return $msgErro; + throw new Exception( str_replace('\n','
', $msgErro) ); } else { return "false" . $msgErro . ""; } @@ -592,7 +641,7 @@ public static function validarDestinatarioIntimacaoEletronica($contatoDTO, $bolE if (count($arrObjMdPetVinculoDTO) > 0) { if($bolEntrada){ - return $msgErro; + throw new Exception( str_replace('\n','
', $msgErro) ); } else { return "false" . $msgErro . ""; } @@ -604,7 +653,7 @@ public static function validarDestinatarioIntimacaoEletronica($contatoDTO, $bolE if (count($arrObjMdPetVinculoDTO) > 0) { if($bolEntrada){ - return $msgErro; + throw new Exception( str_replace('\n','
', $msgErro) ); } else { return "false" . $msgErro . ""; } @@ -618,7 +667,7 @@ public static function validarDestinatarioIntimacaoEletronica($contatoDTO, $bolE if (count($arrObjMdPetVinculoDTO) > 0) { if($bolEntrada){ - return $msgErro; + throw new Exception( str_replace('\n','
', $msgErro) ); } else { return "false" . $msgErro . ""; } @@ -634,7 +683,7 @@ public static function validarDestinatarioIntimacaoEletronica($contatoDTO, $bolE if (count($arrObjMdPetVinculoDTO) > 0) { if($bolEntrada){ - return $msgErro; + throw new Exception( str_replace('\n','
', $msgErro) ); } else { return "false" . $msgErro . ""; } @@ -643,9 +692,12 @@ public static function validarDestinatarioIntimacaoEletronica($contatoDTO, $bolE } } else { - if ($usuarioDTO->getStrStaTipo() == UsuarioRN::$TU_EXTERNO && - $usuarioDTO->getStrSinAtivo() == 'S') { - return "false" . $msgErro . ""; + if ($usuarioDTO->getStrStaTipo() == UsuarioRN::$TU_EXTERNO && $usuarioDTO->getStrSinAtivo() == 'S') { + if ( $bolEntrada ){ + throw new Exception( str_replace('\n','
', $msgErro) ); + } else { + return "false" . $msgErro . ""; + } } } } @@ -661,5 +713,23 @@ public static function validarPetVinculoUsuarioExterno( $arrIdContato ){ $objMdPetVinculoRN = new MdPetVinculoRN(); return $objMdPetVinculoRN->listar($objMdPetVinculoDTO); } + + public static function criarMascara($val, $mask){ + $maskared = ''; + $k = 0; + for ($i = 0; $i <= strlen($mask) - 1; ++$i) { + if ($mask[$i] == '#') { + if (isset($val[$k])) { + $maskared .= $val[$k++]; + } + } else { + if (isset($mask[$i])) { + $maskared .= $mask[$i]; + } + } + } + + return $maskared; + } } ?> \ No newline at end of file diff --git a/sei/web/modulos/correios/int/MdCorMensagemINT.php b/sei/web/modulos/correios/int/MdCorMensagemINT.php new file mode 100644 index 0000000..57d36d6 --- /dev/null +++ b/sei/web/modulos/correios/int/MdCorMensagemINT.php @@ -0,0 +1,42 @@ + 1; + + if($isPersonalizada && !is_null($arrParams)){ + $msgPersonalizada = self::setMensagemPadraoPersonalizada($msg, $arrParams); + return $msgPersonalizada; + } + + return $msg; + } + + public static function setMensagemPadraoPersonalizada($msg, $arrParametros = null) + { + if(!is_array($arrParametros)){ + $arrParametros = array($arrParametros); + } + + if ($msg != '') { + $arrSubstituicao = array(); + + foreach ($arrParametros as $key => $param) { + $vl = $key + 1; + $arrSubstituicao[] = '@VALOR' . $vl . '@'; + } + $msgRetorno = str_replace($arrSubstituicao, $arrParametros, $msg); + return $msgRetorno; + } + + return ''; + } + +} diff --git a/sei/web/modulos/correios/int/MdCorObjetoINT.php b/sei/web/modulos/correios/int/MdCorObjetoINT.php index 93b7325..3efe3f8 100644 --- a/sei/web/modulos/correios/int/MdCorObjetoINT.php +++ b/sei/web/modulos/correios/int/MdCorObjetoINT.php @@ -31,4 +31,18 @@ public static function montarSelectIdMdCorTipoObjeto($strPrimeiroItemValor, $str return parent::montarSelectArrInfraDTO($strPrimeiroItemValor, $strPrimeiroItemDescricao, $strValorItemSelecionado, $arrObjMdCorObjetoDTO, 'IdMdCorObjeto', 'IdMdCorTipoObjeto'); } + + public static function UTF8_Decode($str){ + if ( !empty($str) ) { + return utf8_decode($str); + } + } + + public static function trataHoraAndamento( $hr ){ + if ( !empty($hr) ) { + $arrHr = explode(':' , $hr); + $arrHr[2] = '00'; + return implode(':' , $arrHr); + } + } } diff --git a/sei/web/modulos/correios/int/MdCorParametroRastreioINT.php b/sei/web/modulos/correios/int/MdCorParametroRastreioINT.php deleted file mode 100644 index eb86ea6..0000000 --- a/sei/web/modulos/correios/int/MdCorParametroRastreioINT.php +++ /dev/null @@ -1,61 +0,0 @@ -retNumIdMdCorParametroRastreio(); - - $objMdCorParametroRastreioDTO->setOrdNumIdMdCorParametroRastreio(InfraDTO::$TIPO_ORDENACAO_ASC); - - $objMdCorParametroRastreioRN = new MdCorParametroRastreioRN(); - $arrObjMdCorParametroRastreioDTO = $objMdCorParametroRastreioRN->listar($objMdCorParametroRastreioDTO); - - return parent::montarSelectArrInfraDTO($strPrimeiroItemValor, $strPrimeiroItemDescricao, $strValorItemSelecionado, $arrObjMdCorParametroRastreioDTO, '', 'IdMdCorParametroRastreio'); - } - - public static function gerarXMLvalidacaoRastreio($dadosPost) { - - $existe = strrpos($dadosPost['endereco'], 'http://'); - $endereco = ""; - - if(is_int($existe)){ - $endereco = $dadosPost['endereco']; - } else { - $endereco = 'http://' . $dadosPost['endereco']; - } - - $arrDados = [ - 'endpoint' => $endereco, - 'usuario' => $dadosPost['usuario'], - 'senha' => $dadosPost['senha'] - ]; - $objMdCorWsRastreio = new MdCorWsRastreioRN($arrDados); - $verifica = $objMdCorWsRastreio->rastrearObjeto('0'); - if (is_array($verifica)) { - if ($verifica['objeto']['numero'] == 'Erro') { - $xml = ''; - $xml .= 'true'; - $xml .= '' . $verifica['objeto']['erro'] . ''; - $xml .= ''; - } - } elseif ($verifica == false) { - $xml = ''; - $xml .= 'true'; - $xml .= 'Endereço WSDL preenchido incorretamente.'; - $xml .= ''; - } - - return $xml; - } - -} diff --git a/sei/web/modulos/correios/int/MdCorPlpINT.php b/sei/web/modulos/correios/int/MdCorPlpINT.php index 3cddf2b..e7790cb 100644 --- a/sei/web/modulos/correios/int/MdCorPlpINT.php +++ b/sei/web/modulos/correios/int/MdCorPlpINT.php @@ -99,5 +99,30 @@ public static function verificarImpressaoAR($numIdPlp, $arrNumItemSelecionado) { "; } - + + /* + * Função criada a partir da documentação disponibilizada pelos Correios + * https://www.correios.com.br/atendimento/developers/arquivos/layout-para-postagem-eletronica-para-ambito-nacional-sara + * */ + public static function geraDigitoVerificador($num){ + $total = 0; + $arrPesos = [8,6,4,2,3,5,9,7]; + $digito = null; + $arrLista = str_split($num); + + foreach ( $arrLista as $k => $v ) { + // num * peso + $total += (int) $v * $arrPesos[$k]; + } + + $resto = $total % 11; + + if ( $resto > 1 ) { + $digito = 11 - $resto; + } else { + $digito = $resto == 1 ? 0 : 5; + } + return $digito; + } + } diff --git a/sei/web/modulos/correios/int/MdCorServicoPostalINT.php b/sei/web/modulos/correios/int/MdCorServicoPostalINT.php index dfae93c..eb18e70 100644 --- a/sei/web/modulos/correios/int/MdCorServicoPostalINT.php +++ b/sei/web/modulos/correios/int/MdCorServicoPostalINT.php @@ -58,10 +58,26 @@ public static function montarSelectId_Descricao_MdCorServicoPostal($strPrimeiroI return parent::montarSelectArrInfraDTO($strPrimeiroItemValor, $strPrimeiroItemDescricao, $strValorItemSelecionado, $arrObjMdCorServicoPostalDTO, 'IdMdCorServicoPostal', 'Descricao'); } - public static function retornarServicosPostais($strNumeroContratoCorreio, $strNumeroCartaoPostagem, $strUrlWebservice, $usuario, $senha) { - $xml = MdCorClientWsRN::buscarServicosPostais($strNumeroContratoCorreio,$strNumeroCartaoPostagem, $strUrlWebservice, $usuario, $senha); - return $xml; - } + public static function retornarServicosPostais($strNumeroContratoCorreio, $strCnpj) { + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + + $objMdCorIntegServPostal = $objMdCorAdmIntegracaoRN->buscaIntegracaoPorFuncionalidade(MdCorAdmIntegracaoRN::$SERV_POSTAL); + if ( empty( $objMdCorIntegServPostal ) || is_array($objMdCorIntegServPostal) && isset($objMdCorIntegServPostal['suc']) && $objMdCorIntegServPostal['suc'] === false ) + return self::retornarXmlServicosPostais(['suc' => false , 'msg' => 'Mapeamento de Integração '. MdCorAdmIntegracaoRN::$STR_SERV_POSTAL .' não existe ou está inativo.']); + + $arrParametro = [ + 'endpoint' => $objMdCorIntegServPostal->getStrUrlOperacao(), + 'token' => $objMdCorIntegServPostal->getStrToken(), + 'expiraEm' => $objMdCorIntegServPostal->getDthDataExpiraToken(), + ]; + + $ret = $objMdCorAdmIntegracaoRN->verificaTokenExpirado($arrParametro, $objMdCorIntegServPostal); + if ( is_array( $ret ) && array_key_exists('suc',$ret) && $ret['suc'] === false ) return self::retornarXmlServicosPostais($ret); + + $objMdCorApiServPostal = new MdCorApiRestRN($arrParametro); + $xml = self::retornarXmlServicosPostais( $objMdCorApiServPostal->buscarServicosPostais($strNumeroContratoCorreio, $strCnpj) ); + return $xml; + } public static function montarSelectIdDescricaoMdCorServicoPostalSolicitacaoExpedicao($strPrimeiroItemValor, $strPrimeiroItemDescricao, $strValorItemSelecionado, $numIdMdCorContrato='', $campoordenacao='IdMdCorServicoPostal'){ $objMdCorServicoPostalDTO = new MdCorServicoPostalDTO(); @@ -109,24 +125,45 @@ public static function validaArqExt($arrParams){ $arrExibir = []; $arrNaoExibir = []; - foreach ( $arrIdsProt as $k => $prot ) { - $somenteMidia = filter_var( MdCorExpedicaoSolicitadaProtocoloAnexoINT::verificarAnexoSomenteMidia($prot , false) ,FILTER_VALIDATE_BOOLEAN ); - - if ( $strPermiteGravarMidia == 'N' ) { - if ( $somenteMidia ) { - array_push($arrNaoExibir ,$prot.'#'.$arrDescDoc[$k] ); - } else { - array_push($arrExibir ,$prot.'#'.$arrDescDoc[$k] ); - } - } else { - array_push($arrExibir ,$prot.'#'.$arrDescDoc[$k] ); - } - } - $strListaExibir = ''.implode(';' ,$arrExibir ).''; + if ( $arrIdsProt ) { + foreach ($arrIdsProt as $k => $prot) { + $somenteMidia = filter_var(MdCorExpedicaoSolicitadaProtocoloAnexoINT::verificarAnexoSomenteMidia($prot, false), FILTER_VALIDATE_BOOLEAN); + + if ($strPermiteGravarMidia == 'N') { + if ($somenteMidia) { + array_push($arrNaoExibir, $prot . '#' . $arrDescDoc[$k]); + } else { + array_push($arrExibir, $prot . '#' . $arrDescDoc[$k]); + } + } else { + array_push($arrExibir, $prot . '#' . $arrDescDoc[$k]); + } + } + } + $strListaExibir = !empty($arrExibir) ? ''.implode(';' ,$arrExibir ).'' : ''; $strListaNaoExibir = !empty($arrNaoExibir) ? ''.implode(';' ,$arrNaoExibir ).'' : ''; return $strListaExibir . $strListaNaoExibir; } + public static function retornarXmlServicosPostais($dados){ + // se ocorreu algum erro, gera uma exception + $msg = 'Erro na busca dos Serviços Postais:'; + + if ( array_key_exists('suc',$dados) && $dados['suc'] === false ) { + $msg .= "
" . $dados['msg']; + return ""; + } + + // continua fluxo + $xml = ""; + foreach($dados['itens'] as $servico) + { + $xml .= "{$servico['descricao']}{$servico['codigo']}{$servico['codigo']}"; + } + $xml .= ""; + return $xml; + } + } ?> \ No newline at end of file diff --git a/sei/web/modulos/correios/lib/zbar/composer.json b/sei/web/modulos/correios/lib/zbar/composer.json new file mode 100644 index 0000000..7ced67e --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "robbiep/zbar-qrdecoder": "^2.0" + } +} diff --git a/sei/web/modulos/correios/lib/zbar/composer.lock b/sei/web/modulos/correios/lib/zbar/composer.lock new file mode 100644 index 0000000..a1ddfaa --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/composer.lock @@ -0,0 +1,133 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "389c70a25ddf925d206d5e2434c4c206", + "packages": [ + { + "name": "robbiep/zbar-qrdecoder", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/robbiepaul/zbar-qrdecoder.git", + "reference": "ca652762b28745e8e470ee43f006a2691403c4e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/robbiepaul/zbar-qrdecoder/zipball/ca652762b28745e8e470ee43f006a2691403c4e8", + "reference": "ca652762b28745e8e470ee43f006a2691403c4e8", + "shasum": "" + }, + "require": { + "php": ">=5.5.0", + "symfony/process": "^3.0" + }, + "require-dev": { + "mockery/mockery": "0.9.*@dev", + "phpunit/phpunit": "4.3.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "RobbieP\\ZbarQrdecoder\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Robbie Paul", + "email": "robbiepaul@me.com" + } + ], + "description": "A PHP wrapper for Zbar. Decodes images/photos containing QR codes.", + "keywords": [ + "decode", + "laravel", + "php", + "qr", + "qrcode", + "zbar" + ], + "support": { + "issues": "https://github.com/robbiepaul/zbar-qrdecoder/issues", + "source": "https://github.com/robbiepaul/zbar-qrdecoder/tree/2.x" + }, + "time": "2016-03-13T16:05:08+00:00" + }, + { + "name": "symfony/process", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/b8648cf1d5af12a44a51d07ef9bf980921f15fca", + "reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-24T10:57:07+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.6.0" +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/autoload.php b/sei/web/modulos/correios/lib/zbar/vendor/autoload.php new file mode 100644 index 0000000..f9bef6b --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/autoload.php @@ -0,0 +1,25 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + + // PSR-4 + /** + * @var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var list + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ + private $prefixesPsr0 = array(); + /** + * @var list + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var array + */ + private $missingClasses = array(); + + /** @var string|null */ + private $apcuPrefix; + + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return list + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return list + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return array Array of classname => path + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + $includeFile = self::$includeFile; + $includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } + + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/composer/InstalledVersions.php b/sei/web/modulos/correios/lib/zbar/vendor/composer/InstalledVersions.php new file mode 100644 index 0000000..51e734a --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/composer/InstalledVersions.php @@ -0,0 +1,359 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints((string) $constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; + } else { + self::$installed = array(); + } + } + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } + + return $installed; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/composer/LICENSE b/sei/web/modulos/correios/lib/zbar/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_classmap.php b/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..0fb0a2c --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_classmap.php @@ -0,0 +1,10 @@ + $vendorDir . '/composer/InstalledVersions.php', +); diff --git a/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_namespaces.php b/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..2dd4a95 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_namespaces.php @@ -0,0 +1,10 @@ + array($vendorDir . '/robbiep/zbar-qrdecoder/src'), +); diff --git a/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_psr4.php b/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_psr4.php new file mode 100644 index 0000000..a61a490 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_psr4.php @@ -0,0 +1,10 @@ + array($vendorDir . '/symfony/process'), +); diff --git a/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_real.php b/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_real.php new file mode 100644 index 0000000..ce58cbd --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_real.php @@ -0,0 +1,38 @@ +register(true); + + return $loader; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_static.php b/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_static.php new file mode 100644 index 0000000..881e255 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/composer/autoload_static.php @@ -0,0 +1,47 @@ + + array ( + 'Symfony\\Component\\Process\\' => 26, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Symfony\\Component\\Process\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/process', + ), + ); + + public static $prefixesPsr0 = array ( + 'R' => + array ( + 'RobbieP\\ZbarQrdecoder\\' => + array ( + 0 => __DIR__ . '/..' . '/robbiep/zbar-qrdecoder/src', + ), + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit389c70a25ddf925d206d5e2434c4c206::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit389c70a25ddf925d206d5e2434c4c206::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInit389c70a25ddf925d206d5e2434c4c206::$prefixesPsr0; + $loader->classMap = ComposerStaticInit389c70a25ddf925d206d5e2434c4c206::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/composer/installed.json b/sei/web/modulos/correios/lib/zbar/vendor/composer/installed.json new file mode 100644 index 0000000..8bc8e5a --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/composer/installed.json @@ -0,0 +1,126 @@ +{ + "packages": [ + { + "name": "robbiep/zbar-qrdecoder", + "version": "2.0.2", + "version_normalized": "2.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/robbiepaul/zbar-qrdecoder.git", + "reference": "ca652762b28745e8e470ee43f006a2691403c4e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/robbiepaul/zbar-qrdecoder/zipball/ca652762b28745e8e470ee43f006a2691403c4e8", + "reference": "ca652762b28745e8e470ee43f006a2691403c4e8", + "shasum": "" + }, + "require": { + "php": ">=5.5.0", + "symfony/process": "^3.0" + }, + "require-dev": { + "mockery/mockery": "0.9.*@dev", + "phpunit/phpunit": "4.3.5" + }, + "time": "2016-03-13T16:05:08+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "RobbieP\\ZbarQrdecoder\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Robbie Paul", + "email": "robbiepaul@me.com" + } + ], + "description": "A PHP wrapper for Zbar. Decodes images/photos containing QR codes.", + "keywords": [ + "decode", + "laravel", + "php", + "qr", + "qrcode", + "zbar" + ], + "support": { + "issues": "https://github.com/robbiepaul/zbar-qrdecoder/issues", + "source": "https://github.com/robbiepaul/zbar-qrdecoder/tree/2.x" + }, + "install-path": "../robbiep/zbar-qrdecoder" + }, + { + "name": "symfony/process", + "version": "v3.4.47", + "version_normalized": "3.4.47.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/b8648cf1d5af12a44a51d07ef9bf980921f15fca", + "reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "time": "2020-10-24T10:57:07+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v3.4.47" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/process" + } + ], + "dev": true, + "dev-package-names": [] +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/composer/installed.php b/sei/web/modulos/correios/lib/zbar/vendor/composer/installed.php new file mode 100644 index 0000000..27a4599 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/composer/installed.php @@ -0,0 +1,41 @@ + array( + 'name' => '__root__', + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'reference' => NULL, + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => true, + ), + 'versions' => array( + '__root__' => array( + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'reference' => NULL, + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'robbiep/zbar-qrdecoder' => array( + 'pretty_version' => '2.0.2', + 'version' => '2.0.2.0', + 'reference' => 'ca652762b28745e8e470ee43f006a2691403c4e8', + 'type' => 'library', + 'install_path' => __DIR__ . '/../robbiep/zbar-qrdecoder', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/process' => array( + 'pretty_version' => 'v3.4.47', + 'version' => '3.4.47.0', + 'reference' => 'b8648cf1d5af12a44a51d07ef9bf980921f15fca', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/process', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +); diff --git a/sei/web/modulos/correios/lib/zbar/vendor/composer/platform_check.php b/sei/web/modulos/correios/lib/zbar/vendor/composer/platform_check.php new file mode 100644 index 0000000..d673084 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 50509)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 5.5.9". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/.gitignore b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/.gitignore new file mode 100644 index 0000000..6a9eec9 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/.gitignore @@ -0,0 +1,7 @@ +/vendor +composer.phar +composer.lock +.DS_Store +/tests/html +.idea +/examples \ No newline at end of file diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/.travis.yml b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/.travis.yml new file mode 100644 index 0000000..ba46bc9 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/.travis.yml @@ -0,0 +1,11 @@ +language: php + +php: + - 5.5 + - 5.6 + +before_script: + - travis_retry composer self-update + - travis_retry composer install --prefer-source --no-interaction --dev + +script: phpunit diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/README.md b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/README.md new file mode 100644 index 0000000..06dbf32 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/README.md @@ -0,0 +1,85 @@ + + + +# ZBar QR code decoder for PHP +[![Build Status](https://travis-ci.org/robbiepaul/zbar-qrdecoder.svg?branch=master)](https://travis-ci.org/robbiepaul/zbar-qrdecoder) [![Latest Stable Version](https://poser.pugx.org/robbiep/zbar-qrdecoder/v/stable)](https://packagist.org/packages/robbiep/zbar-qrdecoder) [![Total Downloads](https://poser.pugx.org/robbiep/zbar-qrdecoder/downloads)](https://packagist.org/packages/robbiep/zbar-qrdecoder) [![Latest Unstable Version](https://poser.pugx.org/robbiep/zbar-qrdecoder/v/unstable)](https://packagist.org/packages/robbiep/zbar-qrdecoder) [![License](https://poser.pugx.org/robbiep/zbar-qrdecoder/license)](https://packagist.org/packages/robbiep/zbar-qrdecoder) + +This is a PHP wrapper for `zbar-tools` - (only `zbarimg` at the moment). See [http://zbar.sourceforge.net/](http://zbar.sourceforge.net/). + + + +## Requirements +* __zbar-tools__ - To install on Ubuntu it's as easy as `sudo apt-get install zbar-tools`. See their [project page](http://zbar.sourceforge.net/) for more platforms. +* __ImageMagick__ - It's required by Zbar, I'm not sure if they bundle it or not so make sure you have it + + +## Installation + +Install this package through [Composer](https://getcomposer.org/). + +Add this to your `composer.json` dependencies: + +```js +"require": { + "robbiep/zbar-qrdecoder": "^2.0" +} +``` + +Run `composer install` to download the required files. + +## Usage + +```php +require_once('vendor/autoload.php'); + +$ZbarDecoder = new RobbieP\ZbarQrdecoder\ZbarDecoder(); + +# Optionally change the path of the zbarimg executable if you need to (default: /usr/bin) +$ZbarDecoder->setPath('/usr/local/bin'); + +# Decode the image +$result = $ZbarDecoder->make('/a/path/to/image_with_barcode.jpg'); + +echo $result; // Outputs the decoded text +echo $result->format; // Outputs the barcode's format +echo $result->code; // 200 if it decoded a barcode OR 400 if it couldn't find a barcode. +``` + +## If you're using it in Laravel... +I've included a ServiceProvider class and a config if you need to change any options. Yyou need to add the ServiceProvider to `config/app.php` + +```php +'providers' => array( + ... + 'RobbieP\ZbarQrdecoder\ZbarQrdecoderServiceProvider' +) +``` + +You may need to publish the config `php artisan vendor:publish` + +Now you can use Zbar QR Decoder in your Laravel application! + +### Usage (in Laravel) + +```php +# Decode the image +$result = ZbarDecoder::make('/a/path/to/image_with_barcode.png'); + +echo $result; // Outputs the decoded text +echo $result->format; // Outputs the barcode's format +``` + +## Other barcodes supported +* EAN_13 / ISBN +* CODE_39 +* CODE_128 + +## Contributing + +1. Fork it +2. Create your feature branch: `git checkout -b my-new-feature` +3. Commit your changes: `git commit -am 'Add some feature'` +4. Push to the branch: `git push origin my-new-feature` +5. Submit a pull request + + diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/composer.json b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/composer.json new file mode 100644 index 0000000..99fbe8f --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/composer.json @@ -0,0 +1,26 @@ +{ + "name": "robbiep/zbar-qrdecoder", + "description": "A PHP wrapper for Zbar. Decodes images/photos containing QR codes.", + "keywords": ["zbar","qr","qrcode","decode","php","laravel"], + "license": "MIT", + "authors": [ + { + "name": "Robbie Paul", + "email": "robbiepaul@me.com" + } + ], + "require": { + "php": ">=5.5.0", + "symfony/process": "^3.0" + }, + "require-dev" : { + "phpunit/phpunit": "4.3.5", + "mockery/mockery": "0.9.*@dev" + }, + "autoload": { + "psr-0": { + "RobbieP\\ZbarQrdecoder\\": "src/" + } + }, + "minimum-stability": "stable" +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/phpunit.xml b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/phpunit.xml new file mode 100644 index 0000000..3347b75 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/phpunit.xml @@ -0,0 +1,18 @@ + + + + + ./tests/ + + + diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Facades/ZbarDecoder.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Facades/ZbarDecoder.php new file mode 100644 index 0000000..e2e6af3 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Facades/ZbarDecoder.php @@ -0,0 +1,16 @@ +text($error); + $this->format(self::NOT_FOUND); + $this->code = 400; + } + + /** + * @param $text + */ + public function text($text) + { + $this->text = $text; + } + + /** + * @param $format + */ + public function format($format) + { + $this->format = $format; + } +} \ No newline at end of file diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/Parser/ParserInterface.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/Parser/ParserInterface.php new file mode 100644 index 0000000..c5440a4 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/Parser/ParserInterface.php @@ -0,0 +1,9 @@ +source->index->symbol[0]->data; + $parsed['format'] = (string) $xml->source->index->symbol[0]['type']; + return $parsed; + } + +} \ No newline at end of file diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/Result.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/Result.php new file mode 100644 index 0000000..84f1bfb --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/Result.php @@ -0,0 +1,85 @@ + "QR-Code", + self::FORMAT_EAN_13 => "EAN-13", + self::FORMAT_CODE_39 => "CODE-39", + self::FORMAT_CODE_128 => "CODE-128", + self::FORMAT_INTERLEAVED_2_5 => "I2/5", + ]; + + protected $parser; + + /** + * Pass in the raw result from the process + * @param $result + * @param $parser + */ + function __construct($result, $parser = null) { + $this->parser = !is_null($parser) ? $parser : new ParserXML(); + if(!empty($result)) + { + $parsed = $this->parser->parse($result); + // TODO: Tidy/Refactor this bit of code + $this->text($parsed['text']); + $this->format($parsed['format']); + } + } + + /** + * Will determine what type of barcode and set the correct text response + * @param $text + */ + public function text($text) + { + $this->text = $text; + } + + /** + * Format of the bar code + * @param $format + */ + public function format($format) + { + $this->format = @array_search($format, self::$prefix); + if($this->format) { + $this->code = 200; + } + } + + /** + * Just returns the text output + * @return string + */ + public function __toString() + { + if(!empty($this->text)) { + return $this->text; + } + return 'No result'; + } + +} \ No newline at end of file diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/ResultInterface.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/ResultInterface.php new file mode 100644 index 0000000..08c489c --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/Result/ResultInterface.php @@ -0,0 +1,9 @@ +config = $config; + if(isset($this->config['path'])) { + $this->setPath($this->config['path']); + } + $this->processBuilder = is_null($processBuilder) ? new ProcessBuilder() : $processBuilder; + } + + /** + * Main constructor - builds the process, runs it then returns the Result object + * @param $filename + * @return mixed + * @throws \Exception + */ + public function make($filename) + { + $this->setFilepath($filename); + $this->buildProcess(); + $this->runProcess(); + return $this->output(); + } + + /** + * Returns the path to the executable zbarimg + * Defaults to /usr/bin + * @throws \Exception + * @return mixed + */ + public function getPath() + { + if(! $this->path ) { + $this->setPath('/usr/bin'); + } + return $this->path; + } + + /** + * @param mixed $path + */ + public function setPath($path) + { + $this->path = rtrim($path, DIRECTORY_SEPARATOR); + } + + /** + * @return mixed + */ + public function getFilepath() + { + return $this->file_path; + } + + /** + * @param mixed $filepath + * @throws \Exception + */ + public function setFilepath($filepath) + { + if(! is_file($filepath) ) { + throw new \Exception('Invalid filepath given'); + } + $this->file_path = $filepath; + } + + /** + * Builds the process + * TODO: Configurable arguments + * @throws \Exception + */ + private function buildProcess() + { + $path = $this->getPath(); + $this->processBuilder->setPrefix($path . DIRECTORY_SEPARATOR . static::EXECUTABLE); + $this->processBuilder->setArguments(array('-D', '--xml', '-q', $this->getFilepath()))->enableOutput(); + } + + /** + * Runs the process + * @throws \Exception + */ + private function runProcess() + { + $process = $this->processBuilder->getProcess(); + try { + $process->mustRun(); + $this->result = new Result($process->getOutput()); + } catch (ProcessFailedException $e) { + switch($e->getProcess()->getExitCode()) { + case 1: + throw new \Exception('An error occurred while processing the image. It could be bad arguments, I/O errors and image handling errors from ImageMagick'); + case 2: + throw new \Exception('ImageMagick fatal error'); + case 4: + $this->result = new ErrorResult('No barcode detected'); + break; + default: + throw new \Exception('Problem with decode - check you have zbar-tools installed'); + } + } + + } + + /** + * Only return the output class to the end user + * @return mixed + */ + private function output() + { + return $this->result; + } + +} \ No newline at end of file diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProvider.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProvider.php new file mode 100644 index 0000000..825cf33 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProvider.php @@ -0,0 +1,81 @@ +provider = $this->getProvider(); + } + + /** + * Bootstrap the application events. + * + * @return void + */ + public function boot() + { + $this->provider->boot(); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->provider->register(); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array('zbardecoder'); + } + + /** + * Return ServiceProvider according to Laravel version + * + * @return \Illuminate\Support\ServiceProvider + */ + private function getProvider() + { + $provider = '\RobbieP\ZbarQrdecoder\ZbarQrdecoderServiceProviderLaravel5'; + + if (version_compare(Application::VERSION, '5.0', '<')) { + $provider = '\RobbieP\ZbarQrdecoder\ZbarQrdecoderServiceProviderLaravel4'; + } + + return new $provider($this->app); + } + +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProviderLaravel4.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProviderLaravel4.php new file mode 100644 index 0000000..f7d9c6f --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProviderLaravel4.php @@ -0,0 +1,41 @@ +package('robbiep/zbar-qrdecoder'); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app['zbardecoder'] = $this->app->share(function($app) + { + $processBuilder = new ProcessBuilder(); + $config = $app['config']->get('zbar-qrdecoder::config'); + return new ZbarDecoder($config, $processBuilder); + }); + + $this->app->booting(function() + { + $loader = AliasLoader::getInstance(); + $loader->alias('ZbarDecoder', 'RobbieP\ZbarQrdecoder\Facades\ZbarDecoder'); + }); + } + +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProviderLaravel5.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProviderLaravel5.php new file mode 100644 index 0000000..ea3c191 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/RobbieP/ZbarQrdecoder/ZbarQrdecoderServiceProviderLaravel5.php @@ -0,0 +1,42 @@ +publishes([ + __DIR__ . '/../../config/config.php' => config_path('zbar-qrdecoder.php'), + ]); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app['zbardecoder'] = $this->app->share(function($app) + { + $processBuilder = new ProcessBuilder(); + $config = $app['config']->get('zbar-qrdecoder::config'); + return new ZbarDecoder($config, $processBuilder); + }); + + $this->app->booting(function() + { + $loader = AliasLoader::getInstance(); + $loader->alias('ZbarDecoder', 'RobbieP\ZbarQrdecoder\Facades\ZbarDecoder'); + }); + } + +} diff --git a/sei/web/modulos/correios/md_cor_parametrizacao_rastreio_lista_css.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/config/.gitkeep similarity index 100% rename from sei/web/modulos/correios/md_cor_parametrizacao_rastreio_lista_css.php rename to sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/config/.gitkeep diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/config/config.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/config/config.php new file mode 100644 index 0000000..20c9277 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/src/config/config.php @@ -0,0 +1,18 @@ + '/usr/bin' + + +); + + diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/.gitkeep b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ErrorResultTest.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ErrorResultTest.php new file mode 100644 index 0000000..a5f764e --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ErrorResultTest.php @@ -0,0 +1,21 @@ +result = null; + } + + public function testErrorResult() + { + $this->result = new \RobbieP\ZbarQrdecoder\Result\ErrorResult("No barcode was found"); + $this->assertEquals(\RobbieP\ZbarQrdecoder\Result\ErrorResult::NOT_FOUND, $this->result->format); + $this->assertEquals(400, $this->result->code); + $this->assertEquals("No barcode was found", $this->result->text); + } + +} + \ No newline at end of file diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ResultTest.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ResultTest.php new file mode 100644 index 0000000..df8cbe1 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ResultTest.php @@ -0,0 +1,63 @@ +result = null; + } + + public function testQRbarcodeResult() + { + $this->result = new \RobbieP\ZbarQrdecoder\Result\Result(" + + + + + +"); + $this->assertEquals(\RobbieP\ZbarQrdecoder\Result\Result::FORMAT_QR_CODE, $this->result->format); + $this->assertEquals(200, $this->result->code); + $this->assertEquals("http://robbiepaul.co", $this->result->text); + $this->assertEquals("http://robbiepaul.co", $this->result); + } + + public function testQRbarcodeNoResult() + { + $this->result = new \RobbieP\ZbarQrdecoder\Result\Result(""); + $this->assertEquals("No result", $this->result); + } + + public function testEANbarcodeResult() + { + $this->result = new \RobbieP\ZbarQrdecoder\Result\Result(" + + + + + +"); + $this->assertEquals(\RobbieP\ZbarQrdecoder\Result\Result::FORMAT_EAN_13, $this->result->format); + $this->assertEquals(200, $this->result->code); + $this->assertEquals("1234567890123", $this->result->text); + } + + public function testCODE39barcodeResult() + { + $this->result = new \RobbieP\ZbarQrdecoder\Result\Result(" + + + + + +"); + $this->assertEquals(\RobbieP\ZbarQrdecoder\Result\Result::FORMAT_CODE_39, $this->result->format); + $this->assertEquals(200, $this->result->code); + $this->assertEquals("1234567890123", $this->result->text); + } + +} + \ No newline at end of file diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ZbarDecoderTest.php b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ZbarDecoderTest.php new file mode 100644 index 0000000..ebd8bd3 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/ZbarDecoderTest.php @@ -0,0 +1,240 @@ +processBuilder = Mockery::mock('\Symfony\Component\Process\ProcessBuilder'); + $this->ZbarDecoder = new \RobbieP\ZbarQrdecoder\ZbarDecoder([], $this->processBuilder); + } + + public function tearDown() + { + $this->ZbarDecoder = null; + } + + public function testSetPathWorks() + { + $this->ZbarDecoder->setPath('/usr/local/bin/'); + $this->assertEquals('/usr/local/bin', $this->ZbarDecoder->getPath()); + } + + /** + * Expect exception because file doesnt exist + * @expectedException Exception + */ + public function testSetFilePathWorksOnInvalidFileGiven() + { + $this->ZbarDecoder->setFilePath('a/path/image.jpg'); + } + + public function testSetFilePathWorks() + { + $this->ZbarDecoder->setFilePath(__DIR__.'/stubs/tc.jpg'); + $this->assertEquals(__DIR__.'/stubs/tc.jpg', $this->ZbarDecoder->getFilePath()); + } + + public function testConfigWorksIfPassedAsArrayInConstructor() + { + $ZbarDecoder = new \RobbieP\ZbarQrdecoder\ZbarDecoder(['path'=>'/new/bin/']); + $this->assertEquals('/new/bin', $ZbarDecoder->getPath()); + } + + public function testDefaultPathWorks() + { + $ZbarDecoder = new \RobbieP\ZbarQrdecoder\ZbarDecoder([]); + $this->assertEquals('/usr/bin', $ZbarDecoder->getPath()); + } + + public function testMakeWorks() + { + $processBuilder = $this->getMockBuilder('\Symfony\Component\Process\ProcessBuilder')->disableOriginalConstructor()->getMock(); + $process = $this->getMockBuilder('\Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock(); + + $process->expects($this->any()) + ->method('mustRun') + ->will($this->returnValue(true)); + + $processBuilder->expects($this->any()) + ->method('setPrefix') + ->will($this->returnValue(true)); + $processBuilder->expects($this->any()) + ->method('setArguments') + ->will($this->returnSelf()); + $processBuilder->expects($this->any()) + ->method('enableOutput') + ->will($this->returnValue(true)); + $processBuilder->expects($this->any()) + ->method('getProcess') + ->will($this->returnValue($process)); + + $this->ZbarDecoder = new \RobbieP\ZbarQrdecoder\ZbarDecoder([], $processBuilder); + $this->ZbarDecoder->make(__DIR__.'/stubs/tc.jpg'); + $this->assertEquals(__DIR__.'/stubs/tc.jpg', $this->ZbarDecoder->getFilePath()); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage An error occurred while processing the image. It could be bad arguments, I/O errors and image handling errors from ImageMagick + */ + public function testRunProcessThrowsErrorBadArgs() + { + $processBuilder = $this->getMockBuilder('\Symfony\Component\Process\ProcessBuilder')->disableOriginalConstructor()->getMock(); + $process = $this->getMockBuilder('\Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock(); + $exception = $this->getMockBuilder('\Symfony\Component\Process\Exception\ProcessFailedException')->disableOriginalConstructor()->getMock(); + + $processBuilder->expects($this->any()) + ->method('getProcess') + ->will($this->returnValue($process)); + + $exception->expects($this->any()) + ->method('getProcess') + ->will($this->returnValue($process)); + + $process->expects($this->any()) + ->method('mustRun') + ->will($this->throwException($exception)); + + $process->expects($this->any()) + ->method('getExitCode') + ->will($this->returnValue(1)); + $processBuilder->expects($this->any()) + ->method('setPrefix') + ->will($this->returnValue(true)); + $processBuilder->expects($this->any()) + ->method('setArguments') + ->will($this->returnSelf()); + $processBuilder->expects($this->any()) + ->method('enableOutput') + ->will($this->returnValue(true)); + + $this->ZbarDecoder = new \RobbieP\ZbarQrdecoder\ZbarDecoder([], $processBuilder); + $this->ZbarDecoder->make(__DIR__.'/stubs/tc.jpg'); + $this->assertEquals(__DIR__.'/stubs/tc.jpg', $this->ZbarDecoder->getFilePath()); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage ImageMagick fatal error + */ + public function testRunProcessThrowsErrorImageMagick() + { + $processBuilder = $this->getMockBuilder('\Symfony\Component\Process\ProcessBuilder')->disableOriginalConstructor()->getMock(); + $process = $this->getMockBuilder('\Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock(); + $exception = $this->getMockBuilder('\Symfony\Component\Process\Exception\ProcessFailedException')->disableOriginalConstructor()->getMock(); + + $processBuilder->expects($this->any()) + ->method('getProcess') + ->will($this->returnValue($process)); + + $exception->expects($this->any()) + ->method('getProcess') + ->will($this->returnValue($process)); + + $process->expects($this->any()) + ->method('mustRun') + ->will($this->throwException($exception)); + + $process->expects($this->any()) + ->method('getExitCode') + ->will($this->returnValue(2)); + $processBuilder->expects($this->any()) + ->method('setPrefix') + ->will($this->returnValue(true)); + $processBuilder->expects($this->any()) + ->method('setArguments') + ->will($this->returnSelf()); + $processBuilder->expects($this->any()) + ->method('enableOutput') + ->will($this->returnValue(true)); + + $this->ZbarDecoder = new \RobbieP\ZbarQrdecoder\ZbarDecoder([], $processBuilder); + $this->ZbarDecoder->make(__DIR__.'/stubs/tc.jpg'); + $this->assertEquals(__DIR__.'/stubs/tc.jpg', $this->ZbarDecoder->getFilePath()); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Problem with decode - check you have zbar-tools installed + */ + public function testRunProcessThrowsErrorProblemWithCode() + { + $processBuilder = $this->getMockBuilder('\Symfony\Component\Process\ProcessBuilder')->disableOriginalConstructor()->getMock(); + $process = $this->getMockBuilder('\Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock(); + $exception = $this->getMockBuilder('\Symfony\Component\Process\Exception\ProcessFailedException')->disableOriginalConstructor()->getMock(); + + $processBuilder->expects($this->any()) + ->method('getProcess') + ->will($this->returnValue($process)); + + $exception->expects($this->any()) + ->method('getProcess') + ->will($this->returnValue($process)); + + $process->expects($this->any()) + ->method('mustRun') + ->will($this->throwException($exception)); + + $process->expects($this->any()) + ->method('getExitCode') + ->will($this->returnValue(3)); + $processBuilder->expects($this->any()) + ->method('setPrefix') + ->will($this->returnValue(true)); + $processBuilder->expects($this->any()) + ->method('setArguments') + ->will($this->returnSelf()); + $processBuilder->expects($this->any()) + ->method('enableOutput') + ->will($this->returnValue(true)); + + $this->ZbarDecoder = new \RobbieP\ZbarQrdecoder\ZbarDecoder([], $processBuilder); + $this->ZbarDecoder->make(__DIR__.'/stubs/tc.jpg'); + $this->assertEquals(__DIR__.'/stubs/tc.jpg', $this->ZbarDecoder->getFilePath()); + } + + public function testRunProcessThrowsErrorResultWhenNoCodeDetected() + { + $processBuilder = $this->getMockBuilder('\Symfony\Component\Process\ProcessBuilder')->disableOriginalConstructor()->getMock(); + $process = $this->getMockBuilder('\Symfony\Component\Process\Process')->disableOriginalConstructor()->getMock(); + $exception = $this->getMockBuilder('\Symfony\Component\Process\Exception\ProcessFailedException')->disableOriginalConstructor()->getMock(); + + $processBuilder->expects($this->any()) + ->method('getProcess') + ->will($this->returnValue($process)); + + $exception->expects($this->any()) + ->method('getProcess') + ->will($this->returnValue($process)); + + $process->expects($this->any()) + ->method('mustRun') + ->will($this->throwException($exception)); + + $process->expects($this->any()) + ->method('getExitCode') + ->will($this->returnValue(4)); + $processBuilder->expects($this->any()) + ->method('setPrefix') + ->will($this->returnValue(true)); + $processBuilder->expects($this->any()) + ->method('setArguments') + ->will($this->returnSelf()); + $processBuilder->expects($this->any()) + ->method('enableOutput') + ->will($this->returnValue(true)); + + $this->ZbarDecoder = new \RobbieP\ZbarQrdecoder\ZbarDecoder([], $processBuilder); + $result = $this->ZbarDecoder->make(__DIR__.'/stubs/tc.jpg'); + $this->assertEquals(__DIR__.'/stubs/tc.jpg', $this->ZbarDecoder->getFilePath()); + $this->assertInstanceOf('RobbieP\ZbarQrdecoder\Result\ErrorResult', $result); + $this->assertEquals(400, $result->code); + $this->assertEquals('NOT_FOUND', $result->format); + $this->assertEquals('No barcode detected', $result->text); + } + +} + \ No newline at end of file diff --git a/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/stubs/tc.jpg b/sei/web/modulos/correios/lib/zbar/vendor/robbiep/zbar-qrdecoder/tests/stubs/tc.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5cc308610d0d3595e0060d9747e3b11ac05dc6e1 GIT binary patch literal 86974 zcmb4qWl$VV)b8T$E(;-8@IY`47TCp?1%d|)?hXNhyIXKw+*#a$1ec(}-Q6{W%X{nl zs_x(WOxM)(boV(=Rd@BAKIhEK{L4B3AN&dQ34nlr0QmBH0bZ5>(*M=|Um*V9%71sn z{{<2fGSYuQMEvgo`9B~cp`aimzZPWV|AhRHfY(uo$Vjif{=f0^6F`8Dz=aTpgg^j5 zBtSqSKzQi`&;kGm$VmSQ2mBAvQPD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tgXP5W$1JRKV>T90zM6TWlY!P2QxRb9 zvrH&feXmTYRBEnIi*CY&FTtR!$8Bvzjt_(}ft+BGjN^`Y#d1a=J}V_lU!~76*UfT9 zVeIP?uf-;nuJvwtj=pPRhTF*9N_syV(B#i`R`Mjbv)d>{?m7%K}d|%XyEpI_y^*mZOfq zl6M_^(z36-Z8(uml-n*>7L`VEDnh8LY=9880uPPYl>}$xIL1)qD*Abwc{Sqe@K|g& zvaCjr6OL0Lw-D#lsEC@{oLiEU(i?fzDFHs9@DuAf)hMaGU`=y^LRR8Y1tNq4yr52ol3W( zM3k8Hl|0JUlm@=AbYu>JgO4G`nZ+_qZYN(QL}tR|Za(?0T+BU|W=vZanzIR=tcOd+XYEB2H%5)B&9pd^%e1g5s zF+E9?Yje6(Rd?B?^#~H8F$(A}Jr%|fU8bc;1!yS;`SFYuBJp><6i6qHm@ z$0M(Cbn0>jxg-$EUhJ1C4i6m8$;$YdTKzKvybby^vPoxXY(93ty`5TpYkOvZX+) zLt=w=hvrjXj>E1(j@l5Vw6u32%;5F+?0mRLa_ik7vKr6`k + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Exception; + +/** + * Marker Interface for the Process Component. + * + * @author Johannes M. Schmitt + */ +interface ExceptionInterface +{ +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/InvalidArgumentException.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..926ee21 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Exception; + +/** + * InvalidArgumentException for the Process Component. + * + * @author Romain Neutron + */ +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/LogicException.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/LogicException.php new file mode 100644 index 0000000..be3d490 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/LogicException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Exception; + +/** + * LogicException for the Process Component. + * + * @author Romain Neutron + */ +class LogicException extends \LogicException implements ExceptionInterface +{ +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/ProcessFailedException.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/ProcessFailedException.php new file mode 100644 index 0000000..328acfd --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/ProcessFailedException.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Exception; + +use Symfony\Component\Process\Process; + +/** + * Exception for failed processes. + * + * @author Johannes M. Schmitt + */ +class ProcessFailedException extends RuntimeException +{ + private $process; + + public function __construct(Process $process) + { + if ($process->isSuccessful()) { + throw new InvalidArgumentException('Expected a failed process, but the given process was successful.'); + } + + $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s", + $process->getCommandLine(), + $process->getExitCode(), + $process->getExitCodeText(), + $process->getWorkingDirectory() + ); + + if (!$process->isOutputDisabled()) { + $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", + $process->getOutput(), + $process->getErrorOutput() + ); + } + + parent::__construct($error); + + $this->process = $process; + } + + public function getProcess() + { + return $this->process; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/ProcessTimedOutException.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/ProcessTimedOutException.php new file mode 100644 index 0000000..fef4a8a --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/ProcessTimedOutException.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Exception; + +use Symfony\Component\Process\Process; + +/** + * Exception that is thrown when a process times out. + * + * @author Johannes M. Schmitt + */ +class ProcessTimedOutException extends RuntimeException +{ + const TYPE_GENERAL = 1; + const TYPE_IDLE = 2; + + private $process; + private $timeoutType; + + public function __construct(Process $process, $timeoutType) + { + $this->process = $process; + $this->timeoutType = $timeoutType; + + parent::__construct(sprintf( + 'The process "%s" exceeded the timeout of %s seconds.', + $process->getCommandLine(), + $this->getExceededTimeout() + )); + } + + public function getProcess() + { + return $this->process; + } + + public function isGeneralTimeout() + { + return self::TYPE_GENERAL === $this->timeoutType; + } + + public function isIdleTimeout() + { + return self::TYPE_IDLE === $this->timeoutType; + } + + public function getExceededTimeout() + { + switch ($this->timeoutType) { + case self::TYPE_GENERAL: + return $this->process->getTimeout(); + + case self::TYPE_IDLE: + return $this->process->getIdleTimeout(); + + default: + throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType)); + } + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/RuntimeException.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/RuntimeException.php new file mode 100644 index 0000000..adead25 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Exception/RuntimeException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Exception; + +/** + * RuntimeException for the Process Component. + * + * @author Johannes M. Schmitt + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ExecutableFinder.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ExecutableFinder.php new file mode 100644 index 0000000..ff68ed3 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ExecutableFinder.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process; + +/** + * Generic executable finder. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + */ +class ExecutableFinder +{ + private $suffixes = ['.exe', '.bat', '.cmd', '.com']; + + /** + * Replaces default suffixes of executable. + */ + public function setSuffixes(array $suffixes) + { + $this->suffixes = $suffixes; + } + + /** + * Adds new possible suffix to check for executable. + * + * @param string $suffix + */ + public function addSuffix($suffix) + { + $this->suffixes[] = $suffix; + } + + /** + * Finds an executable by name. + * + * @param string $name The executable name (without the extension) + * @param string|null $default The default to return if no executable is found + * @param array $extraDirs Additional dirs to check into + * + * @return string|null The executable path or default value + */ + public function find($name, $default = null, array $extraDirs = []) + { + if (ini_get('open_basedir')) { + $searchPath = array_merge(explode(\PATH_SEPARATOR, ini_get('open_basedir')), $extraDirs); + $dirs = []; + foreach ($searchPath as $path) { + // Silencing against https://bugs.php.net/69240 + if (@is_dir($path)) { + $dirs[] = $path; + } else { + if (basename($path) == $name && @is_executable($path)) { + return $path; + } + } + } + } else { + $dirs = array_merge( + explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')), + $extraDirs + ); + } + + $suffixes = ['']; + if ('\\' === \DIRECTORY_SEPARATOR) { + $pathExt = getenv('PATHEXT'); + $suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes); + } + foreach ($suffixes as $suffix) { + foreach ($dirs as $dir) { + if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) { + return $file; + } + } + } + + return $default; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/InputStream.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/InputStream.php new file mode 100644 index 0000000..ef38dd7 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/InputStream.php @@ -0,0 +1,92 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process; + +use Symfony\Component\Process\Exception\RuntimeException; + +/** + * Provides a way to continuously write to the input of a Process until the InputStream is closed. + * + * @author Nicolas Grekas + */ +class InputStream implements \IteratorAggregate +{ + /** @var callable|null */ + private $onEmpty = null; + private $input = []; + private $open = true; + + /** + * Sets a callback that is called when the write buffer becomes empty. + */ + public function onEmpty(callable $onEmpty = null) + { + $this->onEmpty = $onEmpty; + } + + /** + * Appends an input to the write buffer. + * + * @param resource|string|int|float|bool|\Traversable|null $input The input to append as scalar, + * stream resource or \Traversable + */ + public function write($input) + { + if (null === $input) { + return; + } + if ($this->isClosed()) { + throw new RuntimeException(sprintf('"%s" is closed.', static::class)); + } + $this->input[] = ProcessUtils::validateInput(__METHOD__, $input); + } + + /** + * Closes the write buffer. + */ + public function close() + { + $this->open = false; + } + + /** + * Tells whether the write buffer is closed or not. + */ + public function isClosed() + { + return !$this->open; + } + + public function getIterator() + { + $this->open = true; + + while ($this->open || $this->input) { + if (!$this->input) { + yield ''; + continue; + } + $current = array_shift($this->input); + + if ($current instanceof \Iterator) { + foreach ($current as $cur) { + yield $cur; + } + } else { + yield $current; + } + if (!$this->input && $this->open && null !== $onEmpty = $this->onEmpty) { + $this->write($onEmpty($this)); + } + } + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/LICENSE b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/LICENSE new file mode 100644 index 0000000..9e936ec --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2020 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/PhpExecutableFinder.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/PhpExecutableFinder.php new file mode 100644 index 0000000..b9a8015 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/PhpExecutableFinder.php @@ -0,0 +1,94 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process; + +/** + * An executable finder specifically designed for the PHP executable. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + */ +class PhpExecutableFinder +{ + private $executableFinder; + + public function __construct() + { + $this->executableFinder = new ExecutableFinder(); + } + + /** + * Finds The PHP executable. + * + * @param bool $includeArgs Whether or not include command arguments + * + * @return string|false The PHP executable path or false if it cannot be found + */ + public function find($includeArgs = true) + { + $args = $this->findArguments(); + $args = $includeArgs && $args ? ' '.implode(' ', $args) : ''; + + // HHVM support + if (\defined('HHVM_VERSION')) { + return (getenv('PHP_BINARY') ?: \PHP_BINARY).$args; + } + + // PHP_BINARY return the current sapi executable + if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cli', 'cli-server', 'phpdbg'], true)) { + return \PHP_BINARY.$args; + } + + if ($php = getenv('PHP_PATH')) { + if (!@is_executable($php)) { + return false; + } + + return $php; + } + + if ($php = getenv('PHP_PEAR_PHP_BIN')) { + if (@is_executable($php)) { + return $php; + } + } + + if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) { + return $php; + } + + $dirs = [\PHP_BINDIR]; + if ('\\' === \DIRECTORY_SEPARATOR) { + $dirs[] = 'C:\xampp\php\\'; + } + + return $this->executableFinder->find('php', false, $dirs); + } + + /** + * Finds the PHP executable arguments. + * + * @return array The PHP executable arguments + */ + public function findArguments() + { + $arguments = []; + + if (\defined('HHVM_VERSION')) { + $arguments[] = '--php'; + } elseif ('phpdbg' === \PHP_SAPI) { + $arguments[] = '-qrr'; + } + + return $arguments; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/PhpProcess.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/PhpProcess.php new file mode 100644 index 0000000..a29c0db --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/PhpProcess.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process; + +use Symfony\Component\Process\Exception\RuntimeException; + +/** + * PhpProcess runs a PHP script in an independent process. + * + * $p = new PhpProcess(''); + * $p->run(); + * print $p->getOutput()."\n"; + * + * @author Fabien Potencier + */ +class PhpProcess extends Process +{ + /** + * @param string $script The PHP script to run (as a string) + * @param string|null $cwd The working directory or null to use the working dir of the current PHP process + * @param array|null $env The environment variables or null to use the same environment as the current PHP process + * @param int $timeout The timeout in seconds + * @param array $options An array of options for proc_open + */ + public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = null) + { + $executableFinder = new PhpExecutableFinder(); + if (false === $php = $executableFinder->find(false)) { + $php = null; + } else { + $php = array_merge([$php], $executableFinder->findArguments()); + } + if ('phpdbg' === \PHP_SAPI) { + $file = tempnam(sys_get_temp_dir(), 'dbg'); + file_put_contents($file, $script); + register_shutdown_function('unlink', $file); + $php[] = $file; + $script = null; + } + if (null !== $options) { + @trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); + } + + parent::__construct($php, $cwd, $env, $script, $timeout, $options); + } + + /** + * Sets the path to the PHP binary to use. + */ + public function setPhpBinary($php) + { + $this->setCommandLine($php); + } + + /** + * {@inheritdoc} + */ + public function start(callable $callback = null/*, array $env = []*/) + { + if (null === $this->getCommandLine()) { + throw new RuntimeException('Unable to find the PHP executable.'); + } + $env = 1 < \func_num_args() ? func_get_arg(1) : null; + + parent::start($callback, $env); + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/AbstractPipes.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/AbstractPipes.php new file mode 100644 index 0000000..cdffaaf --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/AbstractPipes.php @@ -0,0 +1,182 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Pipes; + +use Symfony\Component\Process\Exception\InvalidArgumentException; + +/** + * @author Romain Neutron + * + * @internal + */ +abstract class AbstractPipes implements PipesInterface +{ + public $pipes = []; + + private $inputBuffer = ''; + private $input; + private $blocked = true; + private $lastError; + + /** + * @param resource|string|int|float|bool|\Iterator|null $input + */ + public function __construct($input) + { + if (\is_resource($input) || $input instanceof \Iterator) { + $this->input = $input; + } elseif (\is_string($input)) { + $this->inputBuffer = $input; + } else { + $this->inputBuffer = (string) $input; + } + } + + /** + * {@inheritdoc} + */ + public function close() + { + foreach ($this->pipes as $pipe) { + fclose($pipe); + } + $this->pipes = []; + } + + /** + * Returns true if a system call has been interrupted. + * + * @return bool + */ + protected function hasSystemCallBeenInterrupted() + { + $lastError = $this->lastError; + $this->lastError = null; + + // stream_select returns false when the `select` system call is interrupted by an incoming signal + return null !== $lastError && false !== stripos($lastError, 'interrupted system call'); + } + + /** + * Unblocks streams. + */ + protected function unblock() + { + if (!$this->blocked) { + return; + } + + foreach ($this->pipes as $pipe) { + stream_set_blocking($pipe, 0); + } + if (\is_resource($this->input)) { + stream_set_blocking($this->input, 0); + } + + $this->blocked = false; + } + + /** + * Writes input to stdin. + * + * @return array|null + * + * @throws InvalidArgumentException When an input iterator yields a non supported value + */ + protected function write() + { + if (!isset($this->pipes[0])) { + return null; + } + $input = $this->input; + + if ($input instanceof \Iterator) { + if (!$input->valid()) { + $input = null; + } elseif (\is_resource($input = $input->current())) { + stream_set_blocking($input, 0); + } elseif (!isset($this->inputBuffer[0])) { + if (!\is_string($input)) { + if (!is_scalar($input)) { + throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', \get_class($this->input), \gettype($input))); + } + $input = (string) $input; + } + $this->inputBuffer = $input; + $this->input->next(); + $input = null; + } else { + $input = null; + } + } + + $r = $e = []; + $w = [$this->pipes[0]]; + + // let's have a look if something changed in streams + if (false === @stream_select($r, $w, $e, 0, 0)) { + return null; + } + + foreach ($w as $stdin) { + if (isset($this->inputBuffer[0])) { + $written = fwrite($stdin, $this->inputBuffer); + $this->inputBuffer = substr($this->inputBuffer, $written); + if (isset($this->inputBuffer[0])) { + return [$this->pipes[0]]; + } + } + + if ($input) { + for (;;) { + $data = fread($input, self::CHUNK_SIZE); + if (!isset($data[0])) { + break; + } + $written = fwrite($stdin, $data); + $data = substr($data, $written); + if (isset($data[0])) { + $this->inputBuffer = $data; + + return [$this->pipes[0]]; + } + } + if (feof($input)) { + if ($this->input instanceof \Iterator) { + $this->input->next(); + } else { + $this->input = null; + } + } + } + } + + // no input to read on resource, buffer is empty + if (!isset($this->inputBuffer[0]) && !($this->input instanceof \Iterator ? $this->input->valid() : $this->input)) { + $this->input = null; + fclose($this->pipes[0]); + unset($this->pipes[0]); + } elseif (!$w) { + return [$this->pipes[0]]; + } + + return null; + } + + /** + * @internal + */ + public function handleError($type, $msg) + { + $this->lastError = $msg; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/PipesInterface.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/PipesInterface.php new file mode 100644 index 0000000..52bbe76 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/PipesInterface.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Pipes; + +/** + * PipesInterface manages descriptors and pipes for the use of proc_open. + * + * @author Romain Neutron + * + * @internal + */ +interface PipesInterface +{ + const CHUNK_SIZE = 16384; + + /** + * Returns an array of descriptors for the use of proc_open. + * + * @return array + */ + public function getDescriptors(); + + /** + * Returns an array of filenames indexed by their related stream in case these pipes use temporary files. + * + * @return string[] + */ + public function getFiles(); + + /** + * Reads data in file handles and pipes. + * + * @param bool $blocking Whether to use blocking calls or not + * @param bool $close Whether to close pipes if they've reached EOF + * + * @return string[] An array of read data indexed by their fd + */ + public function readAndWrite($blocking, $close = false); + + /** + * Returns if the current state has open file handles or pipes. + * + * @return bool + */ + public function areOpen(); + + /** + * Returns if pipes are able to read output. + * + * @return bool + */ + public function haveReadSupport(); + + /** + * Closes file handles and pipes. + */ + public function close(); +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/UnixPipes.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/UnixPipes.php new file mode 100644 index 0000000..5784a31 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/UnixPipes.php @@ -0,0 +1,153 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Pipes; + +use Symfony\Component\Process\Process; + +/** + * UnixPipes implementation uses unix pipes as handles. + * + * @author Romain Neutron + * + * @internal + */ +class UnixPipes extends AbstractPipes +{ + private $ttyMode; + private $ptyMode; + private $haveReadSupport; + + public function __construct($ttyMode, $ptyMode, $input, $haveReadSupport) + { + $this->ttyMode = (bool) $ttyMode; + $this->ptyMode = (bool) $ptyMode; + $this->haveReadSupport = (bool) $haveReadSupport; + + parent::__construct($input); + } + + public function __destruct() + { + $this->close(); + } + + /** + * {@inheritdoc} + */ + public function getDescriptors() + { + if (!$this->haveReadSupport) { + $nullstream = fopen('/dev/null', 'c'); + + return [ + ['pipe', 'r'], + $nullstream, + $nullstream, + ]; + } + + if ($this->ttyMode) { + return [ + ['file', '/dev/tty', 'r'], + ['file', '/dev/tty', 'w'], + ['file', '/dev/tty', 'w'], + ]; + } + + if ($this->ptyMode && Process::isPtySupported()) { + return [ + ['pty'], + ['pty'], + ['pty'], + ]; + } + + return [ + ['pipe', 'r'], + ['pipe', 'w'], // stdout + ['pipe', 'w'], // stderr + ]; + } + + /** + * {@inheritdoc} + */ + public function getFiles() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function readAndWrite($blocking, $close = false) + { + $this->unblock(); + $w = $this->write(); + + $read = $e = []; + $r = $this->pipes; + unset($r[0]); + + // let's have a look if something changed in streams + set_error_handler([$this, 'handleError']); + if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { + restore_error_handler(); + // if a system call has been interrupted, forget about it, let's try again + // otherwise, an error occurred, let's reset pipes + if (!$this->hasSystemCallBeenInterrupted()) { + $this->pipes = []; + } + + return $read; + } + restore_error_handler(); + + foreach ($r as $pipe) { + // prior PHP 5.4 the array passed to stream_select is modified and + // lose key association, we have to find back the key + $read[$type = array_search($pipe, $this->pipes, true)] = ''; + + do { + $data = @fread($pipe, self::CHUNK_SIZE); + $read[$type] .= $data; + } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1]))); + + if (!isset($read[$type][0])) { + unset($read[$type]); + } + + if ($close && feof($pipe)) { + fclose($pipe); + unset($this->pipes[$type]); + } + } + + return $read; + } + + /** + * {@inheritdoc} + */ + public function haveReadSupport() + { + return $this->haveReadSupport; + } + + /** + * {@inheritdoc} + */ + public function areOpen() + { + return (bool) $this->pipes; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/WindowsPipes.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/WindowsPipes.php new file mode 100644 index 0000000..36ea57e --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Pipes/WindowsPipes.php @@ -0,0 +1,194 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Pipes; + +use Symfony\Component\Process\Exception\RuntimeException; +use Symfony\Component\Process\Process; + +/** + * WindowsPipes implementation uses temporary files as handles. + * + * @see https://bugs.php.net/51800 + * @see https://bugs.php.net/65650 + * + * @author Romain Neutron + * + * @internal + */ +class WindowsPipes extends AbstractPipes +{ + private $files = []; + private $fileHandles = []; + private $lockHandles = []; + private $readBytes = [ + Process::STDOUT => 0, + Process::STDERR => 0, + ]; + private $haveReadSupport; + + public function __construct($input, $haveReadSupport) + { + $this->haveReadSupport = (bool) $haveReadSupport; + + if ($this->haveReadSupport) { + // Fix for PHP bug #51800: reading from STDOUT pipe hangs forever on Windows if the output is too big. + // Workaround for this problem is to use temporary files instead of pipes on Windows platform. + // + // @see https://bugs.php.net/51800 + $pipes = [ + Process::STDOUT => Process::OUT, + Process::STDERR => Process::ERR, + ]; + $tmpDir = sys_get_temp_dir(); + $lastError = 'unknown reason'; + set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; }); + for ($i = 0;; ++$i) { + foreach ($pipes as $pipe => $name) { + $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name); + + if (!$h = fopen($file.'.lock', 'w')) { + if (file_exists($file.'.lock')) { + continue 2; + } + restore_error_handler(); + throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError); + } + if (!flock($h, \LOCK_EX | \LOCK_NB)) { + continue 2; + } + if (isset($this->lockHandles[$pipe])) { + flock($this->lockHandles[$pipe], \LOCK_UN); + fclose($this->lockHandles[$pipe]); + } + $this->lockHandles[$pipe] = $h; + + if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) { + flock($this->lockHandles[$pipe], \LOCK_UN); + fclose($this->lockHandles[$pipe]); + unset($this->lockHandles[$pipe]); + continue 2; + } + $this->fileHandles[$pipe] = $h; + $this->files[$pipe] = $file; + } + break; + } + restore_error_handler(); + } + + parent::__construct($input); + } + + public function __destruct() + { + $this->close(); + } + + /** + * {@inheritdoc} + */ + public function getDescriptors() + { + if (!$this->haveReadSupport) { + $nullstream = fopen('NUL', 'c'); + + return [ + ['pipe', 'r'], + $nullstream, + $nullstream, + ]; + } + + // We're not using pipe on Windows platform as it hangs (https://bugs.php.net/51800) + // We're not using file handles as it can produce corrupted output https://bugs.php.net/65650 + // So we redirect output within the commandline and pass the nul device to the process + return [ + ['pipe', 'r'], + ['file', 'NUL', 'w'], + ['file', 'NUL', 'w'], + ]; + } + + /** + * {@inheritdoc} + */ + public function getFiles() + { + return $this->files; + } + + /** + * {@inheritdoc} + */ + public function readAndWrite($blocking, $close = false) + { + $this->unblock(); + $w = $this->write(); + $read = $r = $e = []; + + if ($blocking) { + if ($w) { + @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6); + } elseif ($this->fileHandles) { + usleep(Process::TIMEOUT_PRECISION * 1E6); + } + } + foreach ($this->fileHandles as $type => $fileHandle) { + $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]); + + if (isset($data[0])) { + $this->readBytes[$type] += \strlen($data); + $read[$type] = $data; + } + if ($close) { + ftruncate($fileHandle, 0); + fclose($fileHandle); + flock($this->lockHandles[$type], \LOCK_UN); + fclose($this->lockHandles[$type]); + unset($this->fileHandles[$type], $this->lockHandles[$type]); + } + } + + return $read; + } + + /** + * {@inheritdoc} + */ + public function haveReadSupport() + { + return $this->haveReadSupport; + } + + /** + * {@inheritdoc} + */ + public function areOpen() + { + return $this->pipes && $this->fileHandles; + } + + /** + * {@inheritdoc} + */ + public function close() + { + parent::close(); + foreach ($this->fileHandles as $type => $handle) { + ftruncate($handle, 0); + fclose($handle); + flock($this->lockHandles[$type], \LOCK_UN); + fclose($this->lockHandles[$type]); + } + $this->fileHandles = $this->lockHandles = []; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Process.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Process.php new file mode 100644 index 0000000..91ce2c4 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Process.php @@ -0,0 +1,1746 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process; + +use Symfony\Component\Process\Exception\InvalidArgumentException; +use Symfony\Component\Process\Exception\LogicException; +use Symfony\Component\Process\Exception\ProcessFailedException; +use Symfony\Component\Process\Exception\ProcessTimedOutException; +use Symfony\Component\Process\Exception\RuntimeException; +use Symfony\Component\Process\Pipes\PipesInterface; +use Symfony\Component\Process\Pipes\UnixPipes; +use Symfony\Component\Process\Pipes\WindowsPipes; + +/** + * Process is a thin wrapper around proc_* functions to easily + * start independent PHP processes. + * + * @author Fabien Potencier + * @author Romain Neutron + */ +class Process implements \IteratorAggregate +{ + const ERR = 'err'; + const OUT = 'out'; + + const STATUS_READY = 'ready'; + const STATUS_STARTED = 'started'; + const STATUS_TERMINATED = 'terminated'; + + const STDIN = 0; + const STDOUT = 1; + const STDERR = 2; + + // Timeout Precision in seconds. + const TIMEOUT_PRECISION = 0.2; + + const ITER_NON_BLOCKING = 1; // By default, iterating over outputs is a blocking call, use this flag to make it non-blocking + const ITER_KEEP_OUTPUT = 2; // By default, outputs are cleared while iterating, use this flag to keep them in memory + const ITER_SKIP_OUT = 4; // Use this flag to skip STDOUT while iterating + const ITER_SKIP_ERR = 8; // Use this flag to skip STDERR while iterating + + private $callback; + private $hasCallback = false; + private $commandline; + private $cwd; + private $env; + private $input; + private $starttime; + private $lastOutputTime; + private $timeout; + private $idleTimeout; + private $options = ['suppress_errors' => true]; + private $exitcode; + private $fallbackStatus = []; + private $processInformation; + private $outputDisabled = false; + private $stdout; + private $stderr; + private $enhanceWindowsCompatibility = true; + private $enhanceSigchildCompatibility; + private $process; + private $status = self::STATUS_READY; + private $incrementalOutputOffset = 0; + private $incrementalErrorOutputOffset = 0; + private $tty = false; + private $pty; + private $inheritEnv = false; + + private $useFileHandles = false; + /** @var PipesInterface */ + private $processPipes; + + private $latestSignal; + + private static $sigchild; + + /** + * Exit codes translation table. + * + * User-defined errors must use exit codes in the 64-113 range. + */ + public static $exitCodes = [ + 0 => 'OK', + 1 => 'General error', + 2 => 'Misuse of shell builtins', + + 126 => 'Invoked command cannot execute', + 127 => 'Command not found', + 128 => 'Invalid exit argument', + + // signals + 129 => 'Hangup', + 130 => 'Interrupt', + 131 => 'Quit and dump core', + 132 => 'Illegal instruction', + 133 => 'Trace/breakpoint trap', + 134 => 'Process aborted', + 135 => 'Bus error: "access to undefined portion of memory object"', + 136 => 'Floating point exception: "erroneous arithmetic operation"', + 137 => 'Kill (terminate immediately)', + 138 => 'User-defined 1', + 139 => 'Segmentation violation', + 140 => 'User-defined 2', + 141 => 'Write to pipe with no one reading', + 142 => 'Signal raised by alarm', + 143 => 'Termination (request to terminate)', + // 144 - not defined + 145 => 'Child process terminated, stopped (or continued*)', + 146 => 'Continue if stopped', + 147 => 'Stop executing temporarily', + 148 => 'Terminal stop signal', + 149 => 'Background process attempting to read from tty ("in")', + 150 => 'Background process attempting to write to tty ("out")', + 151 => 'Urgent data available on socket', + 152 => 'CPU time limit exceeded', + 153 => 'File size limit exceeded', + 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"', + 155 => 'Profiling timer expired', + // 156 - not defined + 157 => 'Pollable event', + // 158 - not defined + 159 => 'Bad syscall', + ]; + + /** + * @param string|array $commandline The command line to run + * @param string|null $cwd The working directory or null to use the working dir of the current PHP process + * @param array|null $env The environment variables or null to use the same environment as the current PHP process + * @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input + * @param int|float|null $timeout The timeout in seconds or null to disable + * @param array $options An array of options for proc_open + * + * @throws RuntimeException When proc_open is not installed + */ + public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = null) + { + if (!\function_exists('proc_open')) { + throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.'); + } + + $this->commandline = $commandline; + $this->cwd = $cwd; + + // on Windows, if the cwd changed via chdir(), proc_open defaults to the dir where PHP was started + // on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected + // @see : https://bugs.php.net/51800 + // @see : https://bugs.php.net/50524 + if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) { + $this->cwd = getcwd(); + } + if (null !== $env) { + $this->setEnv($env); + } + + $this->setInput($input); + $this->setTimeout($timeout); + $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR; + $this->pty = false; + $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled(); + if (null !== $options) { + @trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED); + $this->options = array_replace($this->options, $options); + } + } + + public function __destruct() + { + $this->stop(0); + } + + public function __clone() + { + $this->resetProcessData(); + } + + /** + * Runs the process. + * + * The callback receives the type of output (out or err) and + * some bytes from the output in real-time. It allows to have feedback + * from the independent process during execution. + * + * The STDOUT and STDERR are also available after the process is finished + * via the getOutput() and getErrorOutput() methods. + * + * @param callable|null $callback A PHP callback to run whenever there is some + * output available on STDOUT or STDERR + * + * @return int The exit status code + * + * @throws RuntimeException When process can't be launched + * @throws RuntimeException When process stopped after receiving signal + * @throws LogicException In case a callback is provided and output has been disabled + * + * @final since version 3.3 + */ + public function run($callback = null/*, array $env = []*/) + { + $env = 1 < \func_num_args() ? func_get_arg(1) : null; + $this->start($callback, $env); + + return $this->wait(); + } + + /** + * Runs the process. + * + * This is identical to run() except that an exception is thrown if the process + * exits with a non-zero exit code. + * + * @return $this + * + * @throws RuntimeException if PHP was compiled with --enable-sigchild and the enhanced sigchild compatibility mode is not enabled + * @throws ProcessFailedException if the process didn't terminate successfully + * + * @final since version 3.3 + */ + public function mustRun(callable $callback = null/*, array $env = []*/) + { + if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { + throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.'); + } + $env = 1 < \func_num_args() ? func_get_arg(1) : null; + + if (0 !== $this->run($callback, $env)) { + throw new ProcessFailedException($this); + } + + return $this; + } + + /** + * Starts the process and returns after writing the input to STDIN. + * + * This method blocks until all STDIN data is sent to the process then it + * returns while the process runs in the background. + * + * The termination of the process can be awaited with wait(). + * + * The callback receives the type of output (out or err) and some bytes from + * the output in real-time while writing the standard input to the process. + * It allows to have feedback from the independent process during execution. + * + * @param callable|null $callback A PHP callback to run whenever there is some + * output available on STDOUT or STDERR + * + * @throws RuntimeException When process can't be launched + * @throws RuntimeException When process is already running + * @throws LogicException In case a callback is provided and output has been disabled + */ + public function start(callable $callback = null/*, array $env = [*/) + { + if ($this->isRunning()) { + throw new RuntimeException('Process is already running.'); + } + if (2 <= \func_num_args()) { + $env = func_get_arg(1); + } else { + if (__CLASS__ !== static::class) { + $r = new \ReflectionMethod($this, __FUNCTION__); + if (__CLASS__ !== $r->getDeclaringClass()->getName() && (2 > $r->getNumberOfParameters() || 'env' !== $r->getParameters()[1]->name)) { + @trigger_error(sprintf('The %s::start() method expects a second "$env" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), \E_USER_DEPRECATED); + } + } + $env = null; + } + + $this->resetProcessData(); + $this->starttime = $this->lastOutputTime = microtime(true); + $this->callback = $this->buildCallback($callback); + $this->hasCallback = null !== $callback; + $descriptors = $this->getDescriptors(); + $inheritEnv = $this->inheritEnv; + + if (\is_array($commandline = $this->commandline)) { + $commandline = implode(' ', array_map([$this, 'escapeArgument'], $commandline)); + + if ('\\' !== \DIRECTORY_SEPARATOR) { + // exec is mandatory to deal with sending a signal to the process + $commandline = 'exec '.$commandline; + } + } + + if (null === $env) { + $env = $this->env; + } else { + if ($this->env) { + $env += $this->env; + } + $inheritEnv = true; + } + + if (null !== $env && $inheritEnv) { + $env += $this->getDefaultEnv(); + } elseif (null !== $env) { + @trigger_error('Not inheriting environment variables is deprecated since Symfony 3.3 and will always happen in 4.0. Set "Process::inheritEnvironmentVariables()" to true instead.', \E_USER_DEPRECATED); + } else { + $env = $this->getDefaultEnv(); + } + if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) { + $this->options['bypass_shell'] = true; + $commandline = $this->prepareWindowsCommandLine($commandline, $env); + } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { + // last exit code is output on the fourth pipe and caught to work around --enable-sigchild + $descriptors[3] = ['pipe', 'w']; + + // See https://unix.stackexchange.com/questions/71205/background-process-pipe-input + $commandline = '{ ('.$commandline.') <&3 3<&- 3>/dev/null & } 3<&0;'; + $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code'; + + // Workaround for the bug, when PTS functionality is enabled. + // @see : https://bugs.php.net/69442 + $ptsWorkaround = fopen(__FILE__, 'r'); + } + if (\defined('HHVM_VERSION')) { + $envPairs = $env; + } else { + $envPairs = []; + foreach ($env as $k => $v) { + if (false !== $v) { + $envPairs[] = $k.'='.$v; + } + } + } + + if (!is_dir($this->cwd)) { + @trigger_error('The provided cwd does not exist. Command is currently ran against getcwd(). This behavior is deprecated since Symfony 3.4 and will be removed in 4.0.', \E_USER_DEPRECATED); + } + + $this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options); + + if (!\is_resource($this->process)) { + throw new RuntimeException('Unable to launch a new process.'); + } + $this->status = self::STATUS_STARTED; + + if (isset($descriptors[3])) { + $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]); + } + + if ($this->tty) { + return; + } + + $this->updateStatus(false); + $this->checkTimeout(); + } + + /** + * Restarts the process. + * + * Be warned that the process is cloned before being started. + * + * @param callable|null $callback A PHP callback to run whenever there is some + * output available on STDOUT or STDERR + * + * @return static + * + * @throws RuntimeException When process can't be launched + * @throws RuntimeException When process is already running + * + * @see start() + * + * @final since version 3.3 + */ + public function restart(callable $callback = null/*, array $env = []*/) + { + if ($this->isRunning()) { + throw new RuntimeException('Process is already running.'); + } + $env = 1 < \func_num_args() ? func_get_arg(1) : null; + + $process = clone $this; + $process->start($callback, $env); + + return $process; + } + + /** + * Waits for the process to terminate. + * + * The callback receives the type of output (out or err) and some bytes + * from the output in real-time while writing the standard input to the process. + * It allows to have feedback from the independent process during execution. + * + * @param callable|null $callback A valid PHP callback + * + * @return int The exitcode of the process + * + * @throws RuntimeException When process timed out + * @throws RuntimeException When process stopped after receiving signal + * @throws LogicException When process is not yet started + */ + public function wait(callable $callback = null) + { + $this->requireProcessIsStarted(__FUNCTION__); + + $this->updateStatus(false); + + if (null !== $callback) { + if (!$this->processPipes->haveReadSupport()) { + $this->stop(0); + throw new \LogicException('Pass the callback to the Process::start method or enableOutput to use a callback with Process::wait.'); + } + $this->callback = $this->buildCallback($callback); + } + + do { + $this->checkTimeout(); + $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen(); + $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running); + } while ($running); + + while ($this->isRunning()) { + $this->checkTimeout(); + usleep(1000); + } + + if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) { + throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig'])); + } + + return $this->exitcode; + } + + /** + * Returns the Pid (process identifier), if applicable. + * + * @return int|null The process id if running, null otherwise + */ + public function getPid() + { + return $this->isRunning() ? $this->processInformation['pid'] : null; + } + + /** + * Sends a POSIX signal to the process. + * + * @param int $signal A valid POSIX signal (see https://php.net/pcntl.constants) + * + * @return $this + * + * @throws LogicException In case the process is not running + * @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed + * @throws RuntimeException In case of failure + */ + public function signal($signal) + { + $this->doSignal($signal, true); + + return $this; + } + + /** + * Disables fetching output and error output from the underlying process. + * + * @return $this + * + * @throws RuntimeException In case the process is already running + * @throws LogicException if an idle timeout is set + */ + public function disableOutput() + { + if ($this->isRunning()) { + throw new RuntimeException('Disabling output while the process is running is not possible.'); + } + if (null !== $this->idleTimeout) { + throw new LogicException('Output can not be disabled while an idle timeout is set.'); + } + + $this->outputDisabled = true; + + return $this; + } + + /** + * Enables fetching output and error output from the underlying process. + * + * @return $this + * + * @throws RuntimeException In case the process is already running + */ + public function enableOutput() + { + if ($this->isRunning()) { + throw new RuntimeException('Enabling output while the process is running is not possible.'); + } + + $this->outputDisabled = false; + + return $this; + } + + /** + * Returns true in case the output is disabled, false otherwise. + * + * @return bool + */ + public function isOutputDisabled() + { + return $this->outputDisabled; + } + + /** + * Returns the current output of the process (STDOUT). + * + * @return string The process output + * + * @throws LogicException in case the output has been disabled + * @throws LogicException In case the process is not started + */ + public function getOutput() + { + $this->readPipesForOutput(__FUNCTION__); + + if (false === $ret = stream_get_contents($this->stdout, -1, 0)) { + return ''; + } + + return $ret; + } + + /** + * Returns the output incrementally. + * + * In comparison with the getOutput method which always return the whole + * output, this one returns the new output since the last call. + * + * @return string The process output since the last call + * + * @throws LogicException in case the output has been disabled + * @throws LogicException In case the process is not started + */ + public function getIncrementalOutput() + { + $this->readPipesForOutput(__FUNCTION__); + + $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset); + $this->incrementalOutputOffset = ftell($this->stdout); + + if (false === $latest) { + return ''; + } + + return $latest; + } + + /** + * Returns an iterator to the output of the process, with the output type as keys (Process::OUT/ERR). + * + * @param int $flags A bit field of Process::ITER_* flags + * + * @throws LogicException in case the output has been disabled + * @throws LogicException In case the process is not started + * + * @return \Generator + */ + public function getIterator($flags = 0) + { + $this->readPipesForOutput(__FUNCTION__, false); + + $clearOutput = !(self::ITER_KEEP_OUTPUT & $flags); + $blocking = !(self::ITER_NON_BLOCKING & $flags); + $yieldOut = !(self::ITER_SKIP_OUT & $flags); + $yieldErr = !(self::ITER_SKIP_ERR & $flags); + + while (null !== $this->callback || ($yieldOut && !feof($this->stdout)) || ($yieldErr && !feof($this->stderr))) { + if ($yieldOut) { + $out = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset); + + if (isset($out[0])) { + if ($clearOutput) { + $this->clearOutput(); + } else { + $this->incrementalOutputOffset = ftell($this->stdout); + } + + yield self::OUT => $out; + } + } + + if ($yieldErr) { + $err = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset); + + if (isset($err[0])) { + if ($clearOutput) { + $this->clearErrorOutput(); + } else { + $this->incrementalErrorOutputOffset = ftell($this->stderr); + } + + yield self::ERR => $err; + } + } + + if (!$blocking && !isset($out[0]) && !isset($err[0])) { + yield self::OUT => ''; + } + + $this->checkTimeout(); + $this->readPipesForOutput(__FUNCTION__, $blocking); + } + } + + /** + * Clears the process output. + * + * @return $this + */ + public function clearOutput() + { + ftruncate($this->stdout, 0); + fseek($this->stdout, 0); + $this->incrementalOutputOffset = 0; + + return $this; + } + + /** + * Returns the current error output of the process (STDERR). + * + * @return string The process error output + * + * @throws LogicException in case the output has been disabled + * @throws LogicException In case the process is not started + */ + public function getErrorOutput() + { + $this->readPipesForOutput(__FUNCTION__); + + if (false === $ret = stream_get_contents($this->stderr, -1, 0)) { + return ''; + } + + return $ret; + } + + /** + * Returns the errorOutput incrementally. + * + * In comparison with the getErrorOutput method which always return the + * whole error output, this one returns the new error output since the last + * call. + * + * @return string The process error output since the last call + * + * @throws LogicException in case the output has been disabled + * @throws LogicException In case the process is not started + */ + public function getIncrementalErrorOutput() + { + $this->readPipesForOutput(__FUNCTION__); + + $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset); + $this->incrementalErrorOutputOffset = ftell($this->stderr); + + if (false === $latest) { + return ''; + } + + return $latest; + } + + /** + * Clears the process output. + * + * @return $this + */ + public function clearErrorOutput() + { + ftruncate($this->stderr, 0); + fseek($this->stderr, 0); + $this->incrementalErrorOutputOffset = 0; + + return $this; + } + + /** + * Returns the exit code returned by the process. + * + * @return int|null The exit status code, null if the Process is not terminated + * + * @throws RuntimeException In case --enable-sigchild is activated and the sigchild compatibility mode is disabled + */ + public function getExitCode() + { + if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { + throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.'); + } + + $this->updateStatus(false); + + return $this->exitcode; + } + + /** + * Returns a string representation for the exit code returned by the process. + * + * This method relies on the Unix exit code status standardization + * and might not be relevant for other operating systems. + * + * @return string|null A string representation for the exit status code, null if the Process is not terminated + * + * @see http://tldp.org/LDP/abs/html/exitcodes.html + * @see http://en.wikipedia.org/wiki/Unix_signal + */ + public function getExitCodeText() + { + if (null === $exitcode = $this->getExitCode()) { + return null; + } + + return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error'; + } + + /** + * Checks if the process ended successfully. + * + * @return bool true if the process ended successfully, false otherwise + */ + public function isSuccessful() + { + return 0 === $this->getExitCode(); + } + + /** + * Returns true if the child process has been terminated by an uncaught signal. + * + * It always returns false on Windows. + * + * @return bool + * + * @throws RuntimeException In case --enable-sigchild is activated + * @throws LogicException In case the process is not terminated + */ + public function hasBeenSignaled() + { + $this->requireProcessIsTerminated(__FUNCTION__); + + if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { + throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.'); + } + + return $this->processInformation['signaled']; + } + + /** + * Returns the number of the signal that caused the child process to terminate its execution. + * + * It is only meaningful if hasBeenSignaled() returns true. + * + * @return int + * + * @throws RuntimeException In case --enable-sigchild is activated + * @throws LogicException In case the process is not terminated + */ + public function getTermSignal() + { + $this->requireProcessIsTerminated(__FUNCTION__); + + if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) { + throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.'); + } + + return $this->processInformation['termsig']; + } + + /** + * Returns true if the child process has been stopped by a signal. + * + * It always returns false on Windows. + * + * @return bool + * + * @throws LogicException In case the process is not terminated + */ + public function hasBeenStopped() + { + $this->requireProcessIsTerminated(__FUNCTION__); + + return $this->processInformation['stopped']; + } + + /** + * Returns the number of the signal that caused the child process to stop its execution. + * + * It is only meaningful if hasBeenStopped() returns true. + * + * @return int + * + * @throws LogicException In case the process is not terminated + */ + public function getStopSignal() + { + $this->requireProcessIsTerminated(__FUNCTION__); + + return $this->processInformation['stopsig']; + } + + /** + * Checks if the process is currently running. + * + * @return bool true if the process is currently running, false otherwise + */ + public function isRunning() + { + if (self::STATUS_STARTED !== $this->status) { + return false; + } + + $this->updateStatus(false); + + return $this->processInformation['running']; + } + + /** + * Checks if the process has been started with no regard to the current state. + * + * @return bool true if status is ready, false otherwise + */ + public function isStarted() + { + return self::STATUS_READY != $this->status; + } + + /** + * Checks if the process is terminated. + * + * @return bool true if process is terminated, false otherwise + */ + public function isTerminated() + { + $this->updateStatus(false); + + return self::STATUS_TERMINATED == $this->status; + } + + /** + * Gets the process status. + * + * The status is one of: ready, started, terminated. + * + * @return string The current process status + */ + public function getStatus() + { + $this->updateStatus(false); + + return $this->status; + } + + /** + * Stops the process. + * + * @param int|float $timeout The timeout in seconds + * @param int $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9) + * + * @return int|null The exit-code of the process or null if it's not running + */ + public function stop($timeout = 10, $signal = null) + { + $timeoutMicro = microtime(true) + $timeout; + if ($this->isRunning()) { + // given `SIGTERM` may not be defined and that `proc_terminate` uses the constant value and not the constant itself, we use the same here + $this->doSignal(15, false); + do { + usleep(1000); + } while ($this->isRunning() && microtime(true) < $timeoutMicro); + + if ($this->isRunning()) { + // Avoid exception here: process is supposed to be running, but it might have stopped just + // after this line. In any case, let's silently discard the error, we cannot do anything. + $this->doSignal($signal ?: 9, false); + } + } + + if ($this->isRunning()) { + if (isset($this->fallbackStatus['pid'])) { + unset($this->fallbackStatus['pid']); + + return $this->stop(0, $signal); + } + $this->close(); + } + + return $this->exitcode; + } + + /** + * Adds a line to the STDOUT stream. + * + * @internal + * + * @param string $line The line to append + */ + public function addOutput($line) + { + $this->lastOutputTime = microtime(true); + + fseek($this->stdout, 0, \SEEK_END); + fwrite($this->stdout, $line); + fseek($this->stdout, $this->incrementalOutputOffset); + } + + /** + * Adds a line to the STDERR stream. + * + * @internal + * + * @param string $line The line to append + */ + public function addErrorOutput($line) + { + $this->lastOutputTime = microtime(true); + + fseek($this->stderr, 0, \SEEK_END); + fwrite($this->stderr, $line); + fseek($this->stderr, $this->incrementalErrorOutputOffset); + } + + /** + * Gets the command line to be executed. + * + * @return string The command to execute + */ + public function getCommandLine() + { + return \is_array($this->commandline) ? implode(' ', array_map([$this, 'escapeArgument'], $this->commandline)) : $this->commandline; + } + + /** + * Sets the command line to be executed. + * + * @param string|array $commandline The command to execute + * + * @return $this + */ + public function setCommandLine($commandline) + { + $this->commandline = $commandline; + + return $this; + } + + /** + * Gets the process timeout (max. runtime). + * + * @return float|null The timeout in seconds or null if it's disabled + */ + public function getTimeout() + { + return $this->timeout; + } + + /** + * Gets the process idle timeout (max. time since last output). + * + * @return float|null The timeout in seconds or null if it's disabled + */ + public function getIdleTimeout() + { + return $this->idleTimeout; + } + + /** + * Sets the process timeout (max. runtime) in seconds. + * + * To disable the timeout, set this value to null. + * + * @param int|float|null $timeout The timeout in seconds + * + * @return $this + * + * @throws InvalidArgumentException if the timeout is negative + */ + public function setTimeout($timeout) + { + $this->timeout = $this->validateTimeout($timeout); + + return $this; + } + + /** + * Sets the process idle timeout (max. time since last output). + * + * To disable the timeout, set this value to null. + * + * @param int|float|null $timeout The timeout in seconds + * + * @return $this + * + * @throws LogicException if the output is disabled + * @throws InvalidArgumentException if the timeout is negative + */ + public function setIdleTimeout($timeout) + { + if (null !== $timeout && $this->outputDisabled) { + throw new LogicException('Idle timeout can not be set while the output is disabled.'); + } + + $this->idleTimeout = $this->validateTimeout($timeout); + + return $this; + } + + /** + * Enables or disables the TTY mode. + * + * @param bool $tty True to enabled and false to disable + * + * @return $this + * + * @throws RuntimeException In case the TTY mode is not supported + */ + public function setTty($tty) + { + if ('\\' === \DIRECTORY_SEPARATOR && $tty) { + throw new RuntimeException('TTY mode is not supported on Windows platform.'); + } + if ($tty) { + static $isTtySupported; + + if (null === $isTtySupported) { + $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes); + } + + if (!$isTtySupported) { + throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.'); + } + } + + $this->tty = (bool) $tty; + + return $this; + } + + /** + * Checks if the TTY mode is enabled. + * + * @return bool true if the TTY mode is enabled, false otherwise + */ + public function isTty() + { + return $this->tty; + } + + /** + * Sets PTY mode. + * + * @param bool $bool + * + * @return $this + */ + public function setPty($bool) + { + $this->pty = (bool) $bool; + + return $this; + } + + /** + * Returns PTY state. + * + * @return bool + */ + public function isPty() + { + return $this->pty; + } + + /** + * Gets the working directory. + * + * @return string|null The current working directory or null on failure + */ + public function getWorkingDirectory() + { + if (null === $this->cwd) { + // getcwd() will return false if any one of the parent directories does not have + // the readable or search mode set, even if the current directory does + return getcwd() ?: null; + } + + return $this->cwd; + } + + /** + * Sets the current working directory. + * + * @param string $cwd The new working directory + * + * @return $this + */ + public function setWorkingDirectory($cwd) + { + $this->cwd = $cwd; + + return $this; + } + + /** + * Gets the environment variables. + * + * @return array The current environment variables + */ + public function getEnv() + { + return $this->env; + } + + /** + * Sets the environment variables. + * + * Each environment variable value should be a string. + * If it is an array, the variable is ignored. + * If it is false or null, it will be removed when + * env vars are otherwise inherited. + * + * That happens in PHP when 'argv' is registered into + * the $_ENV array for instance. + * + * @param array $env The new environment variables + * + * @return $this + */ + public function setEnv(array $env) + { + // Process can not handle env values that are arrays + $env = array_filter($env, function ($value) { + return !\is_array($value); + }); + + $this->env = $env; + + return $this; + } + + /** + * Gets the Process input. + * + * @return resource|string|\Iterator|null The Process input + */ + public function getInput() + { + return $this->input; + } + + /** + * Sets the input. + * + * This content will be passed to the underlying process standard input. + * + * @param string|int|float|bool|resource|\Traversable|null $input The content + * + * @return $this + * + * @throws LogicException In case the process is running + */ + public function setInput($input) + { + if ($this->isRunning()) { + throw new LogicException('Input can not be set while the process is running.'); + } + + $this->input = ProcessUtils::validateInput(__METHOD__, $input); + + return $this; + } + + /** + * Gets the options for proc_open. + * + * @return array The current options + * + * @deprecated since version 3.3, to be removed in 4.0. + */ + public function getOptions() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); + + return $this->options; + } + + /** + * Sets the options for proc_open. + * + * @param array $options The new options + * + * @return $this + * + * @deprecated since version 3.3, to be removed in 4.0. + */ + public function setOptions(array $options) + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED); + + $this->options = $options; + + return $this; + } + + /** + * Gets whether or not Windows compatibility is enabled. + * + * This is true by default. + * + * @return bool + * + * @deprecated since version 3.3, to be removed in 4.0. Enhanced Windows compatibility will always be enabled. + */ + public function getEnhanceWindowsCompatibility() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Enhanced Windows compatibility will always be enabled.', __METHOD__), \E_USER_DEPRECATED); + + return $this->enhanceWindowsCompatibility; + } + + /** + * Sets whether or not Windows compatibility is enabled. + * + * @param bool $enhance + * + * @return $this + * + * @deprecated since version 3.3, to be removed in 4.0. Enhanced Windows compatibility will always be enabled. + */ + public function setEnhanceWindowsCompatibility($enhance) + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Enhanced Windows compatibility will always be enabled.', __METHOD__), \E_USER_DEPRECATED); + + $this->enhanceWindowsCompatibility = (bool) $enhance; + + return $this; + } + + /** + * Returns whether sigchild compatibility mode is activated or not. + * + * @return bool + * + * @deprecated since version 3.3, to be removed in 4.0. Sigchild compatibility will always be enabled. + */ + public function getEnhanceSigchildCompatibility() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Sigchild compatibility will always be enabled.', __METHOD__), \E_USER_DEPRECATED); + + return $this->enhanceSigchildCompatibility; + } + + /** + * Activates sigchild compatibility mode. + * + * Sigchild compatibility mode is required to get the exit code and + * determine the success of a process when PHP has been compiled with + * the --enable-sigchild option + * + * @param bool $enhance + * + * @return $this + * + * @deprecated since version 3.3, to be removed in 4.0. + */ + public function setEnhanceSigchildCompatibility($enhance) + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Sigchild compatibility will always be enabled.', __METHOD__), \E_USER_DEPRECATED); + + $this->enhanceSigchildCompatibility = (bool) $enhance; + + return $this; + } + + /** + * Sets whether environment variables will be inherited or not. + * + * @param bool $inheritEnv + * + * @return $this + */ + public function inheritEnvironmentVariables($inheritEnv = true) + { + if (!$inheritEnv) { + @trigger_error('Not inheriting environment variables is deprecated since Symfony 3.3 and will always happen in 4.0. Set "Process::inheritEnvironmentVariables()" to true instead.', \E_USER_DEPRECATED); + } + + $this->inheritEnv = (bool) $inheritEnv; + + return $this; + } + + /** + * Returns whether environment variables will be inherited or not. + * + * @return bool + * + * @deprecated since version 3.3, to be removed in 4.0. Environment variables will always be inherited. + */ + public function areEnvironmentVariablesInherited() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Environment variables will always be inherited.', __METHOD__), \E_USER_DEPRECATED); + + return $this->inheritEnv; + } + + /** + * Performs a check between the timeout definition and the time the process started. + * + * In case you run a background process (with the start method), you should + * trigger this method regularly to ensure the process timeout + * + * @throws ProcessTimedOutException In case the timeout was reached + */ + public function checkTimeout() + { + if (self::STATUS_STARTED !== $this->status) { + return; + } + + if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) { + $this->stop(0); + + throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL); + } + + if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) { + $this->stop(0); + + throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE); + } + } + + /** + * Returns whether PTY is supported on the current operating system. + * + * @return bool + */ + public static function isPtySupported() + { + static $result; + + if (null !== $result) { + return $result; + } + + if ('\\' === \DIRECTORY_SEPARATOR) { + return $result = false; + } + + return $result = (bool) @proc_open('echo 1 >/dev/null', [['pty'], ['pty'], ['pty']], $pipes); + } + + /** + * Creates the descriptors needed by the proc_open. + * + * @return array + */ + private function getDescriptors() + { + if ($this->input instanceof \Iterator) { + $this->input->rewind(); + } + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback); + } else { + $this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback); + } + + return $this->processPipes->getDescriptors(); + } + + /** + * Builds up the callback used by wait(). + * + * The callbacks adds all occurred output to the specific buffer and calls + * the user callback (if present) with the received output. + * + * @param callable|null $callback The user defined PHP callback + * + * @return \Closure A PHP closure + */ + protected function buildCallback(callable $callback = null) + { + if ($this->outputDisabled) { + return function ($type, $data) use ($callback) { + if (null !== $callback) { + \call_user_func($callback, $type, $data); + } + }; + } + + $out = self::OUT; + + return function ($type, $data) use ($callback, $out) { + if ($out == $type) { + $this->addOutput($data); + } else { + $this->addErrorOutput($data); + } + + if (null !== $callback) { + \call_user_func($callback, $type, $data); + } + }; + } + + /** + * Updates the status of the process, reads pipes. + * + * @param bool $blocking Whether to use a blocking read call + */ + protected function updateStatus($blocking) + { + if (self::STATUS_STARTED !== $this->status) { + return; + } + + $this->processInformation = proc_get_status($this->process); + $running = $this->processInformation['running']; + + $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running); + + if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { + $this->processInformation = $this->fallbackStatus + $this->processInformation; + } + + if (!$running) { + $this->close(); + } + } + + /** + * Returns whether PHP has been compiled with the '--enable-sigchild' option or not. + * + * @return bool + */ + protected function isSigchildEnabled() + { + if (null !== self::$sigchild) { + return self::$sigchild; + } + + if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) { + return self::$sigchild = false; + } + + ob_start(); + phpinfo(\INFO_GENERAL); + + return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild'); + } + + /** + * Reads pipes for the freshest output. + * + * @param string $caller The name of the method that needs fresh outputs + * @param bool $blocking Whether to use blocking calls or not + * + * @throws LogicException in case output has been disabled or process is not started + */ + private function readPipesForOutput($caller, $blocking = false) + { + if ($this->outputDisabled) { + throw new LogicException('Output has been disabled.'); + } + + $this->requireProcessIsStarted($caller); + + $this->updateStatus($blocking); + } + + /** + * Validates and returns the filtered timeout. + * + * @param int|float|null $timeout + * + * @return float|null + * + * @throws InvalidArgumentException if the given timeout is a negative number + */ + private function validateTimeout($timeout) + { + $timeout = (float) $timeout; + + if (0.0 === $timeout) { + $timeout = null; + } elseif ($timeout < 0) { + throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.'); + } + + return $timeout; + } + + /** + * Reads pipes, executes callback. + * + * @param bool $blocking Whether to use blocking calls or not + * @param bool $close Whether to close file handles or not + */ + private function readPipes($blocking, $close) + { + $result = $this->processPipes->readAndWrite($blocking, $close); + + $callback = $this->callback; + foreach ($result as $type => $data) { + if (3 !== $type) { + $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data); + } elseif (!isset($this->fallbackStatus['signaled'])) { + $this->fallbackStatus['exitcode'] = (int) $data; + } + } + } + + /** + * Closes process resource, closes file handles, sets the exitcode. + * + * @return int The exitcode + */ + private function close() + { + $this->processPipes->close(); + if (\is_resource($this->process)) { + proc_close($this->process); + } + $this->exitcode = $this->processInformation['exitcode']; + $this->status = self::STATUS_TERMINATED; + + if (-1 === $this->exitcode) { + if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) { + // if process has been signaled, no exitcode but a valid termsig, apply Unix convention + $this->exitcode = 128 + $this->processInformation['termsig']; + } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { + $this->processInformation['signaled'] = true; + $this->processInformation['termsig'] = -1; + } + } + + // Free memory from self-reference callback created by buildCallback + // Doing so in other contexts like __destruct or by garbage collector is ineffective + // Now pipes are closed, so the callback is no longer necessary + $this->callback = null; + + return $this->exitcode; + } + + /** + * Resets data related to the latest run of the process. + */ + private function resetProcessData() + { + $this->starttime = null; + $this->callback = null; + $this->exitcode = null; + $this->fallbackStatus = []; + $this->processInformation = null; + $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b'); + $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b'); + $this->process = null; + $this->latestSignal = null; + $this->status = self::STATUS_READY; + $this->incrementalOutputOffset = 0; + $this->incrementalErrorOutputOffset = 0; + } + + /** + * Sends a POSIX signal to the process. + * + * @param int $signal A valid POSIX signal (see https://php.net/pcntl.constants) + * @param bool $throwException Whether to throw exception in case signal failed + * + * @return bool True if the signal was sent successfully, false otherwise + * + * @throws LogicException In case the process is not running + * @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed + * @throws RuntimeException In case of failure + */ + private function doSignal($signal, $throwException) + { + if (null === $pid = $this->getPid()) { + if ($throwException) { + throw new LogicException('Can not send signal on a non running process.'); + } + + return false; + } + + if ('\\' === \DIRECTORY_SEPARATOR) { + exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode); + if ($exitCode && $this->isRunning()) { + if ($throwException) { + throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output))); + } + + return false; + } + } else { + if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) { + $ok = @proc_terminate($this->process, $signal); + } elseif (\function_exists('posix_kill')) { + $ok = @posix_kill($pid, $signal); + } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), [2 => ['pipe', 'w']], $pipes)) { + $ok = false === fgets($pipes[2]); + } + if (!$ok) { + if ($throwException) { + throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal)); + } + + return false; + } + } + + $this->latestSignal = (int) $signal; + $this->fallbackStatus['signaled'] = true; + $this->fallbackStatus['exitcode'] = -1; + $this->fallbackStatus['termsig'] = $this->latestSignal; + + return true; + } + + private function prepareWindowsCommandLine($cmd, array &$env) + { + $uid = uniqid('', true); + $varCount = 0; + $varCache = []; + $cmd = preg_replace_callback( + '/"(?:( + [^"%!^]*+ + (?: + (?: !LF! | "(?:\^[%!^])?+" ) + [^"%!^]*+ + )++ + ) | [^"]*+ )"/x', + function ($m) use (&$env, &$varCache, &$varCount, $uid) { + if (!isset($m[1])) { + return $m[0]; + } + if (isset($varCache[$m[0]])) { + return $varCache[$m[0]]; + } + if (false !== strpos($value = $m[1], "\0")) { + $value = str_replace("\0", '?', $value); + } + if (false === strpbrk($value, "\"%!\n")) { + return '"'.$value.'"'; + } + + $value = str_replace(['!LF!', '"^!"', '"^%"', '"^^"', '""'], ["\n", '!', '%', '^', '"'], $value); + $value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"'; + $var = $uid.++$varCount; + + $env[$var] = $value; + + return $varCache[$m[0]] = '!'.$var.'!'; + }, + $cmd + ); + + $cmd = 'cmd /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')'; + foreach ($this->processPipes->getFiles() as $offset => $filename) { + $cmd .= ' '.$offset.'>"'.$filename.'"'; + } + + return $cmd; + } + + /** + * Ensures the process is running or terminated, throws a LogicException if the process has a not started. + * + * @param string $functionName The function name that was called + * + * @throws LogicException if the process has not run + */ + private function requireProcessIsStarted($functionName) + { + if (!$this->isStarted()) { + throw new LogicException(sprintf('Process must be started before calling "%s()".', $functionName)); + } + } + + /** + * Ensures the process is terminated, throws a LogicException if the process has a status different than `terminated`. + * + * @param string $functionName The function name that was called + * + * @throws LogicException if the process is not yet terminated + */ + private function requireProcessIsTerminated($functionName) + { + if (!$this->isTerminated()) { + throw new LogicException(sprintf('Process must be terminated before calling "%s()".', $functionName)); + } + } + + /** + * Escapes a string to be used as a shell argument. + * + * @param string $argument The argument that will be escaped + * + * @return string The escaped argument + */ + private function escapeArgument($argument) + { + if ('\\' !== \DIRECTORY_SEPARATOR) { + return "'".str_replace("'", "'\\''", $argument)."'"; + } + if ('' === $argument = (string) $argument) { + return '""'; + } + if (false !== strpos($argument, "\0")) { + $argument = str_replace("\0", '?', $argument); + } + if (!preg_match('/[\/()%!^"<>&|\s]/', $argument)) { + return $argument; + } + $argument = preg_replace('/(\\\\+)$/', '$1$1', $argument); + + return '"'.str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument).'"'; + } + + private function getDefaultEnv() + { + $env = []; + + foreach ($_SERVER as $k => $v) { + if (\is_string($v) && false !== $v = getenv($k)) { + $env[$k] = $v; + } + } + + foreach ($_ENV as $k => $v) { + if (\is_string($v)) { + $env[$k] = $v; + } + } + + return $env; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ProcessBuilder.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ProcessBuilder.php new file mode 100644 index 0000000..6a8e1ef --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ProcessBuilder.php @@ -0,0 +1,280 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process; + +@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the Process class instead.', ProcessBuilder::class), \E_USER_DEPRECATED); + +use Symfony\Component\Process\Exception\InvalidArgumentException; +use Symfony\Component\Process\Exception\LogicException; + +/** + * @author Kris Wallsmith + * + * @deprecated since version 3.4, to be removed in 4.0. Use the Process class instead. + */ +class ProcessBuilder +{ + private $arguments; + private $cwd; + private $env = []; + private $input; + private $timeout = 60; + private $options; + private $inheritEnv = true; + private $prefix = []; + private $outputDisabled = false; + + /** + * @param string[] $arguments An array of arguments + */ + public function __construct(array $arguments = []) + { + $this->arguments = $arguments; + } + + /** + * Creates a process builder instance. + * + * @param string[] $arguments An array of arguments + * + * @return static + */ + public static function create(array $arguments = []) + { + return new static($arguments); + } + + /** + * Adds an unescaped argument to the command string. + * + * @param string $argument A command argument + * + * @return $this + */ + public function add($argument) + { + $this->arguments[] = $argument; + + return $this; + } + + /** + * Adds a prefix to the command string. + * + * The prefix is preserved when resetting arguments. + * + * @param string|array $prefix A command prefix or an array of command prefixes + * + * @return $this + */ + public function setPrefix($prefix) + { + $this->prefix = \is_array($prefix) ? $prefix : [$prefix]; + + return $this; + } + + /** + * Sets the arguments of the process. + * + * Arguments must not be escaped. + * Previous arguments are removed. + * + * @param string[] $arguments + * + * @return $this + */ + public function setArguments(array $arguments) + { + $this->arguments = $arguments; + + return $this; + } + + /** + * Sets the working directory. + * + * @param string|null $cwd The working directory + * + * @return $this + */ + public function setWorkingDirectory($cwd) + { + $this->cwd = $cwd; + + return $this; + } + + /** + * Sets whether environment variables will be inherited or not. + * + * @param bool $inheritEnv + * + * @return $this + */ + public function inheritEnvironmentVariables($inheritEnv = true) + { + $this->inheritEnv = $inheritEnv; + + return $this; + } + + /** + * Sets an environment variable. + * + * Setting a variable overrides its previous value. Use `null` to unset a + * defined environment variable. + * + * @param string $name The variable name + * @param string|null $value The variable value + * + * @return $this + */ + public function setEnv($name, $value) + { + $this->env[$name] = $value; + + return $this; + } + + /** + * Adds a set of environment variables. + * + * Already existing environment variables with the same name will be + * overridden by the new values passed to this method. Pass `null` to unset + * a variable. + * + * @param array $variables The variables + * + * @return $this + */ + public function addEnvironmentVariables(array $variables) + { + $this->env = array_replace($this->env, $variables); + + return $this; + } + + /** + * Sets the input of the process. + * + * @param resource|string|int|float|bool|\Traversable|null $input The input content + * + * @return $this + * + * @throws InvalidArgumentException In case the argument is invalid + */ + public function setInput($input) + { + $this->input = ProcessUtils::validateInput(__METHOD__, $input); + + return $this; + } + + /** + * Sets the process timeout. + * + * To disable the timeout, set this value to null. + * + * @param float|null $timeout + * + * @return $this + * + * @throws InvalidArgumentException + */ + public function setTimeout($timeout) + { + if (null === $timeout) { + $this->timeout = null; + + return $this; + } + + $timeout = (float) $timeout; + + if ($timeout < 0) { + throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.'); + } + + $this->timeout = $timeout; + + return $this; + } + + /** + * Adds a proc_open option. + * + * @param string $name The option name + * @param string $value The option value + * + * @return $this + */ + public function setOption($name, $value) + { + $this->options[$name] = $value; + + return $this; + } + + /** + * Disables fetching output and error output from the underlying process. + * + * @return $this + */ + public function disableOutput() + { + $this->outputDisabled = true; + + return $this; + } + + /** + * Enables fetching output and error output from the underlying process. + * + * @return $this + */ + public function enableOutput() + { + $this->outputDisabled = false; + + return $this; + } + + /** + * Creates a Process instance and returns it. + * + * @return Process + * + * @throws LogicException In case no arguments have been provided + */ + public function getProcess() + { + if (0 === \count($this->prefix) && 0 === \count($this->arguments)) { + throw new LogicException('You must add() command arguments before calling getProcess().'); + } + + $arguments = array_merge($this->prefix, $this->arguments); + $process = new Process($arguments, $this->cwd, $this->env, $this->input, $this->timeout, $this->options); + // to preserve the BC with symfony <3.3, we convert the array structure + // to a string structure to avoid the prefixing with the exec command + $process->setCommandLine($process->getCommandLine()); + + if ($this->inheritEnv) { + $process->inheritEnvironmentVariables(); + } + if ($this->outputDisabled) { + $process->disableOutput(); + } + + return $process; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ProcessUtils.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ProcessUtils.php new file mode 100644 index 0000000..1c02768 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/ProcessUtils.php @@ -0,0 +1,123 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process; + +use Symfony\Component\Process\Exception\InvalidArgumentException; + +/** + * ProcessUtils is a bunch of utility methods. + * + * This class contains static methods only and is not meant to be instantiated. + * + * @author Martin Hasoň + */ +class ProcessUtils +{ + /** + * This class should not be instantiated. + */ + private function __construct() + { + } + + /** + * Escapes a string to be used as a shell argument. + * + * @param string $argument The argument that will be escaped + * + * @return string The escaped argument + * + * @deprecated since version 3.3, to be removed in 4.0. Use a command line array or give env vars to the `Process::start/run()` method instead. + */ + public static function escapeArgument($argument) + { + @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use a command line array or give env vars to the Process::start/run() method instead.', \E_USER_DEPRECATED); + + //Fix for PHP bug #43784 escapeshellarg removes % from given string + //Fix for PHP bug #49446 escapeshellarg doesn't work on Windows + //@see https://bugs.php.net/43784 + //@see https://bugs.php.net/49446 + if ('\\' === \DIRECTORY_SEPARATOR) { + if ('' === $argument) { + return escapeshellarg($argument); + } + + $escapedArgument = ''; + $quote = false; + foreach (preg_split('/(")/', $argument, -1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE) as $part) { + if ('"' === $part) { + $escapedArgument .= '\\"'; + } elseif (self::isSurroundedBy($part, '%')) { + // Avoid environment variable expansion + $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%'; + } else { + // escape trailing backslash + if ('\\' === substr($part, -1)) { + $part .= '\\'; + } + $quote = true; + $escapedArgument .= $part; + } + } + if ($quote) { + $escapedArgument = '"'.$escapedArgument.'"'; + } + + return $escapedArgument; + } + + return "'".str_replace("'", "'\\''", $argument)."'"; + } + + /** + * Validates and normalizes a Process input. + * + * @param string $caller The name of method call that validates the input + * @param mixed $input The input to validate + * + * @return mixed The validated input + * + * @throws InvalidArgumentException In case the input is not valid + */ + public static function validateInput($caller, $input) + { + if (null !== $input) { + if (\is_resource($input)) { + return $input; + } + if (\is_string($input)) { + return $input; + } + if (is_scalar($input)) { + return (string) $input; + } + if ($input instanceof Process) { + return $input->getIterator($input::ITER_SKIP_ERR); + } + if ($input instanceof \Iterator) { + return $input; + } + if ($input instanceof \Traversable) { + return new \IteratorIterator($input); + } + + throw new InvalidArgumentException(sprintf('"%s" only accepts strings, Traversable objects or stream resources.', $caller)); + } + + return $input; + } + + private static function isSurroundedBy($arg, $char) + { + return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1]; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/README.md b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/README.md new file mode 100644 index 0000000..b7ca5b4 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/README.md @@ -0,0 +1,13 @@ +Process Component +================= + +The Process component executes commands in sub-processes. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/process.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ErrorProcessInitiator.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ErrorProcessInitiator.php new file mode 100644 index 0000000..37c1e65 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ErrorProcessInitiator.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Tests; + +use Symfony\Component\Process\Exception\ProcessTimedOutException; +use Symfony\Component\Process\Process; + +require \dirname(__DIR__).'/vendor/autoload.php'; + +list('e' => $php) = getopt('e:') + ['e' => 'php']; + +try { + $process = new Process("exec $php -r \"echo 'ready'; trigger_error('error', E_USER_ERROR);\""); + $process->start(); + $process->setTimeout(0.5); + while (false === strpos($process->getOutput(), 'ready')) { + usleep(1000); + } + $process->signal(\SIGSTOP); + $process->wait(); + + return $process->getExitCode(); +} catch (ProcessTimedOutException $t) { + echo $t->getMessage().\PHP_EOL; + + return 1; +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ExecutableFinderTest.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ExecutableFinderTest.php new file mode 100644 index 0000000..72e6ff6 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ExecutableFinderTest.php @@ -0,0 +1,175 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Process\ExecutableFinder; + +/** + * @author Chris Smith + */ +class ExecutableFinderTest extends TestCase +{ + private $path; + + protected function tearDown() + { + if ($this->path) { + // Restore path if it was changed. + putenv('PATH='.$this->path); + } + } + + private function setPath($path) + { + $this->path = getenv('PATH'); + putenv('PATH='.$path); + } + + public function testFind() + { + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + + $this->setPath(\dirname(\PHP_BINARY)); + + $finder = new ExecutableFinder(); + $result = $finder->find($this->getPhpBinaryName()); + + $this->assertSamePath(\PHP_BINARY, $result); + } + + public function testFindWithDefault() + { + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + + $expected = 'defaultValue'; + + $this->setPath(''); + + $finder = new ExecutableFinder(); + $result = $finder->find('foo', $expected); + + $this->assertEquals($expected, $result); + } + + public function testFindWithNullAsDefault() + { + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + + $this->setPath(''); + + $finder = new ExecutableFinder(); + + $result = $finder->find('foo'); + + $this->assertNull($result); + } + + public function testFindWithExtraDirs() + { + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + + $this->setPath(''); + + $extraDirs = [\dirname(\PHP_BINARY)]; + + $finder = new ExecutableFinder(); + $result = $finder->find($this->getPhpBinaryName(), null, $extraDirs); + + $this->assertSamePath(\PHP_BINARY, $result); + } + + public function testFindWithOpenBaseDir() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Cannot run test on windows'); + } + + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + + $this->iniSet('open_basedir', \dirname(\PHP_BINARY).(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? \PATH_SEPARATOR.'/' : '')); + + $finder = new ExecutableFinder(); + $result = $finder->find($this->getPhpBinaryName()); + + $this->assertSamePath(\PHP_BINARY, $result); + } + + public function testFindProcessInOpenBasedir() + { + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Cannot run test on windows'); + } + + $this->setPath(''); + $this->iniSet('open_basedir', \PHP_BINARY.(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? \PATH_SEPARATOR.'/' : '')); + + $finder = new ExecutableFinder(); + $result = $finder->find($this->getPhpBinaryName(), false); + + $this->assertSamePath(\PHP_BINARY, $result); + } + + public function testFindBatchExecutableOnWindows() + { + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + if ('\\' !== \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Can be only tested on windows'); + } + + $target = tempnam(sys_get_temp_dir(), 'example-windows-executable'); + + touch($target); + touch($target.'.BAT'); + + $this->assertFalse(is_executable($target)); + + $this->setPath(sys_get_temp_dir()); + + $finder = new ExecutableFinder(); + $result = $finder->find(basename($target), false); + + unlink($target); + unlink($target.'.BAT'); + + $this->assertSamePath($target.'.BAT', $result); + } + + private function assertSamePath($expected, $tested) + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->assertEquals(strtolower($expected), strtolower($tested)); + } else { + $this->assertEquals($expected, $tested); + } + } + + private function getPhpBinaryName() + { + return basename(\PHP_BINARY, '\\' === \DIRECTORY_SEPARATOR ? '.exe' : ''); + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/NonStopableProcess.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/NonStopableProcess.php new file mode 100644 index 0000000..c695f54 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/NonStopableProcess.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Runs a PHP script that can be stopped only with a SIGKILL (9) signal for 3 seconds. + * + * @args duration Run this script with a custom duration + * + * @example `php NonStopableProcess.php 42` will run the script for 42 seconds + */ +function handleSignal($signal) +{ + switch ($signal) { + case \SIGTERM: + $name = 'SIGTERM'; + break; + case \SIGINT: + $name = 'SIGINT'; + break; + default: + $name = $signal.' (unknown)'; + break; + } + + echo "signal $name\n"; +} + +pcntl_signal(\SIGTERM, 'handleSignal'); +pcntl_signal(\SIGINT, 'handleSignal'); + +echo 'received '; + +$duration = isset($argv[1]) ? (int) $argv[1] : 3; +$start = microtime(true); + +while ($duration > (microtime(true) - $start)) { + usleep(10000); + pcntl_signal_dispatch(); +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PhpExecutableFinderTest.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PhpExecutableFinderTest.php new file mode 100644 index 0000000..731e9b1 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PhpExecutableFinderTest.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Process\PhpExecutableFinder; + +/** + * @author Robert Schönthal + */ +class PhpExecutableFinderTest extends TestCase +{ + /** + * tests find() with the constant PHP_BINARY. + */ + public function testFind() + { + if (\defined('HHVM_VERSION')) { + $this->markTestSkipped('Should not be executed in HHVM context.'); + } + + $f = new PhpExecutableFinder(); + + $current = \PHP_BINARY; + $args = 'phpdbg' === \PHP_SAPI ? ' -qrr' : ''; + + $this->assertEquals($current.$args, $f->find(), '::find() returns the executable PHP'); + $this->assertEquals($current, $f->find(false), '::find() returns the executable PHP'); + } + + /** + * tests find() with the env var / constant PHP_BINARY with HHVM. + */ + public function testFindWithHHVM() + { + if (!\defined('HHVM_VERSION')) { + $this->markTestSkipped('Should be executed in HHVM context.'); + } + + $f = new PhpExecutableFinder(); + + $current = getenv('PHP_BINARY') ?: \PHP_BINARY; + + $this->assertEquals($current.' --php', $f->find(), '::find() returns the executable PHP'); + $this->assertEquals($current, $f->find(false), '::find() returns the executable PHP'); + } + + /** + * tests find() with the env var PHP_PATH. + */ + public function testFindArguments() + { + $f = new PhpExecutableFinder(); + + if (\defined('HHVM_VERSION')) { + $this->assertEquals(['--php'], $f->findArguments(), '::findArguments() returns HHVM arguments'); + } elseif ('phpdbg' === \PHP_SAPI) { + $this->assertEquals(['-qrr'], $f->findArguments(), '::findArguments() returns phpdbg arguments'); + } else { + $this->assertEquals([], $f->findArguments(), '::findArguments() returns no arguments'); + } + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PhpProcessTest.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PhpProcessTest.php new file mode 100644 index 0000000..c76ace7 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PhpProcessTest.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Process\PhpProcess; + +class PhpProcessTest extends TestCase +{ + public function testNonBlockingWorks() + { + $expected = 'hello world!'; + $process = new PhpProcess(<<start(); + $process->wait(); + $this->assertEquals($expected, $process->getOutput()); + } + + public function testCommandLine() + { + $process = new PhpProcess(<<<'PHP' +getCommandLine(); + + $process->start(); + $this->assertStringContainsString($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start'); + + $process->wait(); + $this->assertStringContainsString($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait'); + + $this->assertSame(\PHP_VERSION.\PHP_SAPI, $process->getOutput()); + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php new file mode 100644 index 0000000..a206d2b --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +define('ERR_SELECT_FAILED', 1); +define('ERR_TIMEOUT', 2); +define('ERR_READ_FAILED', 3); +define('ERR_WRITE_FAILED', 4); + +$read = [\STDIN]; +$write = [\STDOUT, \STDERR]; + +stream_set_blocking(\STDIN, 0); +stream_set_blocking(\STDOUT, 0); +stream_set_blocking(\STDERR, 0); + +$out = $err = ''; +while ($read || $write) { + $r = $read; + $w = $write; + $e = null; + $n = stream_select($r, $w, $e, 5); + + if (false === $n) { + exit(ERR_SELECT_FAILED); + } elseif ($n < 1) { + exit(ERR_TIMEOUT); + } + + if (in_array(\STDOUT, $w) && strlen($out) > 0) { + $written = fwrite(\STDOUT, (string) $out, 32768); + if (false === $written) { + exit(ERR_WRITE_FAILED); + } + $out = (string) substr($out, $written); + } + if (null === $read && '' === $out) { + $write = array_diff($write, [\STDOUT]); + } + + if (in_array(\STDERR, $w) && strlen($err) > 0) { + $written = fwrite(\STDERR, (string) $err, 32768); + if (false === $written) { + exit(ERR_WRITE_FAILED); + } + $err = (string) substr($err, $written); + } + if (null === $read && '' === $err) { + $write = array_diff($write, [\STDERR]); + } + + if ($r) { + $str = fread(\STDIN, 32768); + if (false !== $str) { + $out .= $str; + $err .= $str; + } + if (false === $str || feof(\STDIN)) { + $read = null; + if (!feof(\STDIN)) { + exit(ERR_READ_FAILED); + } + } + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessBuilderTest.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessBuilderTest.php new file mode 100644 index 0000000..c285135 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessBuilderTest.php @@ -0,0 +1,220 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Process\ProcessBuilder; + +/** + * @group legacy + */ +class ProcessBuilderTest extends TestCase +{ + public function testInheritEnvironmentVars() + { + $proc = ProcessBuilder::create() + ->add('foo') + ->getProcess(); + + $this->assertTrue($proc->areEnvironmentVariablesInherited()); + + $proc = ProcessBuilder::create() + ->add('foo') + ->inheritEnvironmentVariables(false) + ->getProcess(); + + $this->assertFalse($proc->areEnvironmentVariablesInherited()); + } + + public function testAddEnvironmentVariables() + { + $pb = new ProcessBuilder(); + $env = [ + 'foo' => 'bar', + 'foo2' => 'bar2', + ]; + $proc = $pb + ->add('command') + ->setEnv('foo', 'bar2') + ->addEnvironmentVariables($env) + ->getProcess() + ; + + $this->assertSame($env, $proc->getEnv()); + } + + public function testNegativeTimeoutFromSetter() + { + $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException'); + $pb = new ProcessBuilder(); + $pb->setTimeout(-1); + } + + public function testNullTimeout() + { + $pb = new ProcessBuilder(); + $pb->setTimeout(10); + $pb->setTimeout(null); + + $r = new \ReflectionObject($pb); + $p = $r->getProperty('timeout'); + $p->setAccessible(true); + + $this->assertNull($p->getValue($pb)); + } + + public function testShouldSetArguments() + { + $pb = new ProcessBuilder(['initial']); + $pb->setArguments(['second']); + + $proc = $pb->getProcess(); + + $this->assertStringContainsString('second', $proc->getCommandLine()); + } + + public function testPrefixIsPrependedToAllGeneratedProcess() + { + $pb = new ProcessBuilder(); + $pb->setPrefix('/usr/bin/php'); + + $proc = $pb->setArguments(['-v'])->getProcess(); + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->assertEquals('"/usr/bin/php" -v', $proc->getCommandLine()); + } else { + $this->assertEquals("'/usr/bin/php' '-v'", $proc->getCommandLine()); + } + + $proc = $pb->setArguments(['-i'])->getProcess(); + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->assertEquals('"/usr/bin/php" -i', $proc->getCommandLine()); + } else { + $this->assertEquals("'/usr/bin/php' '-i'", $proc->getCommandLine()); + } + } + + public function testArrayPrefixesArePrependedToAllGeneratedProcess() + { + $pb = new ProcessBuilder(); + $pb->setPrefix(['/usr/bin/php', 'composer.phar']); + + $proc = $pb->setArguments(['-v'])->getProcess(); + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->assertEquals('"/usr/bin/php" composer.phar -v', $proc->getCommandLine()); + } else { + $this->assertEquals("'/usr/bin/php' 'composer.phar' '-v'", $proc->getCommandLine()); + } + + $proc = $pb->setArguments(['-i'])->getProcess(); + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->assertEquals('"/usr/bin/php" composer.phar -i', $proc->getCommandLine()); + } else { + $this->assertEquals("'/usr/bin/php' 'composer.phar' '-i'", $proc->getCommandLine()); + } + } + + public function testShouldEscapeArguments() + { + $pb = new ProcessBuilder(['%path%', 'foo " bar', '%baz%baz']); + $proc = $pb->getProcess(); + + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->assertSame('""^%"path"^%"" "foo "" bar" ""^%"baz"^%"baz"', $proc->getCommandLine()); + } else { + $this->assertSame("'%path%' 'foo \" bar' '%baz%baz'", $proc->getCommandLine()); + } + } + + public function testShouldEscapeArgumentsAndPrefix() + { + $pb = new ProcessBuilder(['arg']); + $pb->setPrefix('%prefix%'); + $proc = $pb->getProcess(); + + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->assertSame('""^%"prefix"^%"" arg', $proc->getCommandLine()); + } else { + $this->assertSame("'%prefix%' 'arg'", $proc->getCommandLine()); + } + } + + public function testShouldThrowALogicExceptionIfNoPrefixAndNoArgument() + { + $this->expectException('Symfony\Component\Process\Exception\LogicException'); + ProcessBuilder::create()->getProcess(); + } + + public function testShouldNotThrowALogicExceptionIfNoArgument() + { + $process = ProcessBuilder::create() + ->setPrefix('/usr/bin/php') + ->getProcess(); + + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->assertEquals('"/usr/bin/php"', $process->getCommandLine()); + } else { + $this->assertEquals("'/usr/bin/php'", $process->getCommandLine()); + } + } + + public function testShouldNotThrowALogicExceptionIfNoPrefix() + { + $process = ProcessBuilder::create(['/usr/bin/php']) + ->getProcess(); + + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->assertEquals('"/usr/bin/php"', $process->getCommandLine()); + } else { + $this->assertEquals("'/usr/bin/php'", $process->getCommandLine()); + } + } + + public function testShouldReturnProcessWithDisabledOutput() + { + $process = ProcessBuilder::create(['/usr/bin/php']) + ->disableOutput() + ->getProcess(); + + $this->assertTrue($process->isOutputDisabled()); + } + + public function testShouldReturnProcessWithEnabledOutput() + { + $process = ProcessBuilder::create(['/usr/bin/php']) + ->disableOutput() + ->enableOutput() + ->getProcess(); + + $this->assertFalse($process->isOutputDisabled()); + } + + public function testInvalidInput() + { + $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException'); + $this->expectExceptionMessage('"Symfony\Component\Process\ProcessBuilder::setInput" only accepts strings, Traversable objects or stream resources.'); + $builder = ProcessBuilder::create(); + $builder->setInput([]); + } + + public function testDoesNotPrefixExec() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('This test cannot run on Windows.'); + } + + $builder = ProcessBuilder::create(['command', '-v', 'ls']); + $process = $builder->getProcess(); + $process->run(); + + $this->assertTrue($process->isSuccessful()); + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php new file mode 100644 index 0000000..18e3551 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php @@ -0,0 +1,133 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Process\Exception\ProcessFailedException; + +/** + * @author Sebastian Marek + */ +class ProcessFailedExceptionTest extends TestCase +{ + /** + * tests ProcessFailedException throws exception if the process was successful. + */ + public function testProcessFailedExceptionThrowsException() + { + $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful'])->setConstructorArgs(['php'])->getMock(); + $process->expects($this->once()) + ->method('isSuccessful') + ->willReturn(true); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Expected a failed process, but the given process was successful.'); + + new ProcessFailedException($process); + } + + /** + * tests ProcessFailedException uses information from process output + * to generate exception message. + */ + public function testProcessFailedExceptionPopulatesInformationFromProcessOutput() + { + $cmd = 'php'; + $exitCode = 1; + $exitText = 'General error'; + $output = 'Command output'; + $errorOutput = 'FATAL: Unexpected error'; + $workingDirectory = getcwd(); + + $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful', 'getOutput', 'getErrorOutput', 'getExitCode', 'getExitCodeText', 'isOutputDisabled', 'getWorkingDirectory'])->setConstructorArgs([$cmd])->getMock(); + $process->expects($this->once()) + ->method('isSuccessful') + ->willReturn(false); + + $process->expects($this->once()) + ->method('getOutput') + ->willReturn($output); + + $process->expects($this->once()) + ->method('getErrorOutput') + ->willReturn($errorOutput); + + $process->expects($this->once()) + ->method('getExitCode') + ->willReturn($exitCode); + + $process->expects($this->once()) + ->method('getExitCodeText') + ->willReturn($exitText); + + $process->expects($this->once()) + ->method('isOutputDisabled') + ->willReturn(false); + + $process->expects($this->once()) + ->method('getWorkingDirectory') + ->willReturn($workingDirectory); + + $exception = new ProcessFailedException($process); + + $this->assertEquals( + "The command \"$cmd\" failed.\n\nExit Code: $exitCode($exitText)\n\nWorking directory: {$workingDirectory}\n\nOutput:\n================\n{$output}\n\nError Output:\n================\n{$errorOutput}", + $exception->getMessage() + ); + } + + /** + * Tests that ProcessFailedException does not extract information from + * process output if it was previously disabled. + */ + public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput() + { + $cmd = 'php'; + $exitCode = 1; + $exitText = 'General error'; + $workingDirectory = getcwd(); + + $process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful', 'isOutputDisabled', 'getExitCode', 'getExitCodeText', 'getOutput', 'getErrorOutput', 'getWorkingDirectory'])->setConstructorArgs([$cmd])->getMock(); + $process->expects($this->once()) + ->method('isSuccessful') + ->willReturn(false); + + $process->expects($this->never()) + ->method('getOutput'); + + $process->expects($this->never()) + ->method('getErrorOutput'); + + $process->expects($this->once()) + ->method('getExitCode') + ->willReturn($exitCode); + + $process->expects($this->once()) + ->method('getExitCodeText') + ->willReturn($exitText); + + $process->expects($this->once()) + ->method('isOutputDisabled') + ->willReturn(true); + + $process->expects($this->once()) + ->method('getWorkingDirectory') + ->willReturn($workingDirectory); + + $exception = new ProcessFailedException($process); + + $this->assertEquals( + "The command \"$cmd\" failed.\n\nExit Code: $exitCode($exitText)\n\nWorking directory: {$workingDirectory}", + $exception->getMessage() + ); + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessTest.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessTest.php new file mode 100644 index 0000000..cbb5f70 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessTest.php @@ -0,0 +1,1596 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Process\Exception\LogicException; +use Symfony\Component\Process\Exception\ProcessTimedOutException; +use Symfony\Component\Process\Exception\RuntimeException; +use Symfony\Component\Process\InputStream; +use Symfony\Component\Process\PhpExecutableFinder; +use Symfony\Component\Process\Pipes\PipesInterface; +use Symfony\Component\Process\Process; + +/** + * @author Robert Schönthal + */ +class ProcessTest extends TestCase +{ + private static $phpBin; + private static $process; + private static $sigchild; + private static $notEnhancedSigchild = false; + + public static function setUpBeforeClass() + { + $phpBin = new PhpExecutableFinder(); + self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === \PHP_SAPI ? 'php' : $phpBin->find()); + + ob_start(); + phpinfo(\INFO_GENERAL); + self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild'); + } + + protected function tearDown() + { + if (self::$process) { + self::$process->stop(0); + self::$process = null; + } + } + + /** + * @group legacy + * @expectedDeprecation The provided cwd does not exist. Command is currently ran against getcwd(). This behavior is deprecated since Symfony 3.4 and will be removed in 4.0. + */ + public function testInvalidCwd() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('False-positive on Windows/appveyor.'); + } + + // Check that it works fine if the CWD exists + $cmd = new Process('echo test', __DIR__); + $cmd->run(); + + $cmd = new Process('echo test', __DIR__.'/notfound/'); + $cmd->run(); + } + + public function testThatProcessDoesNotThrowWarningDuringRun() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('This test is transient on Windows'); + } + @trigger_error('Test Error', \E_USER_NOTICE); + $process = $this->getProcessForCode('sleep(3)'); + $process->run(); + $actualError = error_get_last(); + $this->assertEquals('Test Error', $actualError['message']); + $this->assertEquals(\E_USER_NOTICE, $actualError['type']); + } + + public function testNegativeTimeoutFromConstructor() + { + $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException'); + $this->getProcess('', null, null, null, -1); + } + + public function testNegativeTimeoutFromSetter() + { + $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException'); + $p = $this->getProcess(''); + $p->setTimeout(-1); + } + + public function testFloatAndNullTimeout() + { + $p = $this->getProcess(''); + + $p->setTimeout(10); + $this->assertSame(10.0, $p->getTimeout()); + + $p->setTimeout(null); + $this->assertNull($p->getTimeout()); + + $p->setTimeout(0.0); + $this->assertNull($p->getTimeout()); + } + + /** + * @requires extension pcntl + */ + public function testStopWithTimeoutIsActuallyWorking() + { + $p = $this->getProcess([self::$phpBin, __DIR__.'/NonStopableProcess.php', 30]); + $p->start(); + + while (false === strpos($p->getOutput(), 'received')) { + usleep(1000); + } + $start = microtime(true); + $p->stop(0.1); + + $p->wait(); + + $this->assertLessThan(15, microtime(true) - $start); + } + + public function testAllOutputIsActuallyReadOnTermination() + { + // this code will result in a maximum of 2 reads of 8192 bytes by calling + // start() and isRunning(). by the time getOutput() is called the process + // has terminated so the internal pipes array is already empty. normally + // the call to start() will not read any data as the process will not have + // generated output, but this is non-deterministic so we must count it as + // a possibility. therefore we need 2 * PipesInterface::CHUNK_SIZE plus + // another byte which will never be read. + $expectedOutputSize = PipesInterface::CHUNK_SIZE * 2 + 2; + + $code = sprintf('echo str_repeat(\'*\', %d);', $expectedOutputSize); + $p = $this->getProcessForCode($code); + + $p->start(); + + // Don't call Process::run nor Process::wait to avoid any read of pipes + $h = new \ReflectionProperty($p, 'process'); + $h->setAccessible(true); + $h = $h->getValue($p); + $s = @proc_get_status($h); + + while (!empty($s['running'])) { + usleep(1000); + $s = proc_get_status($h); + } + + $o = $p->getOutput(); + + $this->assertEquals($expectedOutputSize, \strlen($o)); + } + + public function testCallbacksAreExecutedWithStart() + { + $process = $this->getProcess('echo foo'); + $process->start(function ($type, $buffer) use (&$data) { + $data .= $buffer; + }); + + $process->wait(); + + $this->assertSame('foo'.\PHP_EOL, $data); + } + + /** + * tests results from sub processes. + * + * @dataProvider responsesCodeProvider + */ + public function testProcessResponses($expected, $getter, $code) + { + $p = $this->getProcessForCode($code); + $p->run(); + + $this->assertSame($expected, $p->$getter()); + } + + /** + * tests results from sub processes. + * + * @dataProvider pipesCodeProvider + */ + public function testProcessPipes($code, $size) + { + $expected = str_repeat(str_repeat('*', 1024), $size).'!'; + $expectedLength = (1024 * $size) + 1; + + $p = $this->getProcessForCode($code); + $p->setInput($expected); + $p->run(); + + $this->assertEquals($expectedLength, \strlen($p->getOutput())); + $this->assertEquals($expectedLength, \strlen($p->getErrorOutput())); + } + + /** + * @dataProvider pipesCodeProvider + */ + public function testSetStreamAsInput($code, $size) + { + $expected = str_repeat(str_repeat('*', 1024), $size).'!'; + $expectedLength = (1024 * $size) + 1; + + $stream = fopen('php://temporary', 'w+'); + fwrite($stream, $expected); + rewind($stream); + + $p = $this->getProcessForCode($code); + $p->setInput($stream); + $p->run(); + + fclose($stream); + + $this->assertEquals($expectedLength, \strlen($p->getOutput())); + $this->assertEquals($expectedLength, \strlen($p->getErrorOutput())); + } + + public function testLiveStreamAsInput() + { + $stream = fopen('php://memory', 'r+'); + fwrite($stream, 'hello'); + rewind($stream); + + $p = $this->getProcessForCode('stream_copy_to_stream(STDIN, STDOUT);'); + $p->setInput($stream); + $p->start(function ($type, $data) use ($stream) { + if ('hello' === $data) { + fclose($stream); + } + }); + $p->wait(); + + $this->assertSame('hello', $p->getOutput()); + } + + public function testSetInputWhileRunningThrowsAnException() + { + $this->expectException('Symfony\Component\Process\Exception\LogicException'); + $this->expectExceptionMessage('Input can not be set while the process is running.'); + $process = $this->getProcessForCode('sleep(30);'); + $process->start(); + try { + $process->setInput('foobar'); + $process->stop(); + $this->fail('A LogicException should have been raised.'); + } catch (LogicException $e) { + } + $process->stop(); + + throw $e; + } + + /** + * @dataProvider provideInvalidInputValues + */ + public function testInvalidInput($value) + { + $this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException'); + $this->expectExceptionMessage('"Symfony\Component\Process\Process::setInput" only accepts strings, Traversable objects or stream resources.'); + $process = $this->getProcess('foo'); + $process->setInput($value); + } + + public function provideInvalidInputValues() + { + return [ + [[]], + [new NonStringifiable()], + ]; + } + + /** + * @dataProvider provideInputValues + */ + public function testValidInput($expected, $value) + { + $process = $this->getProcess('foo'); + $process->setInput($value); + $this->assertSame($expected, $process->getInput()); + } + + public function provideInputValues() + { + return [ + [null, null], + ['24.5', 24.5], + ['input data', 'input data'], + ]; + } + + public function chainedCommandsOutputProvider() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + return [ + ["2 \r\n2\r\n", '&&', '2'], + ]; + } + + return [ + ["1\n1\n", ';', '1'], + ["2\n2\n", '&&', '2'], + ]; + } + + /** + * @dataProvider chainedCommandsOutputProvider + */ + public function testChainedCommandsOutput($expected, $operator, $input) + { + $process = $this->getProcess(sprintf('echo %s %s echo %s', $input, $operator, $input)); + $process->run(); + $this->assertEquals($expected, $process->getOutput()); + } + + public function testCallbackIsExecutedForOutput() + { + $p = $this->getProcessForCode('echo \'foo\';'); + + $called = false; + $p->run(function ($type, $buffer) use (&$called) { + $called = 'foo' === $buffer; + }); + + $this->assertTrue($called, 'The callback should be executed with the output'); + } + + public function testCallbackIsExecutedForOutputWheneverOutputIsDisabled() + { + $p = $this->getProcessForCode('echo \'foo\';'); + $p->disableOutput(); + + $called = false; + $p->run(function ($type, $buffer) use (&$called) { + $called = 'foo' === $buffer; + }); + + $this->assertTrue($called, 'The callback should be executed with the output'); + } + + public function testGetErrorOutput() + { + $p = $this->getProcessForCode('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }'); + + $p->run(); + $this->assertEquals(3, preg_match_all('/ERROR/', $p->getErrorOutput(), $matches)); + } + + public function testFlushErrorOutput() + { + $p = $this->getProcessForCode('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }'); + + $p->run(); + $p->clearErrorOutput(); + $this->assertEmpty($p->getErrorOutput()); + } + + /** + * @dataProvider provideIncrementalOutput + */ + public function testIncrementalOutput($getOutput, $getIncrementalOutput, $uri) + { + $lock = tempnam(sys_get_temp_dir(), __FUNCTION__); + + $p = $this->getProcessForCode('file_put_contents($s = \''.$uri.'\', \'foo\'); flock(fopen('.var_export($lock, true).', \'r\'), LOCK_EX); file_put_contents($s, \'bar\');'); + + $h = fopen($lock, 'w'); + flock($h, \LOCK_EX); + + $p->start(); + + foreach (['foo', 'bar'] as $s) { + while (false === strpos($p->$getOutput(), $s)) { + usleep(1000); + } + + $this->assertSame($s, $p->$getIncrementalOutput()); + $this->assertSame('', $p->$getIncrementalOutput()); + + flock($h, \LOCK_UN); + } + + fclose($h); + } + + public function provideIncrementalOutput() + { + return [ + ['getOutput', 'getIncrementalOutput', 'php://stdout'], + ['getErrorOutput', 'getIncrementalErrorOutput', 'php://stderr'], + ]; + } + + public function testGetOutput() + { + $p = $this->getProcessForCode('$n = 0; while ($n < 3) { echo \' foo \'; $n++; }'); + + $p->run(); + $this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches)); + } + + public function testFlushOutput() + { + $p = $this->getProcessForCode('$n=0;while ($n<3) {echo \' foo \';$n++;}'); + + $p->run(); + $p->clearOutput(); + $this->assertEmpty($p->getOutput()); + } + + public function testZeroAsOutput() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + // see http://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line + $p = $this->getProcess('echo | set /p dummyName=0'); + } else { + $p = $this->getProcess('printf 0'); + } + + $p->run(); + $this->assertSame('0', $p->getOutput()); + } + + public function testExitCodeCommandFailed() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Windows does not support POSIX exit code'); + } + $this->skipIfNotEnhancedSigchild(); + + // such command run in bash return an exitcode 127 + $process = $this->getProcess('nonexistingcommandIhopeneversomeonewouldnameacommandlikethis'); + $process->run(); + + $this->assertGreaterThan(0, $process->getExitCode()); + } + + public function testTTYCommand() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Windows does not have /dev/tty support'); + } + + $process = $this->getProcess('echo "foo" >> /dev/null && '.$this->getProcessForCode('usleep(100000);')->getCommandLine()); + $process->setTty(true); + $process->start(); + $this->assertTrue($process->isRunning()); + $process->wait(); + + $this->assertSame(Process::STATUS_TERMINATED, $process->getStatus()); + } + + public function testTTYCommandExitCode() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Windows does have /dev/tty support'); + } + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess('echo "foo" >> /dev/null'); + $process->setTty(true); + $process->run(); + + $this->assertTrue($process->isSuccessful()); + } + + public function testTTYInWindowsEnvironment() + { + $this->expectException('Symfony\Component\Process\Exception\RuntimeException'); + $this->expectExceptionMessage('TTY mode is not supported on Windows platform.'); + if ('\\' !== \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('This test is for Windows platform only'); + } + + $process = $this->getProcess('echo "foo" >> /dev/null'); + $process->setTty(false); + $process->setTty(true); + } + + public function testExitCodeTextIsNullWhenExitCodeIsNull() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess(''); + $this->assertNull($process->getExitCodeText()); + } + + public function testPTYCommand() + { + if (!Process::isPtySupported()) { + $this->markTestSkipped('PTY is not supported on this operating system.'); + } + + $process = $this->getProcess('echo "foo"'); + $process->setPty(true); + $process->run(); + + $this->assertSame(Process::STATUS_TERMINATED, $process->getStatus()); + $this->assertEquals("foo\r\n", $process->getOutput()); + } + + public function testMustRun() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess('echo foo'); + + $this->assertSame($process, $process->mustRun()); + $this->assertEquals('foo'.\PHP_EOL, $process->getOutput()); + } + + public function testSuccessfulMustRunHasCorrectExitCode() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess('echo foo')->mustRun(); + $this->assertEquals(0, $process->getExitCode()); + } + + public function testMustRunThrowsException() + { + $this->expectException('Symfony\Component\Process\Exception\ProcessFailedException'); + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess('exit 1'); + $process->mustRun(); + } + + public function testExitCodeText() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess(''); + $r = new \ReflectionObject($process); + $p = $r->getProperty('exitcode'); + $p->setAccessible(true); + + $p->setValue($process, 2); + $this->assertEquals('Misuse of shell builtins', $process->getExitCodeText()); + } + + public function testStartIsNonBlocking() + { + $process = $this->getProcessForCode('usleep(500000);'); + $start = microtime(true); + $process->start(); + $end = microtime(true); + $this->assertLessThan(0.4, $end - $start); + $process->stop(); + } + + public function testUpdateStatus() + { + $process = $this->getProcess('echo foo'); + $process->run(); + $this->assertGreaterThan(0, \strlen($process->getOutput())); + } + + public function testGetExitCodeIsNullOnStart() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcessForCode('usleep(100000);'); + $this->assertNull($process->getExitCode()); + $process->start(); + $this->assertNull($process->getExitCode()); + $process->wait(); + $this->assertEquals(0, $process->getExitCode()); + } + + public function testGetExitCodeIsNullOnWhenStartingAgain() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcessForCode('usleep(100000);'); + $process->run(); + $this->assertEquals(0, $process->getExitCode()); + $process->start(); + $this->assertNull($process->getExitCode()); + $process->wait(); + $this->assertEquals(0, $process->getExitCode()); + } + + public function testGetExitCode() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess('echo foo'); + $process->run(); + $this->assertSame(0, $process->getExitCode()); + } + + public function testStatus() + { + $process = $this->getProcessForCode('usleep(100000);'); + $this->assertFalse($process->isRunning()); + $this->assertFalse($process->isStarted()); + $this->assertFalse($process->isTerminated()); + $this->assertSame(Process::STATUS_READY, $process->getStatus()); + $process->start(); + $this->assertTrue($process->isRunning()); + $this->assertTrue($process->isStarted()); + $this->assertFalse($process->isTerminated()); + $this->assertSame(Process::STATUS_STARTED, $process->getStatus()); + $process->wait(); + $this->assertFalse($process->isRunning()); + $this->assertTrue($process->isStarted()); + $this->assertTrue($process->isTerminated()); + $this->assertSame(Process::STATUS_TERMINATED, $process->getStatus()); + } + + public function testStop() + { + $process = $this->getProcessForCode('sleep(31);'); + $process->start(); + $this->assertTrue($process->isRunning()); + $process->stop(); + $this->assertFalse($process->isRunning()); + } + + public function testIsSuccessful() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess('echo foo'); + $process->run(); + $this->assertTrue($process->isSuccessful()); + } + + public function testIsSuccessfulOnlyAfterTerminated() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcessForCode('usleep(100000);'); + $process->start(); + + $this->assertFalse($process->isSuccessful()); + + $process->wait(); + + $this->assertTrue($process->isSuccessful()); + } + + public function testIsNotSuccessful() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcessForCode('throw new \Exception(\'BOUM\');'); + $process->run(); + $this->assertFalse($process->isSuccessful()); + } + + public function testProcessIsNotSignaled() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Windows does not support POSIX signals'); + } + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess('echo foo'); + $process->run(); + $this->assertFalse($process->hasBeenSignaled()); + } + + public function testProcessWithoutTermSignal() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Windows does not support POSIX signals'); + } + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess('echo foo'); + $process->run(); + $this->assertEquals(0, $process->getTermSignal()); + } + + public function testProcessIsSignaledIfStopped() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Windows does not support POSIX signals'); + } + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcessForCode('sleep(32);'); + $process->start(); + $process->stop(); + $this->assertTrue($process->hasBeenSignaled()); + $this->assertEquals(15, $process->getTermSignal()); // SIGTERM + } + + public function testProcessThrowsExceptionWhenExternallySignaled() + { + $this->expectException('Symfony\Component\Process\Exception\RuntimeException'); + $this->expectExceptionMessage('The process has been signaled'); + if (!\function_exists('posix_kill')) { + $this->markTestSkipped('Function posix_kill is required.'); + } + $this->skipIfNotEnhancedSigchild(false); + + $process = $this->getProcessForCode('sleep(32.1);'); + $process->start(); + posix_kill($process->getPid(), 9); // SIGKILL + + $process->wait(); + } + + public function testRestart() + { + $process1 = $this->getProcessForCode('echo getmypid();'); + $process1->run(); + $process2 = $process1->restart(); + + $process2->wait(); // wait for output + + // Ensure that both processed finished and the output is numeric + $this->assertFalse($process1->isRunning()); + $this->assertFalse($process2->isRunning()); + $this->assertIsNumeric($process1->getOutput()); + $this->assertIsNumeric($process2->getOutput()); + + // Ensure that restart returned a new process by check that the output is different + $this->assertNotEquals($process1->getOutput(), $process2->getOutput()); + } + + public function testRunProcessWithTimeout() + { + $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException'); + $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.'); + $process = $this->getProcessForCode('sleep(30);'); + $process->setTimeout(0.1); + $start = microtime(true); + try { + $process->run(); + $this->fail('A RuntimeException should have been raised'); + } catch (RuntimeException $e) { + } + + $this->assertLessThan(15, microtime(true) - $start); + + throw $e; + } + + public function testIterateOverProcessWithTimeout() + { + $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException'); + $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.'); + $process = $this->getProcessForCode('sleep(30);'); + $process->setTimeout(0.1); + $start = microtime(true); + try { + $process->start(); + foreach ($process as $buffer); + $this->fail('A RuntimeException should have been raised'); + } catch (RuntimeException $e) { + } + + $this->assertLessThan(15, microtime(true) - $start); + + throw $e; + } + + public function testCheckTimeoutOnNonStartedProcess() + { + $process = $this->getProcess('echo foo'); + $this->assertNull($process->checkTimeout()); + } + + public function testCheckTimeoutOnTerminatedProcess() + { + $process = $this->getProcess('echo foo'); + $process->run(); + $this->assertNull($process->checkTimeout()); + } + + public function testCheckTimeoutOnStartedProcess() + { + $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException'); + $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.'); + $process = $this->getProcessForCode('sleep(33);'); + $process->setTimeout(0.1); + + $process->start(); + $start = microtime(true); + + try { + while ($process->isRunning()) { + $process->checkTimeout(); + usleep(100000); + } + $this->fail('A ProcessTimedOutException should have been raised'); + } catch (ProcessTimedOutException $e) { + } + + $this->assertLessThan(15, microtime(true) - $start); + + throw $e; + } + + public function testIdleTimeout() + { + $process = $this->getProcessForCode('sleep(34);'); + $process->setTimeout(60); + $process->setIdleTimeout(0.1); + + try { + $process->run(); + + $this->fail('A timeout exception was expected.'); + } catch (ProcessTimedOutException $e) { + $this->assertTrue($e->isIdleTimeout()); + $this->assertFalse($e->isGeneralTimeout()); + $this->assertEquals(0.1, $e->getExceededTimeout()); + } + } + + public function testIdleTimeoutNotExceededWhenOutputIsSent() + { + $process = $this->getProcessForCode('while (true) {echo \'foo \'; usleep(1000);}'); + $process->setTimeout(1); + $process->start(); + + while (false === strpos($process->getOutput(), 'foo')) { + usleep(1000); + } + + $process->setIdleTimeout(0.5); + + try { + $process->wait(); + $this->fail('A timeout exception was expected.'); + } catch (ProcessTimedOutException $e) { + $this->assertTrue($e->isGeneralTimeout(), 'A general timeout is expected.'); + $this->assertFalse($e->isIdleTimeout(), 'No idle timeout is expected.'); + $this->assertEquals(1, $e->getExceededTimeout()); + } + } + + public function testStartAfterATimeout() + { + $this->expectException('Symfony\Component\Process\Exception\ProcessTimedOutException'); + $this->expectExceptionMessage('exceeded the timeout of 0.1 seconds.'); + $process = $this->getProcessForCode('sleep(35);'); + $process->setTimeout(0.1); + + try { + $process->run(); + $this->fail('A ProcessTimedOutException should have been raised.'); + } catch (ProcessTimedOutException $e) { + } + $this->assertFalse($process->isRunning()); + $process->start(); + $this->assertTrue($process->isRunning()); + $process->stop(0); + + throw $e; + } + + public function testGetPid() + { + $process = $this->getProcessForCode('sleep(36);'); + $process->start(); + $this->assertGreaterThan(0, $process->getPid()); + $process->stop(0); + } + + public function testGetPidIsNullBeforeStart() + { + $process = $this->getProcess('foo'); + $this->assertNull($process->getPid()); + } + + public function testGetPidIsNullAfterRun() + { + $process = $this->getProcess('echo foo'); + $process->run(); + $this->assertNull($process->getPid()); + } + + /** + * @requires extension pcntl + */ + public function testSignal() + { + $process = $this->getProcess([self::$phpBin, __DIR__.'/SignalListener.php']); + $process->start(); + + while (false === strpos($process->getOutput(), 'Caught')) { + usleep(1000); + } + $process->signal(\SIGUSR1); + $process->wait(); + + $this->assertEquals('Caught SIGUSR1', $process->getOutput()); + } + + /** + * @requires extension pcntl + */ + public function testExitCodeIsAvailableAfterSignal() + { + $this->skipIfNotEnhancedSigchild(); + + $process = $this->getProcess('sleep 4'); + $process->start(); + $process->signal(\SIGKILL); + + while ($process->isRunning()) { + usleep(10000); + } + + $this->assertFalse($process->isRunning()); + $this->assertTrue($process->hasBeenSignaled()); + $this->assertFalse($process->isSuccessful()); + $this->assertEquals(137, $process->getExitCode()); + } + + public function testSignalProcessNotRunning() + { + $this->expectException('Symfony\Component\Process\Exception\LogicException'); + $this->expectExceptionMessage('Can not send signal on a non running process.'); + $process = $this->getProcess('foo'); + $process->signal(1); // SIGHUP + } + + /** + * @dataProvider provideMethodsThatNeedARunningProcess + */ + public function testMethodsThatNeedARunningProcess($method) + { + $process = $this->getProcess('foo'); + + $this->expectException('Symfony\Component\Process\Exception\LogicException'); + $this->expectExceptionMessage(sprintf('Process must be started before calling "%s()".', $method)); + + $process->{$method}(); + } + + public function provideMethodsThatNeedARunningProcess() + { + return [ + ['getOutput'], + ['getIncrementalOutput'], + ['getErrorOutput'], + ['getIncrementalErrorOutput'], + ['wait'], + ]; + } + + /** + * @dataProvider provideMethodsThatNeedATerminatedProcess + */ + public function testMethodsThatNeedATerminatedProcess($method) + { + $this->expectException('Symfony\Component\Process\Exception\LogicException'); + $this->expectExceptionMessage('Process must be terminated before calling'); + $process = $this->getProcessForCode('sleep(37);'); + $process->start(); + try { + $process->{$method}(); + $process->stop(0); + $this->fail('A LogicException must have been thrown'); + } catch (\Exception $e) { + } + $process->stop(0); + + throw $e; + } + + public function provideMethodsThatNeedATerminatedProcess() + { + return [ + ['hasBeenSignaled'], + ['getTermSignal'], + ['hasBeenStopped'], + ['getStopSignal'], + ]; + } + + /** + * @dataProvider provideWrongSignal + */ + public function testWrongSignal($signal) + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('POSIX signals do not work on Windows'); + } + + if (\PHP_VERSION_ID < 80000 || \is_int($signal)) { + $this->expectException(RuntimeException::class); + } else { + $this->expectException('TypeError'); + } + + $process = $this->getProcessForCode('sleep(38);'); + $process->start(); + try { + $process->signal($signal); + $this->fail('A RuntimeException must have been thrown'); + } catch (\TypeError $e) { + $process->stop(0); + } catch (RuntimeException $e) { + $process->stop(0); + } + + throw $e; + } + + public function provideWrongSignal() + { + return [ + [-4], + ['Céphalopodes'], + ]; + } + + public function testDisableOutputDisablesTheOutput() + { + $p = $this->getProcess('foo'); + $this->assertFalse($p->isOutputDisabled()); + $p->disableOutput(); + $this->assertTrue($p->isOutputDisabled()); + $p->enableOutput(); + $this->assertFalse($p->isOutputDisabled()); + } + + public function testDisableOutputWhileRunningThrowsException() + { + $this->expectException('Symfony\Component\Process\Exception\RuntimeException'); + $this->expectExceptionMessage('Disabling output while the process is running is not possible.'); + $p = $this->getProcessForCode('sleep(39);'); + $p->start(); + $p->disableOutput(); + } + + public function testEnableOutputWhileRunningThrowsException() + { + $this->expectException('Symfony\Component\Process\Exception\RuntimeException'); + $this->expectExceptionMessage('Enabling output while the process is running is not possible.'); + $p = $this->getProcessForCode('sleep(40);'); + $p->disableOutput(); + $p->start(); + $p->enableOutput(); + } + + public function testEnableOrDisableOutputAfterRunDoesNotThrowException() + { + $p = $this->getProcess('echo foo'); + $p->disableOutput(); + $p->run(); + $p->enableOutput(); + $p->disableOutput(); + $this->assertTrue($p->isOutputDisabled()); + } + + public function testDisableOutputWhileIdleTimeoutIsSet() + { + $this->expectException('Symfony\Component\Process\Exception\LogicException'); + $this->expectExceptionMessage('Output can not be disabled while an idle timeout is set.'); + $process = $this->getProcess('foo'); + $process->setIdleTimeout(1); + $process->disableOutput(); + } + + public function testSetIdleTimeoutWhileOutputIsDisabled() + { + $this->expectException('Symfony\Component\Process\Exception\LogicException'); + $this->expectExceptionMessage('timeout can not be set while the output is disabled.'); + $process = $this->getProcess('foo'); + $process->disableOutput(); + $process->setIdleTimeout(1); + } + + public function testSetNullIdleTimeoutWhileOutputIsDisabled() + { + $process = $this->getProcess('foo'); + $process->disableOutput(); + $this->assertSame($process, $process->setIdleTimeout(null)); + } + + /** + * @dataProvider provideOutputFetchingMethods + */ + public function testGetOutputWhileDisabled($fetchMethod) + { + $this->expectException('Symfony\Component\Process\Exception\LogicException'); + $this->expectExceptionMessage('Output has been disabled.'); + $p = $this->getProcessForCode('sleep(41);'); + $p->disableOutput(); + $p->start(); + $p->{$fetchMethod}(); + } + + public function provideOutputFetchingMethods() + { + return [ + ['getOutput'], + ['getIncrementalOutput'], + ['getErrorOutput'], + ['getIncrementalErrorOutput'], + ]; + } + + public function testStopTerminatesProcessCleanly() + { + $process = $this->getProcessForCode('echo 123; sleep(42);'); + $process->run(function () use ($process) { + $process->stop(); + }); + $this->assertTrue(true, 'A call to stop() is not expected to cause wait() to throw a RuntimeException'); + } + + public function testKillSignalTerminatesProcessCleanly() + { + $process = $this->getProcessForCode('echo 123; sleep(43);'); + $process->run(function () use ($process) { + $process->signal(9); // SIGKILL + }); + $this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeException'); + } + + public function testTermSignalTerminatesProcessCleanly() + { + $process = $this->getProcessForCode('echo 123; sleep(44);'); + $process->run(function () use ($process) { + $process->signal(15); // SIGTERM + }); + $this->assertTrue(true, 'A call to signal() is not expected to cause wait() to throw a RuntimeException'); + } + + public function responsesCodeProvider() + { + return [ + //expected output / getter / code to execute + //[1,'getExitCode','exit(1);'], + //[true,'isSuccessful','exit();'], + ['output', 'getOutput', 'echo \'output\';'], + ]; + } + + public function pipesCodeProvider() + { + $variations = [ + 'fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);', + 'include \''.__DIR__.'/PipeStdinInStdoutStdErrStreamSelect.php\';', + ]; + + if ('\\' === \DIRECTORY_SEPARATOR) { + // Avoid XL buffers on Windows because of https://bugs.php.net/65650 + $sizes = [1, 2, 4, 8]; + } else { + $sizes = [1, 16, 64, 1024, 4096]; + } + + $codes = []; + foreach ($sizes as $size) { + foreach ($variations as $code) { + $codes[] = [$code, $size]; + } + } + + return $codes; + } + + /** + * @dataProvider provideVariousIncrementals + */ + public function testIncrementalOutputDoesNotRequireAnotherCall($stream, $method) + { + $process = $this->getProcessForCode('$n = 0; while ($n < 3) { file_put_contents(\''.$stream.'\', $n, 1); $n++; usleep(1000); }', null, null, null, null); + $process->start(); + $result = ''; + $limit = microtime(true) + 3; + $expected = '012'; + + while ($result !== $expected && microtime(true) < $limit) { + $result .= $process->$method(); + } + + $this->assertSame($expected, $result); + $process->stop(); + } + + public function provideVariousIncrementals() + { + return [ + ['php://stdout', 'getIncrementalOutput'], + ['php://stderr', 'getIncrementalErrorOutput'], + ]; + } + + public function testIteratorInput() + { + $input = function () { + yield 'ping'; + yield 'pong'; + }; + + $process = $this->getProcessForCode('stream_copy_to_stream(STDIN, STDOUT);', null, null, $input()); + $process->run(); + $this->assertSame('pingpong', $process->getOutput()); + } + + public function testSimpleInputStream() + { + $input = new InputStream(); + + $process = $this->getProcessForCode('echo \'ping\'; echo fread(STDIN, 4); echo fread(STDIN, 4);'); + $process->setInput($input); + + $process->start(function ($type, $data) use ($input) { + if ('ping' === $data) { + $input->write('pang'); + } elseif (!$input->isClosed()) { + $input->write('pong'); + $input->close(); + } + }); + + $process->wait(); + $this->assertSame('pingpangpong', $process->getOutput()); + } + + public function testInputStreamWithCallable() + { + $i = 0; + $stream = fopen('php://memory', 'w+'); + $stream = function () use ($stream, &$i) { + if ($i < 3) { + rewind($stream); + fwrite($stream, ++$i); + rewind($stream); + + return $stream; + } + + return null; + }; + + $input = new InputStream(); + $input->onEmpty($stream); + $input->write($stream()); + + $process = $this->getProcessForCode('echo fread(STDIN, 3);'); + $process->setInput($input); + $process->start(function ($type, $data) use ($input) { + $input->close(); + }); + + $process->wait(); + $this->assertSame('123', $process->getOutput()); + } + + public function testInputStreamWithGenerator() + { + $input = new InputStream(); + $input->onEmpty(function ($input) { + yield 'pong'; + $input->close(); + }); + + $process = $this->getProcessForCode('stream_copy_to_stream(STDIN, STDOUT);'); + $process->setInput($input); + $process->start(); + $input->write('ping'); + $process->wait(); + $this->assertSame('pingpong', $process->getOutput()); + } + + public function testInputStreamOnEmpty() + { + $i = 0; + $input = new InputStream(); + $input->onEmpty(function () use (&$i) { ++$i; }); + + $process = $this->getProcessForCode('echo 123; echo fread(STDIN, 1); echo 456;'); + $process->setInput($input); + $process->start(function ($type, $data) use ($input) { + if ('123' === $data) { + $input->close(); + } + }); + $process->wait(); + + $this->assertSame(0, $i, 'InputStream->onEmpty callback should be called only when the input *becomes* empty'); + $this->assertSame('123456', $process->getOutput()); + } + + public function testIteratorOutput() + { + $input = new InputStream(); + + $process = $this->getProcessForCode('fwrite(STDOUT, 123); fwrite(STDERR, 234); flush(); usleep(10000); fwrite(STDOUT, fread(STDIN, 3)); fwrite(STDERR, 456);'); + $process->setInput($input); + $process->start(); + $output = []; + + foreach ($process as $type => $data) { + $output[] = [$type, $data]; + break; + } + $expectedOutput = [ + [$process::OUT, '123'], + ]; + $this->assertSame($expectedOutput, $output); + + $input->write(345); + + foreach ($process as $type => $data) { + $output[] = [$type, $data]; + } + + $this->assertSame('', $process->getOutput()); + $this->assertFalse($process->isRunning()); + + $expectedOutput = [ + [$process::OUT, '123'], + [$process::ERR, '234'], + [$process::OUT, '345'], + [$process::ERR, '456'], + ]; + $this->assertSame($expectedOutput, $output); + } + + public function testNonBlockingNorClearingIteratorOutput() + { + $input = new InputStream(); + + $process = $this->getProcessForCode('fwrite(STDOUT, fread(STDIN, 3));'); + $process->setInput($input); + $process->start(); + $output = []; + + foreach ($process->getIterator($process::ITER_NON_BLOCKING | $process::ITER_KEEP_OUTPUT) as $type => $data) { + $output[] = [$type, $data]; + break; + } + $expectedOutput = [ + [$process::OUT, ''], + ]; + $this->assertSame($expectedOutput, $output); + + $input->write(123); + + foreach ($process->getIterator($process::ITER_NON_BLOCKING | $process::ITER_KEEP_OUTPUT) as $type => $data) { + if ('' !== $data) { + $output[] = [$type, $data]; + } + } + + $this->assertSame('123', $process->getOutput()); + $this->assertFalse($process->isRunning()); + + $expectedOutput = [ + [$process::OUT, ''], + [$process::OUT, '123'], + ]; + $this->assertSame($expectedOutput, $output); + } + + public function testChainedProcesses() + { + $p1 = $this->getProcessForCode('fwrite(STDERR, 123); fwrite(STDOUT, 456);'); + $p2 = $this->getProcessForCode('stream_copy_to_stream(STDIN, STDOUT);'); + $p2->setInput($p1); + + $p1->start(); + $p2->run(); + + $this->assertSame('123', $p1->getErrorOutput()); + $this->assertSame('', $p1->getOutput()); + $this->assertSame('', $p2->getErrorOutput()); + $this->assertSame('456', $p2->getOutput()); + } + + public function testSetBadEnv() + { + $process = $this->getProcess('echo hello'); + $process->setEnv(['bad%%' => '123']); + $process->inheritEnvironmentVariables(true); + + $process->run(); + + $this->assertSame('hello'.\PHP_EOL, $process->getOutput()); + $this->assertSame('', $process->getErrorOutput()); + } + + public function testEnvBackupDoesNotDeleteExistingVars() + { + putenv('existing_var=foo'); + $_ENV['existing_var'] = 'foo'; + $process = $this->getProcess('php -r "echo getenv(\'new_test_var\');"'); + $process->setEnv(['existing_var' => 'bar', 'new_test_var' => 'foo']); + $process->inheritEnvironmentVariables(); + + $process->run(); + + $this->assertSame('foo', $process->getOutput()); + $this->assertSame('foo', getenv('existing_var')); + $this->assertFalse(getenv('new_test_var')); + + putenv('existing_var'); + unset($_ENV['existing_var']); + } + + public function testEnvIsInherited() + { + $process = $this->getProcessForCode('echo serialize($_SERVER);', null, ['BAR' => 'BAZ', 'EMPTY' => '']); + + putenv('FOO=BAR'); + $_ENV['FOO'] = 'BAR'; + + $process->run(); + + $expected = ['BAR' => 'BAZ', 'EMPTY' => '', 'FOO' => 'BAR']; + $env = array_intersect_key(unserialize($process->getOutput()), $expected); + + $this->assertEquals($expected, $env); + + putenv('FOO'); + unset($_ENV['FOO']); + } + + /** + * @group legacy + */ + public function testInheritEnvDisabled() + { + $process = $this->getProcessForCode('echo serialize($_SERVER);', null, ['BAR' => 'BAZ']); + + putenv('FOO=BAR'); + $_ENV['FOO'] = 'BAR'; + + $this->assertSame($process, $process->inheritEnvironmentVariables(false)); + $this->assertFalse($process->areEnvironmentVariablesInherited()); + + $process->run(); + + $expected = ['BAR' => 'BAZ', 'FOO' => 'BAR']; + $env = array_intersect_key(unserialize($process->getOutput()), $expected); + unset($expected['FOO']); + + $this->assertSame($expected, $env); + + putenv('FOO'); + unset($_ENV['FOO']); + } + + public function testGetCommandLine() + { + $p = new Process(['/usr/bin/php']); + + $expected = '\\' === \DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'"; + $this->assertSame($expected, $p->getCommandLine()); + } + + /** + * @dataProvider provideEscapeArgument + */ + public function testEscapeArgument($arg) + { + $p = new Process([self::$phpBin, '-r', 'echo $argv[1];', $arg]); + $p->run(); + + $this->assertSame((string) $arg, $p->getOutput()); + } + + /** + * @dataProvider provideEscapeArgument + * @group legacy + */ + public function testEscapeArgumentWhenInheritEnvDisabled($arg) + { + $p = new Process([self::$phpBin, '-r', 'echo $argv[1];', $arg], null, ['BAR' => 'BAZ']); + $p->inheritEnvironmentVariables(false); + $p->run(); + + $this->assertSame((string) $arg, $p->getOutput()); + } + + public function testRawCommandLine() + { + $p = new Process(sprintf('"%s" -r %s "a" "" "b"', self::$phpBin, escapeshellarg('print_r($argv);'))); + $p->run(); + + $expected = << - + [1] => a + [2] => + [3] => b +) + +EOTXT; + $this->assertSame($expected, str_replace('Standard input code', '-', $p->getOutput())); + } + + public function provideEscapeArgument() + { + yield ['a"b%c%']; + yield ['a"b^c^']; + yield ["a\nb'c"]; + yield ['a^b c!']; + yield ["a!b\tc"]; + yield ['a\\\\"\\"']; + yield ['éÉèÈàÀöä']; + yield [null]; + yield [1]; + yield [1.1]; + } + + public function testEnvArgument() + { + $env = ['FOO' => 'Foo', 'BAR' => 'Bar']; + $cmd = '\\' === \DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ'; + $p = new Process($cmd, null, $env); + $p->run(null, ['BAR' => 'baR', 'BAZ' => 'baZ']); + + $this->assertSame('Foo baR baZ', rtrim($p->getOutput())); + $this->assertSame($env, $p->getEnv()); + } + + public function testWaitStoppedDeadProcess() + { + $process = $this->getProcess(self::$phpBin.' '.__DIR__.'/ErrorProcessInitiator.php -e '.self::$phpBin); + $process->start(); + $process->setTimeout(2); + $process->wait(); + $this->assertFalse($process->isRunning()); + } + + /** + * @param string $commandline + * @param string|null $cwd + * @param string|null $input + * @param int $timeout + * + * @return Process + */ + private function getProcess($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60) + { + $process = new Process($commandline, $cwd, $env, $input, $timeout); + $process->inheritEnvironmentVariables(); + + if (false !== $enhance = getenv('ENHANCE_SIGCHLD')) { + try { + $process->setEnhanceSigchildCompatibility(false); + $process->getExitCode(); + $this->fail('ENHANCE_SIGCHLD must be used together with a sigchild-enabled PHP.'); + } catch (RuntimeException $e) { + $this->assertSame('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.', $e->getMessage()); + if ($enhance) { + $process->setEnhanceSigchildCompatibility(true); + } else { + self::$notEnhancedSigchild = true; + } + } + } + + if (self::$process) { + self::$process->stop(0); + } + + return self::$process = $process; + } + + /** + * @return Process + */ + private function getProcessForCode($code, $cwd = null, array $env = null, $input = null, $timeout = 60) + { + return $this->getProcess([self::$phpBin, '-r', $code], $cwd, $env, $input, $timeout); + } + + private function skipIfNotEnhancedSigchild($expectException = true) + { + if (self::$sigchild) { + if (!$expectException) { + $this->markTestSkipped('PHP is compiled with --enable-sigchild.'); + } elseif (self::$notEnhancedSigchild) { + $this->expectException('Symfony\Component\Process\Exception\RuntimeException'); + $this->expectExceptionMessage('This PHP has been compiled with --enable-sigchild.'); + } + } + } +} + +class NonStringifiable +{ +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessUtilsTest.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessUtilsTest.php new file mode 100644 index 0000000..0c2fe94 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/ProcessUtilsTest.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Process\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Process\ProcessUtils; + +/** + * @group legacy + */ +class ProcessUtilsTest extends TestCase +{ + /** + * @dataProvider dataArguments + */ + public function testEscapeArgument($result, $argument) + { + $this->assertSame($result, ProcessUtils::escapeArgument($argument)); + } + + public function dataArguments() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + return [ + ['"\"php\" \"-v\""', '"php" "-v"'], + ['"foo bar"', 'foo bar'], + ['^%"path"^%', '%path%'], + ['"<|>\\" \\"\'f"', '<|>" "\'f'], + ['""', ''], + ['"with\trailingbs\\\\"', 'with\trailingbs\\'], + ]; + } + + return [ + ["'\"php\" \"-v\"'", '"php" "-v"'], + ["'foo bar'", 'foo bar'], + ["'%path%'", '%path%'], + ["'<|>\" \"'\\''f'", '<|>" "\'f'], + ["''", ''], + ["'with\\trailingbs\\'", 'with\trailingbs\\'], + ["'withNonAsciiAccentLikeéÉèÈàÀöä'", 'withNonAsciiAccentLikeéÉèÈàÀöä'], + ]; + } +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/SignalListener.php b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/SignalListener.php new file mode 100644 index 0000000..618be74 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/Tests/SignalListener.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +pcntl_signal(\SIGUSR1, function () { echo 'SIGUSR1'; exit; }); + +echo 'Caught '; + +$n = 0; + +while ($n++ < 400) { + usleep(10000); + pcntl_signal_dispatch(); +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/composer.json b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/composer.json new file mode 100644 index 0000000..f88f521 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/composer.json @@ -0,0 +1,28 @@ +{ + "name": "symfony/process", + "type": "library", + "description": "Symfony Process Component", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Process\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/phpunit.xml.dist b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/phpunit.xml.dist new file mode 100644 index 0000000..c32f251 --- /dev/null +++ b/sei/web/modulos/correios/lib/zbar/vendor/symfony/process/phpunit.xml.dist @@ -0,0 +1,30 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + ./Tests + ./vendor + + + + diff --git a/sei/web/modulos/correios/md_cor_adm_integracao_cadastro.php b/sei/web/modulos/correios/md_cor_adm_integracao_cadastro.php new file mode 100644 index 0000000..c38a5bf --- /dev/null +++ b/sei/web/modulos/correios/md_cor_adm_integracao_cadastro.php @@ -0,0 +1,242 @@ +setBolLigado(false); + //InfraDebug::getInstance()->setBolDebugInfra(true); + //InfraDebug::getInstance()->limpar(); + ////////////////////////////////////////////////////////////////////////////// + + SessaoSEI::getInstance()->validarLink(); + + SessaoSEI::getInstance()->validarPermissao($_GET['acao']); + + // Links para consulta Ajax + #$strLinkValidarWsdl = SessaoSEI::getInstance()->assinarLink('controlador_ajax.php?acao_ajax=md_utl_integracao_busca_operacao'); + + // Instancia classes RN e DTO + $objMdCorAdmIntegracaoDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + + + // Variaveis globais + $strTipoAcao = ''; + $strDesabilitar = ''; + $arrDados = []; + $tpFuncionalidade = null; + $arrFuncionalidadesCadastradas = null; + + $arrComandos = array(); + + switch($_GET['acao']){ + case 'md_cor_adm_integracao_cadastrar': + $strTipoAcao = 'cadastrar'; + $strTitulo = 'Novo Mapeamento de Integração'; + $arrComandos[] = ''; + $arrComandos[] = ''; + + $objMdCorAdmIntegracaoDTO->setNumIdMdCorAdmIntegracao(null); + $objMdCorAdmIntegracaoDTO->setStrNome($_POST['txtNome']); + $objMdCorAdmIntegracaoDTO->setNumFuncionalidade($_POST['selFuncionalidade']); + $objMdCorAdmIntegracaoDTO->setStrUrlOperacao($_POST['txtUrlServico']); + + $objMdCorAdmIntegracaoDTO->setStrUsuario($_POST['txtUsuario'] ?? null); + $objMdCorAdmIntegracaoDTO->setStrSenha($_POST['txtSenha'] ? MdCorAdmIntegracaoINT::gerenciaDadosRestritos($_POST['txtSenha'],'C') : null); + $objMdCorAdmIntegracaoDTO->setStrToken($_POST['txtToken'] ?? null); + + $objMdCorAdmIntegracaoDTO->setStrSinAtivo('S'); + + $arrFuncionalidadesCadastradas = $objMdCorAdmIntegracaoRN->buscaFuncionalidadesCadastradas(); + + if (isset($_POST['sbmCadastrarMdCorAdmIntegracao'])) { + try{ + $objMdCorAdmIntegracaoDTO = $objMdCorAdmIntegracaoRN->cadastrar($objMdCorAdmIntegracaoDTO); + PaginaSEI::getInstance()->adicionarMensagem('Integração "'.$objMdCorAdmIntegracaoDTO->getStrNome().'" cadastrada com sucesso.'); + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.PaginaSEI::getInstance()->getAcaoRetorno().'&acao_origem='.$_GET['acao'].'&id_md_cor_adm_integracao='.$objMdCorAdmIntegracaoDTO->getNumIdMdCorAdmIntegracao().PaginaSEI::getInstance()->montarAncora($objMdCorAdmIntegracaoDTO->getNumIdMdCorAdmIntegracao()))); + die; + }catch(Exception $e){ + PaginaSEI::getInstance()->processarExcecao($e); + } + } + break; + + case 'md_cor_adm_integracao_alterar': + $strTipoAcao = 'alterar'; + $strTitulo = 'Alterar Mapeamento de Integração'; + $arrComandos[] = ''; + $strDesabilitar = 'disabled="disabled"'; + + if (isset($_GET['id_md_cor_adm_integracao'])){ + $objMdCorAdmIntegracaoDTO->setNumIdMdCorAdmIntegracao( $_GET['id_md_cor_adm_integracao'] ); + $objMdCorAdmIntegracaoDTO->retTodos(); + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + $objMdCorAdmIntegracaoDTO = $objMdCorAdmIntegracaoRN->consultar($objMdCorAdmIntegracaoDTO); + + if ($objMdCorAdmIntegracaoDTO==null){ + throw new InfraException("Registro não encontrado."); + } + } else { + $objMdCorAdmIntegracaoDTO->setNumIdMdCorAdmIntegracao($_POST['hdnIdMdCorAdmInteg']); + $objMdCorAdmIntegracaoDTO->setStrNome($_POST['txtNome']); + $objMdCorAdmIntegracaoDTO->setNumFuncionalidade($_POST['selFuncionalidade']); + $objMdCorAdmIntegracaoDTO->setStrUrlOperacao($_POST['txtUrlServico']); + + $objMdCorAdmIntegracaoDTO->setStrUsuario($_POST['txtUsuario'] ?? null); + $objMdCorAdmIntegracaoDTO->setStrSenha($_POST['txtSenha'] ? MdCorAdmIntegracaoINT::gerenciaDadosRestritos($_POST['txtSenha'],'C') : null); + $objMdCorAdmIntegracaoDTO->setStrToken($_POST['txtToken'] ?? null); + } + + $arrComandos[] = ''; + + if (isset($_POST['sbmAlterarMdCorAdmIntegracao'])) { + try{ + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + $objMdCorAdmIntegracaoRN->alterar( $objMdCorAdmIntegracaoDTO ); + PaginaSEI::getInstance()->adicionarMensagem('Integração "'.$objMdCorAdmIntegracaoDTO->getStrNome().'" alterada com sucesso.'); + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.PaginaSEI::getInstance()->getAcaoRetorno().'&acao_origem='.$_GET['acao'].PaginaSEI::getInstance()->montarAncora($objMdCorAdmIntegracaoDTO->getNumIdMdCorAdmIntegracao()))); + die; + }catch(Exception $e){ + PaginaSEI::getInstance()->processarExcecao($e); + } + } + break; + + case 'md_cor_adm_integracao_consultar': + $strTipoAcao = 'consultar'; + $strTitulo = 'Consultar Mapeamento de Integração'; + $arrComandos[] = ''; + $objMdCorAdmIntegracaoDTO->setNumIdMdCorAdmIntegracao($_GET['id_md_cor_adm_integracao']); + $objMdCorAdmIntegracaoDTO->setBolExclusaoLogica(false); + $objMdCorAdmIntegracaoDTO->retTodos(); + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + $objMdCorAdmIntegracaoDTO = $objMdCorAdmIntegracaoRN->consultar($objMdCorAdmIntegracaoDTO); + + if ($objMdCorAdmIntegracaoDTO===null){ + throw new InfraException("Registro não encontrado."); + } + break; + + default: + throw new InfraException("Ação '".$_GET['acao']."' não reconhecida."); + } + + +}catch(Exception $e){ + PaginaSEI::getInstance()->processarExcecao($e); +} + +PaginaSEI::getInstance()->montarDocType(); +PaginaSEI::getInstance()->abrirHtml(); +PaginaSEI::getInstance()->abrirHead(); +PaginaSEI::getInstance()->montarMeta(); +PaginaSEI::getInstance()->montarTitle(PaginaSEI::getInstance()->getStrNomeSistema().' - '.$strTitulo); +PaginaSEI::getInstance()->montarStyle(); +PaginaSEI::getInstance()->abrirStyle(); +PaginaSEI::getInstance()->fecharStyle(); +#require 'md_utl_geral_css.php'; + +PaginaSEI::getInstance()->montarJavaScript(); +PaginaSEI::getInstance()->abrirJavaScript(); +PaginaSEI::getInstance()->fecharJavaScript(); +PaginaSEI::getInstance()->fecharHead(); +PaginaSEI::getInstance()->abrirBody($strTitulo,'onload="inicializar();"'); +?> +

+ + montarBarraComandosSuperior($arrComandos); + //PaginaSEI::getInstance()->montarAreaValidacao(); + PaginaSEI::getInstance()->abrirAreaDados(); + ?> + +
+
+ + /> + + +
+
+ +
+
+ + + + +
+
+ +
+
+ + /> +
+ +
+
+
+ +
+
+
+ Autenticação para Obter Token Diário +
+
+ + /> + +
+
+ + /> + +
+
+ + /> + +
+
+
+
+
+ + + + + fecharAreaDados(); + //PaginaSEI::getInstance()->montarAreaDebug(); + PaginaSEI::getInstance()->montarBarraComandosInferior($arrComandos); + ?> + + +fecharBody(); +PaginaSEI::getInstance()->fecharHtml(); diff --git a/sei/web/modulos/correios/md_cor_adm_integracao_cadastro_js.php b/sei/web/modulos/correios/md_cor_adm_integracao_cadastro_js.php new file mode 100644 index 0000000..841abd2 --- /dev/null +++ b/sei/web/modulos/correios/md_cor_adm_integracao_cadastro_js.php @@ -0,0 +1,42 @@ + diff --git a/sei/web/modulos/correios/md_cor_adm_integracao_lista.php b/sei/web/modulos/correios/md_cor_adm_integracao_lista.php new file mode 100644 index 0000000..8c86dcf --- /dev/null +++ b/sei/web/modulos/correios/md_cor_adm_integracao_lista.php @@ -0,0 +1,356 @@ +setBolLigado(false); + //InfraDebug::getInstance()->setBolDebugInfra(true); + //InfraDebug::getInstance()->limpar(); + ////////////////////////////////////////////////////////////////////////////// + + SessaoSEI::getInstance()->validarLink(); + + #PaginaSEI::getInstance()->prepararSelecao('md_cor_adm_integracao_selecionar'); + + SessaoSEI::getInstance()->validarPermissao($_GET['acao']); + + //Links dos botos + $btnLinkNovo = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=md_cor_adm_integracao_cadastrar&acao_origem='.$_GET['acao'].'&acao_retorno='.$_GET['acao']); + + switch($_GET['acao']){ + case 'md_cor_adm_integracao_excluir': + try{ + $arrStrIds = PaginaSEI::getInstance()->getArrStrItensSelecionados(); + $arrObjMdCorAdmIntegracaoDTO = array(); + for ( $i = 0 ; $i < count($arrStrIds) ; $i++ ){ + + $objMdCorAdmIntegracaoDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegracaoDTO->setNumIdMdCorAdmIntegracao($arrStrIds[$i]); + $arrObjMdCorAdmIntegracaoDTO[] = $objMdCorAdmIntegracaoDTO; + } + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + $objMdCorAdmIntegracaoRN->excluir($arrObjMdCorAdmIntegracaoDTO); + PaginaSEI::getInstance()->adicionarMensagem('Operação realizada com sucesso.'); + }catch(Exception $e){ + PaginaSEI::getInstance()->processarExcecao($e); + } + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_origem'].'&acao_origem='.$_GET['acao'])); + die; + + case 'md_cor_adm_integracao_desativar': + try{ + $arrStrIds = PaginaSEI::getInstance()->getArrStrItensSelecionados(); + $arrObjMdCorAdmIntegracaoDTO = array(); + for ( $i = 0 ; $i < count($arrStrIds) ; $i++ ) { + $objMdCorAdmIntegracaoDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegracaoDTO->setNumIdMdCorAdmIntegracao($arrStrIds[$i]); + $objMdCorAdmIntegracaoDTO->setStrSinAtivo('N'); + $arrObjMdCorAdmIntegracaoDTO[] = $objMdCorAdmIntegracaoDTO; + } + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + $objMdCorAdmIntegracaoRN->desativar($arrObjMdCorAdmIntegracaoDTO); + PaginaSEI::getInstance()->adicionarMensagem('Operação realizada com sucesso.'); + }catch(Exception $e){ + PaginaSEI::getInstance()->processarExcecao($e); + } + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_origem'].'&acao_origem='.$_GET['acao'])); + die; + + case 'md_cor_adm_integracao_reativar': + $strTitulo = 'Reativar Integrações'; + if ( $_GET['acao_confirmada'] == 'sim' ) { + try{ + $arrStrIds = PaginaSEI::getInstance()->getArrStrItensSelecionados(); + $arrObjMdCorAdmIntegracaoDTO = array(); + for ( $i = 0 ; $i < count($arrStrIds) ; $i++ ) { + $objMdCorAdmIntegracaoDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegracaoDTO->setNumIdMdCorAdmIntegracao($arrStrIds[$i]); + $objMdCorAdmIntegracaoDTO->setStrSinAtivo('S'); + $arrObjMdCorAdmIntegracaoDTO[] = $objMdCorAdmIntegracaoDTO; + } + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + $objMdCorAdmIntegracaoRN->reativar($arrObjMdCorAdmIntegracaoDTO); + PaginaSEI::getInstance()->adicionarMensagem('Operação realizada com sucesso.'); + }catch(Exception $e){ + PaginaSEI::getInstance()->processarExcecao($e); + } + header('Location: '.SessaoSEI::getInstance()->assinarLink('controlador.php?acao='.$_GET['acao_origem'].'&acao_origem='.$_GET['acao'])); + die; + } + break; + + case 'md_cor_adm_integracao_selecionar': + $strTitulo = PaginaSEI::getInstance()->getTituloSelecao('Selecionar Integração','Selecionar Integrações'); + + //Se cadastrou alguem + if ($_GET['acao_origem']=='md_cor_adm_integracao_cadastrar'){ + if (isset($_GET['id_md_cor_adm_integracao'])){ + PaginaSEI::getInstance()->adicionarSelecionado($_GET['id_md_cor_adm_integracao']); + } + } + break; + + case 'md_cor_adm_integracao_listar': + $strTitulo = 'Mapeamento das Integrações'; + break; + + default: + throw new InfraException("Ação '".$_GET['acao']."' não reconhecida."); + } + + $arrComandos = array(); + /* No momento não tem usabilidade este botao + if ($_GET['acao'] == 'md_cor_adm_integracao_selecionar'){ + $arrComandos[] = ''; + } + */ + + if ( $_GET['acao'] == 'md_cor_adm_integracao_listar' || $_GET['acao'] == 'md_cor_adm_integracao_selecionar' ){ + $bolAcaoCadastrar = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_cadastrar'); + if ($bolAcaoCadastrar){ + $arrComandos[] = ''; + } + } + + $objMdCorAdmIntegracaoDTO = new MdCorAdmIntegracaoDTO(); + $objMdCorAdmIntegracaoDTO->retNumIdMdCorAdmIntegracao(); + $objMdCorAdmIntegracaoDTO->retStrNome(); + $objMdCorAdmIntegracaoDTO->retNumFuncionalidade(); + $objMdCorAdmIntegracaoDTO->retStrSinAtivo(); + + if ($_GET['acao'] == 'md_cor_adm_integracao_reativar'){ + //Lista somente inativos + $objMdCorAdmIntegracaoDTO->setBolExclusaoLogica(false); + $objMdCorAdmIntegracaoDTO->setStrSinAtivo('N'); + } + + PaginaSEI::getInstance()->prepararOrdenacao($objMdCorAdmIntegracaoDTO, 'IdMdCorAdmIntegracao', InfraDTO::$TIPO_ORDENACAO_ASC); + PaginaSEI::getInstance()->prepararPaginacao($objMdCorAdmIntegracaoDTO); + + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + $arrObjMdCorAdmIntegracaoDTO = $objMdCorAdmIntegracaoRN->listar($objMdCorAdmIntegracaoDTO); + + PaginaSEI::getInstance()->processarPaginacao($objMdCorAdmIntegracaoDTO); + + /** @var MdCorAdmIntegracaoDTO[] $arrObjMdCorAdmIntegracaoDTO */ + + $numRegistros = count($arrObjMdCorAdmIntegracaoDTO); + $strResultado = ''; + $qtdCadastrados = count( MdCorAdmIntegracaoINT::getDadosFuncionalidade() ); + $qtdCadastradosAtivos = 0; + + if ($numRegistros > 0){ + + $bolCheck = false; + + if ($_GET['acao']=='md_cor_adm_integracao_selecionar'){ + $bolAcaoReativar = false; + $bolAcaoConsultar = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_consultar'); + $bolAcaoAlterar = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_alterar'); + $bolAcaoImprimir = false; + $bolAcaoExcluir = false; + $bolAcaoDesativar = false; + $bolCheck = true; + }else if ($_GET['acao']=='md_cor_adm_integracao_reativar'){ + $bolAcaoReativar = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_reativar'); + $bolAcaoConsultar = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_consultar'); + $bolAcaoAlterar = false; + $bolAcaoExcluir = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_excluir'); + $bolAcaoDesativar = false; + }else{ + $bolAcaoReativar = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_reativar'); + $bolAcaoConsultar = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_consultar'); + $bolAcaoAlterar = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_alterar'); + $bolAcaoExcluir = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_excluir'); + $bolAcaoDesativar = SessaoSEI::getInstance()->verificarPermissao('md_cor_adm_integracao_desativar'); + } + + if ($bolAcaoDesativar){ + $bolCheck = true; + $arrComandos[] = ''; + $strLinkDesativar = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=md_cor_adm_integracao_desativar&acao_origem='.$_GET['acao']); + } + + if ($bolAcaoReativar){ + $bolCheck = true; + $arrComandos[] = ''; + $strLinkReativar = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=md_cor_adm_integracao_reativar&acao_origem='.$_GET['acao'].'&acao_confirmada=sim'); + } + + if ($bolAcaoExcluir){ + $bolCheck = true; + $arrComandos[] = ''; + $strLinkExcluir = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=md_cor_adm_integracao_excluir&acao_origem='.$_GET['acao']); + } + + if ($_GET['acao']!='md_cor_adm_integracao_reativar'){ + $strSumarioTabela = 'Tabela de Integrações.'; + $strCaptionTabela = 'Integrações'; + }else{ + $strSumarioTabela = 'Tabela de Integrações Inativas.'; + $strCaptionTabela = 'Integrações Inatives'; + } + + $strResultado .= ''."\n"; + $strResultado .= ''; + $strResultado .= ''; + if ($bolCheck) { + $strResultado .= ''."\n"; + } + $strResultado .= ''."\n"; + $strResultado .= ''."\n"; + //$strResultado .= ''."\n"; + //$strResultado .= ''."\n"; + //$strResultado .= ''."\n"; + //$strResultado .= ''."\n"; + //$strResultado .= ''."\n"; + //$strResultado .= ''."\n"; + //$strResultado .= ''."\n"; + //$strResultado .= ''."\n"; + $strResultado .= ''."\n"; + $strResultado .= ''."\n"; + $strCssTr=''; + for($i = 0;$i < $numRegistros; $i++){ + + if ($arrObjMdCorAdmIntegracaoDTO[$i]->getStrSinAtivo() == 'S' ) $qtdCadastradosAtivos++; + + $strCssTr = ($strCssTr=='')?'':''; + $strResultado .= $strCssTr; + + if ($bolCheck){ + $strResultado .= ''; + } + $strResultado .= ''; + $strResultado .= ''; + //$strResultado .= ''; + $strResultado .= ''."\n"; + } + $strResultado .= '
'.PaginaSEI::getInstance()->gerarCaptionTabela($strCaptionTabela,$numRegistros).'
'.PaginaSEI::getInstance()->getThCheck().''.PaginaSEI::getInstance()->getThOrdenacao($objMdCorAdmIntegracaoDTO,'Nome','Nome',$arrObjMdCorAdmIntegracaoDTO).''.PaginaSEI::getInstance()->getThOrdenacao($objMdCorAdmIntegracaoDTO,'Funcionalidade','Funcionalidade',$arrObjMdCorAdmIntegracaoDTO).''.PaginaSEI::getInstance()->getThOrdenacao($objMdCorAdmIntegracaoDTO,'','TipoIntegracao',$arrObjMdCorAdmIntegracaoDTO).''.PaginaSEI::getInstance()->getThOrdenacao($objMdCorAdmIntegracaoDTO,'','MetodoAutenticacao',$arrObjMdCorAdmIntegracaoDTO).''.PaginaSEI::getInstance()->getThOrdenacao($objMdCorAdmIntegracaoDTO,'','MetodoRequisicao',$arrObjMdCorAdmIntegracaoDTO).''.PaginaSEI::getInstance()->getThOrdenacao($objMdCorAdmIntegracaoDTO,'','FormatoResposta',$arrObjMdCorAdmIntegracaoDTO).''.PaginaSEI::getInstance()->getThOrdenacao($objMdCorAdmIntegracaoDTO,'','VersaoSoap',$arrObjMdCorAdmIntegracaoDTO).''.PaginaSEI::getInstance()->getThOrdenacao($objMdCorAdmIntegracaoDTO,'','TokenAutenticacao',$arrObjMdCorAdmIntegracaoDTO).''.PaginaSEI::getInstance()->getThOrdenacao($objMdCorAdmIntegracaoDTO,'','UrlWsdl',$arrObjMdCorAdmIntegracaoDTO).''.PaginaSEI::getInstance()->getThOrdenacao($objMdCorAdmIntegracaoDTO,'','OperacaoWsdl',$arrObjMdCorAdmIntegracaoDTO).'Ações
'.PaginaSEI::getInstance()->getTrCheck($i,$arrObjMdCorAdmIntegracaoDTO[$i]->getNumIdMdCorAdmIntegracao(),$arrObjMdCorAdmIntegracaoDTO[$i]->getStrNome()).''.PaginaSEI::tratarHTML($arrObjMdCorAdmIntegracaoDTO[$i]->getStrNome()).''.PaginaSEI::tratarHTML(MdCorAdmIntegracaoINT::montarSelectFuncionalidade(null,$arrObjMdCorAdmIntegracaoDTO[$i]->getNumFuncionalidade())).''.PaginaSEI::tratarHTML($arrObjMdCorAdmIntegracaoDTO[$i]->getStrTipoIntegracao()).''; + + $strResultado .= PaginaSEI::getInstance()->getAcaoTransportarItem($i,$arrObjMdCorAdmIntegracaoDTO[$i]->getNumIdMdCorAdmIntegracao()); + + if ($bolAcaoConsultar){ + $strResultado .= 'Consultar Integração '; + } + + if ($bolAcaoAlterar){ + $strResultado .= 'Alterar Integração '; + } + + if ($bolAcaoDesativar || $bolAcaoReativar || $bolAcaoExcluir){ + $strId = $arrObjMdCorAdmIntegracaoDTO[$i]->getNumIdMdCorAdmIntegracao(); + $strDescricao = PaginaSEI::getInstance()->formatarParametrosJavaScript($arrObjMdCorAdmIntegracaoDTO[$i]->getStrNome()); + } + + if ($bolAcaoDesativar && $arrObjMdCorAdmIntegracaoDTO[$i]->getStrSinAtivo() == 'S'){ + $strResultado .= 'Desativar Integração '; + } + + if ($bolAcaoReativar && $arrObjMdCorAdmIntegracaoDTO[$i]->getStrSinAtivo() == 'N'){ + $strResultado .= 'Reativar Integração '; + } + + if ($bolAcaoExcluir){ + $strResultado .= 'Excluir Integração '; + } + + $strResultado .= '
'; + } + if ($_GET['acao'] == 'md_cor_adm_integracao_selecionar'){ + $arrComandos[] = ''; + }else{ + $arrComandos[] = ''; + } + + $strBloquearNovoCadastro = $qtdCadastradosAtivos == $qtdCadastrados ? 'S' : 'N'; + +}catch(Exception $e){ + PaginaSEI::getInstance()->processarExcecao($e); +} + +PaginaSEI::getInstance()->montarDocType(); +PaginaSEI::getInstance()->abrirHtml(); +PaginaSEI::getInstance()->abrirHead(); +PaginaSEI::getInstance()->montarMeta(); +PaginaSEI::getInstance()->montarTitle(PaginaSEI::getInstance()->getStrNomeSistema().' - '.$strTitulo); +PaginaSEI::getInstance()->montarStyle(); +PaginaSEI::getInstance()->abrirStyle(); +PaginaSEI::getInstance()->fecharStyle(); +PaginaSEI::getInstance()->montarJavaScript(); +PaginaSEI::getInstance()->abrirJavaScript(); +PaginaSEI::getInstance()->fecharJavaScript(); +PaginaSEI::getInstance()->fecharHead(); +PaginaSEI::getInstance()->abrirBody($strTitulo,'onload="inicializar();"'); +?> +
+ montarBarraComandosSuperior($arrComandos); + PaginaSEI::getInstance()->abrirAreaDados(); + PaginaSEI::getInstance()->fecharAreaDados(); + PaginaSEI::getInstance()->montarAreaTabela($strResultado,$numRegistros); + //PaginaSEI::getInstance()->montarAreaDebug(); + PaginaSEI::getInstance()->montarBarraComandosInferior($arrComandos); + ?> +
+ + + +fecharBody(); +PaginaSEI::getInstance()->fecharHtml(); diff --git a/sei/web/modulos/correios/md_cor_contrato_cadastro.php b/sei/web/modulos/correios/md_cor_contrato_cadastro.php index 5af2bda..5836fbc 100644 --- a/sei/web/modulos/correios/md_cor_contrato_cadastro.php +++ b/sei/web/modulos/correios/md_cor_contrato_cadastro.php @@ -37,22 +37,15 @@ $arrComandos[] = ''; $arrComandos[] = ''; - //$objMdCorContratoDTO->setNumIdMdCorContrato(null); $objMdCorContratoDTO->setStrNumeroContrato($_POST['txtNumeroContrato']); $objMdCorContratoDTO->setStrNumeroContratoCorreio($_POST['txtNumeroContratoCorreio']); $objMdCorContratoDTO->setStrNumeroCartaoPostagem($_POST['txtNumeroCartaoPostagem']); - $objMdCorContratoDTO->setStrUrlWebservice($_POST['txtUrlWebservice']); $objMdCorContratoDTO->setDblIdProcedimento($_POST['hdnIdProcedimento']); $objMdCorContratoDTO->setStrSinAtivo('S'); - $objMdCorContratoDTO->setStrCodigoAdministrativo($_POST['txtCodigoAdministrativo']); $objMdCorContratoDTO->setNumNumeroCnpj($_POST['txtCNPJ']); - $objMdCorContratoDTO->setStrUsuario($_POST['txtUsuario']); - $objMdCorContratoDTO->setStrSenha($_POST['txtSenha']); $objMdCorContratoDTO->setNumIdMdCorDiretoria($_POST['slCodigoDiretoria']); - $objMdCorContratoDTO->setNumAnoContratoCorreio($_POST['txtNumeroAnoContratoCorreio']); if (isset($_POST['sbmCadastrarMdCorContrato'])) { - try { $objMdCorContratoRN = new MdCorContratoRN(); $objMdCorContratoDTO = $objMdCorContratoRN->cadastrar($_POST); @@ -94,7 +87,15 @@ $arrComandos[] = ''; $objMdCorContratoDTO->setNumIdMdCorContrato($_GET['id_md_cor_contrato']); $objMdCorContratoDTO->setBolExclusaoLogica(false); - $objMdCorContratoDTO->retTodos(); + + $objMdCorContratoDTO->retStrNumeroContrato(); + $objMdCorContratoDTO->retStrNumeroContratoCorreio(); + $objMdCorContratoDTO->retStrNumeroCartaoPostagem(); + $objMdCorContratoDTO->retDblIdProcedimento(); + $objMdCorContratoDTO->retStrSinAtivo(); + $objMdCorContratoDTO->retNumNumeroCnpj(); + $objMdCorContratoDTO->retNumIdMdCorDiretoria(); + $objMdCorContratoRN = new MdCorContratoRN(); $objMdCorContratoDTO = $objMdCorContratoRN->consultar($objMdCorContratoDTO); if ($objMdCorContratoDTO === null) { @@ -112,7 +113,14 @@ $idMdCorContrato = $_GET['id_md_cor_contrato'] ? $_GET['id_md_cor_contrato'] : $_POST['hdnIdMdCorContrato']; if ($idMdCorContrato) { - $objMdCorContratoDTO->retTodos(); + $objMdCorContratoDTO->retNumIdMdCorContrato(); + $objMdCorContratoDTO->retStrNumeroContrato(); + $objMdCorContratoDTO->retStrNumeroContratoCorreio(); + $objMdCorContratoDTO->retStrNumeroCartaoPostagem(); + $objMdCorContratoDTO->retNumNumeroCnpj(); + $objMdCorContratoDTO->retNumIdMdCorDiretoria(); + $objMdCorContratoDTO->retDblIdProcedimento(); + $objMdCorContratoDTO->retStrSinAtivo(); $objMdCorContratoDTO->setBolExclusaoLogica(false); $objMdCorContratoRN = new MdCorContratoRN(); $objMdCorContratoDTO = $objMdCorContratoRN->consultar($objMdCorContratoDTO); @@ -197,24 +205,23 @@ $strAnexarMidia = '
'; $itensTabelaContratoServicos = array( - $objMdCorServicoPostalDTO->getStrIdWsCorreios(), - $objMdCorServicoPostalDTO->getStrCodigoWsCorreios(), + trim($objMdCorServicoPostalDTO->getStrCodigoWsCorreios()), $objMdCorServicoPostalDTO->getStrSinAtivo(), '', $objMdCorServicoPostalDTO->getStrNome(), - /*5*/'
', + /*5*/'
', /*6*/$strRd, /*7*/$strChk, $strAnexarMidia, - '
', + '
', '' ); if ($_GET['acao'] == 'md_cor_contrato_consultar') { $itensTabelaContratoServicos[5] = ($objMdCorServicoPostalDTO->getStrExpedicaoAvisoRecebimento() == 'S') ? 'Sim' : 'Não'; $itensTabelaContratoServicos[6] = ($cobrar == 'S') ? 'Sim' : 'Não'; - $itensTabelaContratoServicos[7] = $objMdCorServicoPostalDTO->getStrDescricao(); - $itensTabelaContratoServicos[8] = ($anexarMidia == 'S') ? 'Sim' : 'Não'; + $itensTabelaContratoServicos[7] = ($anexarMidia == 'S') ? 'Sim' : 'Não'; + $itensTabelaContratoServicos[8] = $objMdCorServicoPostalDTO->getStrDescricao(); } $arrItensTabelaContratoServicos[] = $itensTabelaContratoServicos; @@ -338,23 +345,6 @@ class="infraText form-control" onkeypress="return infraMascaraTexto(this,event,10);" maxlength="10" tabindex="getProxTabDados() ?>"/> -
- - -
@@ -393,24 +383,7 @@ class="infraText form-control"
- - -
-
-
-
-
-
- - -
-
-
-
- - -
-
-
-
- -
- - - - + +
+
-
+ +
@@ -490,15 +414,13 @@ class="infraText form-control" value=""/> - + - +
- @@ -526,5 +448,6 @@ class="infraText form-control" PaginaSEI::getInstance()->fecharAreaDados(); PaginaSEI::getInstance()->fecharBody(); PaginaSEI::getInstance()->fecharHtml(); +include_once('md_cor_funcoes_js.php'); include_once('md_cor_contrato_cadastro_js.php'); ?> \ No newline at end of file diff --git a/sei/web/modulos/correios/md_cor_contrato_cadastro_js.php b/sei/web/modulos/correios/md_cor_contrato_cadastro_js.php index 3177589..08b9f12 100644 --- a/sei/web/modulos/correios/md_cor_contrato_cadastro_js.php +++ b/sei/web/modulos/correios/md_cor_contrato_cadastro_js.php @@ -29,7 +29,7 @@ function tabelaDinamicaEventos() { var $this = $(this); var val = $this.val(); var $tr = $this.closest('tr'); - $tr.find('td:eq(3) div').html(val); //index + $tr.find('td:eq(2) div').html(val); //index objTabelaContratoServicos.alterarLinha($tr.index()); objTabelaContratoServicos.atualizaHdn(); }); @@ -46,18 +46,17 @@ function adicionarContratoServicos(xml) { var indice = (linhasTabela - 1) + index; row = {}; - row.id = $(val).find('Id').text(); - row.codigo = $(val).find('Codigo').text(); + row.codigo = $(val).find('Codigo').text().trim(); row.ar = ''; row.desc = ''; - row.tipo = '
'; + row.tipo = '
'; row.nome = $(val).find('Descricao').text(); rowRdS = '
'; rowRdN = '
'; row.check = divIniRadio + rowRdS + rowRdN + ''; row.cobrar = divIniCheck + ''; row.anexarMidia = '
'; - row.txt = '
'; + row.txt = '
'; row.acoes = 'Ações'; var bolContratoServicosCustomizado = 'hdnCustomizado'; @@ -68,18 +67,16 @@ function adicionarContratoServicos(xml) { function receberContratoServicos(row, ContratoServicosCustomizado) { var qtdContratoServicosIndicados = objTabelaContratoServicos.tbl.rows.length; objTabelaContratoServicos.exibirMensagens = false; - objTabelaContratoServicos.adicionar([row.id, row.codigo, row.ar, row.desc, row.nome, row.tipo, row.check, row.cobrar, row.anexarMidia, row.txt, ''], false); + objTabelaContratoServicos.adicionar([row.codigo, row.ar, row.desc, row.nome, row.tipo, row.check, row.cobrar, row.anexarMidia, row.txt, ''], false); infraEfeitoTabelas(); } function inicializar() { $('#hdnListaContratoServicosIndicados').val(''); - //trVermelha objTabelaContratoServicos = new infraTabelaDinamica('tbContratoServicos', 'hdnListaContratoServicosIndicados', false, tabelaDinamicaRemover, false); - objTabelaContratoServicos.gerarEfeitoTabela = true; objTabelaContratoServicos.inserirNoInicio = false; objTabelaContratoServicos.exibirMensagens = true; @@ -90,8 +87,8 @@ function inicializar() { var tabela = document.getElementById('tbContratoServicos'); // caso não seja um elemento incluido na tela verifica se pode ser excluido - if (tabela.rows[rowIndex].cells[8].querySelector('#idMdCorServicoPostal')) { - var idMdCorServicoPostal = tabela.rows[rowIndex].cells[8].querySelector('#idMdCorServicoPostal').value; + if (tabela.rows[rowIndex].cells[7].querySelector('#idMdCorServicoPostal')) { + var idMdCorServicoPostal = tabela.rows[rowIndex].cells[7].querySelector('#idMdCorServicoPostal').value; var paramsAjax = { idMdCorServicoPostal, }; @@ -137,11 +134,13 @@ function inicializar() { for (let i = 1; i < tabela.rows.length; i++) { var linha = tabela.rows[i]; - var coluna = tabela.rows[i].cells[10]; + + var coluna = tabela.rows[i].cells[9]; + var dirImg = 'getDiretorioSvgGlobal() ?>'; - if (lerCelula(tabela.rows[i].cells[2]) == 'S') { + if (lerCelula(tabela.rows[i].cells[1]) == 'S') { var imgDesativar = document.createElement('img'); imgDesativar.src = dirImg + '/desativar.svg'; @@ -165,13 +164,9 @@ function inicializar() { imgAtivar.onclick = function () { objTabelaContratoServicos.alterarLinha(this.parentNode.parentNode.rowIndex, 'reativar'); - }; - coluna.appendChild(imgAtivar); - } - } objTabelaContratoServicos.alterarLinha = function (rowIndex, flag) { @@ -183,32 +178,23 @@ function inicializar() { arrLinha[i] = infraRemoverFormatacaoXML(this.lerCelula(tabela.rows[rowIndex].cells[i])); } - /* Solução paliativa afim de agrupar todos os id's a serem desativados dentro de um array. Tratar o mesmo em MdCorContratoRn */ if (flag == "desativar") { - tabela.rows[rowIndex].style.backgroundColor = "#F39D9D"; arrLinhasDesativadas[contadorDesativadas] = arrLinha[0]; $('#hdnListaContratoServicosDesativados').val(arrLinhasDesativadas); contadorDesativadas = contadorDesativadas + 1; - - } else if (flag == "reativar") { - tabela.rows[rowIndex].style.backgroundColor = "#E4E4E4"; arrLinhasReativadas[contadorReativadas] = arrLinha[0]; $('#hdnListaContratoServicosReativadas').val(arrLinhasReativadas); contadorReativadas = contadorReativadas + 1; - - } - }; - objTabelaContratoServicos.atualizaHdn(); if ('' == 'md_cor_contrato_cadastrar') { @@ -244,12 +230,11 @@ function validarNumeroProcesso() { document.getElementById('hdnIdProcedimento').value = ''; document.getElementById('hdnNumeroProcessoContratacao').value = ''; - //document.getElementById('lblTipoProcessoContratacao').innerHTML = ''; document.getElementById('txtTipoProcessoContratacao').value = ''; var numeroProcessoPreenchido = document.getElementById('txtNumeroProcessoContratacao').value != ''; if (!numeroProcessoPreenchido) { - alert('Informe o Número.'); + exibirAlert('Informe o Número.','txtNumeroProcessoContratacao'); return false; } @@ -264,11 +249,9 @@ function validarNumeroProcesso() { data: paramsAjax, success: function (r) { if ($(r).find('MensagemValidacao').text()) { - //inicializarCamposPadroesProcesso(); - alert($(r).find('MensagemValidacao').text()); + exibirAlert( $(r).find('MensagemValidacao').text() , 'txtNumeroProcessoContratacao'); } else { document.getElementById('hdnIdProcedimento').value = $(r).find('IdProcedimento').text(); - //document.getElementById('lblTipoProcessoContratacao').innerHTML = $(r).find('TipoProcedimento').text(); document.getElementById('txtTipoProcessoContratacao').value = $(r).find('TipoProcedimento').text(); document.getElementById('txtNumeroProcessoContratacao').value = $(r).find('numeroProcesso').text(); document.getElementById('hdnNumeroProcessoContratacao').value = document.getElementById('txtNumeroProcessoContratacao').value; @@ -277,8 +260,7 @@ function validarNumeroProcesso() { error: function (e) { if ($(e.responseText).find('MensagemValidacao').text()) { - //inicializarCamposPadroesProcesso(); - alert($(e.responseText).find('MensagemValidacao').text()); + exibirAlert( $(e.responseText).find('MensagemValidacao').text() , 'txtNumeroProcessoContratacao' ); } console.error('Erro ao processar o XML do SEI: ' + e.responseText); } @@ -287,6 +269,16 @@ function validarNumeroProcesso() { function buscarServicosPostais() { + if ( infraTrim( $('#txtNumeroContratoCorreio').val() ) == '' ) { + exibirAlert('Informe o Número do Contrato nos Correios.','txtNumeroContratoCorreio'); + return false; + } + + if ( infraTrim( $('#txtCNPJ').val() ) == '' ) { + exibirAlert('Informe o CNPJ do Orgão do Contrato.','txtCNPJ'); + return false; + } + $.ajax({ url: '', type: 'POST', @@ -300,8 +292,8 @@ function buscarServicosPostais() { infraAvisoCancelar(); }, success: function (xml) { - if ($(xml).find("erros").length > 0) { - alert($(xml).find("erro").attr('descricao')); + if ($(xml).find("Erros").length > 0) { + exibirAlert( $(xml).find("Msg").text() ); return false; } else { @@ -311,7 +303,6 @@ function buscarServicosPostais() { } }, error: function (e) { - alert('3') console.error('Erro ao processar o XML do SEI: ' + e.responseText); } }); @@ -325,69 +316,36 @@ function existeContrato() { function validarCadastro() { if (infraTrim(document.getElementById('txtNumeroContrato').value) == '') { - alert('Informe o Número do Contrato no Órgão.'); - document.getElementById('txtNumeroContrato').focus(); + exibirAlert('Informe o Número do Contrato no Órgão.','txtNumeroContrato'); return false; } - if (infraTrim(document.getElementById('hdnNumeroProcessoContratacao').value) != infraTrim(document.getElementById('txtNumeroProcessoContratacao').value)) { - alert('Número do Processo de Contratação não foi validado.'); - document.getElementById('txtNumeroProcessoContratacao').focus(); + if ( + infraTrim(document.getElementById('hdnNumeroProcessoContratacao').value) != infraTrim(document.getElementById('txtNumeroProcessoContratacao').value) + || + document.getElementById('txtNumeroProcessoContratacao').value == '' + ){ + exibirAlert('Número do Processo de Contratação não foi validado.','txtNumeroProcessoContratacao'); return false; } if (infraTrim(document.getElementById('txtNumeroContratoCorreio').value) == '') { - alert('Informe o Número do Contrato nos Correios.'); - document.getElementById('txtNumeroContratoCorreio').focus(); - return false; - } - - if (infraTrim(document.getElementById('txtNumeroAnoContratoCorreio').value) == '') { - alert('Informe o Ano do Contrato nos Correios.'); - document.getElementById('txtNumeroAnoContratoCorreio').focus(); + exibirAlert('Informe o Número do Contrato nos Correios.','txtNumeroContratoCorreio'); return false; } if (infraTrim(document.getElementById('txtNumeroCartaoPostagem').value) == '') { - alert('Informe o Cartão de Postagem dos Correios correspondente ao Contrato.'); - document.getElementById('txtNumeroCartaoPostagem').focus(); + exibirAlert('Informe o Cartão de Postagem dos Correios correspondente ao Contrato.','txtNumeroCartaoPostagem'); return false; } if (infraTrim(document.getElementById('txtCNPJ').value) == '') { - alert('Informe o CNPJ do Orgão do Contrato.'); - document.getElementById('txtCNPJ').focus(); - return false; - } - - if (infraTrim(document.getElementById('txtCodigoAdministrativo').value) == '') { - alert('Informe o Código Administrativo dos Correios correspondente ao Contrato.'); - document.getElementById('txtCodigoAdministrativo').focus(); - return false; - } - - if (infraTrim(document.getElementById('txtUsuario').value) == '') { - alert('Informe o Usuário do SIGEP WEB fornecido pelos Correios.'); - document.getElementById('txtUsuario').focus(); - return false; - } - - if (infraTrim(document.getElementById('txtSenha').value) == '') { - alert('Informe a Senha do SIGEP WEB fornecida pelos Correios.'); - document.getElementById('txtSenha').focus(); - return false; - } - - if (infraTrim(document.getElementById('slCodigoDiretoria').value) == 'null') { - alert('Informe o Código da Diretoria dos Correios correspondente ao Contrato.'); - document.getElementById('slCodigoDiretoria').focus(); + exibirAlert('Informe o CNPJ do Orgão do Contrato.','txtCNPJ'); return false; } - var inputDescList = document.getElementsByClassName('input-desc'); - if (inputDescList.length <= 0) { - alert('Endereço WSDL do Web Service do SIGEP WEB não foi validado.'); - document.getElementById('txtUrlWebservice').focus(); + if (document.getElementById('hdnListaContratoServicosIndicados').value == '' ) { + exibirAlert('A lista de Serviços Postais está vazia. Os Serviços Postais serão carregados abaixo após o fechamento desta mensagem.
Por favor, informar os dados necessários.','grid-validar-url'); return false; } @@ -396,27 +354,23 @@ function validarCadastro() { $('.input-desc').each(function (i, val) { if ($(val).val() == '') { erroDescricao = true; - alert('Informe a Descrição.'); - $(val).focus(); + exibirAlert('Informe a Descrição.', $(val).attr('id')); return false; } }) - if(erroDescricao) - return false; + if (erroDescricao) return false; var erroDescricao = false; $('.sl_tipo').each(function (i, val) { if ($(val).find(':selected').val() == 'null') { erroDescricao = true; - alert('Informe um Tipo.'); - $(val).focus(); + exibirAlert('Informe um Tipo.', $(val).attr('id')); return false; } }); - if(erroDescricao) - return false; + if (erroDescricao) return false; var flag = false; $.ajax({ @@ -430,15 +384,13 @@ function validarCadastro() { }, success: function (r) { if ($(r).find('MensagemValidacao').text() != 'false') { - //inicializarCamposPadroesProcesso(); - alert($(r).find('MensagemValidacao').text()); + exibirAlert( $(r).find('MensagemValidacao').text() , 'txtNumeroContratoCorreio' ); flag = true; } }, error: function (e) { if ($(e.responseText).find('MensagemValidacao').text()) { - //inicializarCamposPadroesProcesso(); - alert($(e.responseText).find('MensagemValidacao').text()); + exibirAlert( $(e.responseText).find('MensagemValidacao').text() ); } } }); @@ -458,7 +410,6 @@ function OnSubmitForm() { return validarCadastro(); } - function exibirBotao() { var div = document.getElementById('divInfraAvisoFundo'); @@ -504,14 +455,11 @@ function processando() { exibirAvisoEditor(); - //timeoutExibirBotao = self.setTimeout('exibirBotao()',1000); - if (INFRA_IE > 0) { window.tempoInicio = (new Date()).getTime(); } else { console.time('s'); } - } function verificaAr(campo) { @@ -551,5 +499,4 @@ function lerCelula(celula) { } return ret.infraReplaceAll('
', '
'); } - \ No newline at end of file diff --git a/sei/web/modulos/correios/md_cor_contrato_lista.php b/sei/web/modulos/correios/md_cor_contrato_lista.php index 0a879b7..05941a5 100644 --- a/sei/web/modulos/correios/md_cor_contrato_lista.php +++ b/sei/web/modulos/correios/md_cor_contrato_lista.php @@ -119,7 +119,13 @@ } $objMdCorContratoDTO = new MdCorContratoDTO(); - $objMdCorContratoDTO->retTodos(true); + $objMdCorContratoDTO->retNumIdMdCorContrato(); + $objMdCorContratoDTO->retStrNumeroContrato(); + $objMdCorContratoDTO->retStrNumeroContratoCorreio(); + $objMdCorContratoDTO->retStrNumeroCartaoPostagem(); + $objMdCorContratoDTO->retNumNumeroCnpj(); + $objMdCorContratoDTO->retDblIdProcedimento(); + $objMdCorContratoDTO->retStrSinAtivo(); if (isset($_POST['txtNumeroContrato']) && !empty($_POST['txtNumeroContrato'])) { $objMdCorContratoDTO->setStrNumeroContrato('%' . $_POST['txtNumeroContrato'] . '%', InfraDTO::$OPER_LIKE); @@ -241,9 +247,9 @@ $objMdCorObjetoRN = new MdCorObjetoRN(); $objMdCorObjetoDTO = $objMdCorObjetoRN->contar($objMdCorObjetoDTO); - if ($objMdCorObjetoDTO > 0) { + //if ($objMdCorObjetoDTO > 0) { $strResultado .= 'Tipos de Embalagem '; - } + //} if ($bolAcaoConsultar) { $strResultado .= 'Consultar Contrato e Serviços Postais '; diff --git a/sei/web/modulos/correios/md_cor_contrato_lista_js.php b/sei/web/modulos/correios/md_cor_contrato_lista_js.php index da2826c..62e10e9 100644 --- a/sei/web/modulos/correios/md_cor_contrato_lista_js.php +++ b/sei/web/modulos/correios/md_cor_contrato_lista_js.php @@ -7,7 +7,7 @@ function inicializar() { } else { document.getElementById('btnFechar').focus(); } - console.log('teste: '); + infraEfeitoTabelas(); if( $('#divInfraAreaTabela').find('table').length == 0 ){ diff --git a/sei/web/modulos/correios/md_cor_expedicao_solicitada_cadastro.php b/sei/web/modulos/correios/md_cor_expedicao_solicitada_cadastro.php index 30ea62a..bb9062d 100644 --- a/sei/web/modulos/correios/md_cor_expedicao_solicitada_cadastro.php +++ b/sei/web/modulos/correios/md_cor_expedicao_solicitada_cadastro.php @@ -32,6 +32,7 @@ $id_doc = $_GET['id_doc']; $id_destinatario_aux = null; $isPermiteGravarMidia = 'N'; + $arrMsgValidacao = []; switch ($_GET['acao']) { @@ -189,7 +190,8 @@ $strLinkMontarArvore = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=procedimento_visualizar&acao_origem='.$_GET["acao"].'&montar_visualizacao=1&arvore=1&id_procedimento='.$arrObjProtocoloDTO[0]->getDblIdProcedimentoDocumento() .'&id_documento='.$_POST['id_doc']); echo ""; } @@ -416,7 +418,8 @@ $strLinkMontarArvore = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=procedimento_visualizar&acao_origem='.$_GET["acao"].'&montar_visualizacao=1&arvore=1&id_procedimento='.$arrObjProtocoloDTO[0]->getDblIdProcedimentoDocumento() .'&id_documento='.$_POST['id_doc']); echo ""; break; @@ -593,112 +596,135 @@ $arrObjProtocoloDTO = $objProtocoloRN->pesquisarRN0967($objPesquisaProtocoloDTO); $strLinkMontarArvore = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=procedimento_visualizar&acao_origem='.$_GET["acao"].'&montar_visualizacao=1&arvore=1&id_procedimento='.$arrObjProtocoloDTO[0]->getDblIdProcedimentoDocumento() .'&id_documento='.$_POST['id_doc']); echo ""; break; } else { + try { + $docDTO = new DocumentoDTO(); + $docRN = new DocumentoRN(); + $docDTO->retDblIdDocumento(); + $docDTO->retDblIdProcedimento(); + $docDTO->setDblIdDocumento($id_doc); + $docDTO = $docRN->consultarRN0005($docDTO); + $id_procedimento = $docDTO->getDblIdProcedimento(); - $docDTO = new DocumentoDTO(); - $docRN = new DocumentoRN(); - $docDTO->retDblIdDocumento(); - $docDTO->retDblIdProcedimento(); - $docDTO->setDblIdDocumento($id_doc); - $docDTO = $docRN->consultarRN0005($docDTO); - $id_procedimento = $docDTO->getDblIdProcedimento(); - - //montando links para pesquisa de protocolos anexos - $strLinkPopUpSelecaoProtocoloAnexo = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=md_cor_expedicao_cadastro_protocolos_selecionar&tipo_selecao=2&id_procedimento=' . $id_procedimento . '&id_doc=' . $id_doc . '&id_object=objLupaProtocoloAnexo'); - - $strLinkAjaxProtocoloAnexo = SessaoSEI::getInstance()->assinarLink('controlador_ajax.php?acao_ajax=md_cor_expedicao_cadastro_protocolos_autocompletar&id_procedimento=' . $id_procedimento); - - - //aplicar validaçao de informaçoes do destinatario do doc principal - require_once 'md_cor_expedicao_solicitada_cadastro_validar_destinatario.php'; - - //aplicar validaçao de informaçoes da unidade solicitante x serviços - $unidade_sol = ''; - $id_num_unidade_solic = SessaoSei::getInstance()->getNumIdUnidadeAtual(); - $id_num_servico_postal = 'null'; - - require_once 'md_cor_expedicao_solicitada_cadastro_validar_unid_exp_serv.php'; - - $isPermiteGravarMidia = $id_num_servico_postal != 'null' - ? ( MdCorServicoPostalINT::getInfoServicoPostalPorId($id_num_servico_postal) )->getStrSinAnexarMidia() ?? 'N' - : 'N'; - - //obtendo informações do contato - $objContatoDTO = new ContatoDTO(); - $objContatoRN = new ContatoRN(); - //$objContatoDTO->retTodos(true); - $objContatoDTO->retNumIdContato(); - //$objContatoDTO->getNumIdCargo(); - $objContatoDTO->retStrExpressaoCargo(); - $objContatoDTO->retStrExpressaoTratamentoCargo(); - $objContatoDTO->retStrStaGenero(); - $objContatoDTO->retStrNome(); - $objContatoDTO->retStrEndereco(); - $objContatoDTO->retStrComplemento(); - $objContatoDTO->retStrBairro(); - $objContatoDTO->retStrCep(); - $objContatoDTO->retStrNomeCidade(); - $objContatoDTO->retStrSiglaUf(); - $objContatoDTO->retNumIdContatoAssociado(); - $objContatoDTO->retStrNomeContatoAssociado(); - $objContatoDTO->retStrSinEnderecoAssociado(); - $objContatoDTO->setNumIdContato($objParticipanteDTO->getNumIdContato()); - $objContatoDTO = $objContatoRN->consultarRN0324($objContatoDTO); - - $id_destinatario = $objContatoDTO->getNumIdContato(); - $nome_destinatario = $objContatoDTO->getStrNome(); - - $cargo_destinatario = $objContatoDTO->getStrExpressaoCargo(); - - //$genero_destinatario = $objContatoDTO->getStrStaGenero(); - $tratamento_destinatario = $objContatoDTO->getStrExpressaoTratamentoCargo(); - - $endereco_destinatario = $objContatoDTO->getStrEndereco(); - $complemento_destinatario = $objContatoDTO->getStrComplemento(); - $bairro_destinatario = $objContatoDTO->getStrBairro(); - $cep_destinatario = $objContatoDTO->getStrCep(); - $cidade_destinatario = $objContatoDTO->getStrNomeCidade(); - $uf_destinatario = $objContatoDTO->getStrSiglaUf(); - - $idContatoAssociado = $objContatoDTO->getNumIdContatoAssociado(); - //$nomeContatoAssociado = $objContatoDTO->getStrNomeContatoAssociado(); - - $nome_destinatario_associado = ''; - //verifica se tem contato associado e se o contato associado é PJ - if ( !is_null( $idContatoAssociado ) ) { - $objContatoAssociadoDTO = new ContatoDTO(); - $objContatoAssociadoDTO->retTodos(true); - $objContatoAssociadoDTO->setNumIdContato($idContatoAssociado); - $objContatoAssociadoDTO = $objContatoRN->consultarRN0324($objContatoAssociadoDTO); - - //captura o nome do associado caso a Natureza seja Pessoa Juridica - if ( $objContatoAssociadoDTO->getStrStaNatureza() == ContatoRN::$TN_PESSOA_JURIDICA ) $nome_destinatario_associado = $objContatoAssociadoDTO->getStrNomeContatoAssociado(); - - //captura o endereço do associado caso esteja sinalizado o uso do seu endereço - if ( $objContatoDTO->getStrSinEnderecoAssociado() == 'S' ) { - $endereco_destinatario = $objContatoAssociadoDTO->getStrEndereco(); - $complemento_destinatario = $objContatoAssociadoDTO->getStrComplemento(); - $bairro_destinatario = $objContatoAssociadoDTO->getStrBairro(); - $cep_destinatario = $objContatoAssociadoDTO->getStrCep(); - $cidade_destinatario = $objContatoAssociadoDTO->getStrNomeCidade(); - $uf_destinatario = $objContatoAssociadoDTO->getStrSiglaUf(); + //montando links para pesquisa de protocolos anexos + $strLinkPopUpSelecaoProtocoloAnexo = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=md_cor_expedicao_cadastro_protocolos_selecionar&tipo_selecao=2&id_procedimento=' . $id_procedimento . '&id_doc=' . $id_doc . '&id_object=objLupaProtocoloAnexo'); + + $strLinkAjaxProtocoloAnexo = SessaoSEI::getInstance()->assinarLink('controlador_ajax.php?acao_ajax=md_cor_expedicao_cadastro_protocolos_autocompletar&id_procedimento=' . $id_procedimento); + + + //aplicar validaçao de informaçoes do destinatario do doc principal + require_once 'md_cor_expedicao_solicitada_cadastro_validar_destinatario.php'; + + //aplicar validaçao de informaçoes da unidade solicitante x serviços + $unidade_sol = ''; + $id_num_unidade_solic = SessaoSei::getInstance()->getNumIdUnidadeAtual(); + $id_num_servico_postal = 'null'; + + require_once 'md_cor_expedicao_solicitada_cadastro_validar_unid_exp_serv.php'; + + $isPermiteGravarMidia = $id_num_servico_postal != 'null' + ? (MdCorServicoPostalINT::getInfoServicoPostalPorId($id_num_servico_postal))->getStrSinAnexarMidia() ?? 'N' + : 'N'; + + //obtendo informações do contato + $objContatoDTO = new ContatoDTO(); + $objContatoRN = new ContatoRN(); + //$objContatoDTO->retTodos(true); + $objContatoDTO->retNumIdContato(); + //$objContatoDTO->getNumIdCargo(); + $objContatoDTO->retStrExpressaoCargo(); + $objContatoDTO->retStrExpressaoTratamentoCargo(); + $objContatoDTO->retStrStaGenero(); + $objContatoDTO->retStrNome(); + $objContatoDTO->retStrEndereco(); + $objContatoDTO->retStrComplemento(); + $objContatoDTO->retStrBairro(); + $objContatoDTO->retStrCep(); + $objContatoDTO->retStrNomeCidade(); + $objContatoDTO->retStrSiglaUf(); + $objContatoDTO->retNumIdContatoAssociado(); + $objContatoDTO->retStrNomeContatoAssociado(); + $objContatoDTO->retStrSinEnderecoAssociado(); + $objContatoDTO->setNumIdContato($objParticipanteDTO->getNumIdContato()); + $objContatoDTO = $objContatoRN->consultarRN0324($objContatoDTO); + + $id_destinatario = $objContatoDTO->getNumIdContato(); + $nome_destinatario = $objContatoDTO->getStrNome(); + + $cargo_destinatario = $objContatoDTO->getStrExpressaoCargo(); + + //$genero_destinatario = $objContatoDTO->getStrStaGenero(); + $tratamento_destinatario = $objContatoDTO->getStrExpressaoTratamentoCargo(); + + $endereco_destinatario = $objContatoDTO->getStrEndereco(); + $complemento_destinatario = $objContatoDTO->getStrComplemento(); + $bairro_destinatario = $objContatoDTO->getStrBairro(); + $cep_destinatario = $objContatoDTO->getStrCep(); + $cidade_destinatario = $objContatoDTO->getStrNomeCidade(); + $uf_destinatario = $objContatoDTO->getStrSiglaUf(); + + $idContatoAssociado = $objContatoDTO->getNumIdContatoAssociado(); + //$nomeContatoAssociado = $objContatoDTO->getStrNomeContatoAssociado(); + + $nome_destinatario_associado = ''; + //verifica se tem contato associado e se o contato associado é PJ + if (!is_null($idContatoAssociado)) { + $objContatoAssociadoDTO = new ContatoDTO(); + $objContatoAssociadoDTO->retTodos(true); + $objContatoAssociadoDTO->setNumIdContato($idContatoAssociado); + $objContatoAssociadoDTO = $objContatoRN->consultarRN0324($objContatoAssociadoDTO); + + //captura o nome do associado caso a Natureza seja Pessoa Juridica + if ($objContatoAssociadoDTO->getStrStaNatureza() == ContatoRN::$TN_PESSOA_JURIDICA) $nome_destinatario_associado = $objContatoAssociadoDTO->getStrNomeContatoAssociado(); + + //captura o endereço do associado caso esteja sinalizado o uso do seu endereço + if ($objContatoDTO->getStrSinEnderecoAssociado() == 'S') { + $endereco_destinatario = $objContatoAssociadoDTO->getStrEndereco(); + $complemento_destinatario = $objContatoAssociadoDTO->getStrComplemento(); + $bairro_destinatario = $objContatoAssociadoDTO->getStrBairro(); + $cep_destinatario = $objContatoAssociadoDTO->getStrCep(); + $cidade_destinatario = $objContatoAssociadoDTO->getStrNomeCidade(); + $uf_destinatario = $objContatoAssociadoDTO->getStrSiglaUf(); + } } - } - //consulta de serviço postal - $strSelectServicoPostal = MdCorMapUnidServicoINT::montarSelectIdMdCorMapUnidServico('null', ' ', $id_num_servico_postal, $id_num_unidade_solic); + //consulta de serviço postal + $strSelectServicoPostal = MdCorMapUnidServicoINT::montarSelectIdMdCorMapUnidServico('null', ' ', $id_num_servico_postal, $id_num_unidade_solic); - $strTitulo = 'Solicitar Expedição pelos Correios'; + if ( empty($strSelectServicoPostal) ) { + $msg = MdCorMensagemINT::setMensagemPadraoPersonalizada(MdCorMensagemINT::$MSG_COR_01,['Não']); + PaginaSEI::getInstance()->adicionarMensagem( $msg , InfraPagina::$TIPO_MSG_AVISO ); + } - $arrComandos[] = ''; + $strTitulo = 'Solicitar Expedição pelos Correios'; - $arrComandos[] = ''; + $arrComandos[] = ''; + $arrComandos[] = ''; + + } catch ( InfraException $e ) { + echo ''; + + $link = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=procedimento_visualizar&acao_origem='.$_GET["acao"].'&montar_visualizacao=1&arvore=1&id_procedimento='.$id_procedimento.'&id_documento='.$id_doc); + + echo ""; + } break; } @@ -871,20 +897,45 @@ //montando links para pesquisa de protocolos anexos $strLinkPopUpSelecaoProtocoloAnexo = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=md_cor_expedicao_cadastro_protocolos_selecionar&tipo_selecao=2&id_procedimento=' . $dto->getDblIdProtocolo() . '&id_doc=' . $_GET['id_doc'] . '&id_object=objLupaProtocoloAnexo'); if (SessaoSei::getInstance()->getNumIdUnidadeAtual() == $dto->getNumIdUnidade() && $dto->getNumIdMdCorPlp() == null && $staAberto) { + + //require_once 'md_cor_expedicao_solicitada_cadastro_validar_destinatario.php'; + $validaContatoEdicao = MdCorExpedicaoSolicitadaINT::validaContatoPreeenchido($id_destinatario,true); + + if ( !empty($validaContatoEdicao)) array_push($arrMsgValidacao,$validaContatoEdicao); //$arrMsgValidacao[] = $validaContatoEdicao; + $strTitulo = 'Alterar Expedição pelos Correios'; //Caso seja ALTERACAO da solicitacao de expedicao $strSelectServicoPostal = MdCorMapUnidServicoINT::montarSelectIdMdCorMapUnidServico(null, null, $dto->getNumIdMdCorServicoPostal(), $dto->getNumIdUnidade(), true); + if ( empty($strSelectServicoPostal) ) { + array_push( $arrMsgValidacao , MdCorMensagemINT::setMensagemPadraoPersonalizada( MdCorMensagemINT::$MSG_COR_01 , ['Não'] ) ); + } + $isPermiteGravarMidia = ( MdCorServicoPostalINT::getInfoServicoPostalPorId( $dto->getNumIdMdCorServicoPostal() ) )->getStrSinAnexarMidia() ?? 'N'; // Se teve mudança no registro do contato, exibe aviso para o usuario if ( $arrObjMdCorContato['isRegAlterado'] ) { $id_destinatario_aux = $id_destinatario; - $msg = 'Os dados do Contato indicado abaixo como Destinatário foram alterados entre a solicitação e o retorno nessa tela de Alteração. Para replicar as alterações nesta Solicitação de Expedição acione o botão "Alterar Solicitação". Caso não queira replicar as alterações no Contato acione o botão "Fechar".'; - PaginaSEI::getInstance()->adicionarMensagem( $msg , InfraPagina::$TIPO_MSG_AVISO ); + array_push($arrMsgValidacao,MdCorMensagemINT::$MSG_COR_02); } + // caso tenha alguma msg de alerta para o usuáro, trata no if abaixo + $msg = null; + if ( $arrMsgValidacao ) { + if ( count($arrMsgValidacao) == 1 ) { + $msg = str_replace( "
" , "\n" , $arrMsgValidacao[0] ); + } else { + foreach ( $arrMsgValidacao as $strMsg ) { + $msg .= "- " . str_replace( "
" , "\n" , $strMsg ) . "\n\n"; + } + } + } + + if ( $msg ) { + PaginaSEI::getInstance()->adicionarMensagem( $msg , InfraPagina::$TIPO_MSG_AVISO ); + } + if ($dto) { if ($dto->getStrSinDevolvido() == "S") { $arrComandos[] = ''; - $arrComandos[] = ''; $arrComandos[] = ''; - $arrComandos[] = ''; - - $objMdCorParametroRastreioDTO->retTodos(); - $objMdCorParametroRastreioRN = new MdCorParametroRastreioRN(); - $qtdObjMdCorParametroRastreioDTO = $objMdCorParametroRastreioRN->contar($objMdCorParametroRastreioDTO); - $objMdCorParametroRastreioDTO = $objMdCorParametroRastreioRN->consultar($objMdCorParametroRastreioDTO); - - if (isset($_POST['sbmCadastrarMdCorParametroRastreio'])) { - try { - if ($qtdObjMdCorParametroRastreioDTO == 0) { - $objMdCorParametroRastreioDTO = new MdCorParametroRastreioDTO(); - } - $objMdCorParametroRastreioDTO->setStrUsuario($_POST['txtUsuario']); - $objMdCorParametroRastreioDTO->setStrSenha($_POST['txtSenha']); - $objMdCorParametroRastreioDTO->setStrEnderecoWsdl($_POST['txtEnderecoWsdl']); - $objMdCorParametroRastreioRN = new MdCorParametroRastreioRN(); - if ($qtdObjMdCorParametroRastreioDTO > 0) { - $objMdCorParametroRastreioRN->alterar($objMdCorParametroRastreioDTO); - } else { - $objMdCorParametroRastreioDTO = $objMdCorParametroRastreioRN->cadastrar($objMdCorParametroRastreioDTO); - } - PaginaSEI::getInstance()->adicionarMensagem('Dados salvos com sucesso.', InfraPagina::$TIPO_MSG_AVISO); - header('Location: ' . SessaoSEI::getInstance()->assinarLink('controlador.php?acao=md_cor_parametrizacao_rastreio_listar')); - die; - } catch (Exception $e) { - PaginaSEI::getInstance()->processarExcecao($e); - } - } - break; - - - case 'md_cor_parametro_rastreio_consultar': - $strTitulo = 'Consultar '; - $arrComandos[] = ''; - $objMdCorParametroRastreioDTO->setBolExclusaoLogica(false); - $objMdCorParametroRastreioDTO->retTodos(); - $objMdCorParametroRastreioRN = new MdCorParametroRastreioRN(); - $objMdCorParametroRastreioDTO = $objMdCorParametroRastreioRN->consultar($objMdCorParametroRastreioDTO); - if ($objMdCorParametroRastreioDTO === null) { - throw new InfraException("Registro não encontrado."); - } - break; - - default: - throw new InfraException("Ação '" . $_GET['acao'] . "' não reconhecida."); - } - - -} catch (Exception $e) { - PaginaSEI::getInstance()->processarExcecao($e); -} - -PaginaSEI::getInstance()->montarDocType(); -PaginaSEI::getInstance()->abrirHtml(); -PaginaSEI::getInstance()->abrirHead(); -PaginaSEI::getInstance()->montarMeta(); -PaginaSEI::getInstance()->montarTitle(PaginaSEI::getInstance()->getStrNomeSistema() . ' - ' . $strTitulo); -PaginaSEI::getInstance()->montarStyle(); -PaginaSEI::getInstance()->abrirStyle(); -PaginaSEI::getInstance()->fecharStyle(); -PaginaSEI::getInstance()->montarJavaScript(); -PaginaSEI::getInstance()->abrirJavaScript(); -PaginaSEI::getInstance()->fecharJavaScript(); -PaginaSEI::getInstance()->fecharHead(); -PaginaSEI::getInstance()->abrirBody($strTitulo, 'onload="inicializar();"'); -?> - - montarBarraComandosSuperior($arrComandos); ?> -
-
-
- - -
-
-
-
- - -
-
-
-
-
-
- -
- - -
-
-
-
- montarBarraComandosInferior($arrComandos); ?> - -fecharBody(); -PaginaSEI::getInstance()->fecharHtml(); \ No newline at end of file diff --git a/sei/web/modulos/correios/md_cor_parametrizacao_rastreio_lista_js.php b/sei/web/modulos/correios/md_cor_parametrizacao_rastreio_lista_js.php deleted file mode 100644 index 31a11ea..0000000 --- a/sei/web/modulos/correios/md_cor_parametrizacao_rastreio_lista_js.php +++ /dev/null @@ -1,77 +0,0 @@ - diff --git a/sei/web/modulos/correios/md_cor_parametrizacao_status_lista.php b/sei/web/modulos/correios/md_cor_parametrizacao_status_lista.php index 66c8123..d52731b 100644 --- a/sei/web/modulos/correios/md_cor_parametrizacao_status_lista.php +++ b/sei/web/modulos/correios/md_cor_parametrizacao_status_lista.php @@ -48,7 +48,7 @@ break; case 'md_cor_parametrizacao_status_listar': - $strTitulo = 'Tipos de Situações SRO'; + $strTitulo = 'Tipos de Situações de Rastreamento de Objeto'; $arrComandos = array(); $arrComandos[] = ''; diff --git a/sei/web/modulos/correios/md_cor_parametrizacao_status_tabela.php b/sei/web/modulos/correios/md_cor_parametrizacao_status_tabela.php index 0659e25..5178a61 100644 --- a/sei/web/modulos/correios/md_cor_parametrizacao_status_tabela.php +++ b/sei/web/modulos/correios/md_cor_parametrizacao_status_tabela.php @@ -56,11 +56,11 @@ $strResultado = ''; if ($_GET['acao'] != 'md_cor_parametrizacao_status_reativar') { - $strSumarioTabela = 'Tabela de Tipos de Situações SRO.'; - $strCaptionTabela = 'Tipos de Situações SRO '; + $strSumarioTabela = 'Tabela de Tipos de Situações de Rastreamento de Objeto.'; + $strCaptionTabela = 'Tipos de Situações de Rastreamento de Objeto '; } else { - $strSumarioTabela = 'Tabela de Tipos de Situações SRO Inativos.'; - $strCaptionTabela = 'Tipos de Situações SRO '; + $strSumarioTabela = 'Tabela de Tipos de Situações de Rastreamento de Objeto Inativos.'; + $strCaptionTabela = 'Tipos de Situações de Rastreamento de Objeto '; } $strResultado .= '
' . "\n"; diff --git a/sei/web/modulos/correios/md_cor_plp_detalhada.php b/sei/web/modulos/correios/md_cor_plp_detalhada.php index 3cc6f14..2b0da15 100644 --- a/sei/web/modulos/correios/md_cor_plp_detalhada.php +++ b/sei/web/modulos/correios/md_cor_plp_detalhada.php @@ -37,48 +37,40 @@ switch ($_GET['acao']) { case 'md_cor_plp_detalhada': - $strTitulo = 'Detalhar PLP - Identificador nº '; + $strTitulo = 'Detalhar '. MdCorPlpRN::$STR_SING_PRE_POSTAGEM .' - Identificador nº '; $strAcaoTabela = 'md_cor_plp_detalhar_objeto'; $titleBotao = 'Detalhar Objeto'; - $arrComandos[] = ''; - $arrComandos[] = ''; $arrComandos[] = ''; - $arrComandos[] = ''; break; case 'md_cor_plp_expedir': $strAcaoTabela = 'md_cor_plp_expedir_objeto'; - $strTitulo = 'Expedir PLP - Identificador nº '; + $strTitulo = 'Expedir '. MdCorPlpRN::$STR_SING_PRE_POSTAGEM .' - Identificador nº '; $titleBotao = 'Expedir Objeto'; - $arrComandos[] = ''; - $arrComandos[] = ''; $arrComandos[] = ''; - $arrComandos[] = ''; - $arrComandos[] = ''; break; @@ -209,7 +201,7 @@ 'idPlp' => $idPlp, ]; $objMdCorPlpRN->salvarAndamentoProcesso($arrParametro); - PaginaSEI::getInstance()->setStrMensagem('Conclusão da expedição da PLP realizada com sucesso!', InfraPagina::$TIPO_MSG_AVISO); + PaginaSEI::getInstance()->setStrMensagem('Conclusão da expedição realizada com sucesso!', InfraPagina::$TIPO_MSG_AVISO); header('Location: ' . SessaoSEI::getInstance()->assinarLink('controlador.php?acao=md_cor_geracao_plp_listar')); } catch (Exception $e) { throw new InfraException('Erro ao imprimir', $e); @@ -268,8 +260,8 @@ if ($numRegistros > 0) { $strResultado = ''; - $strSumarioTabela = 'Tabela de PLP detalhada'; - $strCaptionTabela = 'PLP detalhada'; + $strSumarioTabela = 'Tabela de '. MdCorPlpRN::$STR_PLURAL_PRE_POSTAGEM .' detalhada'; + $strCaptionTabela = MdCorPlpRN::$STR_SING_PRE_POSTAGEM .' detalhada'; $strResultado .= '
' . "\n"; $strResultado .= ''; @@ -296,7 +288,7 @@ $midia = ''; if ($arrObjMdCorExpedicaoSolicitadaDTO[$i]->getStrMidia() == 'S') { - $midia = '
PLP possui midia para gravação.
'; + $midia = '
'. MdCorPlpRN::$STR_SING_PRE_POSTAGEM .' possui midia para gravação.
'; } $strCssTr = ($strCssTr == '') ? '' : ''; @@ -327,7 +319,7 @@ $strResultado .= '' . $titleBotao . ''; } - $strResultado .= 'Impressão do Rótulo do Envelope'; + $strResultado .= 'Impressão do Rótulo do Envelope'; if ($arrObjMdCorExpedicaoSolicitadaDTO[$i]->getStrSinNecessitaAr() == 'S') { $strResultado .= 'Impressão do AR'; } @@ -370,6 +362,7 @@ PaginaSEI::getInstance()->montarBarraComandosSuperior($arrComandos); ?> + montarAreaTabela($strResultado, $numRegistros); ?> montarBarraComandosInferior($arrComandos); ?> diff --git a/sei/web/modulos/correios/md_cor_plp_detalhada_js.php b/sei/web/modulos/correios/md_cor_plp_detalhada_js.php index 30d6d2d..3890d78 100644 --- a/sei/web/modulos/correios/md_cor_plp_detalhada_js.php +++ b/sei/web/modulos/correios/md_cor_plp_detalhada_js.php @@ -27,20 +27,7 @@ function imprimirArquivolLote() { return false; } - /*var isRestrito = getAjaxValidarDocumentoAPI(); - - if (isRestrito === 'false') { - alert('Esta Unidade Expedidora não possui acesso ao documento para poder imprimir.'); - return false; - } - - if (' ' == true) { - alert('Esta Unidade Expedidora não possui acesso ao documento para poder imprimir.'); - return false; - }*/ - - - document.getElementById('frmDetalharPlp').target = '_blank'; + document.getElementById('frmDetalharPlp').target = '_blank'; document.getElementById('frmDetalharPlp').action = 'assinarLink('controlador.php?acao=md_cor_plp_pdf_arquivo_lote&acao_origem=' . $_GET['acao'] . '&id_md_cor_plp=' . $_GET['id_md_cor_plp']); ?>' document.getElementById('frmDetalharPlp').submit(); var arrIdSocitacao = new Array(); @@ -51,9 +38,9 @@ function imprimirArquivolLote() { } function substituiIconeExpedirPlp(idPlp) { - console.log($('.'+idPlp+' a.botaoExpedirObjeto').html()); $('.'+idPlp+' a.botaoExpedirObjeto').html('Expedir Objeto'); } + function getAjaxValidarDocumentoAPI() { var arrIdSocitacao = new Array(); @@ -86,11 +73,6 @@ function imprimirVoucher() { infraSelecaoMultipla('Infra'); - /*if(document.getElementById('hdnInfraItensSelecionados').value == ''){ - alert('Selecione ao menos uma PLP para o voucher'); - return false; - }*/ - var frm = document.getElementById('frmDetalharPlp'); var targetAnterior = frm.target; @@ -164,8 +146,7 @@ function imprimirAR(id) { } - function imprimirRotuloEnvelope(id) { - + function imprimirRotuloEnvelopeModal(id){ if (typeof id !== 'undefined') { document.getElementById('hdnInfraItensSelecionados').value = id; } @@ -175,6 +156,11 @@ function imprimirRotuloEnvelope(id) { return false; } + let link = "assinarLink('controlador.php?acao=md_cor_selecionar_layout_envelope') ?>"; + infraAbrirJanelaModal(link,600,300,false); + } + + function imprimirRotuloEnvelope() { var frm = document.getElementById('frmDetalharPlp'); var targetAnterior = frm.target; @@ -190,7 +176,7 @@ function imprimirRotuloEnvelope(id) { } - function ConcluirPLP() { + function ConcluirPrePostagem() { var numRegistro = document.getElementById('hdnInfraNroItens').value; var acessado = document.getElementsByClassName('acessado'); var qtdAcessado = 0; @@ -200,7 +186,7 @@ function ConcluirPLP() { } if (qtdAcessado < numRegistro) { - alert('Somente é possível concluir a expedição da PLP depois que realizar a expedição de cada Objeto abaixo'); + alert('Somente é possível concluir a expedição da Pré-Postagem depois que realizar a expedição de cada Objeto abaixo'); return false; } infraExibirAviso(false); diff --git a/sei/web/modulos/correios/md_cor_plp_imprimir_ar.php b/sei/web/modulos/correios/md_cor_plp_imprimir_ar.php index ea56c87..12732a9 100644 --- a/sei/web/modulos/correios/md_cor_plp_imprimir_ar.php +++ b/sei/web/modulos/correios/md_cor_plp_imprimir_ar.php @@ -4,362 +4,125 @@ * * 23/10/2017 - criado por Ellyson de Jesus Silva * + * 07/05/2024 - alterdo por Gustavo Camelo + * */ -try { - require_once dirname(__FILE__) . '/../../SEI.php'; - - session_start(); - - SessaoSEI::getInstance()->validarLink(); +require_once dirname(__FILE__) . '/../../SEI.php'; - SessaoSEI::getInstance()->validarPermissao($_GET['acao']); +session_start(); - switch ($_GET['acao']) { - case 'md_cor_plp_imprimir_ar': - $strTitulo = ''; - break; - default: - throw new InfraException("Ação '" . $_GET['acao'] . "' não reconhecida."); - } +SessaoSEI::getInstance()->validarLink(); - //colocando a pagina sem menu e titulo inicial - PaginaSEI::getInstance()->setTipoPagina(InfraPagina::$TIPO_PAGINA_SIMPLES); +SessaoSEI::getInstance()->validarPermissao($_GET['acao']); - //recuperando a expedição solicitada - $objExpSolicDTO = new MdCorExpedicaoSolicitadaDTO(); - $objExpSolicDTO->retNumIdContatoDestinatario(); - $objExpSolicDTO->retStrNumeroContratoCorreio(); - $objExpSolicDTO->retStrProtocoloFormatadoDocumento(); - $objExpSolicDTO->retStrCodigoRastreamento(); - $objExpSolicDTO->retStrNomeDestinatario(); - $objExpSolicDTO->retStrEnderecoDestinatario(); - $objExpSolicDTO->retStrComplementoDestinatario(); - $objExpSolicDTO->retStrBairroDestinatario(); - $objExpSolicDTO->retStrCepDestinatario(); - $objExpSolicDTO->retStrNomeCidadeDestinatario(); - $objExpSolicDTO->retStrSiglaUfDestinatario(); - $objExpSolicDTO->retStrCodigoRastreamento(); - $objExpSolicDTO->retStrNomeContratoOrgao(); - $objExpSolicDTO->retStrEnderecoContratoOrgao(); - $objExpSolicDTO->retStrComplementoContratoOrgao(); - $objExpSolicDTO->retStrCepContratoOrgao(); - $objExpSolicDTO->retStrNomeCidadeContratoOrgao(); - $objExpSolicDTO->retStrSiglaUfContratoOrgao(); - $objExpSolicDTO->retStrBairroContratoOrgao(); - $objExpSolicDTO->retStrNumeroDocumento(); - $objExpSolicDTO->retStrProtocoloFormatado(); - $objExpSolicDTO->retNumIdUnidade(); - $objExpSolicDTO->retNumIdMdCorExpedicaoSolicitada(); - $objExpSolicDTO->retStrNomeSerie(); - $objExpSolicDTO->retDtaGeracaoProtocolo(); - $objExpSolicDTO->retStrSiglaOrgao(); - $objExpSolicDTO->retStrSinEnderecoAssociado(); - - $objExpSolicDTO->setNumIdMdCorPlp($_GET['id_md_cor_plp']); - $objExpSolicDTO->setStrSinNecessitaAr('S'); - $objExpSolicDTO->setDistinct(true); - $objExpSolicDTO->setOrd('IdMdCorExpedicaoSolicitada', InfraDTO::$TIPO_ORDENACAO_ASC); +switch ($_GET['acao']) { + case 'md_cor_plp_imprimir_ar': + $strTitulo = 'Impressão de AR'; + $validado = true; + $msgErro = ''; + $msgFinalErro = 'Erro na impressão do Aviso de Recebimento:
'; + break; + default: + throw new InfraException("Ação '" . $_GET['acao'] . "' não reconhecida."); +} - if (isset($_POST['hdnInfraItensSelecionados']) && $_POST['hdnInfraItensSelecionados'] != '') { - $objExpSolicDTO->setNumIdMdCorExpedicaoSolicitada(explode(',', $_POST['hdnInfraItensSelecionados']), InfraDTO::$OPER_IN); - } +//recuperando a expedição solicitada +$objExpSolicDTO = new MdCorExpedicaoSolicitadaDTO(); - $objMdCorExpedicaoSolicitadaRN = new MdCorExpedicaoSolicitadaRN(); - $arrObjMdCorExpedicaoSolicitadaDTO = $objMdCorExpedicaoSolicitadaRN->listar($objExpSolicDTO); +$objExpSolicDTO->retStrIdPrePostagem(); +$objExpSolicDTO->setNumIdMdCorPlp($_GET['id_md_cor_plp']); +$objExpSolicDTO->setStrSinNecessitaAr('S'); +//$objExpSolicDTO->setDistinct(true); +$objExpSolicDTO->setOrd('IdMdCorExpedicaoSolicitada', InfraDTO::$TIPO_ORDENACAO_ASC); - if (count($arrObjMdCorExpedicaoSolicitadaDTO) == 0) { - throw new InfraException('Nenhuma solicitação de expedição possui AR!'); - } +if (isset($_POST['hdnInfraItensSelecionados']) && $_POST['hdnInfraItensSelecionados'] != '') { + $objExpSolicDTO->setNumIdMdCorExpedicaoSolicitada(explode(',', $_POST['hdnInfraItensSelecionados']), InfraDTO::$OPER_IN); +} +$objMdCorExpedicaoSolicitadaRN = new MdCorExpedicaoSolicitadaRN(); +$arrObjMdCorExpedicaoSolicitadaDTO = $objMdCorExpedicaoSolicitadaRN->listar($objExpSolicDTO); -} catch (Exception $e) { - PaginaSEI::getInstance()->processarExcecao($e); +if ( count($arrObjMdCorExpedicaoSolicitadaDTO) == 0 ) { + //throw new InfraException('Nenhuma solicitação de expedição possui AR!'); + $msgErro .= "Nenhuma solicitação de expedição possui AR.
"; } -PaginaSEI::getInstance()->montarDocType(); -PaginaSEI::getInstance()->abrirHtml(); -PaginaSEI::getInstance()->abrirHead(); -PaginaSEI::getInstance()->montarMeta(); -PaginaSEI::getInstance()->montarTitle(PaginaSEI::getInstance()->getStrNomeSistema() . ' - ' . $strTitulo); -//PaginaSEI::getInstance()->montarStyle(); -PaginaSEI::getInstance()->abrirStyle(); -include_once("md_cor_plp_imprimir_ar_css.php"); -PaginaSEI::getInstance()->fecharStyle(); -PaginaSEI::getInstance()->montarJavaScript(); -PaginaSEI::getInstance()->abrirJavaScript(); -PaginaSEI::getInstance()->fecharJavaScript(); -PaginaSEI::getInstance()->fecharHead(); -PaginaSEI::getInstance()->abrirBody($strTitulo, 'onload="inicializar();"'); -?> -abrirAreaDados('100%', 'style="overflow-y: hidden;"'); -$count = 0; -?> - - retNumIdContatoAssociado(); - $mdCorContatoDTO->retStrNomeContatoAssociado(); - $mdCorContatoDTO->retStrEndereco(); - $mdCorContatoDTO->retStrComplemento(); - $mdCorContatoDTO->retStrBairro(); - $mdCorContatoDTO->retStrCep(); - $mdCorContatoDTO->retStrNomeCidade(); - $mdCorContatoDTO->retStrSiglaUf(); - $mdCorContatoDTO->retStrExpressaoTratamentoCargo(); - $mdCorContatoDTO->retStrExpressaoCargo(); - $mdCorContatoDTO->setNumIdContato($objExpSolicDTO->getNumIdContatoDestinatario()); - $mdCorContatoDTO->setNumIdMdCorExpedicaoSolicitada($objExpSolicDTO->getNumIdMdCorExpedicaoSolicitada()); +$objMdCorIntegAR = $objMdCorAdmIntegracaoRN->buscaIntegracaoPorFuncionalidade(MdCorAdmIntegracaoRN::$AVISO_RECEB); - $mdCorContatoRN = new MdCorContatoRN(); - $arrMdCorContatoDTO = $mdCorContatoRN->consultar($mdCorContatoDTO); +if ( is_null( $objMdCorIntegAR ) ) + $msgErro .= "Mapeamento de Integração ". MdCorAdmIntegracaoRN::$STR_AVISO_RECEB ." não existe ou está inativo.
"; - $nome = $objExpSolicDTO->getStrNomeDestinatario(); +$arrParametroRest = [ + 'endpoint' => $objMdCorIntegAR->getStrUrlOperacao(), + 'token' => $objMdCorIntegAR->getStrToken(), + 'expiraEm' => $objMdCorIntegAR->getDthDataExpiraToken(), +]; - if (!empty($arrMdCorContatoDTO->getStrNomeContatoAssociado()) && ($objExpSolicDTO->getNumIdContatoDestinatario() != $arrMdCorContatoDTO->getNumIdContatoAssociado())) { - $nome .= '
' . $arrMdCorContatoDTO->getStrNomeContatoAssociado(); - } +$ret = $objMdCorAdmIntegracaoRN->verificaTokenExpirado($arrParametroRest, $objMdCorIntegAR); - $tratamento = $arrMdCorContatoDTO->getStrExpressaoTratamentoCargo(); - $cargo = $arrMdCorContatoDTO->getStrExpressaoCargo(); - $endereco = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrEnderecoDestinatario() : $arrMdCorContatoDTO->getStrEndereco(); - $complemento = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrComplementoDestinatario() : $arrMdCorContatoDTO->getStrComplemento(); - $bairro = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrBairroDestinatario() : $arrMdCorContatoDTO->getStrBairro(); - $cep = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrCepDestinatario() : $arrMdCorContatoDTO->getStrCep(); - $cidade = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrNomeCidadeDestinatario() : $arrMdCorContatoDTO->getStrNomeCidade(); - $uf = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrSiglaUfDestinatario() : $arrMdCorContatoDTO->getStrSiglaUf(); +if ( is_array( $ret ) ) $msgErro .= "Falha na Integração: ". MdCorAdmIntegracaoRN::$STR_AVISO_RECEB . ".
"; - $unidadeRN = new UnidadeRN(); - $unidadeDTO = new UnidadeDTO(); - $unidadeDTO->setNumIdUnidade($objExpSolicDTO->getNumIdUnidade()); +// instancia class ApiRest com os dados necessarios para uso da API que gera Aviso Recebimento +$objMdCorApiAR = new MdCorApiRestRN( $arrParametroRest ); - $arrDadosHierarquia = $unidadeRN->obterDadosHierarquia($unidadeDTO); +$strHtmlAR = ''; - $hierarquia = $arrDadosHierarquia['RAMIFICACAO']; - $arrHierarquiaUnidade = explode('/', $arrDadosHierarquia['RAMIFICACAO']); - $strHierarquiaUnidade = ''; - for ($i = count($arrHierarquiaUnidade) - 1; $i >= 0; $i--) { - if ($strHierarquiaUnidade != '') { - $strHierarquiaUnidade .= '/'; - } - $strHierarquiaUnidade .= $arrHierarquiaUnidade[$i]; - } - $strHierarquia = $strHierarquiaUnidade; - $arrConteudoTags = []; - $arrConteudoTags[] = array('@serie@', $objExpSolicDTO->getStrNomeSerie()); - $arrConteudoTags[] = array('@numeracao_serie@', $objExpSolicDTO->getStrNumeroDocumento()); - $arrConteudoTags[] = array('@ano@', substr($objExpSolicDTO->getDtaGeracaoProtocolo(), 6, 4)); - $arrConteudoTags[] = array('@hierarquia_unidade_invertida@', $strHierarquia); - $arrConteudoTags[] = array('@sigla_orgao_origem@', $objExpSolicDTO->getStrSiglaOrgao()); +//recupera os ids da Pre Postagem separa por virgula para buscar os AR via API REST dos Correios +$strIdsPPN = implode( ',' , InfraArray::converterArrInfraDTO($arrObjMdCorExpedicaoSolicitadaDTO,'IdPrePostagem') ); +$ret = $objMdCorApiAR->avisoRecebimento( $strIdsPPN ); - $objMdCorExpedicaoFormatoDTO = new MdCorExpedicaoFormatoDTO(); - $objMdCorExpedicaoFormatoDTO->retStrProtocoloFormatado(); - $objMdCorExpedicaoFormatoDTO->retStrNomeSerie(); - $objMdCorExpedicaoFormatoDTO->retStrNumeroDocumento(); - $objMdCorExpedicaoFormatoDTO->setNumIdMdCorExpedicaoSolicitada($objExpSolicDTO->getNumIdMdCorExpedicaoSolicitada()); - $objMdCorExpedicaoFormatoDTO->setStrProtocoloFormatado($objExpSolicDTO->getStrProtocoloFormatadoDocumento(), INFRADTO::$OPER_DIFERENTE); +if ( is_array( $ret ) && isset( $ret['suc'] ) && $ret['suc'] === false ) + $msgErro .= $ret['msg']. "
"; +else + $strHtmlAR .= $ret; - $objMdCorExpedicaoFormatoRN = new MdCorExpedicaoFormatoRN(); - $arrObjMdCorExpedicaoFormatoDTO = $objMdCorExpedicaoFormatoRN->listar($objMdCorExpedicaoFormatoDTO); +if ( !empty($msgErro) ) { + $validado = false; + $msgFinalErro .= $msgErro; +} - $conteudo = "@serie@ @numeracao_serie@"; - foreach ($arrConteudoTags as $item) { - $conteudo = str_replace($item[0], $item[1], $conteudo); - } - if ($count == 2) { - $style = 'page-break-after: always;'; - $count = 0; - } else { - $style = ''; - $count++; - } +if ( $validado ) { + echo $strHtmlAR; + echo ""; +} else { + PaginaSEI::getInstance()->montarDocType(); + PaginaSEI::getInstance()->abrirHtml(); + PaginaSEI::getInstance()->abrirHead(); + PaginaSEI::getInstance()->montarMeta(); + PaginaSEI::getInstance()->montarTitle(PaginaSEI::getInstance()->getStrNomeSistema() . ' - ' . $strTitulo); + PaginaSEI::getInstance()->montarStyle(); + PaginaSEI::getInstance()->abrirStyle(); + PaginaSEI::getInstance()->fecharStyle(); + PaginaSEI::getInstance()->montarJavaScript(); + PaginaSEI::getInstance()->abrirJavaScript(); + PaginaSEI::getInstance()->fecharJavaScript(); + PaginaSEI::getInstance()->fecharHead(); + PaginaSEI::getInstance()->abrirBody($strTitulo, ''); + PaginaSEI::getInstance()->abrirAreaDados('100%', 'style="overflow-y: hidden;"'); ?> -
' . PaginaSEI::getInstance()->gerarCaptionTabela($strCaptionTabela, $numRegistros) . '
- - - - - - - - +} - - - - - - - - - - - - - - - - - - -

Cole Aqui

- - - - - - -
- - -
AVISO DE RECEBIMENTO
-
-
CONTRATO getStrNumeroContratoCorreio();?>
-
-
- - - - - -
-

DESTINATÁRIO:

- -

- -

+ + + - -

- + - -

-

-

-

getStrCodigoRastreamento() ?>

-

-

- - getStrNomeContratoOrgao() ?> -

-

ENDEREÇO PARA DEVOLUÇÃO DO OBJETO:

-

getStrEnderecoContratoOrgao() . ', ' . $objExpSolicDTO->getStrComplementoContratoOrgao() ?>

-

getStrBairroContratoOrgao() ?>

-

getStrCepContratoOrgao() . ' - ' . $objExpSolicDTO->getStrNomeCidadeContratoOrgao() . '/' . $objExpSolicDTO->getStrSiglaUfContratoOrgao() ?>

-
-

getStrCodigoRastreamento() ?>

- -
-
-

TENTATIVAS DE ENTREGA:

-

1º ____/____/____        ____:____h

-

2º ____/____/____        ____:____h

-

3º ____/____/____        ____:____h

-

MOTIVO DE DEVOLUÇÃO:

- - - - - - - - - - - - - - - - - - - - -
-

1 Mudou-se

-
-

5 Recusado

-
-

2 Endereço Insuficiente

-
-

6 Não Procurado

-
-

3 Não Existe o Número

-
-

7 Ausente

-
-

4 Desconhecido

-
-

8 Falecido

-
-

9 Outros___________________________

-
-
-

CARIMBO
UNIDADE DE ENTREGA

-
-

RUBRICA E MATRÍCULA DO CARTEIRO

-
-

DECLARAÇÃO DE CONTEÚDO

-

- Documento Principal: - -

-

- Anexos: - -

-

- Processo nº - -

-
-

Assinatura do Recebedor

-
-

Data de entrega

-
-

Nome Legível do Recebedor

-
-

N° Doc de identidade

-
- -fecharAreaDados(); -PaginaSEI::getInstance()->fecharAreaTabela(); PaginaSEI::getInstance()->fecharBody(); PaginaSEI::getInstance()->fecharHtml(); -?> - \ No newline at end of file +?> \ No newline at end of file diff --git a/sei/web/modulos/correios/md_cor_plp_imprimir_rotulo_envelope.php b/sei/web/modulos/correios/md_cor_plp_imprimir_rotulo_envelope.php index 525e805..418e662 100644 --- a/sei/web/modulos/correios/md_cor_plp_imprimir_rotulo_envelope.php +++ b/sei/web/modulos/correios/md_cor_plp_imprimir_rotulo_envelope.php @@ -3,6 +3,7 @@ * ANATEL * * 23/10/2017 - criado por Ellyson de Jesus Silva + * 18/04/2024 - alterado por Gustavo Camelo * */ try { @@ -16,55 +17,25 @@ switch ($_GET['acao']) { case 'md_cor_plp_imprimir_rotulo_envelope': - $strTitulo = ''; + $strTitulo = 'Impressão de Envelope'; break; default: throw new InfraException("Ação '" . $_GET['acao'] . "' não reconhecida."); } - //colocando a pagina sem menu e titulo inicial - PaginaSEI::getInstance()->setTipoPagina(InfraPagina::$TIPO_PAGINA_SIMPLES); + $msgErroCompl = ''; //recuperando a expedição solicitada $objExpSolicDTO = new MdCorExpedicaoSolicitadaDTO(); - $objExpSolicDTO->retNumIdUnidade(); - $objExpSolicDTO->retNumIdContatoDestinatario(); - $objExpSolicDTO->retStrNomeSerie(); - $objExpSolicDTO->retStrNumeroDocumento(); - $objExpSolicDTO->retStrProtocoloFormatadoDocumento(); - $objExpSolicDTO->retDtaGeracaoProtocolo(); - $objExpSolicDTO->retStrSiglaOrgao(); + + $objExpSolicDTO->retNumIdMdCorExpedicaoSolicitada(); $objExpSolicDTO->retStrTipoRotuloImpressaoObjeto(); - $objExpSolicDTO->retDblMargemSuperiorImpressaoObjeto(); - $objExpSolicDTO->retDblMargemEsquerdaImpressaoObjeto(); - $objExpSolicDTO->retStrNumeroContratoCorreio(); - $objExpSolicDTO->retStrDescricaoServicoPostal(); - $objExpSolicDTO->retStrNomeImagemChancela(); + $objExpSolicDTO->retStrIdPrePostagem(); $objExpSolicDTO->retStrCodigoRastreamento(); - $objExpSolicDTO->retStrProtocoloFormatado(); - $objExpSolicDTO->retStrNomeDestinatario(); - $objExpSolicDTO->retStrEnderecoDestinatario(); - $objExpSolicDTO->retStrBairroDestinatario(); - $objExpSolicDTO->retStrCepDestinatario(); - $objExpSolicDTO->retStrSiglaUfDestinatario(); - $objExpSolicDTO->retStrNomeContratoOrgao(); - $objExpSolicDTO->retStrEnderecoContratoOrgao(); - $objExpSolicDTO->retStrBairroContratoOrgao(); - $objExpSolicDTO->retStrCepContratoOrgao(); - $objExpSolicDTO->retStrSiglaUfContratoOrgao(); - $objExpSolicDTO->retStrTimbreOrgao(); - $objExpSolicDTO->retStrComplementoDestinatario(); - $objExpSolicDTO->retStrComplementoContratoOrgao(); - $objExpSolicDTO->retStrSinNecessitaAr(); - $objExpSolicDTO->retStrCartaoPostagem(); - $objExpSolicDTO->retStrCodigoWsCorreioServico(); - $objExpSolicDTO->retStrNomeCidadeContratoOrgao(); - $objExpSolicDTO->retStrNomeCidadeDestinatario(); - $objExpSolicDTO->retNumIdMdCorExpedicaoSolicitada(); + $objExpSolicDTO->retNumIdMdCorServicoPostal(); $objExpSolicDTO->setNumIdMdCorPlp($_GET['id_md_cor_plp']); - $objExpSolicDTO->setDistinct(true); - $objExpSolicDTO->retStrSinEnderecoAssociado(); + //$objExpSolicDTO->setDistinct(true); $objExpSolicDTO->setOrd('IdMdCorExpedicaoSolicitada', InfraDTO::$TIPO_ORDENACAO_ASC); if (isset($_POST['hdnInfraItensSelecionados']) && $_POST['hdnInfraItensSelecionados'] != '') { @@ -74,319 +45,128 @@ $objMdCorExpedicaoSolicitadaRN = new MdCorExpedicaoSolicitadaRN(); $arrObjMdCorExpedicaoSolicitadaDTO = $objMdCorExpedicaoSolicitadaRN->listar($objExpSolicDTO); - if (count($arrObjMdCorExpedicaoSolicitadaDTO) == 0) { - throw new InfraException('Não possui Expedição Solicitada!'); - } - $objExpSolicDTO = current($arrObjMdCorExpedicaoSolicitadaDTO); + if ( count($arrObjMdCorExpedicaoSolicitadaDTO) == 0 ) + throw new InfraException('Não possui Expedição Solicitada.'); -} catch (Exception $e) { - PaginaSEI::getInstance()->processarExcecao($e); -} + // retorna dados da integração Emitir Rotulo + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); -PaginaSEI::getInstance()->montarDocType(); -PaginaSEI::getInstance()->abrirHtml(); -PaginaSEI::getInstance()->abrirHead(); -PaginaSEI::getInstance()->montarMeta(); -PaginaSEI::getInstance()->montarTitle(PaginaSEI::getInstance()->getStrNomeSistema() . ' - ' . $strTitulo); -PaginaSEI::getInstance()->abrirStyle(); -include_once("md_cor_plp_imprimir_rotulo_envelope_css.php"); -PaginaSEI::getInstance()->fecharStyle(); -PaginaSEI::getInstance()->montarJavaScript(); -PaginaSEI::getInstance()->abrirJavaScript(); -?> -$("#btnInfraTopo").remove(); -var objTabelaContatos; -function inicializar(){ -if($('#imagemOrgao')[0].offsetWidth > 70){ -$('#imagemOrgao')[0].style.width = '70px'; -var altura = $('#imagemOrgao')[0].offsetHeight; -$('#imagemOrgao')[0].style.marginTop = (70) / 2 + 'px'; -} -} -fecharJavaScript(); -PaginaSEI::getInstance()->fecharHead(); -PaginaSEI::getInstance()->abrirBody($strTitulo, 'onload="inicializar();"'); -PaginaSEI::getInstance()->abrirAreaDados(); -$count = 0; -?> + $objMdCorIntegEmitirRotulo = $objMdCorAdmIntegracaoRN->buscaIntegracaoPorFuncionalidade(MdCorAdmIntegracaoRN::$EMITIR_ROTULO); + if ( is_null( $objMdCorIntegEmitirRotulo ) ) + throw new InfraException('Mapeamento de Integração '. MdCorAdmIntegracaoRN::$STR_EMITIR_ROTULO .' não existe ou está inativo.'); -retNumIdContatoAssociado(); -$mdCorContatoDTO->retStrNomeContatoAssociado(); -$mdCorContatoDTO->retStrEndereco(); -$mdCorContatoDTO->retStrComplemento(); -$mdCorContatoDTO->retStrBairro(); -$mdCorContatoDTO->retStrCep(); -$mdCorContatoDTO->retStrNomeCidade(); -$mdCorContatoDTO->retStrSiglaUf(); -$mdCorContatoDTO->retStrExpressaoTratamentoCargo(); -$mdCorContatoDTO->retStrExpressaoCargo(); -$mdCorContatoDTO->setNumIdContato($objExpSolicDTO->getNumIdContatoDestinatario()); -$mdCorContatoDTO->setNumIdMdCorExpedicaoSolicitada($objExpSolicDTO->getNumIdMdCorExpedicaoSolicitada()); - -$mdCorContatoRN = new MdCorContatoRN(); -$arrMdCorContatoDTO = $mdCorContatoRN->consultar($mdCorContatoDTO); - -$nome = $objExpSolicDTO->getStrNomeDestinatario(); - -if (!empty($arrMdCorContatoDTO->getStrNomeContatoAssociado()) && ($objExpSolicDTO->getNumIdContatoDestinatario() != $arrMdCorContatoDTO->getNumIdContatoAssociado())) { - $nome .= '
' . $arrMdCorContatoDTO->getStrNomeContatoAssociado(); -} + $arrParametroRest = [ + 'endpoint' => $objMdCorIntegEmitirRotulo->getStrUrlOperacao(), + 'token' => $objMdCorIntegEmitirRotulo->getStrToken(), + 'expiraEm' => $objMdCorIntegEmitirRotulo->getDthDataExpiraToken(), + ]; + + $ret = $objMdCorAdmIntegracaoRN->verificaTokenExpirado($arrParametroRest, $objMdCorIntegEmitirRotulo); + + if ( is_array( $ret ) ) + throw new InfraException('Falha na Integração: '. MdCorAdmIntegracaoRN::$STR_GERAR_TOKEN .'.'); + + // instancia class ApiRest com os parametros necessarios para uso da API que emiti rotulo + $objMdCorApiEmitirRotulo = new MdCorApiRestRN($arrParametroRest); + + // retorna info da integracao Download Rotulo + $objMdCorIntegDownRotulo = $objMdCorAdmIntegracaoRN->buscaIntegracaoPorFuncionalidade(MdCorAdmIntegracaoRN::$DOWN_ROTULO); + + $arrParametroRest['endpoint'] = $objMdCorIntegDownRotulo->getStrUrlOperacao(); + + // instancia class ApiRest com os parametros necessarios para uso da API que faz o download do rotulo + $objMdCorApiDownRotulo = new MdCorApiRestRN($arrParametroRest); -$tratamento = $arrMdCorContatoDTO->getStrExpressaoTratamentoCargo(); -$cargo = $arrMdCorContatoDTO->getStrExpressaoCargo(); -$endereco = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrEnderecoDestinatario() : $arrMdCorContatoDTO->getStrEndereco(); -$complemento = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrComplementoDestinatario() : $arrMdCorContatoDTO->getStrComplemento(); -$bairro = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrBairroDestinatario() : $arrMdCorContatoDTO->getStrBairro(); -$cep = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrCepDestinatario() : $arrMdCorContatoDTO->getStrCep(); -$cidade = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrNomeCidadeDestinatario() : $arrMdCorContatoDTO->getStrNomeCidade(); -$uf = ($objExpSolicDTO->getStrSinEnderecoAssociado() != 'S') ? $objExpSolicDTO->getStrSiglaUfDestinatario() : $arrMdCorContatoDTO->getStrSiglaUf(); - -$unidadeRN = new UnidadeRN(); -$unidadeDTO = new UnidadeDTO(); -$unidadeDTO->setNumIdUnidade($objExpSolicDTO->getNumIdUnidade()); - -$arrDadosHierarquia = $unidadeRN->obterDadosHierarquia($unidadeDTO); - -$numSei = $objExpSolicDTO->getStrProtocoloFormatadoDocumento(); - -$hierarquia = $arrDadosHierarquia['RAMIFICACAO']; -$arrHierarquiaUnidade = explode('/', $arrDadosHierarquia['RAMIFICACAO']); -$strHierarquiaUnidade = ''; -for ($i = count($arrHierarquiaUnidade) - 1; $i >= 0; $i--) { - if ($strHierarquiaUnidade != '') { - $strHierarquiaUnidade .= '/'; + // gera um array com os ids das PPN + $arrIdsPPN = InfraArray::converterArrInfraDTO($arrObjMdCorExpedicaoSolicitadaDTO,'IdPrePostagem'); + + //busca o tipo de servico postal cadastrado + $idServicoPostal = $arrObjMdCorExpedicaoSolicitadaDTO[0]->getNumIdMdCorServicoPostal(); + $objMdCorServicoPostalDTO = new MdCorServicoPostalDTO(); + $objMdCorServicoPostalDTO->retStrCodigoWsCorreios(); + $objMdCorServicoPostalDTO->retStrNome(); + $objMdCorServicoPostalDTO->setNumIdMdCorServicoPostal($idServicoPostal); + + $objMdCorServicoPostalDTO = ( new MdCorServicoPostalRN() )->consultar($objMdCorServicoPostalDTO); + + $strLayoutImpressao = $_POST['hdnSelTipoLayout']; + + /* + * Formulario onde salva o Tipo de Embalagem, os dados estão assim: "C = completo e R = resumido" + * Tipos de Rotuto: [P - Padrao , R - Reduzido] + * Formato Rotulo: [ET - Etiqueta , EV - Envelope] + */ + $tpRotulo = $arrObjMdCorExpedicaoSolicitadaDTO[0]->getStrTipoRotuloImpressaoObjeto() == MdCorObjetoRN::$ROTULO_COMPLETO ? 'P' : 'R'; + + $arrParams = [ + 'idsPrePostagem' => $arrIdsPPN, + 'tipoRotulo' => $tpRotulo, + 'formatoRotulo' => 'ET', // No ambiente de HM dos Correios não aceita o valor EV + 'layoutImpressao' => $strLayoutImpressao + ]; + + // Gera Id Recibo necessário para imprimir a Etiqueta + $arrEmissaoRot = $objMdCorApiEmitirRotulo->emissaoRotulo( $arrParams ); + + if ( is_array($arrEmissaoRot) && key_exists('suc',$arrEmissaoRot) && $arrEmissaoRot['suc'] === false ) { + $msgErroCompl = "Operação: {$objMdCorApiEmitirRotulo->getEndPoint()}

"; + throw new InfraException( $arrEmissaoRot['msg'] ); } - $strHierarquiaUnidade .= $arrHierarquiaUnidade[$i]; -} -$strHierarquia = $strHierarquiaUnidade; -$arrConteudoTags = []; -$arrConteudoTags[] = array('@serie@', $objExpSolicDTO->getStrNomeSerie()); -$arrConteudoTags[] = array('@numeracao_serie@', $objExpSolicDTO->getStrNumeroDocumento()); -$arrConteudoTags[] = array('@ano@', substr($objExpSolicDTO->getDtaGeracaoProtocolo(), 6, 4)); -$arrConteudoTags[] = array('@hierarquia_unidade_invertida@', $strHierarquia); -$arrConteudoTags[] = array('@sigla_orgao_origem@', $objExpSolicDTO->getStrSiglaOrgao()); - - -$conteudo = "@serie@ nº @numeracao_serie@/@ano@/SEI/@hierarquia_unidade_invertida@-@sigla_orgao_origem@"; -foreach ($arrConteudoTags as $item) { - $conteudo = str_replace($item[0], $item[1], $conteudo); -} -if ($count == 2) { - $count = 1; -} else { - $style = ''; - $count++; + + // Executa download da Etiqueta passando como parametro o Id Recibo + $rotuloBase64 = $objMdCorApiDownRotulo->downloadRotulo( $arrEmissaoRot['idRecibo'] ); + + if ( is_array($rotuloBase64) && key_exists('suc',$rotuloBase64) && $rotuloBase64['suc'] === false ) { + $msgErroCompl = "Operação: {$objMdCorApiDownRotulo->getEndPoint()}

"; + throw new InfraException( $rotuloBase64['msg'] ); + } + + header("Content-Type: application/pdf"); + header("Cache-Control: no-store"); + //header("Content-Disposition: attachment;filename=ImpressaoEnvelope.pdf"); + header("Content-Disposition: inline;"); + + echo file_get_contents('data://application/pdf;base64,'. $rotuloBase64); + +} catch (InfraException $e) { + + $msgFinalErro = "Não foi possível integrar com os Correios para imprimir a(s) etiqueta(s) de envelope:

+ $msgErroCompl" . + "Retorno da API: " . $e->getMessage(); + + PaginaSEI::getInstance()->montarDocType(); + PaginaSEI::getInstance()->abrirHtml(); + PaginaSEI::getInstance()->abrirHead(); + PaginaSEI::getInstance()->montarMeta(); + PaginaSEI::getInstance()->montarTitle(PaginaSEI::getInstance()->getStrNomeSistema() . ' - ' . $strTitulo ); + PaginaSEI::getInstance()->montarStyle(); + PaginaSEI::getInstance()->abrirStyle(); + PaginaSEI::getInstance()->fecharStyle(); + PaginaSEI::getInstance()->montarJavaScript(); + PaginaSEI::getInstance()->abrirJavaScript(); + PaginaSEI::getInstance()->fecharJavaScript(); + PaginaSEI::getInstance()->fecharHead(); + PaginaSEI::getInstance()->abrirBody($strTitulo, ''); + PaginaSEI::getInstance()->abrirAreaDados('100%', 'style="overflow-y: hidden;"'); + ?> + + + + + + - - getStrTipoRotuloImpressaoObjeto() == MdCorObjetoRN::$ROTULO_RESUMIDO): ?> - - - - -
-
-
-
-
- -
-
- -

Contrato: - getStrNumeroContratoCorreio() ?>

-

- getStrDescricaoServicoPostal() ?>

-
-
-

Volume: 1/1

-

Peso(g): 1000

-
-
- -
-
-

- getStrCodigoRastreamento() ?>

-
-
-
-
- -
-
-

AR XX

-

MP XX

-

DD XX

-

VD XX

-
-
-
-

(SEI - nº getStrProtocoloFormatadoDocumento(); ?>)

-

Processo: - nº getStrProtocoloFormatado(); ?>

-
-
-
-
-
-
- -
-
-
- -
-
- -

- - -

- - -

- - -

- -

-

-
-
-
-
-

- Remetente: getStrNomeContratoOrgao()) ?>

-

getStrEnderecoContratoOrgao() . ', ' . $objExpSolicDTO->getStrComplementoContratoOrgao() ?> - - getStrBairroContratoOrgao() ?>

-

- getStrCepContratoOrgao() ?> getStrNomeCidadeContratoOrgao() . '-' . $objExpSolicDTO->getStrSiglaUfContratoOrgao() ?> -

-
-
-
- - - -
-
-
-
- -
-
- -

Contrato: getStrNumeroContratoCorreio() ?> -

-

getStrDescricaoServicoPostal() ?>

-
-
- -

Volume: 1/1

-

Peso (g): 10

-
-
-
-
-

- getStrCodigoRastreamento() ?>

- -
-
-

AR XX

-

MP XX

-

DD XX

-

VD XX

-
-
-
-

(SEI - nº getStrProtocoloFormatadoDocumento(); ?>)

-

Processo: - nº getStrProtocoloFormatado(); ?>

-
-
-
-
-
- -
-
- -
-
-
- -

- - -

- - -

- - -

- getStrComplementoDestinatario()) ? ', ' . trim($objExpSolicDTO->getStrComplementoDestinatario()) : ''; - $strEndCompleto .= ', ' . trim($bairro); - echo $strEndCompleto; - ?> -

-

- -

-
-
- -
-
-
-
-

- Remetente: getStrNomeContratoOrgao()) ?>

-

getStrEnderecoContratoOrgao() . ', ' . $objExpSolicDTO->getStrComplementoContratoOrgao() ?>

-

getStrBairroContratoOrgao() ?>

-

- getStrCepContratoOrgao() ?> getStrNomeCidadeContratoOrgao() . '-' . $objExpSolicDTO->getStrSiglaUfContratoOrgao() ?> -

-
-
-
- -
-fecharAreaDados(); -PaginaSEI::getInstance()->fecharAreaTabela(); -PaginaSEI::getInstance()->fecharBody(); -PaginaSEI::getInstance()->fecharHtml(); -?> - \ No newline at end of file + diff --git a/sei/web/modulos/correios/md_cor_plps_geradas_lista.php b/sei/web/modulos/correios/md_cor_plps_geradas_lista.php index a3a074c..7291767 100644 --- a/sei/web/modulos/correios/md_cor_plps_geradas_lista.php +++ b/sei/web/modulos/correios/md_cor_plps_geradas_lista.php @@ -15,11 +15,11 @@ SessaoSEI::getInstance()->validarPermissao($_GET['acao']); switch ($_GET['acao']) { case 'md_cor_plps_geradas_listar': - $strTitulo = 'Consultar PLPs Geradas'; + $strTitulo = 'Consultar '. MdCorPlpRN::$STR_PLURAL_PRE_POSTAGEM .' Geradas'; $strAcao = 'md_cor_plp_detalhada'; break; - case 'md_cor_expedicao_plp_listar' : - $strTitulo = 'PLPs Geradas para Expedição'; + case 'md_cor_expedicao_plp_listar': + $strTitulo = MdCorPlpRN::$STR_PLURAL_PRE_POSTAGEM .' Geradas para Expedição'; $strAcao = 'md_cor_plp_expedir'; break; default: @@ -74,21 +74,21 @@ $strResultado = ''; - $strSumarioTabela = 'Tabela de PLPs geradas'; - $strCaptionTabela = 'Lista de PLPs geradas'; + $strSumarioTabela = 'Tabela de '.MdCorPlpRN::$STR_PLURAL_PRE_POSTAGEM.' geradas'; + $strCaptionTabela = MdCorPlpRN::$STR_PLURAL_PRE_POSTAGEM . ' geradas'; $strResultado .= '' . "\n"; $strResultado .= ''; $strResultado .= ''; $strResultado .= '' . "\n"; - $strResultado .= '' . "\n"; + $strResultado .= '' . "\n"; - $strResultado .= '' . "\n"; + $strResultado .= '' . "\n"; - $strResultado .= '' . "\n"; + $strResultado .= '' . "\n"; $strResultado .= '' . "\n"; $strResultado .= '' . "\n"; - $strResultado .= '' . "\n"; + $strResultado .= '' . "\n"; $strResultado .= '' . "\n"; $strCssTr = ''; @@ -96,7 +96,7 @@ foreach ($arrObjMdCorPlpDTO as $objMdCorPlpDTO) { $midia = ''; if ($objMdCorPlpDTO->getStrMidia() == 'S') { - $midia = 'PLP possui midia para gravação.'; + $midia = ''. MdCorPlpRN::$STR_SING_PRE_POSTAGEM .' possui midia para gravação.'; } @@ -108,14 +108,20 @@ $strResultado .= ''; - $strResultado .= ''; + $strResultado .= ''; $strResultado .= ''; $strResultado .= ''; $strResultado .= '' . "\n"; $cContador++; diff --git a/sei/web/modulos/correios/md_cor_plps_geradas_lista_js.php b/sei/web/modulos/correios/md_cor_plps_geradas_lista_js.php index 8b6d2be..847e161 100644 --- a/sei/web/modulos/correios/md_cor_plps_geradas_lista_js.php +++ b/sei/web/modulos/correios/md_cor_plps_geradas_lista_js.php @@ -7,4 +7,49 @@ function inicializar(){ function pesquisar(){ document.getElementById('frmPlpsGeradas').submit(); } + + function cancelarPLP(codPlp, idPlp , codRastreamento, linkCancelarPlp){ + if ( confirm('Deseja cancelar a PLP de número: '+ codPlp +'?') ) { + $.ajax({ + url: linkCancelarPlp, + type: 'post', + dataType: 'xml', + data: { idPlp: idPlp, codRastreamento: codRastreamento }, + beforeSend: function(){ + infraExibirAviso(false); + }, + success: function ( result ) { + infraAvisoCancelar(); + let rs = $( result ).find('Sucesso').text(); + if ( rs == 'N') { + exibirMsg(codPlp, $( result ).find('Msg').text() ); + return false; + } else { + location.reload(); + } + }, + error: function (e) { + alert('Ocorreu alguma falha!!'); + console.error('Erro ao processar o XML do SEI: ' + e.responseText); + } + }); + } + } + + function exibirMsg(codPlp,msg){ + msg = msg.replace('#','

'); + let elem = ''; + + $('#divInfraBarraComandosSuperior').prepend( elem ); + + let nivel = document.getElementById( 'divInfraBarraComandosSuperior' ).offsetTop + top; + let divInfraMoverTopo = document.getElementById("divInfraAreaTelaD"); + $( divInfraMoverTopo ).animate( { scrollTop: nivel } , 800 ); + } diff --git a/sei/web/modulos/correios/md_cor_selecionar_layout_envelope.php b/sei/web/modulos/correios/md_cor_selecionar_layout_envelope.php new file mode 100644 index 0000000..040834f --- /dev/null +++ b/sei/web/modulos/correios/md_cor_selecionar_layout_envelope.php @@ -0,0 +1,71 @@ +setBolLigado(false); + InfraDebug::getInstance()->setBolDebugInfra(true); + InfraDebug::getInstance()->limpar(); + ////////////////////////////////////////////////////////////////////////////// + + SessaoSEI::getInstance()->validarLink(); + + PaginaSEI::getInstance()->setTipoPagina(InfraPagina::$TIPO_PAGINA_SIMPLES); + + $strTitulo = 'Selecionar Layout para Impressão'; + +}catch(Exception $e){ + PaginaSEI::getInstance()->processarExcecao($e); +} + +PaginaSEI::getInstance()->montarDocType(); +PaginaSEI::getInstance()->abrirHtml(); +PaginaSEI::getInstance()->abrirHead(); +PaginaSEI::getInstance()->montarMeta(); +PaginaSEI::getInstance()->montarTitle(PaginaSEI::getInstance()->getStrNomeSistema().' - '.$strTitulo); +PaginaSEI::getInstance()->montarStyle(); +PaginaSEI::getInstance()->abrirStyle(); +PaginaSEI::getInstance()->fecharStyle(); +PaginaSEI::getInstance()->montarJavaScript(); +PaginaSEI::getInstance()->abrirJavaScript(); +PaginaSEI::getInstance()->fecharJavaScript(); +PaginaSEI::getInstance()->fecharHead(); +PaginaSEI::getInstance()->abrirBody($strTitulo,''); +?> + +
+
+ + +
+ +
+
+ + + +fecharBody(); +PaginaSEI::getInstance()->fecharHtml(); +?> diff --git a/sei/web/modulos/correios/rn/MdCorAdmIntegracaoRN.php b/sei/web/modulos/correios/rn/MdCorAdmIntegracaoRN.php new file mode 100644 index 0000000..6fc638b --- /dev/null +++ b/sei/web/modulos/correios/rn/MdCorAdmIntegracaoRN.php @@ -0,0 +1,337 @@ +getStrNome())){ + $objInfraException->adicionarValidacao('Nome não informado.'); + }else{ + $objMdCorAdmIntegracaoDTO->setStrNome(trim($objMdCorAdmIntegracaoDTO->getStrNome())); + + if (strlen($objMdCorAdmIntegracaoDTO->getStrNome()) > 200){ + $objInfraException->adicionarValidacao('Nome possui tamanho superior a 200 caracteres.'); + } + } + } + + private function validarNumFuncionalidade(MdCorAdmIntegracaoDTO $objMdCorAdmIntegracaoDTO, InfraException $objInfraException){ + if (InfraString::isBolVazia($objMdCorAdmIntegracaoDTO->getNumFuncionalidade())){ + $objInfraException->adicionarValidacao('Funcionalidade não informada.'); + } + } + + private function validarStrSinAtivo(MdCorAdmIntegracaoDTO $objMdCorAdmIntegracaoDTO, InfraException $objInfraException){ + if (InfraString::isBolVazia($objMdCorAdmIntegracaoDTO->getStrSinAtivo())){ + $objInfraException->adicionarValidacao('Sinalizador de Exclusão Lógica não informado.'); + }else{ + if (!InfraUtil::isBolSinalizadorValido($objMdCorAdmIntegracaoDTO->getStrSinAtivo())){ + $objInfraException->adicionarValidacao('Sinalizador de Exclusão Lógica inválido.'); + } + } + } + + protected function cadastrarControlado(MdCorAdmIntegracaoDTO $objMdCorAdmIntegracaoDTO) { + try{ + SessaoSEI::getInstance()->validarAuditarPermissao('md_cor_adm_integracao_cadastrar', __METHOD__, $objMdCorAdmIntegracaoDTO); + + $objInfraException = new InfraException(); + + $this->validarStrNome($objMdCorAdmIntegracaoDTO, $objInfraException); + $this->validarNumFuncionalidade($objMdCorAdmIntegracaoDTO, $objInfraException); + $objInfraException->lancarValidacoes(); + + $objMdCorAdmIntegracaoBD = new MdCorAdmIntegracaoBD( $this->getObjInfraIBanco() ); + $ret = $objMdCorAdmIntegracaoBD->cadastrar( $objMdCorAdmIntegracaoDTO ); + + return $ret; + + }catch(Exception $e){ + throw new InfraException('Erro cadastrando Integração.',$e); + } + } + + protected function alterarControlado(MdCorAdmIntegracaoDTO $objMdCorAdmIntegracaoDTO){ + try { + SessaoSEI::getInstance()->validarAuditarPermissao('md_cor_adm_integracao_alterar', __METHOD__, $objMdCorAdmIntegracaoDTO); + + $objInfraException = new InfraException(); + + $this->validarStrNome($objMdCorAdmIntegracaoDTO, $objInfraException); + $this->validarNumFuncionalidade($objMdCorAdmIntegracaoDTO, $objInfraException); + $objInfraException->lancarValidacoes(); + + $objMdCorAdmIntegracaoBD = new MdCorAdmIntegracaoBD( $this->getObjInfraIBanco() ); + $objMdCorAdmIntegracaoBD->alterar( $objMdCorAdmIntegracaoDTO ); + + }catch(Exception $e){ + throw new InfraException('Erro alterando Integração.',$e); + } + } + + protected function excluirControlado($arrObjMdCorAdmIntegracaoDTO){ + try { + + SessaoSEI::getInstance()->validarAuditarPermissao('md_cor_adm_integracao_excluir', __METHOD__, $arrObjMdCorAdmIntegracaoDTO); + + //Regras de Negocio + //$objInfraException = new InfraException(); + + //$objInfraException->lancarValidacoes(); + + $objMdCorAdmIntegracaoBD = new MdCorAdmIntegracaoBD($this->getObjInfraIBanco()); + for($i=0;$iexcluir($arrObjMdCorAdmIntegracaoDTO[$i]); + } + + }catch(Exception $e){ + throw new InfraException('Erro excluindo Integração.',$e); + } + } + + protected function consultarConectado(MdCorAdmIntegracaoDTO $objMdCorAdmIntegracaoDTO){ + try { + + SessaoSEI::getInstance()->validarAuditarPermissao('md_cor_adm_integracao_consultar', __METHOD__, $objMdCorAdmIntegracaoDTO); + + //Regras de Negocio + //$objInfraException = new InfraException(); + + //$objInfraException->lancarValidacoes(); + + $objMdCorAdmIntegracaoBD = new MdCorAdmIntegracaoBD($this->getObjInfraIBanco()); + $ret = $objMdCorAdmIntegracaoBD->consultar($objMdCorAdmIntegracaoDTO); + + return $ret; + }catch(Exception $e){ + throw new InfraException('Erro consultando Integração.',$e); + } + } + + protected function listarConectado(MdCorAdmIntegracaoDTO $objMdCorAdmIntegracaoDTO) { + try { + + SessaoSEI::getInstance()->validarAuditarPermissao('md_cor_adm_integracao_listar', __METHOD__, $objMdCorAdmIntegracaoDTO); + + //Regras de Negocio + //$objInfraException = new InfraException(); + + //$objInfraException->lancarValidacoes(); + + $objMdCorAdmIntegracaoBD = new MdCorAdmIntegracaoBD($this->getObjInfraIBanco()); + $ret = $objMdCorAdmIntegracaoBD->listar($objMdCorAdmIntegracaoDTO); + + return $ret; + + }catch(Exception $e){ + throw new InfraException('Erro listando Integrações.',$e); + } + } + + protected function contarConectado(MdCorAdmIntegracaoDTO $objMdCorAdmIntegracaoDTO){ + try { + + SessaoSEI::getInstance()->validarAuditarPermissao('md_cor_adm_integracao_listar', __METHOD__, $objMdCorAdmIntegracaoDTO); + + //Regras de Negocio + //$objInfraException = new InfraException(); + + //$objInfraException->lancarValidacoes(); + + $objMdCorAdmIntegracaoBD = new MdCorAdmIntegracaoBD($this->getObjInfraIBanco()); + $ret = $objMdCorAdmIntegracaoBD->contar($objMdCorAdmIntegracaoDTO); + + return $ret; + }catch(Exception $e){ + throw new InfraException('Erro contando Integrações.',$e); + } + } + + protected function desativarControlado($arrObjMdCorAdmIntegracaoDTO){ + try { + + SessaoSEI::getInstance()->validarAuditarPermissao('md_cor_adm_integracao_desativar', __METHOD__, $arrObjMdCorAdmIntegracaoDTO); + + //Regras de Negocio + //$objInfraException = new InfraException(); + + //$objInfraException->lancarValidacoes(); + + $objMdCorAdmIntegracaoBD = new MdCorAdmIntegracaoBD($this->getObjInfraIBanco()); + for($i=0;$idesativar($arrObjMdCorAdmIntegracaoDTO[$i]); + } + + }catch(Exception $e){ + throw new InfraException('Erro desativando Integração.',$e); + } + } + + protected function reativarControlado($arrObjMdCorAdmIntegracaoDTO){ + try { + + SessaoSEI::getInstance()->validarAuditarPermissao('md_cor_adm_integracao_reativar', __METHOD__, $arrObjMdCorAdmIntegracaoDTO); + + //Regras de Negocio + //$objInfraException = new InfraException(); + + //$objInfraException->lancarValidacoes(); + + $objMdCorAdmIntegracaoBD = new MdCorAdmIntegracaoBD($this->getObjInfraIBanco()); + for($i=0;$ireativar($arrObjMdCorAdmIntegracaoDTO[$i]); + } + + }catch(Exception $e){ + throw new InfraException('Erro reativando Integração.',$e); + } + } + + protected function bloquearControlado(MdCorAdmIntegracaoDTO $objMdCorAdmIntegracaoDTO){ + try { + + SessaoSEI::getInstance()->validarAuditarPermissao('md_utl_adm_integracao_consultar', __METHOD__, $objMdCorAdmIntegracaoDTO); + + //Regras de Negocio + //$objInfraException = new InfraException(); + + //$objInfraException->lancarValidacoes(); + + $objMdCorAdmIntegracaoBD = new MdCorAdmIntegracaoBD($this->getObjInfraIBanco()); + $ret = $objMdCorAdmIntegracaoBD->bloquear($objMdCorAdmIntegracaoDTO); + + return $ret; + }catch(Exception $e){ + throw new InfraException('Erro bloqueando Integração.',$e); + } + } + + /* + * Consulta somente na Integracao + * */ + public function buscaIntegracaoPorFuncionalidade( $tpFuncionalidade ){ + + if ( empty($tpFuncionalidade) ) return ['suc' => false , 'msg' => 'O Tipo de Funcionalidade da Integração está vazio ou nulo.']; + + $objMdCorAdmIntegracaoDTO = new MdCorAdmIntegracaoDTO(); + + $objMdCorAdmIntegracaoDTO->setNumFuncionalidade( $tpFuncionalidade ); + $objMdCorAdmIntegracaoDTO->setStrSinAtivo( 'S' ); + $objMdCorAdmIntegracaoDTO->retTodos(); + + return $this->consultar( $objMdCorAdmIntegracaoDTO ); + } + + public function buscaFuncionalidadesCadastradas(){ + $objMdCorAdmIntegracaoDTO = new MdCorAdmIntegracaoDTO(); + + $objMdCorAdmIntegracaoDTO->setStrSinAtivo('S'); + $objMdCorAdmIntegracaoDTO->retNumFuncionalidade(); + + return InfraArray::converterArrInfraDTO( + $this->listar( $objMdCorAdmIntegracaoDTO ), + 'Funcionalidade' + ); + } + + public function verificaTokenExpirado( &$arrParametro, $objMdCorIntegracao ){ + // data atual + $dataNesteInstante = date('Y-m-d H:i:s'); + $dataNesteInstante = strtotime( $dataNesteInstante ); + + // data de expiracao salva no banco + $arrDataExp = explode(' ' , $arrParametro['expiraEm']); + $dataExpToken = implode('-',array_reverse(explode('/',$arrDataExp[0]))); + $dataExpToken .= ' ' . $arrDataExp[1]; // $arrDataExp[1] => horas + $dataExpToken = strtotime($dataExpToken); + + // verifica se data atual eh maior que a data de expiracao da operacao da API + if ( $dataExpToken < $dataNesteInstante ) { + + $objMdCorIntegToken = $this->buscaIntegracaoPorFuncionalidade( self::$GERAR_TOKEN ); + + if ( is_array( $objMdCorIntegToken ) && isset( $objMdCorIntegToken['suc'] ) && $objMdCorIntegToken['suc'] === false ) + return $objMdCorIntegToken; + + if ( empty($objMdCorIntegToken) ) + return ['suc' => false , ',msg' => 'Mapeamento de Integração '. MdCorAdmIntegracaoRN::$STR_GERAR_TOKEN .' não existe ou está inativo.']; + + // busca nova data de expiracao e token da operacao da API + $dados = ( new MdCorApiRestRN() )->gerarToken($objMdCorIntegToken); + + if( empty($dados) ) return ['suc' => false , 'msg' => 'Erro no uso da API Gerar Token' , 'url' => $objMdCorIntegToken->getStrUrlOperacao()]; + + if ( isset( $dados['suc'] ) && $dados['suc'] === false ) { + $dados['url'] = $objMdCorIntegToken->getStrUrlOperacao(); + return $dados; + } + + //atualiza dados no banco + $arrDataHr = explode('T',$dados['expiraEm']); + $strData = implode('/' , array_reverse(explode('-',$arrDataHr[0]))); + $strDataHr = $strData .' '. $arrDataHr[1]; + + $objMdCorIntegracao->setDthDataExpiraToken($strDataHr); + $objMdCorIntegracao->setStrToken($dados['token']); + + $this->alterar($objMdCorIntegracao); + + //atualiza dados da variavel $arrParametro + $arrParametro['token'] = $objMdCorIntegracao->getStrToken(); + $arrParametro['expiraEm'] = $objMdCorIntegracao->getDthDataExpiraToken(); + } + return true; + } +} diff --git a/sei/web/modulos/correios/rn/MdCorApiRestRN.php b/sei/web/modulos/correios/rn/MdCorApiRestRN.php new file mode 100644 index 0000000..2efe509 --- /dev/null +++ b/sei/web/modulos/correios/rn/MdCorApiRestRN.php @@ -0,0 +1,330 @@ + + * @since 12/06/2017 + * + * Atualizado por: Gustavo Camelo - 14/12/2023 + */ +class MdCorApiRestRN +{ + private $_endpoint; + private $_resultado; + private $_token; + private $_expiraEm; + + public static $STR_HEADER_ACCEPT = 'application/json'; + + public function __construct($params = array()) + { + $this->_endpoint = isset($params['endpoint']) ? $params['endpoint'] : ''; + $this->_resultado = isset($params['resultado']) ? $params['resultado'] : null; //U - Ultimo evento, T - Todos os eventos + $this->_token = isset($params['token']) ? $params['token'] : ''; + $this->_expiraEm = isset($params['expiraEm']) ? $params['expiraEm'] : ''; + } + + public function gerarToken($objMdCorIntegToken){ + + if ( empty( $objMdCorIntegToken ) ) return ['erro' => 'Objeto de Integração Token inexistente ou inválido.']; + + $nr_postagem = isset( $_POST['txtNumeroCartaoPostagem'] ) + ? $_POST['txtNumeroCartaoPostagem'] + : ( new MdCorContratoRN() )->getNumeroPostagemContratoAtivo(); + + if ( $nr_postagem === false ) return ['suc' => false ,'msg' => 'Número de postagem inexistente ou inválido.']; + + $arrParams = [ + 'urlOperacao' => $objMdCorIntegToken->getStrUrlOperacao(), + 'token' => $objMdCorIntegToken->getStrToken(), + 'tipoReq' => MdCorAdmIntegracaoRN::$STR_POST, + 'tipoAuth' => 'Basic', + 'paramsCorpo' => ['numero' => $nr_postagem], + 'paramsUserPass' => ['usuario' => $objMdCorIntegToken->getStrUsuario() , 'senha' => $objMdCorIntegToken->getStrSenha()] + ]; + $rs = $this->executaRequisicaoAPI($arrParams); + return $rs['suc'] === false ? $rs : $rs['dados']; + } + + public function rastrearObjeto($codigoRastreio){ + $arrParams = [ + 'codigoRef' => ['objetos' => $codigoRastreio], + 'tipoReq' => MdCorAdmIntegracaoRN::$STR_GET, + ]; + $rs = $this->executaRequisicaoAPI($arrParams); + return $rs['suc'] === false ? ['erro' => $rs] : $rs['dados']; + } + + public function consultarCEP($cep){ + $arrParams = [ + 'codigoRef' => ['enderecos' => $cep], + 'tipoReq' => MdCorAdmIntegracaoRN::$STR_GET, + ]; + $rs = $this->executaRequisicaoAPI($arrParams); + return $rs['suc'] === false ? $rs : $rs['dados']; + } + + public function buscarServicosPostais($strNumeroContratoCorreio, $strCnpj){ + $arrParams = [ + 'codigoRef' => ['empresas' => $strCnpj , 'contratos' => $strNumeroContratoCorreio , 'servicos' => ''], + 'tipoReq' => MdCorAdmIntegracaoRN::$STR_GET, + 'queryParams' => ['size' => 250] + ]; + $rs = $this->executaRequisicaoAPI($arrParams); + return $rs['suc'] === false ? $rs : $rs['dados']; + } + + public function solicitarEtiquetas($codServPostal,$qtdEtiquetas){ + $arrParams = [ + 'tipoReq' => MdCorAdmIntegracaoRN::$STR_POST, + 'paramsCorpo' => ['codigoServico' => $codServPostal, 'quantidade' => $qtdEtiquetas] + ]; + $rs = $this->executaRequisicaoAPI($arrParams); + return $rs['suc'] === false ? $rs : (object) $rs['dados'][0]; + } + + public function gerarPPN($arrObjJson){ + $arrParams = ['tipoReq' => MdCorAdmIntegracaoRN::$STR_POST , 'paramsCorpo' => $arrObjJson , 'operacao' => 'ppn']; + $rs = $this->executaRequisicaoAPI($arrParams); + return $rs['suc'] === false ? $rs : $rs['dados']; + } + + public function emissaoRotulo($arrParamsApi){ + $arrParams = [ + 'tipoReq' => MdCorAdmIntegracaoRN::$STR_POST, + 'paramsCorpo' => $arrParamsApi + ]; + $rs = $this->executaRequisicaoAPI($arrParams); + return $rs['suc'] === false ? $rs : $rs['dados']; + } + + public function downloadRotulo($idRecibo){ + $arrParams = [ + 'tipoReq' => MdCorAdmIntegracaoRN::$STR_GET, + 'codigoRef' => ['assincrono' => $idRecibo], + 'naoContentType' => true + ]; + $rs = $this->executaRequisicaoAPI($arrParams); + return $rs['suc'] === false ? $rs : $rs['dados']['dados']; + } + + public function avisoRecebimento($idPrePostagem){ + $arrParams = [ + 'tipoReq' => MdCorAdmIntegracaoRN::$STR_GET, + 'codigoRef' => ['avisorecebimento' => $idPrePostagem], + 'naoContentType' => true, + 'accept' => 'text/html;charset=utf-8', + 'retornaString' => true + ]; + $rs = $this->executaRequisicaoAPI($arrParams); + return $rs['suc'] === false ? $rs : $rs['dados']; + } + + public function cancelarPPN($arrCodObjeto){ + + foreach ( $arrCodObjeto as $codObjeto ) { + $arrParams = [ + 'tipoReq' => MdCorAdmIntegracaoRN::$STR_DEL, + 'codigoRef' => ['objeto' => $codObjeto] + ]; + + $rs = $this->executaRequisicaoAPI($arrParams); + + if ( $rs['suc'] === false ) return $rs; + } + return true; + } + + /* + * Método responsável pela execução da requisição API Correios + * + * */ + private function executaRequisicaoAPI( $arrParams = null ){ + try { + if (is_null($arrParams)) + throw new InfraException('Não foi informado nenhum dado de parâmetro para execução da Requisição na API'); + + $urlServico = isset($arrParams['urlOperacao']) ? $arrParams['urlOperacao'] : $this->_endpoint; + + if (empty($urlServico)) + throw new InfraException('URL da operação não informada.'); + + // parametros montados na URL do servico + if (key_exists('codigoRef', $arrParams)) { + foreach ($arrParams['codigoRef'] as $k => $v) { + if (!empty($v)) + $urlServico .= '/' . $k . '/' . $v; + else + $urlServico .= '/' . $k; + } + } + + // verifica se existe parametros na url a ser passado + if ( isset($arrParams['queryParams']) ) { + $urlServico .= '?' . http_build_query($arrParams['queryParams']); + } + + $curl = curl_init($urlServico); + + // parametros montado no corpo da requisicao + $corpoJson = null; + if (key_exists('paramsCorpo', $arrParams)) { + $corpoJson = InfraUtil::converterJSON($arrParams['paramsCorpo']); + + if ( empty($corpoJson) ) { + curl_close($curl); + throw new InfraException( self::trataErroJson() ); + } + + $arrParams['corpoJson'] = $corpoJson; + curl_setopt($curl, CURLOPT_POSTFIELDS, $corpoJson); + } + + // monta dados de parametros especificos + if ($this->_resultado) + curl_setopt($curl, CURLOPT_POSTFIELDS, InfraUtil::converterJSON(['resultado' => $this->_resultado])); + + curl_setopt_array($curl, [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYPEER => false, + CURLOPT_CONNECTTIMEOUT => 10, + CURLOPT_TIMEOUT => 20, + CURLOPT_CUSTOMREQUEST => $arrParams['tipoReq'], + ]); + + // monta dados de cabecalho + $strTpAuth = $arrParams['tipoAuth'] ?? 'Bearer'; + $strToken = isset($arrParams['token']) ? $arrParams['token'] : $this->_token; + $strAutorizacao = "$strTpAuth $strToken"; + $strAccept = isset($arrParams['accept']) ? $arrParams['accept'] : self::$STR_HEADER_ACCEPT; + + $headers = [ + 'Accept: ' . $strAccept, + 'Authorization: ' . $strAutorizacao + ]; + + if (!isset($arrParams['naoContentType'])) $headers[] = 'Content-Type: application/json'; + + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + // monta credenciais usuario e senha + if (key_exists('paramsUserPass', $arrParams)) { + $senha = MdCorAdmIntegracaoINT::gerenciaDadosRestritos($arrParams['paramsUserPass']['senha'],'D'); + $strUserPass = "{$arrParams['paramsUserPass']['usuario']}:$senha"; + curl_setopt($curl, CURLOPT_USERPWD, $strUserPass); + } + + // executa requisicao no webservice + $rs = curl_exec($curl); + sleep(1); + $info = curl_getinfo($curl); + $rs = $this->trataRetornoCurl($info, $rs, $arrParams); + $strErro = ''; + + // se ocorreu alguma falha + if ( $info['http_code'] == 0 ) { + $strErro = curl_error($curl); + } else if ( $rs['suc'] === false ) { + $strErro = $rs['msg']; + } + + curl_close($curl); + + if ( !empty( $strErro) ) throw new InfraException( $strErro ); + + return $rs; + + } catch ( Exception $e ) { + return ['suc' => false , 'msg' => $e->getMessage()]; + } + } + + private function trataRetornoCurl( $info , $ret , $arrOpcoes = [] ){ + $strCodInfo = isset($info['http_code']) ? "Código: {$info['http_code']} - " : ""; + $arrRet = ['suc' => false , 'msg' => $strCodInfo , 'dados' => null , 'code' => $info['http_code'] ?? '']; + + if ( $arrRet['code'] == 200 && ( isset( $arrOpcoes['retornaString'] ) && $arrOpcoes['retornaString'] === true ) ) { + $arrRet['suc'] = true; + $arrRet['dados'] = $ret; + + return $arrRet; + } + + $rs = json_decode( $ret , true ); + + switch ( $info['http_code'] ) { + case 200: + case 201: + if ( isset( $rs['mensagem'] ) ) { + $arrRet['msg'] = utf8_decode( $rs['mensagem'] ); + } else { + $arrRet['suc'] = true; + $arrRet['dados'] = $rs; + $arrRet['msg'] = null; + } + break; + + case 400: + case 403: + case 404: + case 405: + case 500: + if ( empty( $rs ) ) { + if ( empty($ret) ) $arrRet['msg'] .= 'Erro não identificado'; + else $arrRet['msg'] .= utf8_decode( $ret ); + } else { + if ( isset($rs['msgs']) && !empty($rs['msgs']) ) { + $arrRet['msg'] .= utf8_decode( $rs['msgs'][0] ); + } else if( isset( $rs['detail'] ) && !empty( $rs['detail'] ) ) { + $arrRet['msg'] .= utf8_decode( $rs['detail'] ); + } else { + $arrRet['msg'] .= "Erro não Identificado"; + } + } + break; + + default: + if ( isset( $rs['mensagem'] ) ) : $arrRet['msg'] = utf8_decode( $rs['mensagem'] ); + elseif ( isset( $rs['msg'] ) ) : $arrRet['msg'] = utf8_decode( $rs['msg'] ); + else : $arrRet['msg'] = 'Sem Código de Retorno - Falha não Identificada'; + endif; + break; + } + return $arrRet; + } + + public static function trataErroJson(){ + $msg_erro = ''; + + switch ( json_last_error() ) { + case JSON_ERROR_DEPTH: + $msg_erro = "Profundidade máxima da pilha foi excedida."; + break; + case JSON_ERROR_STATE_MISMATCH: + $msg_erro = "Inválido ou mal formado JSON."; + break; + case JSON_ERROR_CTRL_CHAR: + $msg_erro = "Caractere de controle inesperado encontrado."; + break; + case JSON_ERROR_SYNTAX: + $msg_erro = "Erro de sintaxe, JSON malformado."; + break; + case JSON_ERROR_UTF8: + $msg_erro = "Caracteres UTF-8 malformados, possivelmente codificados incorretamente."; + break; + default: + $msg_erro = ""; + break; + } + + return "$msg_erro \n\n Erro: " . json_last_error_msg(); + } + + public function getEndPoint(){ + return $this->_endpoint; + } +} \ No newline at end of file diff --git a/sei/web/modulos/correios/rn/MdCorClientWsRN.php b/sei/web/modulos/correios/rn/MdCorClientWsRN.php deleted file mode 100644 index a7679e7..0000000 --- a/sei/web/modulos/correios/rn/MdCorClientWsRN.php +++ /dev/null @@ -1,167 +0,0 @@ - array( - self::AMBIENTE_DSV => self::URL_DSV, - self::AMBIENTE_PRD => self::URL_PRD, - ) - ); - - private function __construct() - {} - - /** - * @param string $wsdl - * @return null|SoapClient - */ - public static function gerarCliente($wsdl) - { - try { - - //$wsdl = self::retornaWsdlPorTipo(self::WSDL_BUSCA_CLIENTE); - - return new SoapClient ($wsdl, array( - 'stream_context' => stream_context_create( - array( - 'ssl' => array( - 'verify_peer' => false, - 'verify_peer_name' => false, - ), - 'http' => array( - 'protocol_version' => '1.1', - 'header' => 'Connection: Close' - ) - ) - ) - ) - ); - - } catch (SoapFault $soapFault) { - throw new InfraException('Problema ao acessar o Web Service dos Correios. Por Favor, tentar mais tarde.'); - } - } - - /** - * @param string $tipo - * @return string gmixed - */ - public static function retornaWsdlPorTipo($tipo) - { - $objConfiguracaoSEI = ConfiguracaoSEI::getInstance(); - $arrConfiguracoes = $objConfiguracaoSEI->getArrConfiguracoes(); - - $ambiente = self::AMBIENTE_DSV; - if ($arrConfiguracoes['SEI']['Producao'] == true) { - $ambiente = self::AMBIENTE_PRD; - } - - return self::$arrWsdl[$tipo][$ambiente]; - } - - /** - * @param integer $idContrato - * @param integer $idCartaoPostagem - * @param string $wsdl - * @return string - */ - public static function buscarServicosPostais($idContrato, $idCartaoPostagem, $wsdl, $strUsuario, $strSenha) - { - try{ - - //return self::retornarXmlServicosPostaisMock(); - $cliente = self::gerarCliente($wsdl); - - $response = $cliente->buscaCliente(array( - 'idContrato' => $idContrato, - 'idCartaoPostagem' => $idCartaoPostagem, - 'usuario' => $strUsuario, - 'senha' => $strSenha - )); - - return self::retornarXmlServicosPostais($response); - }catch (SoapFault $e){ - throw new InfraException($e->getMessage(). 'Por Favor, verifique suas Credencias.'); - } - } - - /** - * @param $obj - * @return array - */ - private static function retornarArrayServicosPostais($obj) - { - $ret = array(); - $servicos = $obj->return->contratos->cartoesPostagem->servicos; - - foreach($servicos as $servico) - { - $item = array( - 'descricao' => $servico->descricao, - 'id' => $servico->id, - 'codigo' => $servico->codigo, - ); - $ret[] = $item; - } - return $ret; - } - - private static function retornarXmlServicosPostais($obj) - { - $xml = ""; - $servicos = $obj->return->contratos->cartoesPostagem->servicos; - foreach($servicos as $servico) - { - $xml .= "descricao}]]>id}]]>codigo}]]>"; - } - $xml .= ""; - return $xml; - } - - private static function retornarXmlServicosPostaisMock() - { - $servico1 = new stdClass(); - $servico1->descricao = 'sedex 10'; - $servico1->id = '1'; - $servico1->codigo = '10'; - - $servico2 = new stdClass(); - $servico2->descricao = 'sedex pac'; - $servico2->id = '2'; - $servico2->codigo = '20'; - - $servico3 = new stdClass(); - $servico3->descricao = 'carta'; - $servico3->id = '3'; - $servico3->codigo = '30'; - - $servicos = array( - $servico1, $servico2, $servico3 - ); - - $xml = ""; - foreach($servicos as $servico) - { - $xml .= "descricao}]]>id}]]>codigo}]]>"; - } - $xml .= ""; - return $xml; - } - -} \ No newline at end of file diff --git a/sei/web/modulos/correios/rn/MdCorContratoRN.php b/sei/web/modulos/correios/rn/MdCorContratoRN.php index f64845e..e5591bf 100644 --- a/sei/web/modulos/correios/rn/MdCorContratoRN.php +++ b/sei/web/modulos/correios/rn/MdCorContratoRN.php @@ -61,19 +61,6 @@ private function validarStrNumeroCartaoPostagem(MdCorContratoDTO $objMdCorContra } } - private function validarStrUrlWebservice(MdCorContratoDTO $objMdCorContratoDTO, InfraException $objInfraException) - { - if (InfraString::isBolVazia($objMdCorContratoDTO->getStrUrlWebservice())) { - $objInfraException->adicionarValidacao('Endereço WSDL do Webservice do SIGEP WEB não informada.'); - } else { - $objMdCorContratoDTO->setStrUrlWebservice(trim($objMdCorContratoDTO->getStrUrlWebservice())); - - if (strlen($objMdCorContratoDTO->getStrUrlWebservice()) > 2081) { - $objInfraException->adicionarValidacao('Endereço WSDL do Webservice do SIGEP WEB possui tamanho superior a 2081 caracteres.'); - } - } - } - private function validarDblIdProcedimento(MdCorContratoDTO $objMdCorContratoDTO, InfraException $objInfraException) { if (InfraString::isBolVazia($objMdCorContratoDTO->getDblIdProcedimento())) { @@ -109,16 +96,10 @@ protected function cadastrarControlado($arr) $objMdCorContratoDTO->setStrNumeroContrato($arr['txtNumeroContrato']); $objMdCorContratoDTO->setStrNumeroContratoCorreio($arr['txtNumeroContratoCorreio']); $objMdCorContratoDTO->setStrNumeroCartaoPostagem($arr['txtNumeroCartaoPostagem']); - $objMdCorContratoDTO->setStrUrlWebservice($arr['txtUrlWebservice']); $objMdCorContratoDTO->setDblIdProcedimento($arr['hdnIdProcedimento']); $objMdCorContratoDTO->setStrSinAtivo('S'); - $objMdCorContratoDTO->setNumNumeroCnpj(InfraUtil::retirarFormatacao($_POST['txtCNPJ'])); - $objMdCorContratoDTO->setStrUsuario($_POST['txtUsuario']); - $objMdCorContratoDTO->setStrSenha($_POST['txtSenha']); - $objMdCorContratoDTO->setNumIdMdCorDiretoria($_POST['slCodigoDiretoria']); - $objMdCorContratoDTO->setStrCodigoAdministrativo($_POST['txtCodigoAdministrativo']); - $objMdCorContratoDTO->setNumAnoContratoCorreio($arr['txtNumeroAnoContratoCorreio']); + $objMdCorContratoDTO->setNumIdMdCorDiretoria($arr['slCodigoDiretoria']); //Regras de Negocio $objInfraException = new InfraException(); @@ -126,7 +107,6 @@ protected function cadastrarControlado($arr) $this->validarStrNumeroContrato($objMdCorContratoDTO, $objInfraException); $this->validarStrNumeroContratoCorreio($objMdCorContratoDTO, $objInfraException); $this->validarStrNumeroCartaoPostagem($objMdCorContratoDTO, $objInfraException); - $this->validarStrUrlWebservice($objMdCorContratoDTO, $objInfraException); $this->validarDblIdProcedimento($objMdCorContratoDTO, $objInfraException); $this->validarStrSinAtivo($objMdCorContratoDTO, $objInfraException); @@ -136,13 +116,12 @@ protected function cadastrarControlado($arr) $ret = $objMdCorContratoBD->cadastrar($objMdCorContratoDTO); $objMdCorServicoPostalRN = new MdCorServicoPostalRN(); - foreach ($arr['ar'] as $i => $ar) { + foreach ($arr['codigo'] as $i => $ar) { $cobrar = isset($arr['cobrar'][$i]) ? $arr['cobrar'][$i] : 'N'; $anexarMidia = isset($arr['anexarMidia'][$i]) ? $arr['anexarMidia'][$i] : 'N'; $objMdCorServicoPostalDTO = new MdCorServicoPostalDTO(); $objMdCorServicoPostalDTO->setNumIdMdCorContrato($objMdCorContratoDTO->getNumIdMdCorContrato()); - $objMdCorServicoPostalDTO->setStrIdWsCorreios($arr['id'][$i]); $objMdCorServicoPostalDTO->setStrCodigoWsCorreios($arr['codigo'][$i]); $objMdCorServicoPostalDTO->setStrNome($arr['nome'][$i]); $objMdCorServicoPostalDTO->setStrExpedicaoAvisoRecebimento($arr['ar'][$i]); @@ -150,10 +129,8 @@ protected function cadastrarControlado($arr) $objMdCorServicoPostalDTO->setStrSinAtivo('S'); $objMdCorServicoPostalDTO->setStrSinServicoCobrar($cobrar); $objMdCorServicoPostalDTO->setStrSinAnexarMidia($anexarMidia); - $objMdCorContratoDTO->setNumNumeroCnpj(InfraUtil::retirarFormatacao($arr['txtCNPJ'])); - $objMdCorContratoDTO->setStrUsuario($arr['txtUsuario']); - $objMdCorContratoDTO->setStrSenha($arr['txtSenha']); + //trata dados sobre tipoo de correspondencia $arrTipoCorrespondencia = explode('|', $arr['sl_tipo'][$i]); $tipoCorrespondencia = current($arrTipoCorrespondencia); $objMdCorServicoPostalDTO->setNumIdMdCorTipoCorrespondencia($tipoCorrespondencia); @@ -183,16 +160,10 @@ protected function alterarControlado($arr) $objMdCorContratoDTO->setStrNumeroContrato($arr['txtNumeroContrato']); $objMdCorContratoDTO->setStrNumeroContratoCorreio($arr['txtNumeroContratoCorreio']); $objMdCorContratoDTO->setStrNumeroCartaoPostagem($arr['txtNumeroCartaoPostagem']); - $objMdCorContratoDTO->setStrUrlWebservice($arr['txtUrlWebservice']); $objMdCorContratoDTO->setDblIdProcedimento($arr['hdnIdProcedimento']); $objMdCorContratoDTO->setNumNumeroCnpj(InfraUtil::retirarFormatacao($arr['txtCNPJ'])); - $objMdCorContratoDTO->setStrUsuario($arr['txtUsuario']); - $objMdCorContratoDTO->setStrSenha($arr['txtSenha']); $objMdCorContratoDTO->setNumIdMdCorDiretoria($arr['slCodigoDiretoria']); - $objMdCorContratoDTO->setStrCodigoAdministrativo($arr['txtCodigoAdministrativo']); $objMdCorContratoDTO->setStrSinAtivo('S'); - $objMdCorContratoDTO->setNumAnoContratoCorreio($arr['txtNumeroAnoContratoCorreio']); - /* * Trata os id's a serem desativados/reativados vindo do post. @@ -212,9 +183,6 @@ protected function alterarControlado($arr) if ($objMdCorContratoDTO->isSetStrNumeroCartaoPostagem()) { $this->validarStrNumeroCartaoPostagem($objMdCorContratoDTO, $objInfraException); } - if ($objMdCorContratoDTO->isSetStrUrlWebservice()) { - $this->validarStrUrlWebservice($objMdCorContratoDTO, $objInfraException); - } if ($objMdCorContratoDTO->isSetDblIdProcedimento()) { $this->validarDblIdProcedimento($objMdCorContratoDTO, $objInfraException); } @@ -231,7 +199,7 @@ protected function alterarControlado($arr) $objMdCorMapUnidServicoRN = new MdCorMapUnidServicoRN(); $objMdCorServicoPostalDTO = new MdCorServicoPostalDTO(); -// $objMdCorServicoPostalDTO->retNumIdMdCorServicoPostal(); + $objMdCorServicoPostalDTO->retTodos(); $objMdCorServicoPostalDTO->setNumIdMdCorContrato($arr['hdnIdMdCorContrato']); $objMdCorServicoPostalDTO->setBolExclusaoLogica(array()); @@ -242,16 +210,17 @@ protected function alterarControlado($arr) $arrIdServicoPostalPost = array(); for ($j = 0; $j < count($arrObjMdCorServicoPostalDTO); $j++) { - $key = $arrObjMdCorServicoPostalDTO[$j]->getStrIdWsCorreios(); + $arrObjMdCorServicoPostalDTO[$j]->setStrCodigoWsCorreios( trim( $arrObjMdCorServicoPostalDTO[$j]->getStrCodigoWsCorreios() ) ); + $key = $arrObjMdCorServicoPostalDTO[$j]->getStrCodigoWsCorreios(); $arrIdServicoPostalBanco[$key] = $arrObjMdCorServicoPostalDTO[$j]; } - foreach ($arr['id'] as $i => $ar) { + + foreach ($arr['codigo'] as $i => $ar) { $cobrar = isset($arr['cobrar'][$i]) ? $arr['cobrar'][$i] : 'N'; $anexarMidia = isset($arr['anexarMidia'][$i]) ? $arr['anexarMidia'][$i] : 'N'; $objMdCorServicoPostalDTO = new MdCorServicoPostalDTO(); $objMdCorServicoPostalDTO->setNumIdMdCorContrato($arr['hdnIdMdCorContrato']); - $objMdCorServicoPostalDTO->setStrIdWsCorreios($arr['id'][$i]); $objMdCorServicoPostalDTO->setStrCodigoWsCorreios($arr['codigo'][$i]); $objMdCorServicoPostalDTO->setStrNome($arr['nome'][$i]); $objMdCorServicoPostalDTO->setStrDescricao($arr['descricao'][$i]); @@ -262,7 +231,6 @@ protected function alterarControlado($arr) $tipoCorrespondencia = current($arrTipoCorrespondencia); $sinAr = end($arrTipoCorrespondencia); - $objMdCorServicoPostalDTO->setStrSinAtivo('S'); $objMdCorServicoPostalDTO->setStrExpedicaoAvisoRecebimento($arr['ar'][$i]); @@ -272,7 +240,7 @@ protected function alterarControlado($arr) $objMdCorServicoPostalDTO->setNumIdMdCorTipoCorrespondencia($tipoCorrespondencia); - $key = $objMdCorServicoPostalDTO->getStrIdWsCorreios(); + $key = $objMdCorServicoPostalDTO->getStrCodigoWsCorreios(); $arrIdServicoPostalPost[$key] = $objMdCorServicoPostalDTO; } @@ -285,13 +253,12 @@ protected function alterarControlado($arr) foreach ($arrIdParaAtualizar as $j => $objMdCorServicoPostalDTO) { /* - * If para verificar se o IdWsCorreios está contido no array de serviçoes desativados vindo do post, se sim seta N para sin + * If para verificar se o CodigoWsCorreios está contido no array de serviçoes desativados vindo do post, se sim seta N para sin * sin_ativo. */ - // in_array($arrIdServicoPostalPost[$j]->getStrIdWsCorreios(), $arr['hdnListaContratoServicosDesativados']) $arrIdParaAtualizar[$j]->setStrSinAtivo('N'); - if(in_array($arrIdServicoPostalPost[$j]->getStrIdWsCorreios(), $arr['hdnListaContratoServicosDesativados'])){ + if(in_array($arrIdServicoPostalPost[$j]->getStrCodigoWsCorreios(), $arr['hdnListaContratoServicosDesativados'])){ $arrIdParaAtualizar[$j]->setStrSinAtivo('N'); - }else if (in_array($arrIdServicoPostalPost[$j]->getStrIdWsCorreios(), $arr['hdnListaContratoServicosReativadas'])){ + }else if (in_array($arrIdServicoPostalPost[$j]->getStrCodigoWsCorreios(), $arr['hdnListaContratoServicosReativadas'])){ $arrIdParaAtualizar[$j]->setStrSinAtivo('S'); } @@ -308,10 +275,8 @@ protected function alterarControlado($arr) $objMdCorServicoPostalRN->cadastrar($objMdCorServicoPostalDTO); } - // excluindo se nao tiver mapeado para alguma unidade foreach ($arrIdParaExcluir as $j => $objMdCorServicoPostalDTO) { - $objMdCorExpedicaoSolicitadaDTO = new MdCorExpedicaoSolicitadaDTO(); $objMdCorExpedicaoSolicitadaRN = new MdCorExpedicaoSolicitadaRN(); $objMdCorMapUnidServicoDTO = new MdCorMapUnidServicoDTO(); @@ -330,25 +295,18 @@ protected function alterarControlado($arr) /* Verifica se o serviço está vinculado a alguma solicitação de expedição */ if (!(in_array($arrIdParaExcluir[$j]->getNumIdMdCorServicoPostal(),$arrIdMdCorServicoPostal))) { - $objMdCorServicoPostalRN->excluir(array($objMdCorServicoPostalDTO)); - } else { - PaginaSEI::getInstance()->setStrMensagem('Não é permitido excluir o Serviço Postal ' . $arrIdParaExcluir[$j]->getStrNome() . ' pois ele está vinculado a alguma Solicitação de Expedição.', InfraPagina::$TIPO_MSG_AVISO); - } - } else { - PaginaSEI::getInstance()->setStrMensagem('Não é permitido excluir o Serviço Postal ' . $arrIdParaExcluir[$j]->getStrNome() . ' pois ele está parametrizado no Mapeamento de Unidades Solicitantes e Serviços Postais.', InfraPagina::$TIPO_MSG_AVISO); if ($arrIdParaExcluir[$j]->getStrSinAtivo() == 'N') { $arrIdParaExcluir[$j]->setStrSinAtivo('S'); $objMdCorServicoPostalRN->alterar($objMdCorServicoPostalDTO); } - } } @@ -400,23 +358,15 @@ protected function excluirControlado($arrObjMdCorContratoDTO) /* Verifica se o serviço está mapeado em alguma unidade */ if (count($arrObjMdCorMapUnidServicoDTO) > 0) { $alterarContrato = true; -// $objMdCorServicoPostalRN->desativar(array($objItemMdCorServicoPostalDTO)); PaginaSEI::getInstance()->setStrMensagem('Não foi possível excluir este Contrato, pois existem outras parametrizações ou expedições que já o ultilizaram.', InfraPagina::$TIPO_MSG_AVISO); } else { $objMdCorServicoPostalRN->excluir(array($objItemMdCorServicoPostalDTO)); } - $objMdCorServicoPostalExcluirDTO = new MdCorServicoPostalDTO(); - $objMdCorServicoPostalExcluirDTO->retTodos(); - $objMdCorServicoPostalExcluirDTO->setNumIdMdCorServicoPostal($objItemMdCorServicoPostalDTO->getNumIdMdCorServicoPostal()); - $arrObjMdCorServicoPostalExcluirDTO = $objMdCorServicoPostalRN->consultar($objMdCorServicoPostalExcluirDTO); - - $objMdCorServicoPostalRN->excluir($arrObjMdCorServicoPostalExcluirDTO); } } if ($alterarContrato) { PaginaSEI::getInstance()->setStrMensagem('Não foi possível excluir este Contrato, pois existem outras parametrizações ou expedições que já o ultilizaram.', InfraPagina::$TIPO_MSG_AVISO); -// $objMdCorContratoBD->desativar($objMdCorContratoDTO); } else { $mdCorObjetoRN = new MdCorObjetoRN(); $objMdCorObjetoDTO = new MdCorObjetoDTO(); @@ -676,6 +626,17 @@ public static function verificarUnidServicoMapeado( $idUnidServico , $idServicoP return $xml; } + public function getNumeroPostagemContratoAtivo(){ + $objMdCorContratoDTO = new MdCorContratoDTO(); + $objMdCorContratoDTO->setStrSinAtivo('S'); + $objMdCorContratoDTO->retStrNumeroCartaoPostagem(); + + $objMdCorContratoDTO = $this->consultar($objMdCorContratoDTO); + + if ( $objMdCorContratoDTO ) return $objMdCorContratoDTO->getStrNumeroCartaoPostagem(); + + return false; + } } ?> diff --git a/sei/web/modulos/correios/rn/MdCorExpedicaoAndamentoRN.php b/sei/web/modulos/correios/rn/MdCorExpedicaoAndamentoRN.php index ee9023e..be6b0bb 100644 --- a/sei/web/modulos/correios/rn/MdCorExpedicaoAndamentoRN.php +++ b/sei/web/modulos/correios/rn/MdCorExpedicaoAndamentoRN.php @@ -388,43 +388,47 @@ protected function buscarUltimoAndamentoConectado($idMdCorExpedicaoSolicitada) protected function salvarAndamentoConectado($idProcedimento = null) { - $objMdCorParametroRastreioRN = new MdCorParametroRastreioRN(); - $objMdCorParametroRastreioDTO = new MdCorParametroRastreioDTO(); - $objMdCorParametroRastreioDTO->retStrUsuario(); - $objMdCorParametroRastreioDTO->retStrSenha(); - $objMdCorParametroRastreioDTO->retStrEnderecoWsdl(); + $arrFalha = []; + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); - $objMdCorParametroRastreioDTO = $objMdCorParametroRastreioRN->consultar($objMdCorParametroRastreioDTO); + $objMdCorIntegRastreio = $objMdCorAdmIntegracaoRN->buscaIntegracaoPorFuncionalidade(MdCorAdmIntegracaoRN::$RASTREAR); - if (is_null($objMdCorParametroRastreioDTO)) { + if ( empty( $objMdCorIntegRastreio ) || ( is_array($objMdCorIntegRastreio) && isset($objMdCorIntegRastreio['suc']) && $objMdCorIntegRastreio['suc'] === false ) ) { $objInfraException = new InfraException(); - $objInfraException->adicionarValidacao(' Parametros de rastreio não cadastrados.'); + $objInfraException->adicionarValidacao(' Parâmetros de Rastreio e/ou Token não cadastrados.'); $objInfraException->lancarValidacoes(); } $arrParametro = [ 'resultado' => 'T', - 'endpoint' => $objMdCorParametroRastreioDTO->getStrEnderecoWsdl(), - 'usuario' => $objMdCorParametroRastreioDTO->getStrUsuario(), - 'senha' => $objMdCorParametroRastreioDTO->getStrSenha(), + 'endpoint' => $objMdCorIntegRastreio->getStrUrlOperacao(), + 'token' => $objMdCorIntegRastreio->getStrToken(), + 'expiraEm' => $objMdCorIntegRastreio->getDthDataExpiraToken(), ]; + // Verifica a data que expira o token para usar nas API + // se retornar um array, teve falha + $ret = $objMdCorAdmIntegracaoRN->verificaTokenExpirado($arrParametro, $objMdCorIntegRastreio); + if ( is_array( $ret ) && isset( $ret['suc'] ) && $ret['suc'] === false ) { + $arrFalha[] = ['erro' => $ret['msg'] , 'numero' => '000000']; + return $arrFalha; + } + $objMdCorExpedicaoSolicitadaRN = new MdCorExpedicaoSolicitadaRN(); - $objMdCorWsRastreio = new MdCorWsRastreioRN($arrParametro); + $objMdCorWsRastreio = new MdCorApiRestRN($arrParametro); - if ($_GET['acao'] == 'md_cor_expedicao_unidade_listar') { + if ( $_GET['acao'] == 'md_cor_expedicao_unidade_listar' ) { $objMdCorExpedicaoSolicitadaRN->setIsConsultarExpedicaoAndamento(true); } $arrObjMdCorExpedicaoSolicitadaDTO = $objMdCorExpedicaoSolicitadaRN->listarExpedicaoSolicitadaExpedida($idProcedimento); - $arrFalha = array(); if (!is_null($arrObjMdCorExpedicaoSolicitadaDTO)) { $mdCorListaStatusRN = new MdCorListaStatusRN(); foreach ($arrObjMdCorExpedicaoSolicitadaDTO as $objMdCorExpedicaoSolicitadaDTO) { $idMdCorExpedicaoSolicitada = $objMdCorExpedicaoSolicitadaDTO->getNumIdMdCorExpedicaoSolicitada(); - $codigoRastreamento = trim($objMdCorExpedicaoSolicitadaDTO->getStrCodigoRastreamento()); + $codigoRastreamento = trim($objMdCorExpedicaoSolicitadaDTO->getStrCodigoRastreamento()); $objMdCorExpedicaoAndamentoDTO = $this->buscarUltimoAndamento($idMdCorExpedicaoSolicitada); @@ -433,21 +437,20 @@ protected function salvarAndamentoConectado($idProcedimento = null) $dadosRastreio = $objMdCorWsRastreio->rastrearObjeto($codigoRastreamento); //Se não deu erro no rastreio - if (!isset($dadosRastreio['objeto']['erro'])) { + if ( !isset( $dadosRastreio['erro'] ) ) { $this->_criarObjetoAndamento($idMdCorExpedicaoSolicitada, $dadosRastreio); } else { - $arrFalha[] = $dadosRastreio['objeto']; + $arrFalha[] = ['erro' => $dadosRastreio['msg'] , 'numero' => $codigoRastreamento ]; } } else { - $staRastreioModulo = $mdCorListaStatusRN->getStaRastreioModuloAndamento($objMdCorExpedicaoAndamentoDTO); - if ($staRastreioModulo == 'P' || $staRastreioModulo == 'T') { + if ( $staRastreioModulo == 'P' || $staRastreioModulo == 'T' ) { $dadosRastreio = $objMdCorWsRastreio->rastrearObjeto($codigoRastreamento); //Se não deu erro no rastreio - if (!isset($dadosRastreio['objeto']['erro'])) { - $arrEvento = $dadosRastreio['objeto']['evento']; + if ( !isset( $dadosRastreio['erro'] ) ) { + $arrEvento = $dadosRastreio['objetos'][0]['eventos']; $objMdCorListaStatusRN = new MdCorListaStatusRN(); $objMdCorListaStatusRN->_retornaTipoStatusNaoSalvos($arrEvento); @@ -458,13 +461,14 @@ protected function salvarAndamentoConectado($idProcedimento = null) //Salva todos os andamentos que ainda não estão no banco if (!empty($arrEventoNaoSalvo)) { - $dadosRastreio['objeto']['evento'] = $arrEventoNaoSalvo; + $arrEventoNaoSalvo = array_reverse($arrEventoNaoSalvo); + $dadosRastreio['objetos'][0]['eventos'] = $arrEventoNaoSalvo; $this->_criarObjetoAndamento($idMdCorExpedicaoSolicitada, $dadosRastreio); } } } else { - $arrFalha[] = $dadosRastreio['objeto']; + $arrFalha[] = ['erro' => $dadosRastreio['msg'] , 'numero' => $codigoRastreamento]; } } } @@ -472,100 +476,110 @@ protected function salvarAndamentoConectado($idProcedimento = null) } return $arrFalha; - } private function _retornaEventoNaoSalvo($arrEvento, $dtUltimoAndamento) { - $arrEventoNaoSalvo = array(); - $arrData = explode(' ', $dtUltimoAndamento); - $data = implode('-', array_reverse(explode('/', $arrData[0])));; - $hora = $arrData[1]; + $arrData = explode(' ', $dtUltimoAndamento); + $data = implode('-', array_reverse(explode('/', $arrData[0]))); + $hora = $arrData[1]; $dataHoraAndamento = strtotime($data . ' ' . $hora); - if (isset($arrEvento['data'])) { - $dataHoraWs = $this->_converterDataHoraWs($arrEvento); - if ($dataHoraAndamento < $dataHoraWs) { - $arrEventoNaoSalvo[] = $arrEvento; - } - - } else { - foreach ($arrEvento as $evento) { - $dataHoraWs = $this->_converterDataHoraWs($evento); - if ($dataHoraAndamento < $dataHoraWs) { - $arrEventoNaoSalvo[] = $evento; - } - - } - } + if( !empty($arrEvento)) { + foreach ($arrEvento as $evento) { + $dataHoraWs = $this->_converterDataHoraWs($evento); + if ($dataHoraAndamento < $dataHoraWs) { + $arrEventoNaoSalvo[] = $evento; + } + } + } return $arrEventoNaoSalvo; - } private function _converterDataHoraWs($evento) { - $data = implode('-', array_reverse(explode('/', $evento['data']))); - $hora = $evento['hora'] . ':00'; - return strtotime($data . ' ' . $hora); + $arrDtHr = explode('T', $evento['dtHrCriado']); + $hrs = MdCorObjetoINT::trataHoraAndamento($arrDtHr[1]); + return strtotime($arrDtHr[0] .' '. $hrs); } private function _criarObjetoAndamento($idMdCorExpedicaoSolicitada, $dadosRastreio) { + if ( isset( $dadosRastreio['objetos'][0]['mensagem'] ) ) { + $this->trataRegistrosNaoEncontrados( $idMdCorExpedicaoSolicitada , $dadosRastreio ); + } else { + $siglaObjeto = $dadosRastreio['objetos'][0]['tipoPostal']['sigla']; + $nomeObjeto = MdCorObjetoINT::UTF8_Decode( $dadosRastreio['objetos'][0]['tipoPostal']['descricao'] ); + $categoriaObjeto = MdCorObjetoINT::UTF8_Decode( $dadosRastreio['objetos'][0]['tipoPostal']['categoria'] ); + $versao = trim($dadosRastreio['versao']); + $dtUltimaAtualizacao = date('d/m/Y H:i:s'); + + if ( !empty($dadosRastreio['objetos'][0]['eventos']) ){ + foreach ( $dadosRastreio['objetos'][0]['eventos'] as $evento ) { + $arrDtHr = explode('T', $evento['dtHrCriado']); + $tipo = $evento['codigo']; + $data = implode('/' , array_reverse( explode('-' , $arrDtHr[0]) ) ); + $hora = MdCorObjetoINT::trataHoraAndamento($arrDtHr[1]); + $dataHora = $data . ' ' . $hora; + + $descricao = MdCorObjetoINT::UTF8_Decode( trim(@$evento['descricao']) ); + $detalhe = MdCorObjetoINT::UTF8_Decode( trim(@$evento['detalhe']) ); + $status = trim(@$evento['tipo']); + $local = MdCorObjetoINT::UTF8_Decode(trim(@$evento['unidade']['tipo'])); + $codigoCep = trim(@$evento['unidade']['endereco']['cep'] ?? '00000000'); + $cidade = MdCorObjetoINT::UTF8_Decode( trim(@$evento['unidade']['endereco']['cidade']) ); + $uf = trim(@$evento['unidade']['endereco']['uf']); + + $objMdCorExpedicaoAndamentoDTO = new MdCorExpedicaoAndamentoDTO(); + $objMdCorExpedicaoAndamentoDTO->setNumIdMdCorExpedicaoSolicitada($idMdCorExpedicaoSolicitada); + $objMdCorExpedicaoAndamentoDTO->setDthDataHora($dataHora); + $objMdCorExpedicaoAndamentoDTO->setDthDataUltimaAtualizacao($dtUltimaAtualizacao); + $objMdCorExpedicaoAndamentoDTO->setStrDescricao($descricao); + $objMdCorExpedicaoAndamentoDTO->setStrDetalhe($detalhe); + $objMdCorExpedicaoAndamentoDTO->setNumStatus($status); + $objMdCorExpedicaoAndamentoDTO->setStrLocal($local); + $objMdCorExpedicaoAndamentoDTO->setStrCodigoCep($codigoCep); + $objMdCorExpedicaoAndamentoDTO->setStrCidade($cidade); + $objMdCorExpedicaoAndamentoDTO->setStrUf($uf); + $objMdCorExpedicaoAndamentoDTO->setStrVersaoSroXml($versao); + $objMdCorExpedicaoAndamentoDTO->setStrSiglaObjeto($siglaObjeto); + $objMdCorExpedicaoAndamentoDTO->setStrNomeObjeto($nomeObjeto); + $objMdCorExpedicaoAndamentoDTO->setStrCategoriaObjeto($categoriaObjeto); + $objMdCorExpedicaoAndamentoDTO->setStrTipo($tipo); + $this->cadastrar($objMdCorExpedicaoAndamentoDTO); + } + } + } + } - $siglaObjeto = trim($dadosRastreio['objeto']['sigla']); - $nomeObjeto = trim($dadosRastreio['objeto']['nome']); - $categoriaObjeto = trim($dadosRastreio['objeto']['categoria']); - $versao = trim($dadosRastreio['versao']); - + private function trataRegistrosNaoEncontrados($idMdCorExpedicaoSolicitada,$dadosRastreio){ + $siglaObjeto = 'NE'; // Nao Encontrado + $nomeObjeto = $categoriaObjeto = 'Não Encontrado'; + $versao = trim($dadosRastreio['versao']); + $dtUltimaAtualizacao = $dataHora = date('d/m/Y H:i:s'); + $descricao = $detalhe = MdCorObjetoINT::UTF8_Decode( $dadosRastreio['objetos'][0]['mensagem'] ); + $status = 29; - //Ajuste para quando vir somente um evento - if (isset($dadosRastreio['objeto']['evento']['tipo'])) { - $arrEventos = $dadosRastreio['objeto']['evento']; - unset($dadosRastreio['objeto']['evento']); - $dadosRastreio['objeto']['evento'][] = $arrEventos; - } + $objMdCorExpedicaoAndamentoDTO = new MdCorExpedicaoAndamentoDTO(); - $dtUltimaAtualizacao = date('d/m/Y H:i:s'); - if (!empty($dadosRastreio['objeto']['evento']) && is_array($dadosRastreio['objeto']['evento'])){ - foreach ($dadosRastreio['objeto']['evento'] as $evento) { - - $tipo = $evento['tipo']; - $data = $evento['data']; - $hora = $evento['hora'] . ':00'; - $dataHora = $data . ' ' . $hora; - - $descricao = trim(@$evento['descricao']); - $detalhe = trim(@$evento['detalhe']); - $status = trim(@$evento['status']); - $local = trim(@$evento['local']); - $codigoCep = trim(@$evento['codigo']); - $cidade = trim(@$evento['cidade']); - $uf = trim(@$evento['uf']); - - - $objMdCorExpedicaoAndamentoDTO = new MdCorExpedicaoAndamentoDTO(); - $objMdCorExpedicaoAndamentoDTO->setNumIdMdCorExpedicaoSolicitada($idMdCorExpedicaoSolicitada); - $objMdCorExpedicaoAndamentoDTO->setDthDataHora($dataHora); - - $objMdCorExpedicaoAndamentoDTO->setDthDataUltimaAtualizacao($dtUltimaAtualizacao); - - $objMdCorExpedicaoAndamentoDTO->setStrDescricao($descricao); - $objMdCorExpedicaoAndamentoDTO->setStrDetalhe($detalhe); - $objMdCorExpedicaoAndamentoDTO->setNumStatus($status); - $objMdCorExpedicaoAndamentoDTO->setStrLocal($local); - $objMdCorExpedicaoAndamentoDTO->setStrCodigoCep($codigoCep); - $objMdCorExpedicaoAndamentoDTO->setStrCidade($cidade); - $objMdCorExpedicaoAndamentoDTO->setStrUf($uf); - $objMdCorExpedicaoAndamentoDTO->setStrVersaoSroXml($versao); - $objMdCorExpedicaoAndamentoDTO->setStrSiglaObjeto($siglaObjeto); - $objMdCorExpedicaoAndamentoDTO->setStrNomeObjeto($nomeObjeto); - $objMdCorExpedicaoAndamentoDTO->setStrCategoriaObjeto($categoriaObjeto); - $objMdCorExpedicaoAndamentoDTO->setStrTipo($tipo); - $this->cadastrar($objMdCorExpedicaoAndamentoDTO); - } - } + $objMdCorExpedicaoAndamentoDTO->setNumIdMdCorExpedicaoSolicitada($idMdCorExpedicaoSolicitada); + $objMdCorExpedicaoAndamentoDTO->setDthDataHora($dataHora); + $objMdCorExpedicaoAndamentoDTO->setDthDataUltimaAtualizacao($dtUltimaAtualizacao); + $objMdCorExpedicaoAndamentoDTO->setStrDescricao($descricao); + $objMdCorExpedicaoAndamentoDTO->setStrDetalhe($detalhe); + $objMdCorExpedicaoAndamentoDTO->setNumStatus($status); + $objMdCorExpedicaoAndamentoDTO->setStrLocal('Anatel-Correios'); + $objMdCorExpedicaoAndamentoDTO->setStrCodigoCep(00000000); + $objMdCorExpedicaoAndamentoDTO->setStrCidade('Brasília'); + $objMdCorExpedicaoAndamentoDTO->setStrUf('DF'); + $objMdCorExpedicaoAndamentoDTO->setStrVersaoSroXml($versao); + $objMdCorExpedicaoAndamentoDTO->setStrSiglaObjeto($siglaObjeto); + $objMdCorExpedicaoAndamentoDTO->setStrNomeObjeto($nomeObjeto); + $objMdCorExpedicaoAndamentoDTO->setStrCategoriaObjeto($categoriaObjeto); + $objMdCorExpedicaoAndamentoDTO->setStrTipo('BDE'); + $this->cadastrar($objMdCorExpedicaoAndamentoDTO); } private function _getAndamentosSolicitacao($idSol) diff --git a/sei/web/modulos/correios/rn/MdCorExpedicaoSolicitadaRN.php b/sei/web/modulos/correios/rn/MdCorExpedicaoSolicitadaRN.php index 4dae614..3cf623f 100644 --- a/sei/web/modulos/correios/rn/MdCorExpedicaoSolicitadaRN.php +++ b/sei/web/modulos/correios/rn/MdCorExpedicaoSolicitadaRN.php @@ -679,6 +679,8 @@ private function _addSelectsListarAndamento(&$objDTO) $objDTO->retDthDataExpedicao(); $objDTO->retStrCodigoRastreamento(); $objDTO->retStrDescricaoServicoPostal(); + + $objDTO->setOrd('IdMdCorExpedicaoSolicitada',InfraDTO::$TIPO_ORDENACAO_DESC); } private function _formatarArrListaAtributos(&$arrObjDTO, $arrStatus, $arrAnexo) @@ -770,6 +772,7 @@ public function listarExpedicaoSolicitadaExpedidaConectado($idProcedimento = nul { //Busca todas as expedições solicitadas que ja foram expedidas $objMdCorExpedicaoSolicitadaDTO = new MdCorExpedicaoSolicitadaDTO(); + $objMdCorExpedicaoSolicitadaDTO->retNumIdMdCorExpedicaoSolicitada(); $objMdCorExpedicaoSolicitadaDTO->retStrCodigoRastreamento(); $objMdCorExpedicaoSolicitadaDTO->retDthDataExpedicao(); diff --git a/sei/web/modulos/correios/rn/MdCorListaStatusRN.php b/sei/web/modulos/correios/rn/MdCorListaStatusRN.php index 29b4e19..cf60374 100644 --- a/sei/web/modulos/correios/rn/MdCorListaStatusRN.php +++ b/sei/web/modulos/correios/rn/MdCorListaStatusRN.php @@ -882,26 +882,35 @@ public function _retornaTipoStatusNaoSalvos($arrTipoStatus) if ($arrTipoStatus) { foreach ($arrTipoStatus as $tipoStatus) { + /* if (empty($arrTipoStatus[0])) { $tipoStatus = $arrTipoStatus; } + */ - $status = (int)$tipoStatus['status']; + /* + $status = (int) $tipoStatus['status']; $tipo = $tipoStatus['tipo']; + */ + + $status = (int) $tipoStatus['tipo']; + $tipo = $tipoStatus['codigo']; $objMdCorListaStatusDTOAux->setNumStatus($status, InfraDTO::$OPER_IGUAL); - $objMdCorListaStatusDTOAux->setStrTipo('' . $tipo . '', InfraDTO::$OPER_IGUAL); + $objMdCorListaStatusDTOAux->setStrTipo($tipo, InfraDTO::$OPER_IGUAL); $arrObjMdCorListaStatusDTOll = $objMdCorListaStatusRNAux->listar($objMdCorListaStatusDTOAux); if (count($arrObjMdCorListaStatusDTOll) == 0) { + $desc = utf8_decode( $tipoStatus['descricao'] ); + $desc .= array_key_exists('detalhe',$tipoStatus) ? ' - '. utf8_decode( $tipoStatus['detalhe'] ) : ''; + $objMdCorListaStatusDTOAuxll->setNumStatus($status); - $objMdCorListaStatusDTOAuxll->setStrTipo('' . $tipoStatus['tipo'] . ''); - $objMdCorListaStatusDTOAuxll->setStrDescricao('' . $tipo . ''); - $objMdCorListaStatusDTOAuxll->setStrStaRastreioModulo(''); - $objMdCorListaStatusDTOAuxll->setStrSinAtivo('N'); + $objMdCorListaStatusDTOAuxll->setStrTipo($tipo); + $objMdCorListaStatusDTOAuxll->setStrDescricao($desc); + $objMdCorListaStatusDTOAuxll->setStrStaRastreioModulo('W'); + $objMdCorListaStatusDTOAuxll->setStrSinAtivo('S'); $this->cadastrarControlado($objMdCorListaStatusDTOAuxll); } - } } } diff --git a/sei/web/modulos/correios/rn/MdCorParametroRastreioRN.php b/sei/web/modulos/correios/rn/MdCorParametroRastreioRN.php deleted file mode 100644 index 2e48394..0000000 --- a/sei/web/modulos/correios/rn/MdCorParametroRastreioRN.php +++ /dev/null @@ -1,284 +0,0 @@ -getNumIdMdCorParametroRastreio())){ - $objMdCorParametroRastreioDTO->setNumIdMdCorParametroRastreio(null); - } - } - - private function validarStrUsuario(MdCorParametroRastreioDTO $objMdCorParametroRastreioDTO, InfraException $objInfraException){ - if (InfraString::isBolVazia($objMdCorParametroRastreioDTO->getStrUsuario())){ - $objMdCorParametroRastreioDTO->setStrUsuario(null); - }else{ - $objMdCorParametroRastreioDTO->setStrUsuario(trim($objMdCorParametroRastreioDTO->getStrUsuario())); - - if (strlen($objMdCorParametroRastreioDTO->getStrUsuario())>100){ - $objInfraException->adicionarValidacao(' possui tamanho superior a 100 caracteres.'); - } - } - } - - private function validarStrSenha(MdCorParametroRastreioDTO $objMdCorParametroRastreioDTO, InfraException $objInfraException){ - if (InfraString::isBolVazia($objMdCorParametroRastreioDTO->getStrSenha())){ - $objMdCorParametroRastreioDTO->setStrSenha(null); - }else{ - $objMdCorParametroRastreioDTO->setStrSenha(trim($objMdCorParametroRastreioDTO->getStrSenha())); - - if (strlen($objMdCorParametroRastreioDTO->getStrSenha())>100){ - $objInfraException->adicionarValidacao(' possui tamanho superior a 100 caracteres.'); - } - } - } - - private function validarStrEnderecoWsdl(MdCorParametroRastreioDTO $objMdCorParametroRastreioDTO, InfraException $objInfraException){ - if (InfraString::isBolVazia($objMdCorParametroRastreioDTO->getStrEnderecoWsdl())){ - $objMdCorParametroRastreioDTO->setStrEnderecoWsdl(null); - }else{ - $objMdCorParametroRastreioDTO->setStrEnderecoWsdl(trim($objMdCorParametroRastreioDTO->getStrEnderecoWsdl())); - - if (strlen($objMdCorParametroRastreioDTO->getStrEnderecoWsdl())>500){ - $objInfraException->adicionarValidacao(' possui tamanho superior a 500 caracteres.'); - } - } - } - - protected function cadastrarControlado(MdCorParametroRastreioDTO $objMdCorParametroRastreioDTO) { - try{ - - //Valida Permissao - SessaoSEI::getInstance()->validarPermissao('md_cor_parametro_rastreio_cadastrar'); - - //Regras de Negocio - $objInfraException = new InfraException(); - - $this->validarStrUsuario($objMdCorParametroRastreioDTO, $objInfraException); - $this->validarStrSenha($objMdCorParametroRastreioDTO, $objInfraException); - $this->validarStrEnderecoWsdl($objMdCorParametroRastreioDTO, $objInfraException); - - $objInfraException->lancarValidacoes(); - - $objMdCorParametroRastreioBD = new MdCorParametroRastreioBD($this->getObjInfraIBanco()); - $ret = $objMdCorParametroRastreioBD->cadastrar($objMdCorParametroRastreioDTO); - - //Auditoria - - return $ret; - - }catch(Exception $e){ - throw new InfraException('Erro cadastrando .',$e); - } - } - - protected function alterarControlado(MdCorParametroRastreioDTO $objMdCorParametroRastreioDTO){ - try { - - //Valida Permissao - SessaoSEI::getInstance()->validarPermissao('md_cor_parametro_rastreio_alterar'); - - //Regras de Negocio - $objInfraException = new InfraException(); - - if ($objMdCorParametroRastreioDTO->isSetNumIdMdCorParametroRastreio()){ - $this->validarNumIdMdCorParametroRastreio($objMdCorParametroRastreioDTO, $objInfraException); - } - if ($objMdCorParametroRastreioDTO->isSetStrUsuario()){ - $this->validarStrUsuario($objMdCorParametroRastreioDTO, $objInfraException); - } - if ($objMdCorParametroRastreioDTO->isSetStrSenha()){ - $this->validarStrSenha($objMdCorParametroRastreioDTO, $objInfraException); - } - if ($objMdCorParametroRastreioDTO->isSetStrEnderecoWsdl()){ - $this->validarStrEnderecoWsdl($objMdCorParametroRastreioDTO, $objInfraException); - } - - $objInfraException->lancarValidacoes(); - - $objMdCorParametroRastreioBD = new MdCorParametroRastreioBD($this->getObjInfraIBanco()); - $objMdCorParametroRastreioBD->alterar($objMdCorParametroRastreioDTO); - - //Auditoria - - }catch(Exception $e){ - throw new InfraException('Erro alterando .',$e); - } - } - - protected function excluirControlado($arrObjMdCorParametroRastreioDTO){ - try { - - //Valida Permissao - SessaoSEI::getInstance()->validarPermissao('md_cor_parametro_rastreio_excluir'); - - //Regras de Negocio - //$objInfraException = new InfraException(); - - //$objInfraException->lancarValidacoes(); - - $objMdCorParametroRastreioBD = new MdCorParametroRastreioBD($this->getObjInfraIBanco()); - for($i=0;$iexcluir($arrObjMdCorParametroRastreioDTO[$i]); - } - - //Auditoria - - }catch(Exception $e){ - throw new InfraException('Erro excluindo .',$e); - } - } - - protected function consultarConectado(MdCorParametroRastreioDTO $objMdCorParametroRastreioDTO){ - try { - - //Valida Permissao - SessaoSEI::getInstance()->validarPermissao('md_cor_parametro_rastreio_consultar'); - - //Regras de Negocio - //$objInfraException = new InfraException(); - - //$objInfraException->lancarValidacoes(); - - $objMdCorParametroRastreioBD = new MdCorParametroRastreioBD($this->getObjInfraIBanco()); - $ret = $objMdCorParametroRastreioBD->consultar($objMdCorParametroRastreioDTO); - - //Auditoria - - return $ret; - }catch(Exception $e){ - throw new InfraException('Erro consultando .',$e); - } - } - - protected function listarConectado(MdCorParametroRastreioDTO $objMdCorParametroRastreioDTO) { - try { - - //Valida Permissao - SessaoSEI::getInstance()->validarPermissao('md_cor_parametro_rastreio_listar'); - - //Regras de Negocio - //$objInfraException = new InfraException(); - - //$objInfraException->lancarValidacoes(); - - $objMdCorParametroRastreioBD = new MdCorParametroRastreioBD($this->getObjInfraIBanco()); - $ret = $objMdCorParametroRastreioBD->listar($objMdCorParametroRastreioDTO); - - //Auditoria - - return $ret; - - }catch(Exception $e){ - throw new InfraException('Erro listando .',$e); - } - } - - protected function contarConectado(MdCorParametroRastreioDTO $objMdCorParametroRastreioDTO){ - try { - - //Valida Permissao - SessaoSEI::getInstance()->validarPermissao('md_cor_parametro_rastreio_listar'); - - //Regras de Negocio - //$objInfraException = new InfraException(); - - //$objInfraException->lancarValidacoes(); - - $objMdCorParametroRastreioBD = new MdCorParametroRastreioBD($this->getObjInfraIBanco()); - $ret = $objMdCorParametroRastreioBD->contar($objMdCorParametroRastreioDTO); - - //Auditoria - - return $ret; - }catch(Exception $e){ - throw new InfraException('Erro contando .',$e); - } - } -/* - protected function desativarControlado($arrObjMdCorParametroRastreioDTO){ - try { - - //Valida Permissao - SessaoSEI::getInstance()->validarPermissao('md_cor_parametro_rastreio_desativar'); - - //Regras de Negocio - //$objInfraException = new InfraException(); - - //$objInfraException->lancarValidacoes(); - - $objMdCorParametroRastreioBD = new MdCorParametroRastreioBD($this->getObjInfraIBanco()); - for($i=0;$idesativar($arrObjMdCorParametroRastreioDTO[$i]); - } - - //Auditoria - - }catch(Exception $e){ - throw new InfraException('Erro desativando .',$e); - } - } - - protected function reativarControlado($arrObjMdCorParametroRastreioDTO){ - try { - - //Valida Permissao - SessaoSEI::getInstance()->validarPermissao('md_cor_parametro_rastreio_reativar'); - - //Regras de Negocio - //$objInfraException = new InfraException(); - - //$objInfraException->lancarValidacoes(); - - $objMdCorParametroRastreioBD = new MdCorParametroRastreioBD($this->getObjInfraIBanco()); - for($i=0;$ireativar($arrObjMdCorParametroRastreioDTO[$i]); - } - - //Auditoria - - }catch(Exception $e){ - throw new InfraException('Erro reativando .',$e); - } - } - - protected function bloquearControlado(MdCorParametroRastreioDTO $objMdCorParametroRastreioDTO){ - try { - - //Valida Permissao - SessaoSEI::getInstance()->validarPermissao('md_cor_parametro_rastreio_consultar'); - - //Regras de Negocio - //$objInfraException = new InfraException(); - - //$objInfraException->lancarValidacoes(); - - $objMdCorParametroRastreioBD = new MdCorParametroRastreioBD($this->getObjInfraIBanco()); - $ret = $objMdCorParametroRastreioBD->bloquear($objMdCorParametroRastreioDTO); - - //Auditoria - - return $ret; - }catch(Exception $e){ - throw new InfraException('Erro bloqueando .',$e); - } - } - - */ -} diff --git a/sei/web/modulos/correios/rn/MdCorPlpRN.php b/sei/web/modulos/correios/rn/MdCorPlpRN.php index 1d44cb4..dc10170 100644 --- a/sei/web/modulos/correios/rn/MdCorPlpRN.php +++ b/sei/web/modulos/correios/rn/MdCorPlpRN.php @@ -18,9 +18,14 @@ class MdCorPlpRN extends InfraRN { public static $STA_GERADA = 'G'; public static $STA_PENDENTE = 'P'; public static $STA_ENTREGUES = 'E'; + public static $STA_CANCELADA = 'C'; + public static $STA_RETORNO_AR_PENDENTE = 'R'; public static $STA_FINALIZADA = 'F'; + public static $STR_SING_PRE_POSTAGEM = 'Pré-Postagem'; + public static $STR_PLURAL_PRE_POSTAGEM = 'Pré-Postagens'; + public function __construct() { parent::__construct(); } @@ -238,6 +243,7 @@ protected function listarComExpedicaoSolicitadaConectado(MdCorPlpDTO $objMdCorPl $objMdCorExpedicaoSolicitadaDTO->retStrNomeServicoPostal(); $objMdCorExpedicaoSolicitadaDTO->retStrDescricaoServicoPostal(); $objMdCorExpedicaoSolicitadaDTO->retStrFormaExpedicao(); + $objMdCorExpedicaoSolicitadaDTO->retStrCodigoRastreamento(); $objMdCorExpedicaoSolicitadaDTO->setDblIdUnidadeExpedidora($idUnidadeAtual); $objMdCorExpedicaoSolicitadaDTO->setNumIdMdCorPlp($item->getNumIdMdPlp()); @@ -401,22 +407,19 @@ protected function bloquearControlado(MdCorPlpDTO $objMdCorPlpDTO){ */ protected function gerarPlpWebServiceControlado($arrIdMdCorExpedicaoSolicitada) { try { + //Valida Permissao SessaoSEI::getInstance()->validarPermissao('md_cor_plp_webservice_acessar'); + $strUrlAPIUsada = ''; $objMdCorExpedicaoSolicitadaRN = new MdCorExpedicaoSolicitadaRN(); $objMdCorExpedicaoSolicitadaDTO = new MdCorExpedicaoSolicitadaDTO(); $objMdCorExpedicaoSolicitadaDTO->retNumIdMdCorServicoPostal(); $objMdCorExpedicaoSolicitadaDTO->retDblIdMdCorContrato(); - $objMdCorExpedicaoSolicitadaDTO->retStrUrlWebService(); - $objMdCorExpedicaoSolicitadaDTO->retStrUsuario(); $objMdCorExpedicaoSolicitadaDTO->retStrCartaoPostagem(); - $objMdCorExpedicaoSolicitadaDTO->retStrSenha(); $objMdCorExpedicaoSolicitadaDTO->retNumNumeroCnpj(); $objMdCorExpedicaoSolicitadaDTO->retStrNumeroContratoCorreio(); - $objMdCorExpedicaoSolicitadaDTO->retStrNumeroCodigoAdministrativo(); - $objMdCorExpedicaoSolicitadaDTO->retNumIdWsCorreios(); $objMdCorExpedicaoSolicitadaDTO->retNumIdMdCorContato(); $objMdCorExpedicaoSolicitadaDTO->retDblIdUnidadeExpedidora(); $objMdCorExpedicaoSolicitadaDTO->retDblIdContatoOrgao(); @@ -424,8 +427,11 @@ protected function gerarPlpWebServiceControlado($arrIdMdCorExpedicaoSolicitada) $objMdCorExpedicaoSolicitadaDTO->retStrExpedicaoAvisoRecebimentoServico(); $objMdCorExpedicaoSolicitadaDTO->retNumIdMdCorExpedicaoSolicitada(); $objMdCorExpedicaoSolicitadaDTO->retStrBairroContratoOrgao(); - $objMdCorExpedicaoSolicitadaDTO->retStrCodigoDiretoria(); - $objMdCorExpedicaoSolicitadaDTO->setDistinct(true); + + $objMdCorExpedicaoSolicitadaDTO->retStrNomeSerie(); + $objMdCorExpedicaoSolicitadaDTO->retStrNumeroDocumento(); + $objMdCorExpedicaoSolicitadaDTO->retStrProtocoloFormatado(); + $objMdCorExpedicaoSolicitadaDTO->retStrProtocoloFormatadoDocumento(); //Dados Destinatario $objMdCorExpedicaoSolicitadaDTO->retStrNomeDestinatario(); @@ -437,166 +443,158 @@ protected function gerarPlpWebServiceControlado($arrIdMdCorExpedicaoSolicitada) $objMdCorExpedicaoSolicitadaDTO->retStrSiglaUfDestinatario(); $objMdCorExpedicaoSolicitadaDTO->setNumIdMdCorExpedicaoSolicitada($arrIdMdCorExpedicaoSolicitada, InfraDTO::$OPER_IN); + $objMdCorExpedicaoSolicitadaDTO->setDistinct(true); $arrObjDTO = $objMdCorExpedicaoSolicitadaRN->listar($objMdCorExpedicaoSolicitadaDTO); - - $arrQtdEtiquetas = []; - $arrServico = []; $arrIdUnidade = []; - foreach ($arrObjDTO as $objDto) { - $arrQtdEtiquetas[$objDto->getNumIdWsCorreios()] += 1; - $arrServico[$objDto->getNumIdWsCorreios()][] = $objDto->getNumIdMdCorExpedicaoSolicitada(); - $wsdl = $objDto->getStrUrlWebService(); - $cnpj = str_pad($objDto->getNumNumeroCnpj(), 14, '0',STR_PAD_LEFT); - $usuario = $objDto->getStrUsuario(); - $senha = $objDto->getStrSenha(); - $cartaoPostagem = $objDto->getStrCartaoPostagem(); - $nuContratoCorreio = $objDto->getStrNumeroContratoCorreio(); - $nuCodigoAdministrativo = $objDto->getStrNumeroCodigoAdministrativo(); - $nuNumeroDiretoria = $objDto->getStrCodigoDiretoria(); - $idContatoOrgao = $objDto->getDblIdContatoOrgao(); - - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['coServicoPostagem'] = $objDto->getStrCodigoWsCorreioServico(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['stExpedicaoAvisoRecebimentoServico'] = $objDto->getStrExpedicaoAvisoRecebimentoServico(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['noDestinatario'] = $objDto->getStrNomeDestinatario(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['dsEnderecoDestinatario'] = $objDto->getStrEnderecoDestinatario(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['dsBairroDestinatario'] = $objDto->getStrBairroDestinatario(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['nuCepDestinatario'] = $objDto->getStrCepDestinatario(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['dsComplementoDestinatario'] = $objDto->getStrComplementoDestinatario(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['noCidadeDestinatario'] = $objDto->getStrNomeCidadeDestinatario(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['sgUfDestinatario'] = $objDto->getStrSiglaUfDestinatario(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['idMdCorExpedicaoSolicitada'] = $objDto->getNumIdMdCorExpedicaoSolicitada(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['idMdCorContato'] = $objDto->getNumIdMdCorContato(); - $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['idUnidadeExpedidora'] = $arrIdUnidade[] = $objDto->getDblIdUnidadeExpedidora(); + foreach ( $arrObjDTO as $objDto ) { - } + $objContDTO = new MdCorContatoDTO(); + $objContDTO->retStrCep(); + $objContDTO->setNumIdMdCorContato( $objDto->getNumIdMdCorContato() ); - $objMDCorUnidadeExpRN = new MdCorUnidadeExpRN(); - $objMDCorUnidadeExpRN->validaCamposEnderecoUnidade($arrIdUnidade); + $objContatoRN = new MdCorContatoRN(); + $objContDTO = $objContatoRN->consultar( $objContDTO ); - $cliente = MdCorClientWsRN::gerarCliente($wsdl); - $arrCodigoRastreio = []; - $arrCodigoRastreioTratado = []; - - - foreach ($arrQtdEtiquetas as $idServico => $qtdEtiqueta) { - - $codigoRastreio = $cliente->solicitaEtiquetas( - ['tipoDestinatario' => 'C' - , 'identificador' => $cnpj - , 'idServico' => $idServico - , 'qtdEtiquetas' => $qtdEtiqueta - , 'usuario' => $usuario - , 'senha' => $senha - ] - )->return; - - $arrDadosRastreioWebService = explode(',', $codigoRastreio); - - $codRangeInicial = substr(current($arrDadosRastreioWebService), 2, 8); - $codRangeFinal = substr(end($arrDadosRastreioWebService), 2, 8); - $sgCodigoRastreio = substr(current($arrDadosRastreioWebService), 0, 2); - $sgPais = substr(current($arrDadosRastreioWebService), 10); - - for ($inicio = $codRangeInicial; $inicio <= $codRangeFinal; $inicio++) { - $arrCodigoRastreio[$idServico][] = $sgCodigoRastreio . str_pad($inicio, 8, '0', STR_PAD_LEFT) . $sgPais; - } - - $arrDv[$idServico] = $cliente->geraDigitoVerificadorEtiquetas( - ['etiquetas' => $arrCodigoRastreio[$idServico] - , 'usuario' => $usuario - , 'senha' => $senha - ] - )->return; - - - $contador = 0; - $cCodigoRastreiamento = 0; - foreach ($arrDv as $idServico => $dadosDv) { - $dadosDv = is_array($dadosDv) ? $dadosDv : [$dadosDv]; - foreach ($dadosDv as $chave => $dv) { - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['codigoRastreio'] = substr($arrCodigoRastreio[$idServico][$chave], 0, 10) - . $dv - . substr($arrCodigoRastreio[$idServico][$chave], 11); - - $arrCodigoRastreioFinal[$arrServico[$idServico][$chave]] = $arrCodigoRastreioTratado[$cCodigoRastreiamento]['codigoRastreio']; - - $arrEtiquetaSemDigito[] = substr($arrCodigoRastreio[$idServico][$chave], 0, 10) - . substr($arrCodigoRastreio[$idServico][$chave], 11); - $IdMdCorExpedicaoSolicitada = $arrIdMdCorExpedicaoSolicitada[$contador]; - - $objContDTO = new MdCorContatoDTO(); - $objContDTO->retStrCep(); - $objContDTO->setNumIdMdCorContato($arrDados[$IdMdCorExpedicaoSolicitada]['idMdCorContato']); - - $objContatoRN = new MdCorContatoRN(); - $objContDTO = $objContatoRN->consultar($objContDTO); - - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['IdMdCorExpedicaoSolicitada'] = $IdMdCorExpedicaoSolicitada; - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['coServicoPostagem'] = trim($arrDados[$IdMdCorExpedicaoSolicitada]['coServicoPostagem']); - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['stExpedicaoAvisoRecebimentoServico'] = trim($arrDados[$IdMdCorExpedicaoSolicitada]['stExpedicaoAvisoRecebimentoServico']); - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['noDestinatario'] = $arrDados[$IdMdCorExpedicaoSolicitada]['noDestinatario']; - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['dsEnderecoDestinatario'] = $arrDados[$IdMdCorExpedicaoSolicitada]['dsEnderecoDestinatario']; - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['dsBairroDestinatario'] = $arrDados[$IdMdCorExpedicaoSolicitada]['dsBairroDestinatario']; - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['nuCepDestinatario'] = $arrDados[$IdMdCorExpedicaoSolicitada]['nuCepDestinatario']; - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['dsComplementoDestinatario'] = $arrDados[$IdMdCorExpedicaoSolicitada]['dsComplementoDestinatario']; - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['noCidadeDestinatario'] = $arrDados[$IdMdCorExpedicaoSolicitada]['noCidadeDestinatario']; - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['sgUfDestinatario'] = $arrDados[$IdMdCorExpedicaoSolicitada]['sgUfDestinatario']; - $arrCodigoRastreioTratado[$cCodigoRastreiamento]['idUnidadeExpedidora'] = $arrDados[$IdMdCorExpedicaoSolicitada]['idUnidadeExpedidora']; - if($objContDTO->getStrCep() != $arrCodigoRastreioTratado[$cCodigoRastreiamento]['nuCepDestinatario']) { - unset($arrCodigoRastreioFinal[$arrServico[$idServico][$chave]]); - LogSEI::getInstance()->gravar("A solicitação de expedição de id ".$IdMdCorExpedicaoSolicitada." não foi inserida na PLP. O CEP enviado para a PLP está diferente do CEP cadastrado na tabela md_cor_contato. O CEP inserido na PLP é ".$arrCodigoRastreioTratado[$cCodigoRastreiamento]['nuCepDestinatario']. " o CEP correto é o ".$objContDTO->getStrCep()); + if( $objContDTO->getStrCep() != $objDto->getStrCepDestinatario() ) { + LogSEI::getInstance()->gravar("A solicitação de expedição de id ".$objDto->getNumIdMdCorExpedicaoSolicitada()." não foi inserida na PLP. O CEP enviado para a PLP está diferente do CEP cadastrado na tabela md_cor_contato. O CEP inserido na PLP é ".$objDto->getStrCepDestinatario(). " o CEP correto é o ".$objContDTO->getStrCep()); + continue; + } + $idContatoOrgao = $objDto->getDblIdContatoOrgao(); + + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['coServicoPostagem'] = trim($objDto->getStrCodigoWsCorreioServico()); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['stExpedicaoAvisoRecebimentoServico'] = $objDto->getStrExpedicaoAvisoRecebimentoServico(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['noDestinatario'] = $objDto->getStrNomeDestinatario(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['dsEnderecoDestinatario'] = $objDto->getStrEnderecoDestinatario(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['dsBairroDestinatario'] = $objDto->getStrBairroDestinatario(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['nuCepDestinatario'] = $objDto->getStrCepDestinatario(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['dsComplementoDestinatario'] = $objDto->getStrComplementoDestinatario(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['noCidadeDestinatario'] = $objDto->getStrNomeCidadeDestinatario(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['sgUfDestinatario'] = $objDto->getStrSiglaUfDestinatario(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['idMdCorExpedicaoSolicitada'] = $objDto->getNumIdMdCorExpedicaoSolicitada(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['idMdCorContato'] = $objDto->getNumIdMdCorContato(); + + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['NomeSerie'] = $objDto->getStrNomeSerie(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['NumeroDocumento'] = $objDto->getStrNumeroDocumento(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['ProtocoloFormatadoDocumento'] = $objDto->getStrProtocoloFormatadoDocumento(); + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['ProtocoloFormatado'] = $objDto->getStrProtocoloFormatado(); + + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['codigoObjeto'] = null; + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['idPrePostagem'] = null; + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['idUnidadeExpedidora'] = $arrIdUnidade[] = $objDto->getDblIdUnidadeExpedidora(); + + $objMdCorExpedicaoFormatoDTO = new MdCorExpedicaoFormatoDTO(); + $objMdCorExpedicaoFormatoDTO->retStrProtocoloFormatado(); + $objMdCorExpedicaoFormatoDTO->retStrNomeSerie(); + $objMdCorExpedicaoFormatoDTO->retStrNumeroDocumento(); + $objMdCorExpedicaoFormatoDTO->setNumIdMdCorExpedicaoSolicitada($objDto->getNumIdMdCorExpedicaoSolicitada()); + $objMdCorExpedicaoFormatoDTO->setStrProtocoloFormatado($objDto->getStrProtocoloFormatadoDocumento(), INFRADTO::$OPER_DIFERENTE); + + $arrObjMdCorExpedicaoFormatoDTO = ( new MdCorExpedicaoFormatoRN() )->listar($objMdCorExpedicaoFormatoDTO); + + if ( !empty($arrObjMdCorExpedicaoFormatoDTO) ) { + $arrAnexos = []; + $numLimiteCaracteres = 30; + foreach ( $arrObjMdCorExpedicaoFormatoDTO as $item ) { + $codNumformat = trim( $item->getStrProtocoloFormatado() ); + $numLimiteCaracteres -= ( strlen( $codNumformat ) + 1 ); + if ( $numLimiteCaracteres > 0 ) { + $arrAnexos[] = $codNumformat; + } else { + break; + } + } + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['infoAnexos'] = implode( ',' , $arrAnexos ); + } else { + $arrDados[$objDto->getNumIdMdCorExpedicaoSolicitada()]['infoAnexos'] = null; } - $cCodigoRastreiamento++; - $contador++; - } - } } + $objMDCorUnidadeExpRN = new MdCorUnidadeExpRN(); + $objMDCorUnidadeExpRN->validaCamposEnderecoUnidadePLP($arrIdUnidade); + // Array parametro criado para montar a base de informacoes a ser passado para os Correios $arrParametros = [ - 'nuCartaoPostagem' => $cartaoPostagem, - 'nuContrato' => $nuContratoCorreio, - 'nuDiretoria' => $nuNumeroDiretoria, - 'coAdministrativo' => $nuCodigoAdministrativo, - 'nuCnpjRemetente' => $cnpj, - 'idContatoOrgao' => $idContatoOrgao, - 'arrCodigoRastreioTratado' => $arrCodigoRastreioTratado, + 'idContatoOrgao' => $idContatoOrgao, + 'arrDadosSolicitacao' => $arrDados ]; - $xml = $this->_recuperarXmlPlp($arrParametros); + // ['idSolicExp' => idMdCorSolicitacaoExpedicao , 'arrJson' => estrutura do Json para a API ] + $arrParamJson = $this->montarDadosJsonPostagem($arrParametros); + + // retorna dados da integração GERAR PRE POSTAGEM + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); - $arrEtiquetaSemDigito = array_values(array_unique($arrEtiquetaSemDigito)); + $objMdCorIntegSolicPPN = $objMdCorAdmIntegracaoRN->buscaIntegracaoPorFuncionalidade(MdCorAdmIntegracaoRN::$GERAR_PRE_POSTAGEM); - $arrParametroPlp = ['xml' => $xml - , 'idPlpCliente' => '1' - , 'cartaoPostagem' => $cartaoPostagem - , 'listaEtiquetas' => $arrEtiquetaSemDigito - , 'usuario' => $usuario - , 'senha' => $senha + if ( is_null( $objMdCorIntegSolicPPN ) ) throw new InfraException('Mapeamento de Integração '. MdCorAdmIntegracaoRN::$STR_PRE_POSTAGEM .' não existe ou está inativo.'); + + $arrParametroRest = [ + 'endpoint' => $objMdCorIntegSolicPPN->getStrUrlOperacao(), + 'token' => $objMdCorIntegSolicPPN->getStrToken(), + 'expiraEm' => $objMdCorIntegSolicPPN->getDthDataExpiraToken(), ]; - $idPlp = $cliente->fechaPlpVariosServicos($arrParametroPlp)->return; + + $ret = $objMdCorAdmIntegracaoRN->verificaTokenExpirado($arrParametroRest, $objMdCorIntegSolicPPN); + + if ( is_array( $ret ) && isset( $ret['suc'] ) && $ret['suc'] === false ) { + $strUrlAPIUsada = $ret['url'] ?? $arrParametroRest['endpoint']; + throw new InfraException("Falha na Integração: " . MdCorAdmIntegracaoRN::$STR_PRE_POSTAGEM . "." . "\n" . $ret['msg'] ); + } + + // instancia class ApiRest com os dados necessarios para uso da API que gera Pre Postagem + $objMdCorApiPPN = new MdCorApiRestRN( $arrParametroRest ); + + $arrCodigoRastreio = []; + + foreach ( $arrParamJson as $arrItens ) { + + $rs = $objMdCorApiPPN->gerarPPN( $arrItens['arrJson'] ); + + if ( is_array( $rs ) and $rs['suc'] === false ) { + $strUrlAPIUsada = $objMdCorApiPPN->getEndPoint(); + throw new InfraException("A solicitação de expedição de id {$arrItens['idSolicExp']} não foi inserida na PLP.\n\n {$rs['msg']}"); + } + + $arrCodigoRastreio[$arrItens['idSolicExp']] = [ + 'codigoObjeto' => $rs['codigoObjeto'], + 'idPrePostagem' => $rs['id'] + ]; + } $arrRetorno = [ - 'idPlp' => $idPlp, - 'arrRastreio' => $arrCodigoRastreioFinal + 'arrRastreio' => $arrCodigoRastreio ]; return $arrRetorno; - } catch (SoapFault $soapFault) { - throw new InfraException('Erro ao gerar PLP - WebService.', $soapFault); - } + } catch ( InfraException $e ) { + $operacao = ''; + $msgDefault = "Não foi possível Gerar PLP devido à incompatibilidade das informações da Solicitação de Expedição com a nova Integração com os Correios. + É necessário Devolver a Solicitação de Expedição e requerer à Unidade Solicitante que revise o Serviço Postal e demais informações da Solicitação."; + + if ( ! empty( $strUrlAPIUsada) ) $operacao = "Operação: $strUrlAPIUsada \n\n"; + + $msgFinal = "$msgDefault \n\n" . $operacao . "Retorno: " . $e->getMessage(); + $e->lancarValidacao( $msgFinal ); + + LogSEI::getInstance()->gravar( $msgFinal ); + } } protected function alterarDadosPlpSolicitacaoControlado($arrParametro) { try { + $idPlp = $this->geradorCodigoPLP(); + $idPlp += 1; + $mdCorPlpDto = new MdCorPlpDTO(); + SessaoSEI::getInstance()->validarAuditarPermissao('md_cor_plp_cadastrar', __METHOD__, $mdCorPlpDto); - $mdCorPlpDto->setDblCodigoPlp($arrParametro['idPlp']); + + $mdCorPlpDto->setDblCodigoPlp($idPlp); $mdCorPlpDto->setStrStaPlp(self::$STA_GERADA); $mdCorPlpDto->setNumIdUnidadeGeradora(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); @@ -604,7 +602,8 @@ protected function alterarDadosPlpSolicitacaoControlado($arrParametro) { $ret = $this->cadastrar($mdCorPlpDto); - foreach ($arrParametro['arrRastreio'] as $idMdCorExpedicaoSolicitada => $dadosRastreio) { + foreach ($arrParametro['arrRastreio'] as $k => $dadosRastreio) { + $idMdCorExpedicaoSolicitada = $k; $mdCorExpedicaoSolicitadaRN = new MdCorExpedicaoSolicitadaRN(); $mdCorExpedicaoSolicitadaDTO = new MdCorExpedicaoSolicitadaDTO(); $mdCorExpedicaoSolicitadaDTO->retTodos(); @@ -612,7 +611,8 @@ protected function alterarDadosPlpSolicitacaoControlado($arrParametro) { $mdCorExpedicaoSolicitadaDTO->setNumIdMdCorExpedicaoSolicitada($idMdCorExpedicaoSolicitada); $mdCorExpedicaoSolicitadaDTO = $mdCorExpedicaoSolicitadaRN->consultar($mdCorExpedicaoSolicitadaDTO); - $mdCorExpedicaoSolicitadaDTO->setStrCodigoRastreamento($dadosRastreio); + $mdCorExpedicaoSolicitadaDTO->setStrCodigoRastreamento($dadosRastreio['codigoObjeto']); + $mdCorExpedicaoSolicitadaDTO->setStrIdPrePostagem($dadosRastreio['idPrePostagem']); $mdCorExpedicaoSolicitadaDTO->setNumIdMdCorPlp($ret->getNumIdMdPlp()); if (empty($mdCorExpedicaoSolicitadaDTO->getNumIdMdCorObjeto())) { @@ -636,280 +636,6 @@ protected function alterarDadosPlpSolicitacaoControlado($arrParametro) { } } - /** - * Metodo que gera o XML para geração do PLP seguindo o manual Correios - Revisão: 13/06/2017 - * @param $arrParametros - * @return string - */ - private function _recuperarXmlPlp($arrParametros) { - $dom = new DOMDocument("1.0", "ISO-8859-1"); - $dom->preserveWhiteSpace = false; - $dom->formatOutput = true; - - //Tag principal - $tagInicial = $dom->createElement("correioslog"); - - //Tipo de Arquivo e Versao - $tipoArquivo = $dom->createElement("tipo_arquivo", 'Postagem'); - $versao = $dom->createElement("versao_arquivo", '2.3'); - $tagInicial->appendChild($tipoArquivo); - $tagInicial->appendChild($versao); -// -// -// //tag da PLP - $plp = $dom->createElement("plp"); - $idPlp = $dom->createElement("id_plp"); - $vlGlobal = $dom->createElement("valor_global"); - $mcuUnidadePostagem = $dom->createElement("mcu_unidade_postagem"); - $nomeUnidadePostagem = $dom->createElement("nome_unidade_postagem"); - $nuCartaoPostagem = $dom->createElement("cartao_postagem", $arrParametros['nuCartaoPostagem']); - - $plp->appendChild($idPlp); - $plp->appendChild($vlGlobal); - $plp->appendChild($mcuUnidadePostagem); - $plp->appendChild($nomeUnidadePostagem); - $plp->appendChild($nuCartaoPostagem); - $tagInicial->appendChild($plp); - - //Tag Remetente - $remetente = $dom->createElement("remetente"); - $nuContrato = $dom->createElement("numero_contrato", $arrParametros['nuContrato']); - $remetente->appendChild($nuContrato); - $nuDiretoria = $dom->createElement("numero_diretoria", '10'); - $remetente->appendChild($nuDiretoria); - $coAdministrativo = $dom->createElement("codigo_administrativo", $arrParametros['coAdministrativo']); - $remetente->appendChild($coAdministrativo); - - $objContatoDTO = new ContatoDTO(); - $objContatoDTO->retNumIdContato(); - $objContatoDTO->retStrNome(); - $objContatoDTO->retStrEndereco(); - $objContatoDTO->retStrComplemento(); - $objContatoDTO->retStrBairro(); - $objContatoDTO->retStrCep(); - $objContatoDTO->retStrNomeCidade(); - $objContatoDTO->retStrSiglaUf(); - $objContatoDTO->retDblCnpj(); - $objContatoDTO->retStrSigla(); - $objContatoDTO->retStrEmail(); - $objContatoDTO->retStrTelefoneComercial(); - $objContatoDTO->retStrSinEnderecoAssociado(); - $objContatoDTO->retStrEnderecoContatoAssociado(); - $objContatoDTO->retStrComplementoContatoAssociado(); - $objContatoDTO->retStrBairroContatoAssociado(); - $objContatoDTO->retStrCepContatoAssociado(); - $objContatoDTO->retStrNomeCidadeContatoAssociado(); - $objContatoDTO->retStrSiglaUfContatoAssociado(); - $objContatoDTO->setNumIdContato($arrParametros['idContatoOrgao']); - - - $objContatoRN = new ContatoRN(); - $objContatoDTO = $objContatoRN->consultarRN0324($objContatoDTO); - - $noRemetente = $dom->createElement('nome_remetente') ; - $noRemetente->appendChild($dom->createCDATASection(preg_replace('/[^A-Za-z0-9\-]/', ' ', InfraString::excluirAcentos($objContatoDTO->getStrNome())))); - $remetente->appendChild($noRemetente); - - $arrContato = $this->retornarArrEnderecoComplento($objContatoDTO->getStrEndereco(), $objContatoDTO->getStrComplemento()); - - - - $cpfCnpjRemetente = $dom->createElement("cpf_cnpj_remetente", InfraUtil::retirarFormatacao(InfraUtil::formatarCnpj($objContatoDTO->getDblCnpj()))); - $remetente->appendChild($cpfCnpjRemetente); - - $remetenteEndereco = $arrContato['endereco']; - $remetenteComplemento = $arrContato['complemento']; - - $logradouroRemetente = $dom->createElement('logradouro_remetente') ; - $logradouroRemetente->appendChild($dom->createCDATASection(preg_replace('/[^A-Za-z0-9\-]/', ' ', InfraString::excluirAcentos($remetenteEndereco)))); - $remetente->appendChild($logradouroRemetente); - - $nuRemetente = $dom->createElement('numero_remetente') ; - $nuRemetente->appendChild($dom->createCDATASection('N/A')); - $remetente->appendChild($nuRemetente); - - $compRemetente = $dom->createElement('complemento_remetente') ; - $compRemetente->appendChild($dom->createCDATASection(preg_replace('/[^A-Za-z0-9\-]/', ' ', InfraString::excluirAcentos($remetenteComplemento)))); - $remetente->appendChild($compRemetente); - - $bairroRemetente = $dom->createElement('bairro_remetente') ; - $bairroRemetente->appendChild($dom->createCDATASection(preg_replace('/[^A-Za-z0-9\-]/', ' ', InfraString::excluirAcentos($objContatoDTO->getStrBairro())))); - $remetente->appendChild($bairroRemetente); - - $cepRemetente = $dom->createElement("cep_remetente", InfraUtil::retirarFormatacao($objContatoDTO->getStrCep())); - $remetente->appendChild($cepRemetente); - - $cidadeRemetente = $dom->createElement('cidade_remetente') ; - - $cidade_Remetente = substr(preg_replace('/[^A-Za-z0-9\-]/', ' ', InfraString::excluirAcentos($objContatoDTO->getStrNomeCidade())), 0, 30); - $cidadeRemetente->appendChild($dom->createCDATASection($cidade_Remetente)); - $remetente->appendChild($cidadeRemetente); - - $ufRemetente = $dom->createElement("uf_remetente", $objContatoDTO->getStrSiglaUf()); - $remetente->appendChild($ufRemetente); - - $telefoneRemetente = $dom->createElement('telefone_remetente') ; - $telefoneRemetente->appendChild($dom->createCDATASection(InfraUtil::retirarFormatacao($objContatoDTO->getStrTelefoneComercial()))); - $remetente->appendChild($telefoneRemetente); - - $faxRemetente = $dom->createElement("fax_remetente"); - $remetente->appendChild($faxRemetente); - - $emailRemetente = $dom->createElement('email_remetente') ; - $emailRemetente->appendChild($dom->createCDATASection($objContatoDTO->getStrEmail())); - $remetente->appendChild($emailRemetente); - - $tagInicial->appendChild($remetente); - - //forma pagamento - $emailRemetente = $dom->createElement("forma_pagamento"); - $tagInicial->appendChild($emailRemetente); - - //Objeto Postal - - foreach ($arrParametros['arrCodigoRastreioTratado'] as $codigoRastreio) { - $objetoPostal = $dom->createElement("objeto_postal"); - - $nuEtiqueta = $dom->createElement("numero_etiqueta", $codigoRastreio['codigoRastreio']); - $objetoPostal->appendChild($nuEtiqueta); - $coObjCliente = $dom->createElement("codigo_objeto_cliente"); - $objetoPostal->appendChild($coObjCliente); - $coServicoPostagem = $dom->createElement("codigo_servico_postagem", $codigoRastreio['coServicoPostagem']); - $objetoPostal->appendChild($coServicoPostagem); - $cubagem = $dom->createElement("cubagem", '0,00'); - $objetoPostal->appendChild($cubagem); - $peso = $dom->createElement("peso", 10); - $objetoPostal->appendChild($peso); - $rt1 = $dom->createElement("rt1"); - $objetoPostal->appendChild($rt1); - $rt2 = $dom->createElement("rt2"); - $objetoPostal->appendChild($rt2); - $tagInicial->appendChild($objetoPostal); - - //Destinatario - $destinatario = $dom->createElement("destinatario"); - - $noDestinatario = $dom->createElement('nome_destinatario') ; - $noDestinatario->appendChild($dom->createCDATASection(preg_replace('/[^A-Za-z0-9\-]/', ' ', InfraString::excluirAcentos($codigoRastreio['noDestinatario'])))); - $destinatario->appendChild($noDestinatario); - - $telDestinatario = $dom->createElement("telefone_destinatario"); - $destinatario->appendChild($telDestinatario); - $celDestinatario = $dom->createElement("celular_destinatario"); - $destinatario->appendChild($celDestinatario); - $emailDestinatario = $dom->createElement("email_destinatario"); - $destinatario->appendChild($emailDestinatario); - - $destinatarioEndereco = ($objContatoDTO->getStrSinEnderecoAssociado() == 'S') ? $objContatoDTO->getStrEnderecoContatoAssociado(): $codigoRastreio['dsEnderecoDestinatario']; - $destinatarioComplemento = ($objContatoDTO->getStrSinEnderecoAssociado() == 'S') ? $objContatoDTO->getStrComplementoContatoAssociado(): $codigoRastreio['dsComplementoDestinatario']; - - $arrContato = $this->retornarArrEnderecoComplento( $destinatarioEndereco , $destinatarioComplemento); - - $destinatarioEndereco = $arrContato['endereco']; - $destinatarioComplemento = $arrContato['complemento']; - - $logradouroDestinatario = $dom->createElement('logradouro_destinatario') ; - $logradouroDestinatario->appendChild($dom->createCDATASection(preg_replace('/[^A-Za-z0-9\-]/', ' ', InfraString::excluirAcentos( $destinatarioEndereco )))); - $destinatario->appendChild($logradouroDestinatario); - - $compDestinatario = $dom->createElement('complemento_destinatario') ; - $compDestinatario->appendChild($dom->createCDATASection(preg_replace('/[^A-Za-z0-9\-]/', ' ', InfraString::excluirAcentos( $destinatarioComplemento )))); - $destinatario->appendChild($compDestinatario); - - $nuEnderecoDestinatario = $dom->createElement("numero_end_destinatario", 'N/A'); - $destinatario->appendChild($nuEnderecoDestinatario); - $objetoPostal->appendChild($destinatario); - // Tag Nacional - $nacional = $dom->createElement("nacional"); - - $bairroDestinatario = $dom->createElement('bairro_destinatario') ; - $bairroDestinatario->appendChild($dom->createCDATASection(preg_replace('/[^A-Za-z0-9\-]/', ' ', InfraString::excluirAcentos($objContatoDTO->getStrSinEnderecoAssociado() == 'S' ? $objContatoDTO->getStrBairroContatoAssociado() : $codigoRastreio['dsBairroDestinatario'])))); - $nacional->appendChild($bairroDestinatario); - - $cidadeDestinatario = $dom->createElement('cidade_destinatario') ; - $cidadeDestinatario->appendChild($dom->createCDATASection(preg_replace('/[^A-Za-z0-9\-]/', ' ', InfraString::excluirAcentos($objContatoDTO->getStrSinEnderecoAssociado() == 'S' ? $objContatoDTO->getStrNomeCidadeContatoAssociado() : $codigoRastreio['noCidadeDestinatario'])))); - $nacional->appendChild($cidadeDestinatario); - - $ufDestinatario = $dom->createElement("uf_destinatario", $objContatoDTO->getStrSinEnderecoAssociado() == 'S' ? $objContatoDTO->getStrSiglaUf() : $codigoRastreio['sgUfDestinatario']); - $nacional->appendChild($ufDestinatario); - - $cepDestinatario = $dom->createElement('cep_destinatario') ; - $cepDestinatario->appendChild($dom->createCDATASection(InfraUtil::retirarFormatacao($objContatoDTO->getStrSinEnderecoAssociado() == 'S' ? $objContatoDTO->getStrCepContatoAssociado() : $codigoRastreio['nuCepDestinatario']))); - $nacional->appendChild($cepDestinatario); - - $codigoUsuarioPostal = $dom->createElement("codigo_usuario_postal"); - $nacional->appendChild($codigoUsuarioPostal); - $centroCustoCliente = $dom->createElement("centro_custo_cliente"); - $nacional->appendChild($centroCustoCliente); - $numeroNotaFiscal = $dom->createElement("numero_nota_fiscal"); - $nacional->appendChild($numeroNotaFiscal); - $serieNotaFiscal = $dom->createElement("serie_nota_fiscal"); - $nacional->appendChild($serieNotaFiscal); - $valorNotaFiscal = $dom->createElement("valor_nota_fiscal"); - $nacional->appendChild($valorNotaFiscal); - $naturezaNotaFiscal = $dom->createElement("natureza_nota_fiscal"); - $nacional->appendChild($naturezaNotaFiscal); - $descricaoObjeto = $dom->createElement("descricao_objeto"); - $nacional->appendChild($descricaoObjeto); - $valorACobrar = $dom->createElement("valor_a_cobrar"); - $nacional->appendChild($valorACobrar); - $objetoPostal->appendChild($nacional); - - //tag servico adicional - $servicoAdicional = $dom->createElement("servico_adicional"); - $nacional = $dom->createElement("codigo_servico_adicional", "025"); - $servicoAdicional->appendChild($nacional); - - if( $codigoRastreio['stExpedicaoAvisoRecebimentoServico'] == 'S' ){ - $nacional = $dom->createElement("codigo_servico_adicional", "001"); - $servicoAdicional->appendChild($nacional); - } - - $valorDeclarado = $dom->createElement("valor_declarado"); - $servicoAdicional->appendChild($valorDeclarado); - $objetoPostal->appendChild($servicoAdicional); - - - //tag dimensao_objeto - /** - * @todo verificar com os correios pois o documento está desacordo com o XSD de validacao - */ - $dimensaoObjeto = $dom->createElement("dimensao_objeto"); - $tipoObjeto = $dom->createElement("tipo_objeto", '001'); - $dimensaoObjeto->appendChild($tipoObjeto); - $dimensaoAltura = $dom->createElement("dimensao_altura", '0'); - $dimensaoObjeto->appendChild($dimensaoAltura); - $dimencaoLargura = $dom->createElement("dimensao_largura", '0'); - $dimensaoObjeto->appendChild($dimencaoLargura); - $dimencaoComprimento = $dom->createElement("dimensao_comprimento", '0'); - $dimensaoObjeto->appendChild($dimencaoComprimento); - $dimencaoDiametro = $dom->createElement("dimensao_diametro", '0'); - $dimensaoObjeto->appendChild($dimencaoDiametro); - $objetoPostal->appendChild($dimensaoObjeto); - - - //tags finais - $dataPostagemSara = $dom->createElement("data_postagem_sara"); - $objetoPostal->appendChild($dataPostagemSara); - $statusProcessamento = $dom->createElement("status_processamento", '0'); - $objetoPostal->appendChild($statusProcessamento); - $numeroComprovantePostagem = $dom->createElement("numero_comprovante_postagem"); - $objetoPostal->appendChild($numeroComprovantePostagem); - $vlCobrado = $dom->createElement("valor_cobrado"); - $objetoPostal->appendChild($vlCobrado); - } - - - $dom->appendChild($tagInicial); - - -#cabeçalho da página -// header("Content-Type: text/xml"); -# imprime o xml na tela -// print $dom->saveXML();die; - return $dom->saveXML(); - } - private function retornarArrEnderecoComplento( $endereco, $complemento ){ $arr = []; @@ -1023,5 +749,228 @@ private function retornaObjAtributoAndamentoAPI($nome, $valor, $id = null) { return $objAtributoAndamentoAPI; } + private function montarDadosJsonPostagem( $arrParametros ){ + $objContatoDTO = new ContatoDTO(); + $objContatoDTO->retNumIdContato(); + $objContatoDTO->retStrNome(); + $objContatoDTO->retStrEndereco(); + $objContatoDTO->retStrComplemento(); + $objContatoDTO->retStrBairro(); + $objContatoDTO->retStrCep(); + $objContatoDTO->retStrNomeCidade(); + $objContatoDTO->retStrSiglaUf(); + $objContatoDTO->retDblCnpj(); + $objContatoDTO->retStrSigla(); + $objContatoDTO->retStrEmail(); + $objContatoDTO->retStrTelefoneComercial(); + $objContatoDTO->retStrSinEnderecoAssociado(); + $objContatoDTO->retStrEnderecoContatoAssociado(); + $objContatoDTO->retStrComplementoContatoAssociado(); + $objContatoDTO->retStrBairroContatoAssociado(); + $objContatoDTO->retStrCepContatoAssociado(); + $objContatoDTO->retStrNomeCidadeContatoAssociado(); + $objContatoDTO->retStrSiglaUfContatoAssociado(); + $objContatoDTO->setNumIdContato($arrParametros['idContatoOrgao']); + + $objContatoRN = new ContatoRN(); + $objContatoDTO = $objContatoRN->consultarRN0324( $objContatoDTO ); + return $this->montaEstruturaJsonPostagem( $objContatoDTO, $arrParametros ); + } + + private function montaEstruturaJsonPostagem( $objContatoDTO,$arrParametros ){ + + $arrRetorno = []; + + $arrContato = $this->retornarArrEnderecoComplento($objContatoDTO->getStrEndereco(), $objContatoDTO->getStrComplemento()); + + $arrRemetente = [ + "nome" => substr(InfraString::excluirAcentos($objContatoDTO->getStrNome()),0,50), + "dddTelefone" => "", + "telefone" => "", + "dddCelular" => "", + "celular" => "", + "email" => "", + "cpfCnpj" => InfraUtil::retirarFormatacao(InfraUtil::formatarCnpj($objContatoDTO->getDblCnpj())), + "obs" => "", + "endereco" => [ + "cep" => InfraUtil::retirarFormatacao($objContatoDTO->getStrCep()), + "logradouro" => InfraString::excluirAcentos( str_replace( ['º','ª','&'] , ['','a','e'] , $arrContato['endereco'] ) ), + "numero" => "N/A", + "complemento" => InfraString::excluirAcentos( str_replace( ['º','ª','&'] , ['','a','e'] , $arrContato['complemento'] ) ), + "bairro" => substr(InfraString::excluirAcentos($objContatoDTO->getStrBairro()), 0, 30), + "cidade" => substr(InfraString::excluirAcentos($objContatoDTO->getStrNomeCidade()), 0, 30), + "uf" => $objContatoDTO->getStrSiglaUf() + ] + ]; + + foreach ( $arrParametros['arrDadosSolicitacao'] as $idSolic => $arrItens ) { + // configura dados de destinatario + if ( $objContatoDTO->getStrSinEnderecoAssociado() == 'S' ) { + $destinatarioEndereco = $objContatoDTO->getStrEnderecoContatoAssociado(); + $destinatarioComplemento = $objContatoDTO->getStrComplementoContatoAssociado() ?? ""; + $destinatarioCEP = $objContatoDTO->getStrCepContatoAssociado(); + $destinatarioBairro = $objContatoDTO->getStrBairroContatoAssociado(); + $destinatarioCidade = $objContatoDTO->getStrNomeCidadeContatoAssociado(); + $destinatarioUF = $objContatoDTO->getStrSiglaUfContatoAssociado(); + } else { + $destinatarioEndereco = $arrItens['dsEnderecoDestinatario']; + $destinatarioComplemento = $arrItens['dsComplementoDestinatario'] ?? ""; + $destinatarioCEP = $arrItens['nuCepDestinatario']; + $destinatarioBairro = $arrItens['dsBairroDestinatario']; + $destinatarioCidade = $arrItens['noCidadeDestinatario']; + $destinatarioUF = $arrItens['sgUfDestinatario']; + } + + $arrEnderecoDest = $this->retornarArrEnderecoComplento( $destinatarioEndereco , $destinatarioComplemento ); + + $arrDest = [ + "nome" => substr(InfraString::excluirAcentos($arrItens['noDestinatario']),0,50), + "dddTelefone" => "", + "telefone" => "", + "dddCelular" => "", + "celular" => "", + "email" => "", + "cpfCnpj" => "", + "obs" => "", + "endereco" => [ + "cep" => InfraUtil::retirarFormatacao($destinatarioCEP), + "logradouro" => InfraString::excluirAcentos( str_replace( ['º','ª','&'],['','a','e'],$arrEnderecoDest['endereco'] ) ), + "numero" => "N/A", + "complemento" => InfraString::excluirAcentos( str_replace( ['º','ª','&'],['','a','e'],$arrEnderecoDest['complemento'] ) ), + "bairro" => substr(InfraString::excluirAcentos($destinatarioBairro), 0, 30), + "cidade" => substr(InfraString::excluirAcentos($destinatarioCidade), 0, 30), + "uf" => $destinatarioUF, + ] + ]; + + // configura servico adicional + $arrServAdd = [ + ['codigoServicoAdicional' => '025', 'valorDeclarado' => '0'], + ]; + + if ( $arrItens['stExpedicaoAvisoRecebimentoServico'] == 'S' ) array_push( $arrServAdd , ['codigoServicoAdicional' => '001', 'valorDeclarado' => '0'] ); + + // declaracao de conteudo + // $arrDecConteudo = [['conteudo' => 'Nº Processo: 56.000011/2021-58','quantidade' => 1,'valor' => 0.1]], + + $arrJson = [ + "idCorreios" => "", + "remetente" => $arrRemetente, + "destinatario" => $arrDest, + "codigoServico" => $arrItens['coServicoPostagem'], + "listaServicoAdicional" => $arrServAdd, + #"itensDeclaracaoConteudo" => $arrDecConteudo, + "pesoInformado" => "10", + "codigoFormatoObjetoInformado" => "1", + "alturaInformada" => "0", + "larguraInformada" => "0", + "comprimentoInformado" => "0", + "diametroInformado" => "0", + "cienteObjetoNaoProibido" => "1", + "solicitarColeta" => "N", + "observacao" => $arrItens['infoAnexos'], + "modalidadePagamento" => "2" + ]; + + //CARTA RG AR CONV: Correspondência Registrada com AR + if ( $arrItens['coServicoPostagem'] == 80810 ) $arrJson['dataPrevistaPostagem'] = InfraData::getStrDataAtual(); + + $arrRetorno[] = ['idSolicExp' => $idSolic , 'arrJson' => $arrJson]; + } + + return $arrRetorno; + } + + protected function geradorCodigoPLPConectado(){ + $objMdCorPlpDTO = new MdCorPlpDTO(); + $objMdCorPlpDTO->setOrd('CodigoPlp',InfraDTO::$TIPO_ORDENACAO_DESC); + $objMdCorPlpDTO->setNumMaxRegistrosRetorno(1); + $objMdCorPlpDTO->retDblCodigoPlp(); + $objCodigoPLP = ( new MdCorPlpRN() )->consultar( $objMdCorPlpDTO ); + return $objCodigoPLP ? $objCodigoPLP->getDblCodigoPlp() + 1 : 0; + } + + protected function cancelarPlpConectado($arrDados){ + + // retorna dados da integração GERAR PRE POSTAGEM + $objMdCorAdmIntegracaoRN = new MdCorAdmIntegracaoRN(); + + $objMdCorIntegCancelarPPN = $objMdCorAdmIntegracaoRN->buscaIntegracaoPorFuncionalidade(MdCorAdmIntegracaoRN::$CANCELAR_PRE_POSTAGEM); + + if ( empty($objMdCorIntegCancelarPPN) || ( is_array( $objMdCorIntegCancelarPPN ) && isset($objMdCorIntegCancelarPPN['suc'] ) && $objMdCorIntegCancelarPPN['suc'] === false ) ) + return ['suc' => false , 'msg' => 'Mapeamento de Integração '. MdCorAdmIntegracaoRN::$STR_CANCELAR_PRE_POSTAGEM .' não existe ou está inativo.']; + + $arrParametroRest = [ + 'endpoint' => $objMdCorIntegCancelarPPN->getStrUrlOperacao(), + 'token' => $objMdCorIntegCancelarPPN->getStrToken(), + 'expiraEm' => $objMdCorIntegCancelarPPN->getDthDataExpiraToken(), + ]; + + $ret = $objMdCorAdmIntegracaoRN->verificaTokenExpirado($arrParametroRest, $objMdCorIntegCancelarPPN); + + if ( is_array( $ret ) ) return ['suc' => false , 'msg' => $ret['msg']]; + + // instancia class ApiRest com os dados necessarios para uso da API que gera Pre Postagem + $objMdCorApiCancelarPPN = new MdCorApiRestRN( $arrParametroRest ); + + $arrCodRastreamento = $this->getListaCodigoRastreamento($arrDados['idPlp']); + + $rs = $objMdCorApiCancelarPPN->cancelarPPN($arrCodRastreamento); + + if ( is_array($rs) ){ + $msgErroCompl = "Operação: {$objMdCorApiCancelarPPN->getEndPoint()}.#Retorno: {$rs['msg']}"; + return ['suc' => false , 'msg' => $msgErroCompl]; + } + + $rs = $this->atualizarSolicitacoesAposCancelamentoPlp(['idPlp' => $_POST['idPlp']]); + + if ( is_array($rs) ) { + return ['suc' => false , 'msg' => $rs['msg']]; + } + + return true; + } + + private function getListaCodigoRastreamento($idPlp){ + $objMdCorExpSolicitacaoDTO = new MdCorExpedicaoSolicitadaDTO(); + $objMdCorExpSolicitacaoDTO->setNumIdMdCorPlp($idPlp); + $objMdCorExpSolicitacaoDTO->retStrCodigoRastreamento(); + + $arrObjExpSolicDTO = ( new MdCorExpedicaoSolicitadaRN() )->listar($objMdCorExpSolicitacaoDTO); + return InfraArray::converterArrInfraDTO($arrObjExpSolicDTO,'CodigoRastreamento'); + } + + protected function atualizarSolicitacoesAposCancelamentoPlpConectado($arrDados){ + try { + // atualizar a PLP para Cancelada + $objMdCorPlpDTO = new MdCorPlpDTO(); + $objMdCorPlpDTO->setNumIdMdPlp($arrDados['idPlp']); + $objMdCorPlpDTO->setStrStaPlp(self::$STA_CANCELADA); + $rs = ( new MdCorPlpRN() )->alterar( $objMdCorPlpDTO ); + + // atualizar as solicitacoes de expedicao + $objMdCorExpSolicitacaoDTO = new MdCorExpedicaoSolicitadaDTO(); + $objMdCorExpSolicitacaoDTO->setNumIdMdCorPlp($arrDados['idPlp']); + $objMdCorExpSolicitacaoDTO->retNumIdMdCorExpedicaoSolicitada(); + $objMdCorExpSolicitacaoDTO->retNumIdMdCorPlp(); + $objMdCorExpSolicitacaoDTO->retStrCodigoRastreamento(); + $objMdCorExpSolicitacaoDTO->retStrIdPrePostagem(); + + $objMdCorExpSolicitadaRN = new MdCorExpedicaoSolicitadaRN(); + + $arrObjMdCorExpSolicitacaoDTO = $objMdCorExpSolicitadaRN->listar($objMdCorExpSolicitacaoDTO); + + foreach ( $arrObjMdCorExpSolicitacaoDTO as $objExpSolicDTO ) { + $objExpSolicDTO->setNumIdMdCorPlp(null); + $objExpSolicDTO->setStrCodigoRastreamento(null); + $objExpSolicDTO->setStrIdPrePostagem(null); + + $objMdCorExpSolicitadaRN->alterar( $objExpSolicDTO ); + } + + } catch(InfraException $e ) { + return ['suc' => false , 'msg' => $e->getMessage()]; + } + } } diff --git a/sei/web/modulos/correios/rn/MdCorRetornoArDocRN.php b/sei/web/modulos/correios/rn/MdCorRetornoArDocRN.php index 9759c53..c9a4c69 100644 --- a/sei/web/modulos/correios/rn/MdCorRetornoArDocRN.php +++ b/sei/web/modulos/correios/rn/MdCorRetornoArDocRN.php @@ -328,7 +328,7 @@ protected function cadastrarArsControlado($dados) { $objMdCorRetornoArDocDTO->setNumIdMdCorParamArInfrigencia($coInfrigencia); $strSituacaoRetorno = ' objeto devolvido,'; - if ($dados['co_motivo'][$chave] != 'null') { + if ($dados['co_motivo'][$chave] != null) { $mdCorParamArInfrigenRN = new MdCorParamArInfrigenRN(); $objMdCorParamArInfrigenDTO = new MdCorParamArInfrigenDTO(); $objMdCorParamArInfrigenDTO->setNumIdMdCorParamArInfrigencia($coInfrigencia); diff --git a/sei/web/modulos/correios/rn/MdCorRetornoArRN.php b/sei/web/modulos/correios/rn/MdCorRetornoArRN.php index 34829bc..1ec05ef 100644 --- a/sei/web/modulos/correios/rn/MdCorRetornoArRN.php +++ b/sei/web/modulos/correios/rn/MdCorRetornoArRN.php @@ -8,7 +8,8 @@ */ require_once dirname(__FILE__) . '/../../../SEI.php'; -require_once dirname(__FILE__) . '/../lib/qrcode/vendor/autoload.php'; +require_once dirname(__FILE__) . '/../lib/zbar/vendor/autoload.php'; +//require_once dirname(__FILE__) . '/../lib/qrcode/vendor/autoload.php'; class MdCorRetornoArRN extends InfraRN { @@ -269,20 +270,32 @@ protected function processarArquivoConectado($dados) $objInfraException = new InfraException(); + if ( file_exists($url) === false ) { + $objInfraException->adicionarValidacao('Arquivo Zip não encontrado no caminho: ' . $url); + $objInfraException->lancarValidacoes(); + } + $zip = new ZipArchive(); - $zip->open($url); + $bolOpenZip = $zip->open($url); + + if ( $bolOpenZip !== true ) { + $objInfraException->adicionarValidacao('Não foi possível abrir o arquivo Zip no caminho: ' . $url); + $objInfraException->lancarValidacoes(); + } + $arrArs = []; $arrArs['numFiles'] = $zip->numFiles; if ($zip->numFiles <= 50) { if ($zip->extractTo($destino) == TRUE) { $arrArs = $this->converterPdfImage($destino); - } else { - $objInfraException->adicionarValidacao('Dentro do ZIP somente deve constar 50 arquivos PDFs.'); - $objInfraException->lancarValidacoes(); } + $zip->close(); return $this->verificarArs($arrArs); + } else { + $zip->close(); + $objInfraException->adicionarValidacao('Dentro do ZIP somente deve constar 50 arquivos PDFs.'); + $objInfraException->lancarValidacoes(); } - $zip->close(); } protected function converterPdfImageControlado($url) @@ -294,9 +307,10 @@ protected function converterPdfImageControlado($url) $objInfraException = new InfraException(); $files = array_diff(scandir($url), array('.', '..')); - $QRCodeReader = new Libern\QRCodeReader\QRCodeReader(); + $objDecoder = new \RobbieP\ZbarQrdecoder\ZbarDecoder(); $arrQrCode = []; + foreach ($files as $chave => $file) { $localArquivo = $url . '/' . $file; $noArquivoJpg = $url . '/' . str_replace('pdf', 'jpg', $file); @@ -313,16 +327,25 @@ protected function converterPdfImageControlado($url) $objInfraException->lancarValidacoes(); } - $im = new Imagick(); - $im->setResolution(80, 80); + $im->setResolution(380, 380); $im->readimage($url . '/' . $file . '[0]'); - $im->setImageFormat("jpeg"); - $im->setImageCompressionQuality(80); + $im->setImageFormat("jpg"); + $im->setImageCompressionQuality(100); $im->writeImage($noArquivoJpg); $im->destroy(); - $arrQrCode[$file] = $QRCodeReader->decode($noArquivoJpg); + // realiza leitura de qrcode ou barcode + $result = $objDecoder->make($noArquivoJpg); + + if ( $result->code == 400 ) { + //$objInfraException->adicionarValidacao('Não foi possível fazer a leitura do QRCode ou Código de Barras.'); + //$objInfraException->lancarValidacoes(); + $result = '0'; + } + + $arrQrCode[$file] = $result; + if (($key = array_search($file, $files)) !== false) { unset($files[$key]); } @@ -331,7 +354,6 @@ protected function converterPdfImageControlado($url) return $arrQrCode; - } protected function verificarArsControlado($arrArs) diff --git a/sei/web/modulos/correios/rn/MdCorUnidadeExpRN.php b/sei/web/modulos/correios/rn/MdCorUnidadeExpRN.php index d18efaa..0c4a283 100644 --- a/sei/web/modulos/correios/rn/MdCorUnidadeExpRN.php +++ b/sei/web/modulos/correios/rn/MdCorUnidadeExpRN.php @@ -296,4 +296,71 @@ protected function validaCamposEnderecoUnidadeControlado($arrUnidades) { } } + + protected function validaCamposEnderecoUnidadePLPControlado($arrUnidades) { + + $unidadeRN = new UnidadeRN(); + + $unidadeDTO = new UnidadeDTO(); + $unidadeDTO->retNumIdOrgao(); + $unidadeDTO->retNumIdContato(); + $unidadeDTO->retStrDescricao(); + $unidadeDTO->setNumIdUnidade($arrUnidades, InfraDTO::$OPER_IN); + $arrObjUnidadeDTO = $unidadeRN->listarRN0127($unidadeDTO); + + foreach ($arrObjUnidadeDTO as $objOrgaoDTO) { + + $contatoRN = new ContatoRN(); + + $objContatoDTO = new ContatoDTO(); + $objContatoDTO->setNumIdContato($objOrgaoDTO->getNumIdContato()); + $objContatoDTO->retStrBairro(); + $objContatoDTO->retStrEndereco(); + $objContatoDTO->retNumIdCidade(); + $objContatoDTO->retNumIdUf(); + $objContatoDTO->retStrBairro(); + $objContatoDTO->retStrCep(); + $arrContatoDTO = $contatoRN->consultarRN0324($objContatoDTO); + + $noOrgao = $objOrgaoDTO->getStrDescricao(); + $endereco = $arrContatoDTO->getStrEndereco(); + $noCidade = $arrContatoDTO->getNumIdCidade(); + $uf = $arrContatoDTO->getNumIdUf(); + $bairro = $arrContatoDTO->getStrBairro(); + $cep = $arrContatoDTO->getStrCep(); + + if (empty($endereco) or is_null($endereco)) { + $erros[$noOrgao][] = 'Endereço'; + } + + if (empty($bairro)or is_null($endereco)) { + $erros[$noOrgao][] = 'Bairro'; + } + + if (empty($uf) or is_null($endereco)) { + $erros[$noOrgao][] = 'Estado'; + } + + if (empty($noCidade) or is_null($noCidade)) { + $erros[$noOrgao][] = 'Cidade'; + } + + if (empty($cep) or is_null($cep)) { + $erros[$noOrgao][] = 'CEP'; + } + } + + if (is_array($erros) && count($erros) > 0) { + + $str_msg_validacao = "Existe(m) Unidade(s) Expedidora(s) com dados cadastrais incompletos. Antes é necessário preencher os dados abaixo:" . '\n'; + foreach ($erros as $unidade => $erro) { + foreach ($erro as $dErro) { + $str_msg_validacao .= '(' . $unidade . ') - ' . $dErro . '\n'; + } + } + + throw new InfraException($str_msg_validacao); + } + } + } diff --git a/sei/web/modulos/correios/rn/MdCorWsRastreioRN.php b/sei/web/modulos/correios/rn/MdCorWsRastreioRN.php index e6e24f0..a3accae 100644 --- a/sei/web/modulos/correios/rn/MdCorWsRastreioRN.php +++ b/sei/web/modulos/correios/rn/MdCorWsRastreioRN.php @@ -19,6 +19,8 @@ class MdCorWsRastreioRN extends nusoap_client private $_resultado; private $_lingua; private $_wsdl; + private $_token; + private $_expiraEm; public function __construct($params = array()) { @@ -29,11 +31,14 @@ public function __construct($params = array()) $this->_resultado = isset($params['resultado']) ? $params['resultado'] : 'T'; //U - Ultimo evento, T - Todos os eventos $this->_lingua = isset($params['lingua']) ? $params['lingua'] : '101'; $this->_wsdl = isset($params['wsdl']) ? $params['wsdl'] : true; + $this->_token = isset($params['token']) ? $params['token'] : ''; + $this->_expiraEm = isset($params['expiraEm']) ? $params['expiraEm'] : ''; - parent::nusoap_client($this->_endpoint, $this->_wsdl); + //parent::nusoap_client($this->_endpoint, $this->_wsdl); } + /* public function rastrearObjeto($codigoRastreio) { try { @@ -55,11 +60,136 @@ public function rastrearObjeto($codigoRastreio) }else{ return false; } - - } catch (Exception $e) { throw new Exception('Erro ao rastrear o objeto' . $e->getMessage()); } } + */ + + public function rastrearObjeto($codigoRastreio){ + //$objInfraException = new InfraException(); + + $urlServico = $this->_endpoint .'/'. $codigoRastreio; + + if ( !filter_var( $urlServico , FILTER_VALIDATE_URL ) ) + throw new InfraException("Endereço do WebService inválido!"); + + $curl = curl_init( $urlServico ); + + curl_setopt_array( $curl, [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYPEER => false, + CURLOPT_CONNECTTIMEOUT => 5, + CURLOPT_TIMEOUT => 20, + CURLOPT_CUSTOMREQUEST => 'GET' + ]); + + // monta dados de parametros necessarios + if ( $this->_resultado ) { + $payload = json_encode( ['resultado' => $this->_resultado] ); + curl_setopt( $curl, CURLOPT_POSTFIELDS, $payload ); + } + + // monta dados de cabecalho + $headers = [ + 'Content-Type: application/json', + 'Accept: application/json', + 'Authorization: Bearer ' . $this->_token + ]; + + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + // executa a consulta no webservice + $ret = curl_exec( $curl ); + $info = curl_getinfo( $curl ); + $ret = self::trataRetornoCurl( $info , $ret ); + + if ( $info['http_code'] == 0 ) $ret['msg'] = curl_error($curl); + + if ( $ret['suc'] === false ) { + $strError = "STATUS CODE: " . $ret['code'] . " - ". $ret['msg']; + return ['objeto' => ['erro' => $strError , 'numero' => $codigoRastreio] ]; + } else { + curl_close( $curl ); + return $ret['dados']; + } + } + + public function gerarToken($arrParametro){ + //$objInfraException = new InfraException(); + + $urlServico = 'https://api.correios.com.br/token/v1/autentica/cartaopostagem'; + + if ( !filter_var( $urlServico , FILTER_VALIDATE_URL ) ) + throw new InfraException("Endereço do WebService inválido!"); + + $curl = curl_init( $urlServico ); + + curl_setopt_array( $curl, [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYPEER => false, + CURLOPT_CONNECTTIMEOUT => 5, + CURLOPT_TIMEOUT => 20, + CURLOPT_CUSTOMREQUEST => 'POST' + ]); + + // monta dados de parametros necessarios, neste caso, somente o numero do cartao de postagem + //if ( $this->_resultado ) { + $payload = json_encode( ['numero' => '0073770523'] ); + curl_setopt( $curl, CURLOPT_POSTFIELDS, $payload ); + //} + + // monta dados de cabecalho + $headers = [ + 'Content-Type: application/json', + 'Accept: application/json', + 'Authorization: Basic YW5hdGVsMDE6bVAzZldSeGRTZUdyTFl4a2FzeldJTVBQR0FKQkdkZFczRDlkdzZwZA==', + ]; + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + // monta credenciais usuario e senha + curl_setopt($curl,CURLOPT_USERPWD,"{$arrParametro['usuario']}:{$arrParametro['senha']}"); + + // executa a consulta no webservice + $ret = curl_exec( $curl ); + $info = curl_getinfo( $curl ); + $ret = self::trataRetornoCurl( $info , $ret ); + + if ( $info['http_code'] == 0 ) $ret['msg'] = curl_error($curl); + + if ( $ret['suc'] === false ) { + $strError = "STATUS CODE: " . $ret['code'] . " - ". $ret['msg']; + return ['objeto' => ['erro' => $strError , 'numero' => '0000000000'] ]; + } else { + curl_close( $curl ); + return $ret['dados']; + } + } + + private static function trataRetornoCurl( $info , $ret ){ + $arrRet = ['suc' => false , 'msg' => null , 'dados' => null , 'code' => $info['http_code']]; + #$type = gettype( $ret ); + $rs = json_decode( $ret , true ); + + switch ( $info['http_code'] ) { + case 200: + case 201: + $arrRet['suc'] = true; + $arrRet['dados'] = $rs; + break; + + case 400: + case 403: + case 404: + case 500: + $arrRet['msg'] = utf8_decode( $rs['msgs'][0] ); + break; + + default: + $arrRet['msg'] = 'Falha não Identificada'; + break; + } + return $arrRet; + } } \ No newline at end of file diff --git a/sip/scripts/sip_atualizar_versao_modulo_correios.php b/sip/scripts/sip_atualizar_versao_modulo_correios.php index 5f76da0..fde6dac 100644 --- a/sip/scripts/sip_atualizar_versao_modulo_correios.php +++ b/sip/scripts/sip_atualizar_versao_modulo_correios.php @@ -5,10 +5,10 @@ class MdCorAtualizadorSipRN extends InfraRN { private $numSeg = 0; - private $versaoAtualDesteModulo = '2.2.0'; + private $versaoAtualDesteModulo = '2.3.0'; private $nomeDesteModulo = 'MÓDULO DOS CORREIOS'; private $nomeParametroModulo = 'VERSAO_MODULO_CORREIOS'; - private $historicoVersoes = array('1.0.0', '2.0.0', '2.1.0','2.2.0'); + private $historicoVersoes = array('1.0.0', '2.0.0', '2.1.0','2.2.0','2.3.0'); public function __construct() { @@ -66,15 +66,6 @@ protected function finalizar($strMsg = null, $bolErro = false) die; } - protected function normalizaVersao($versao) - { - $ultimoPonto = strrpos($versao, '.'); - if ($ultimoPonto !== false) { - $versao = substr($versao, 0, $ultimoPonto) . substr($versao, $ultimoPonto + 1); - } - return $versao; - } - protected function atualizarVersaoConectado() { @@ -90,7 +81,7 @@ protected function atualizarVersaoConectado() //testando versao do framework $numVersaoInfraRequerida = '2.0.18'; - if ($this->normalizaVersao(VERSAO_INFRA) < $this->normalizaVersao($numVersaoInfraRequerida)) { + if (version_compare(VERSAO_INFRA, $numVersaoInfraRequerida) < 0) { $this->finalizar('VERSÃO DO FRAMEWORK PHP INCOMPATÍVEL (VERSÃO ATUAL ' . VERSAO_INFRA . ', SENDO REQUERIDA VERSÃO IGUAL OU SUPERIOR A ' . $numVersaoInfraRequerida . ')', true); } @@ -116,6 +107,8 @@ protected function atualizarVersaoConectado() $this->instalarv210(); case '2.1.0': $this->instalarv220(); + case '2.2.0': + $this->instalarv230(); break; default: @@ -689,6 +682,128 @@ protected function instalarv220() $this->atualizarNumeroVersao($nmVersao); } + protected function instalarv230(){ + $nmVersao = '2.3.0'; + $this->logar('EXECUTANDO A INSTALAÇÃO/ATUALIZAÇÃO DA VERSÃO '. $nmVersao .' DO ' . $this->nomeDesteModulo . ' NA BASE DO SIP'); + + $objSistemaRN = new SistemaRN(); + $objPerfilRN = new PerfilRN(); + $objMenuRN = new MenuRN(); + $objItemMenuRN = new ItemMenuRN(); + + // retorna ID do Sistema Principal + $objSistemaDTO = new SistemaDTO(); + $objSistemaDTO->retNumIdSistema(); + $objSistemaDTO->setStrSigla('SEI'); + + $objSistemaDTO = $objSistemaRN->consultar($objSistemaDTO); + + if ($objSistemaDTO == null) { + throw new InfraException('Sistema SEI não encontrado.'); + } + + $numIdSistemaSei = $objSistemaDTO->getNumIdSistema(); + + // Perfil Administrador e Basico + $objPerfilDTO = new PerfilDTO(); + $objPerfilDTO->retNumIdPerfil(); + $objPerfilDTO->retStrNome(); + $objPerfilDTO->setNumIdSistema($numIdSistemaSei); + // caso seja necessario adicionar ou remover o perfil, editar o array abaixo + $objPerfilDTO->setStrNome(['Administrador','Básico','Expedição Correios'] , InfraDTO::$OPER_IN); + $objPerfilDTO = $objPerfilRN->listar($objPerfilDTO); + + if ($objPerfilDTO == null) { + throw new InfraException('Perfil buscado no sistema SEI não encontrado.'); + } + + $arrPerfis = InfraArray::converterArrInfraDTO($objPerfilDTO,'IdPerfil','Nome'); + + /* + * Inicia o vinculo dos perfis com recursos relacionados a integração + * $k => Nome , $v => IdPerfil + */ + foreach($arrPerfis as $k => $v ) { + $this->logar('CRIANDO e VINCULANDO RECURSO DO PERFIL '. $k .' - Mapeamento das Integrações'); + + //Relacionamento dos recursos para todos os perfis do loop + $objRecursoComMenuDTO = $this->adicionarRecursoPerfil($numIdSistemaSei, $v , 'md_cor_adm_integracao_listar'); + + $this->adicionarRecursoPerfil($numIdSistemaSei, $v, 'md_cor_adm_integracao_consultar'); + $this->adicionarRecursoPerfil($numIdSistemaSei, $v, 'md_cor_adm_integracao_alterar'); + + //Administrador já tem perfil relacionado a recurso md_cor_contrato_consultar, então cria somente + //para os perfis do array abaixo + if ( in_array( $k , ['Básico','Expedição Correios'] ) ) { + $this->adicionarRecursoPerfil($numIdSistemaSei, $v, 'md_cor_contrato_consultar'); + } + + if ( $k == 'Administrador') { + $this->adicionarRecursoPerfil($numIdSistemaSei, $v, 'md_cor_adm_integracao_cadastrar'); + $this->adicionarRecursoPerfil($numIdSistemaSei, $v, 'md_cor_adm_integracao_excluir'); + $this->adicionarRecursoPerfil($numIdSistemaSei, $v, 'md_cor_adm_integracao_desativar'); + $this->adicionarRecursoPerfil($numIdSistemaSei, $v, 'md_cor_adm_integracao_reativar'); + + $idItemMenuPrincipal = $this->_getIdItemMenuCorreiosNaAdministracao($numIdSistemaSei); + $numIdMenuSei = $this->validarMenu('Principal', $numIdSistemaSei, $objMenuRN); + + $this->adicionarItemMenu($numIdSistemaSei, + $v, + $numIdMenuSei, + $idItemMenuPrincipal, + $objRecursoComMenuDTO->getNumIdRecurso(), + 'Mapeamento das Integrações', + 110); + } + } + + // Alterar nome de Menu Gerar e Expedir PLP para Gerar e Expedir Pré-Postagem + $numIdMenuSei = $this->validarMenu('Principal', $numIdSistemaSei, $objMenuRN); + + // [ 0 => nomes atuais , 1 => nome para qual sera alterado ] + $arrNomesUrls = [ + ['Gerar PLP','Expedir PLP','Consultar PLPs Geradas','Tipos de Situações SRO'], + ['Gerar Pré-Postagem','Expedir Pré-Postagem','Consultar Pré-Postagens Geradas','Tipos de Situações de Rastreamento'] + ]; + + $objItemMenuDTO = new ItemMenuDTO(); + $objItemMenuDTO->retTodos(); + + $objItemMenuDTO->setNumIdSistema($numIdSistemaSei); + $objItemMenuDTO->setNumIdMenu($numIdMenuSei); + $objItemMenuDTO->setStrRotulo($arrNomesUrls[0],InfraDTO::$OPER_IN); + + $arrObjItemMenuDTO = $objItemMenuRN->listar($objItemMenuDTO); + + if ( $arrObjItemMenuDTO ) { + foreach ($arrObjItemMenuDTO as $itemMenuDTO) { + foreach ( $arrNomesUrls[0] as $k => $nmASerAlterado ) { + if ( $itemMenuDTO->getStrRotulo() == $nmASerAlterado ) { + $this->logar('Alterar nome do Menu '. $nmASerAlterado .' para '. $arrNomesUrls[1][$k] .''); + $itemMenuDTO->setStrRotulo($arrNomesUrls[1][$k]); + break; + } + } + $objItemMenuRN->alterar($itemMenuDTO); + } + } + + // Remover recursos relacionados ao rastreio + $numIdMenu = $this->_getIdMenu($numIdSistemaSei); + $numIdItemMenu = $this->_getIdItemMenu($numIdSistemaSei,'Integração SRO'); + + $this->logar('Remover o Menu Integração SRO'); + $this->removerItemMenu($numIdSistemaSei, $numIdMenu, $numIdItemMenu); + + $this->logar('Remover os Recursos atrelados ao parametro de rastreio'); + $this->removerRecurso($numIdSistemaSei, 'md_cor_parametro_rastreio_alterar'); + $this->removerRecurso($numIdSistemaSei, 'md_cor_parametro_rastreio_consultar'); + $this->removerRecurso($numIdSistemaSei, 'md_cor_parametro_rastreio_listar'); + $this->removerRecurso($numIdSistemaSei, 'md_cor_parametro_rastreio_cadastrar'); + $this->removerRecurso($numIdSistemaSei, 'md_cor_parametrizacao_rastreio_listar'); + + $this->atualizarNumeroVersao($nmVersao); + } /** * Atualiza o número de versão do módulo na tabela de parâmetro do sistema @@ -1097,6 +1212,82 @@ private function getArrNumIdSei($nomePerfil = 'Administrador') return array('numIdPerfilSei' => $objPerfilDTO->getNumIdPerfil(), 'numIdSistemaSei' => $numIdSistemaSei); } + private function _getIdItemMenuCorreiosNaAdministracao($numIdSistema) + { + $rotuloItemMenu = 'Correios'; + $rotuloItemMenuAdm = 'Administração'; + + $objItemMenuRN = new ItemMenuRN(); + + //captura informação do menu Administração + $objItemMenuAdmDTO = new ItemMenuDTO(); + $objItemMenuAdmDTO->retNumIdItemMenu(); + + $objItemMenuAdmDTO->setNumIdSistema($numIdSistema); + $objItemMenuAdmDTO->setStrRotulo($rotuloItemMenuAdm); + $objItemMenuAdmDTO = $objItemMenuRN->consultar($objItemMenuAdmDTO); + + if ($objItemMenuAdmDTO == null) { + $msg = 'Item de menu Administração do sistema no encontrado.'; + throw new InfraException($msg); + } + + $objItemMenuDTO = new ItemMenuDTO(); + $objItemMenuDTO->retNumIdItemMenu(); + + $objItemMenuDTO->setNumIdSistema($numIdSistema); + $objItemMenuDTO->setStrRotulo($rotuloItemMenu); + $objItemMenuDTO->setNumIdItemMenuPai($objItemMenuAdmDTO->getNumIdItemMenu()); + + $objItemMenuDTO = $objItemMenuRN->consultar($objItemMenuDTO); + + if ($objItemMenuDTO == null) { + $msg = 'Item de menu ' . $rotuloItemMenu . ' do sistema no encontrado.'; + throw new InfraException($msg); + } + + $numIdItemMenuSeiAdm = $objItemMenuDTO->getNumIdItemMenu(); + + return $numIdItemMenuSeiAdm; + } + + private function _getIdMenu($numIdSistema, $nomeMenu = 'Principal') + { + $objMenuRN = new MenuRN(); + $objMenuDTO = new MenuDTO(); + $objMenuDTO->retNumIdMenu(); + $objMenuDTO->setNumIdSistema($numIdSistema); + $objMenuDTO->setStrNome($nomeMenu); + $objMenuDTO = $objMenuRN->consultar($objMenuDTO); + + if ($objMenuDTO == null) { + throw new InfraException('Menu do sistema não encontrado.'); + } + + $idMenu = $objMenuDTO->getNumIdMenu(); + + return $idMenu; + } + + private function _getIdItemMenu($numIdSistema, $rotuloItemMenu = 'Administração') + { + $objItemMenuRN = new ItemMenuRN(); + $objItemMenuDTO = new ItemMenuDTO(); + $objItemMenuDTO->retNumIdItemMenu(); + $objItemMenuDTO->setNumIdSistema($numIdSistema); + $objItemMenuDTO->setStrRotulo($rotuloItemMenu); + $objItemMenuDTO = $objItemMenuRN->consultar($objItemMenuDTO); + + if ($objItemMenuDTO == null) { + $msg = 'Item de menu ' . $rotuloItemMenu . ' do sistema no encontrado.'; + throw new InfraException($msg); + } + + $numIdItemMenuSeiAdm = $objItemMenuDTO->getNumIdItemMenu(); + + return $numIdItemMenuSeiAdm; + } + } try {
' . PaginaSEI::getInstance()->gerarCaptionTabela($strCaptionTabela, $numRegistros) . '
' . PaginaSEI::getInstance()->getThCheck() . '' . PaginaSEI::getInstance()->getThOrdenacao($objMdCorPlpDTO, 'PLP', 'CodigoPlp', $arrObjMdCorPlpDTO) . '' . PaginaSEI::getInstance()->getThOrdenacao($objMdCorPlpDTO, 'PLP', 'CodigoPlp', $arrObjMdCorPlpDTO) . '' . PaginaSEI::getInstance()->getThOrdenacao($objMdCorPlpDTO, 'Data da PLP', 'DataCadastro', $arrObjMdCorPlpDTO) . '' . PaginaSEI::getInstance()->getThOrdenacao($objMdCorPlpDTO, 'Data de Geração', 'DataCadastro', $arrObjMdCorPlpDTO) . '' . 'Serviços Postais' . '' . 'Serviço Postal' . '' . PaginaSEI::getInstance()->getThOrdenacao($objMdCorPlpDTO, 'Objetos', 'Contagem', $arrObjMdCorPlpDTO) . '' . PaginaSEI::getInstance()->getThOrdenacao($objMdCorPlpDTO, 'Situação', 'StaPlp', $arrObjMdCorPlpDTO) . 'AçõesAções
' . PaginaSEI::tratarHTML($objMdCorPlpDTO->getDthDataCadastro()) . '' . PaginaSEI::tratarHTML($arrServico) . '' . PaginaSEI::tratarHTML($arrServico) . '' . $midia . PaginaSEI::tratarHTML($objMdCorPlpDTO->getNumContagem()) . '' . PaginaSEI::tratarHTML($objMdCorPlpDTO->getStrNomeStaPlp()) . ''; if ($_GET['acao'] == 'md_cor_expedicao_plp_listar') { - $strResultado .= 'Expedir PLP '; + $strResultado .= 'Expedir '. MdCorPlpRN::$STR_SING_PRE_POSTAGEM .' '; + + $linkCancelarPlp = PaginaSEI::getInstance()->formatarXHTML(SessaoSEI::getInstance()->assinarLink('controlador_ajax.php?acao_ajax=md_cor_plp_cancelar_plp')); + $codRastreamento = $objMdCorPlpDTO->getArrMdCorExpedicaoSolicitadaDTO()[0]->getStrCodigoRastreamento(); + $strResultado .= ' + Cancelar '. MdCorPlpRN::$STR_SING_PRE_POSTAGEM .' +  '; } else { - $strResultado .= 'Detalhar PLP '; + $strResultado .= 'Detalhar '. MdCorPlpRN::$STR_SING_PRE_POSTAGEM .' '; } $strResultado .= '