From 6f9c6d8e8f9617d890aa0550ab431c6583c56c5a Mon Sep 17 00:00:00 2001 From: Lucas D'Avila Date: Fri, 8 Mar 2013 20:00:09 -0300 Subject: [PATCH] Escapado strings ao cadastrar / pesquisar pessoa fisica, aluno e endereçamento. --- ieducar/intranet/atendidos_cad.php | 369 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ieducar/intranet/educar_aluno_cad.php | 5 ----- ieducar/intranet/educar_pesquisa_cep_log_bairro.php | 177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------ ieducar/intranet/include/clsListagem.inc.php | 8 ++++++++ ieducar/intranet/include/pessoa/clsPessoaFisica.inc.php | 8 ++++++-- ieducar/intranet/include/pessoa/clsPessoa_.inc.php | 7 ++----- ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php | 8 ++++++++ ieducar/intranet/include/public/clsPublicBairro.inc.php | 6 +++--- ieducar/intranet/include/public/clsPublicLogradouro.inc.php | 12 ++++++------ ieducar/intranet/include/public/clsPublicMunicipio.inc.php | 10 +++++----- ieducar/intranet/include/public/clsPublicPais.inc.php | 10 +++++----- ieducar/intranet/include/public/clsPublicUf.inc.php | 10 +++++----- ieducar/intranet/public_uf_det.php | 10 +++++----- ieducar/intranet/public_uf_lst.php | 7 ++++--- ieducar/lib/Portabilis/Controller/Page/ListController.php | 7 ------- ieducar/modules/Api/Views/AlunoController.php | 13 +++++++++++-- ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js | 4 ++++ ieducar/modules/Cadastro/Assets/Javascripts/PessoaFisica.js | 2 -- ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Resource.js | 8 ++++++++ ieducar/modules/Portabilis/Assets/Version.php | 2 +- 20 files changed, 302 insertions(+), 381 deletions(-) diff --git a/ieducar/intranet/atendidos_cad.php b/ieducar/intranet/atendidos_cad.php index f751d69..56d33fa 100755 --- a/ieducar/intranet/atendidos_cad.php +++ b/ieducar/intranet/atendidos_cad.php @@ -94,7 +94,6 @@ class indice extends clsCadastro var $ddd_telefone_fax; var $telefone_fax; var $email; - var $http; var $tipo_pessoa; var $sexo; var $busca_pessoa; @@ -110,8 +109,6 @@ class indice extends clsCadastro var $caminho_det; var $caminho_lst; - var $alterado; - function Inicializar() { $this->cod_pessoa_fj = @$_GET['cod_pessoa_fj']; @@ -125,7 +122,7 @@ class indice extends clsCadastro $this->ddd_telefone_1, $this->telefone_1, $this->ddd_telefone_2, $this->telefone_2, $this->ddd_telefone_mov, $this->telefone_mov, $this->ddd_telefone_fax, $this->telefone_fax, $this->email, - $this->http, $this->tipo_pessoa, $this->sexo, $this->cidade, + $this->tipo_pessoa, $this->sexo, $this->cidade, $this->bairro, $this->logradouro, $this->cep, $this->idlog, $this->idbai, $this->idtlog, $this->sigla_uf, $this->complemento, $this->numero, $this->bloco, $this->apartamento, $this->andar, $this->zona_localizacao, $this->estado_civil, @@ -136,7 +133,7 @@ class indice extends clsCadastro $objPessoa->queryRapida( $this->cod_pessoa_fj, 'nome', 'cpf', 'data_nasc', 'ddd_1', 'fone_1', 'ddd_2', 'fone_2', 'ddd_mov', 'fone_mov', 'ddd_fax', 'fone_fax', 'email', - 'url', 'tipo', 'sexo', 'cidade', 'bairro', 'logradouro', 'cep', 'idlog', + 'tipo', 'sexo', 'cidade', 'bairro', 'logradouro', 'cep', 'idlog', 'idbai', 'idtlog', 'sigla_uf', 'complemento', 'numero', 'bloco', 'apartamento', 'andar', 'zona_localizacao', 'ideciv', 'idpes_pai', 'idpes_mae', 'nacionalidade', 'idpais_estrangeiro', 'idmun_nascimento', 'letra' @@ -798,17 +795,8 @@ class indice extends clsCadastro $this->inputTelefone('2', 'Telefone adicional'); $this->inputTelefone('fax', 'Fax'); - $this->campoTexto('http', 'Site', $this->http, '50', '255', FALSE); - $this->campoTexto('email', 'E-mail', $this->email, '50', '255', FALSE); - /*if ($this->cod_pessoa_fj) { - $this->campoRotulo('documentos', 'Documentos', - "cod_pessoa_fj}'); \">"); - - $this->campoCheck('alterado', 'Alterado', $this->alterado); - }*/ - // after change pessoa pai / mae @@ -828,189 +816,15 @@ class indice extends clsCadastro Portabilis_View_Helper_Application::loadJavascript($this, $script); } - function Novo() - { - - if (! $this->validatesCpf($this->id_federal)) - return false; - - // pessoa - - $objPessoa = new clsPessoa_(FALSE, $this->nm_pessoa, $this->currentUserId(), $this->http, - 'F', FALSE, FALSE, $this->email); - - $idpes = $objPessoa->cadastra(); - - // pessoa fisica - - $fisica = new clsFisica(); - - $fisica->idpes = $idpes; - $fisica->data_nasc = Portabilis_Date_Utils::brToPgSQL($this->data_nasc); - $fisica->sexo = $this->sexo; - $fisica->ref_cod_sistema = 'NULL'; - $fisica->cpf = idFederal2int($this->id_federal); - $fisica->ideciv = $this->estado_civil_id; - $fisica->idpes_pai = $this->pai_id; - $fisica->idpes_mae = $this->mae_id; - $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade']; - $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id']; - $fisica->idmun_nascimento = $_REQUEST['naturalidade_id']; - - $fisica->cadastra(); - - $this->createOrUpdateDocumentos($idpes); - - $objTelefone = new clsPessoaTelefone($idpes, 1, $this->telefone_1, $this->ddd_telefone_1); - $objTelefone->cadastra(); - - $objTelefone = new clsPessoaTelefone($idpes, 2, $this->telefone_2, $this->ddd_telefone_2); - $objTelefone->cadastra(); - - $objTelefone = new clsPessoaTelefone($idpes, 3, $this->telefone_mov, $this->ddd_telefone_mov); - $objTelefone->cadastra(); - - $objTelefone = new clsPessoaTelefone($idpes, 4, $this->telefone_fax, $this->ddd_telefone_fax); - $objTelefone->cadastra(); - - if ($this->cep && $this->idbai && $this->idlog) { - $this->cep = idFederal2Int($this->cep); - $objEndereco = new clsPessoaEndereco($idpes); - $objEndereco2 = new clsPessoaEndereco($idpes, $this->cep, $this->idlog, - $this->idbai, $this->numero, $this->complemento, FALSE, $this->letra, - $this->bloco, $this->apartamento, $this->andar); - - if ($objEndereco->detalhe()) { - $objEndereco2->edita(); - } - else { - $objEndereco2->cadastra(); - } - } - elseif($this->cep_) { - $this->cep_ = idFederal2int($this->cep_); - - $objEnderecoExterno = new clsEnderecoExterno($idpes); - $objEnderecoExterno2 = new clsEnderecoExterno($idpes, '1', $this->idtlog, - $this->logradouro, $this->numero, $this->letra, $this->complemento, - $this->bairro, $this->cep_, $this->cidade, $this->sigla_uf, FALSE, - $this->bloco, $this->apartamento, $this->andar, FALSE, FALSE, - $this->zona_localizacao); - - if ($objEnderecoExterno->detalhe()) { - $objEnderecoExterno2->edita(); - } - else { - $objEnderecoExterno2->cadastra(); - } - } - - // Cadastra raça. - $this->_cadastraRaca($idpes, $this->cor_raca); - - $this->afterChangePessoa($idpes); - return TRUE; + function Novo() { + return $this->createOrUpdate(); } - function Editar() - { - if (! $this->validatesCpf($this->id_federal)) - return false; - - // pessoa - - $objPessoa = new clsPessoa_($this->cod_pessoa_fj, $this->nm_pessoa, FALSE, - $this->p_http, FALSE, $this->currentUserId(), - date('Y-m-d H:i:s', time()), $this->email); - - $objPessoa->edita(); - - // pessoa fisica - - $fisica = new clsFisica(); - - $fisica->idpes = $this->cod_pessoa_fj; - $fisica->data_nasc = Portabilis_Date_Utils::brToPgSQL($this->data_nasc); - $fisica->sexo = $this->sexo; - $fisica->ref_cod_sistema = 'NULL'; - $fisica->cpf = $this->id_federal ? idFederal2int($this->id_federal) : 'NULL'; - $fisica->ideciv = $this->estado_civil_id; - $fisica->idpes_pai = $this->pai_id ? $this->pai_id : "NULL"; - $fisica->idpes_mae = $this->mae_id ? $this->mae_id : "NULL"; - $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade']; - $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id']; - $fisica->idmun_nascimento = $_REQUEST['naturalidade_id']; - - $fisica->edita(); - - $this->createOrUpdateDocumentos($this->cod_pessoa_fj); - - if ($this->alterado) { - $db = new clsBanco(); - $db->Consulta("UPDATE cadastro.fisica SET alterado = 'TRUE' WHERE idpes = '$this->cod_pessoa_fj'"); - } - - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 1, - $this->telefone_1, $this->ddd_telefone_1); - $objTelefone->cadastra(); - - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 2, - $this->telefone_2, $this->ddd_telefone_2); - $objTelefone->cadastra(); - - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 3, - $this->telefone_mov, $this->ddd_telefone_mov); - $objTelefone->cadastra(); - - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 4, - $this->telefone_fax, $this->ddd_telefone_fax); - $objTelefone->cadastra(); - - $objEndereco = new clsPessoaEndereco($this->cod_pessoa_fj); - - $this->cep = idFederal2Int($this->cep); - - $objEndereco2 = new clsPessoaEndereco($this->cod_pessoa_fj, $this->cep, - $this->idlog, $this->idbai, $this->numero, $this->complemento, FALSE, - $this->letra, $this->bloco, $this->apartamento,$this->andar); - - if ($objEndereco->detalhe() && $this->cep && $this->idlog && $this->idbai) { - $objEndereco2->edita(); - } - elseif ($this->cep && $this->idlog && $this->idbai) { - $objEndereco2->cadastra(); - } - elseif ($objEndereco->detalhe()) { - $objEndereco2->exclui(); - } - else { - $this->cep_ = idFederal2int($this->cep_); - $objEnderecoExterno = new clsEnderecoExterno($this->cod_pessoa_fj); - - $objEnderecoExterno2 = new clsEnderecoExterno($this->cod_pessoa_fj, '1', - $this->idtlog, $this->logradouro, $this->numero, $this->letra, - $this->complemento, $this->bairro, $this->cep_, $this->cidade, - $this->sigla_uf, FALSE, $this->bloco, $this->apartamento, $this->andar, - FALSE, FALSE, $this->zona_localizacao); - - if ($objEnderecoExterno->detalhe()) { - $objEnderecoExterno2->edita(); - } - else { - $objEnderecoExterno2->cadastra(); - } - } - - // Atualizada raça. - $this->_cadastraRaca($this->cod_pessoa_fj, $this->cor_raca); - - $this->afterChangePessoa($this->cod_pessoa_fj); - - return TRUE; + function Editar() { + return $this->createOrUpdate($this->cod_pessoa_fj); } - function Excluir() - { + function Excluir() { echo ''; return TRUE; } @@ -1032,28 +846,6 @@ class indice extends clsCadastro ", $afterReady = true); } - /** - * Cadastra ou atualiza a raça de uma pessoa. - * - * @access protected - * @param int $pessoaId - * @param int $corRaca - * @return bool - * @since Método disponível desde a versão 1.2.0 - */ - function _cadastraRaca($pessoaId, $corRaca) - { - $pessoaId = (int) $pessoaId; - $corRaca = (int) $corRaca; - - $raca = new clsCadastroFisicaRaca($pessoaId, $corRaca); - if ($raca->existe()) { - return $raca->edita(); - } - - return $raca->cadastra(); - } - protected function loadAlunoByPessoaId($id) { $aluno = new clsPmieducarAluno(); $aluno->ref_idpes = $id; @@ -1127,6 +919,79 @@ class indice extends clsCadastro return $isValid; } + protected function createOrUpdate($pessoaIdOrNull = null) { + if (! $this->validatesCpf($this->id_federal)) + return false; + + $pessoaId = $this->createOrUpdatePessoa($pessoaIdOrNull); + + $this->createOrUpdatePessoaFisica($pessoaId); + $this->createOrUpdateDocumentos($pessoaId); + $this->createOrUpdateTelefones($pessoaId); + $this->createOrUpdateEndereco($pessoaId); + + $this->afterChangePessoa($pessoaId); + return true; + } + + protected function createOrUpdatePessoa($pessoaId = null) { + $pessoa = new clsPessoa_(); + $pessoa->idpes = $pessoaId; + $pessoa->nome = addslashes($this->nm_pessoa); + $pessoa->email = addslashes($this->email); + + $sql = "select 1 from cadastro.pessoa WHERE idpes = $1 limit 1"; + + if (! $pessoaId || Portabilis_Utils_Database::selectField($sql, $pessoaId) != 1) { + $pessoa->tipo = 'F'; + $pessoa->idpes_cad = $this->currentUserId(); + $pessoaId = $pessoa->cadastra(); + } + else { + $pessoa->idpes_rev = $this->currentUserId(); + $pessoa->data_rev = date('Y-m-d H:i:s', time()); + $pessoa->edita(); + } + + return $pessoaId; + } + + protected function createOrUpdatePessoaFisica($pessoaId) { + $fisica = new clsFisica(); + $fisica->idpes = $pessoaId; + $fisica->data_nasc = Portabilis_Date_Utils::brToPgSQL($this->data_nasc); + $fisica->sexo = $this->sexo; + $fisica->ref_cod_sistema = 'NULL'; + $fisica->cpf = $this->id_federal ? idFederal2int($this->id_federal) : 'NULL'; + $fisica->ideciv = $this->estado_civil_id; + $fisica->idpes_pai = $this->pai_id ? $this->pai_id : "NULL"; + $fisica->idpes_mae = $this->mae_id ? $this->mae_id : "NULL"; + $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade']; + $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id']; + $fisica->idmun_nascimento = $_REQUEST['naturalidade_id']; + + $sql = "select 1 from cadastro.fisica WHERE idpes = $1 limit 1"; + + if (Portabilis_Utils_Database::selectField($sql, $pessoaId) != 1) + $fisica->cadastra(); + else + $fisica->edita(); + + $this->createOrUpdateRaca($pessoaId, $this->cor_raca); + } + + function createOrUpdateRaca($pessoaId, $corRaca) { + $pessoaId = (int) $pessoaId; + $corRaca = (int) $corRaca; + + $raca = new clsCadastroFisicaRaca($pessoaId, $corRaca); + + if ($raca->existe()) + return $raca->edita(); + + return $raca->cadastra(); + } + protected function createOrUpdateDocumentos($pessoaId) { $documentos = new clsDocumento(); $documentos->idpes = $pessoaId; @@ -1171,8 +1036,7 @@ class indice extends clsCadastro ); $documentos->sigla_uf_cert_civil = $_REQUEST['uf_emissao_certidao_civil']; - $documentos->cartorio_cert_civil = $_REQUEST['cartorio_emissao_certidao_civil']; - + $documentos->cartorio_cert_civil = addslashes($_REQUEST['cartorio_emissao_certidao_civil']); // carteira de trabalho @@ -1207,6 +1071,77 @@ class indice extends clsCadastro $documentos->edita(); } + protected function _createOrUpdatePessoaEndereco($pessoaId) { + $endereco = new clsPessoaEndereco( + $pessoaId, + idFederal2Int($this->cep), + $this->idlog, + $this->idbai, + $this->numero, + addslashes($this->complemento), + FALSE, + addslashes($this->letra), + addslashes($this->bloco), + $this->apartamento, + $this->andar + ); + + // forçado exclusão, assim ao cadastrar endereco_pessoa novamente, + // será excluido endereco_externo (por meio da trigger fcn_aft_ins_endereco_pessoa). + $endereco->exclui(); + $endereco->cadastra(); + } + + protected function _createOrUpdateEnderecoExterno($pessoaId) { + $endereco = new clsEnderecoExterno( + $pessoaId, + '1', + $this->idtlog, + addslashes($this->logradouro), + $this->numero, + addslashes($this->letra), + addslashes($this->complemento), + addslashes($this->bairro), + idFederal2int($this->cep_), + addslashes($this->cidade), + $this->sigla_uf, + FALSE, + addslashes($this->bloco), + $this->apartamento, + $this->andar, + FALSE, + FALSE, + $this->zona_localizacao + ); + + // forçado exclusão, assim ao cadastrar endereco_externo novamente, + // será excluido endereco_pessoa (por meio da trigger fcn_aft_ins_endereco_externo). + $endereco->exclui(); + $endereco->cadastra(); + } + + protected function createOrUpdateEndereco($pessoaId) { + $enderecoExterno = ! empty($this->cep_); + + if (! $enderecoExterno && $this->cep && $this->idbai && $this->idlog) + $this->_createOrUpdatePessoaEndereco($pessoaId); + + elseif($enderecoExterno) + $this->_createOrUpdateEnderecoExterno($pessoaId); + } + + protected function createOrUpdateTelefones($pessoaId) { + $telefones = array(); + + $telefones[] = new clsPessoaTelefone($pessoaId, 1, $this->telefone_1, $this->ddd_telefone_1); + $telefones[] = new clsPessoaTelefone($pessoaId, 2, $this->telefone_2, $this->ddd_telefone_2); + $telefones[] = new clsPessoaTelefone($pessoaId, 3, $this->telefone_mov, $this->ddd_telefone_mov); + $telefones[] = new clsPessoaTelefone($pessoaId, 4, $this->telefone_fax, $this->ddd_telefone_fax); + + foreach ($telefones as $telefone) + $telefone->cadastra(); + } + // inputs usados em Gerar, // implementado estes metodos para não duplicar código // uma vez que estes campos são usados várias vezes em Gerar. diff --git a/ieducar/intranet/educar_aluno_cad.php b/ieducar/intranet/educar_aluno_cad.php index 146ab79..fabb914 100644 --- a/ieducar/intranet/educar_aluno_cad.php +++ b/ieducar/intranet/educar_aluno_cad.php @@ -262,11 +262,6 @@ class indice extends clsCadastro $this->campoOculto('ref_idpes', $this->ref_idpes); $this->campoAdicionaTab('Dados Pessoais', $this->tab_habilitado); - if ($this->cod_aluno) { - $obj_matricula = new clsPmieducarMatricula(); - $lst_matricula = $obj_matricula->lista(NULL, NULL, NULL, NULL, NULL, NULL, $this->cod_aluno); - } - if (!empty($this->ref_idpes)) { $obj_aluno = new clsPmieducarAluno(); $lista_aluno = $obj_aluno->lista(NULL, NULL, NULL, NULL, NULL, diff --git a/ieducar/intranet/educar_pesquisa_cep_log_bairro.php b/ieducar/intranet/educar_pesquisa_cep_log_bairro.php index 3d09732..7b2da0f 100644 --- a/ieducar/intranet/educar_pesquisa_cep_log_bairro.php +++ b/ieducar/intranet/educar_pesquisa_cep_log_bairro.php @@ -108,27 +108,28 @@ class miolo1 extends clsListagem $this->campoTexto('nm_logradouro', 'Logradouro', $_GET['nm_logradouro'], 50, 255); $this->campoTexto('cidade', 'Cidade', $_GET['cidade'], 60, 60); - $obj_uf = new clsUf(FALSE, FALSE, 1); - $lst_uf = $obj_uf->lista(FALSE, FALSE, FALSE, FALSE, FALSE, 'sigla_uf'); + // uf - $array_uf; - foreach ($lst_uf as $uf) { - $array_uf[$uf['sigla_uf']] = $uf['nome']; - } - if (! $_GET['ref_sigla_uf']) { - $_GET['ref_sigla_uf'] = $coreExt['Config']->app->locale->province; - } - /* Portabilis: Foi comentada a linha abaixo e adicionado 'SC' no lugar de $_GET['ref_sigla_uf'], - para trazer o estado como defaut */ - /*$this->campoLista('ref_sigla_uf', 'UF', $array_uf, $_GET['ref_sigla_uf'], - '', FALSE, '');*/ - - $this->campoLista('ref_sigla_uf', 'UF', $array_uf, 'SC', - '', FALSE, ''); + $defaultProvince = isset($_GET['ref_sigla_uf']) ? $_GET['ref_sigla_uf'] : $coreExt['Config']->app->locale->province; + + $options = array( + 'required' => false, + 'label' => 'Estado', + 'value' => $defaultProvince + ); + + $helperOptions = array( + 'attrName' => 'ref_sigla_uf' + ); + + $this->inputsHelper()->uf($options, $helperOptions); $this->addCabecalhos(array('Bairro', 'CEP', 'Logradouro', 'UF', 'Cidade')); + + // consulta dados + $select = ' SELECT c.idlog, c.cep, c.idbai, u.sigla_uf, m.nome, t.idtlog, m.idmun, b.zona_localizacao @@ -143,111 +144,71 @@ class miolo1 extends clsListagem l.idtlog = t.idtlog AND m.sigla_uf = u.sigla_uf'; - $select_count = ' - SELECT - COUNT(*) - FROM - urbano.cep_logradouro_bairro c, public.bairro b, public.logradouro l, - public.municipio m, public.uf u, urbano.tipo_logradouro t - WHERE - c.idlog = l.idlog AND - c.idbai = b.idbai AND - l.idmun = b.idmun AND - l.idmun = m.idmun AND - l.idtlog = t.idtlog AND - m.sigla_uf = u.sigla_uf'; + $params = array(); + + if (isset($_GET['nr_cep'])) + $params['c.cep'] = idFederal2int($_GET['nr_cep']); + + if (isset($_GET['nm_bairro'])) + $params['b.nome'] = $_GET['nm_bairro']; - if ( - $_GET['nm_bairro'] || $_GET['nr_cep'] || $_GET['nm_logradouro'] || - $_GET['ref_sigla_uf'] || $_GET['cidade'] - ) { - if ($_GET['nr_cep']) { - $num_cep = idFederal2int($_GET['nr_cep']); - $select .= sprintf(' AND c.cep ILIKE \'%%%s%%\'', $num_cep); - $select_count .= sprintf(' AND c.cep ILIKE \'%%%s%%\'', $num_cep); - } - - if ($_GET['nm_bairro']) { - $select .= sprintf(' AND b.nome ILIKE \'%%%s%%\'', $_GET['nm_bairro']); - $select_count .= sprintf(' AND b.nome ILIKE \'%%%s%%\'', $_GET['nm_bairro']); - } - - if ($_GET['nm_logradouro']) { - $select .= sprintf(' AND l.nome ILIKE \'%%%s%%\'', $_GET['nm_logradouro']); - $select_count .= sprintf(' AND l.nome ILIKE \'%%%s%%\'', $_GET['nm_logradouro']); - } - - if ($_GET['ref_sigla_uf']) { - $select .= sprintf(' AND u.sigla_uf ILIKE \'%%%s%%\'', $_GET['ref_sigla_uf']); - $select_count .= sprintf(' AND u.sigla_uf ILIKE \'%%%s%%\'', $_GET['ref_sigla_uf']); - } - - if ($_GET['cidade']) { - $select .= sprintf(' AND m.nome ILIKE \'%%%s%%\'', $_GET['cidade']); - $select_count .= sprintf(' AND m.nome ILIKE \'%%%s%%\'', $_GET['cidade']); - } + if (isset($_GET['nm_logradouro'])) + $params['l.nome'] = $_GET['nm_logradouro']; + + if (isset($_GET['ref_sigla_uf'])) + $params['u.sigla_uf'] = $_GET['ref_sigla_uf']; + + if (isset($_GET['cidade'])) + $params['m.nome'] = $_GET['cidade']; + + $paramCount = 1; + + foreach ($params as $name => $value) { + $select .= " AND $name ILIKE '%'||\$$paramCount||'%'"; + $paramCount++; } $select .= sprintf(' LIMIT %s OFFSET %s', $limite, $iniciolimit); - $db = new clsBanco(); - $total = $db->CampoUnico($select_count); + $result = Portabilis_Utils_Database::fetchPreparedQuery($select, array('params' => array_values($params))); + $total = count($result); - $db->Consulta($select); + foreach ($result as $record) { + list($idlog, $cep, $idbai, $uf, $cidade, $tipoLogradouroId, $id_mun, $zona) = $record; - while ($db->ProximoRegistro()) { - list($idlog, $cep, $idbai, $uf, $cidade, $descricao,$id_mun, $zona) = - array('', '', '', '', '', '', '', ''); + $cidade = addslashes($cidade); - list($idlog, $cep, $idbai, $uf, $cidade, $descricao, $id_mun, $zona) = $db->Tupla(); + $logradouro = new clsLogradouro($idlog); + $logradouro = $logradouro->detalhe(); + $logradouro = addslashes($logradouro['nome']); - $logradouro = new clsLogradouro($idlog); - $detalhe_logradouro = $logradouro->detalhe(); - - $bairro = new clsBairro($idbai); - $detalhe_bairro = $bairro->detalhe(); + $bairro = new clsBairro($idbai); + $bairro = $bairro->detalhe(); + $bairro = addslashes($bairro['nome']); $cep2 = int2CEP($cep); $s_end = '0'; - $descricao = urlencode($descricao); - - if ($_GET['param']) { - $url = sprintf( - '%%s', - $cep, $cep2, $uf, $uf, $id_mun, $cidade, $detalhe_bairro['idbai'], $detalhe_bairro['nome'], $descricao, $descricao, $detalhe_logradouro['idlog'], $detalhe_logradouro['nome'] - ); - - $this->addLinhas(array( - sprintf($url, $detalhe_bairro['nome']), - sprintf($url, $cep2), - sprintf($url, $detalhe_logradouro["nome"]), - sprintf($url, $uf), - sprintf($url, $cidade) - )); - } - else { - $url = sprintf( - '%%s', - $_SESSION['campo1'], $detalhe_bairro["nome"], $_SESSION['campo2'], - $detalhe_bairro["idbai"], $_SESSION['campo3'], $cep, - $_SESSION['campo4'], $detalhe_logradouro["nome"], - $_SESSION['campo5'], $detalhe_logradouro["idlog"], - $_SESSION['campo6'], $uf, $_SESSION['campo7'], $cidade, - $_SESSION['campo8'], $descricao, $_SESSION['campo9'], $s_end, - $_SESSION['campo10'], $cep2, $_SESSION['campo11'], $uf, - $_SESSION['campo12'], $_SESSION['campo13'], $id_mun, - $_SESSION['campo14'], $zona - ); - - $this->addLinhas(array( - sprintf($url, $detalhe_bairro['nome']), - sprintf($url, $cep2), - sprintf($url, $detalhe_logradouro['nome']), - sprintf($url, $uf), - sprintf($url, $cidade) - )); - } + $url = sprintf( + '%%s', + $_SESSION['campo1'], $bairro, $_SESSION['campo2'], + $idbai, $_SESSION['campo3'], $cep, + $_SESSION['campo4'], $logradouro, + $_SESSION['campo5'], $idlog, + $_SESSION['campo6'], $uf, $_SESSION['campo7'], $cidade, + $_SESSION['campo8'], $tipoLogradouroId, $_SESSION['campo9'], $s_end, + $_SESSION['campo10'], $cep2, $_SESSION['campo11'], $uf, + $_SESSION['campo12'], $_SESSION['campo13'], $id_mun, + $_SESSION['campo14'], $zona + ); + + $this->addLinhas(array( + sprintf($url, $bairro), + sprintf($url, $cep2), + sprintf($url, $logradouro), + sprintf($url, $uf), + sprintf($url, $cidade) + )); } $this->largura = '100%'; diff --git a/ieducar/intranet/include/clsListagem.inc.php b/ieducar/intranet/include/clsListagem.inc.php index 048d2ca..43898b6 100755 --- a/ieducar/intranet/include/clsListagem.inc.php +++ b/ieducar/intranet/include/clsListagem.inc.php @@ -35,6 +35,7 @@ if (class_exists('clsPmiajudaPagina')) { } require_once 'Portabilis/View/Helper/Application.php'; +require_once 'Portabilis/View/Helper/Inputs.php'; define('alTopLeft', 'valign=top align=left'); define('alTopCenter', 'valign=top align=center'); @@ -745,4 +746,11 @@ class clsListagem extends clsCampos { die("
{$msg}
"); } + + public function inputsHelper() { + if (! isset($this->_inputsHelper)) + $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this); + + return $this->_inputsHelper; + } } diff --git a/ieducar/intranet/include/pessoa/clsPessoaFisica.inc.php b/ieducar/intranet/include/pessoa/clsPessoaFisica.inc.php index 6422d78..55b954a 100755 --- a/ieducar/intranet/include/pessoa/clsPessoaFisica.inc.php +++ b/ieducar/intranet/include/pessoa/clsPessoaFisica.inc.php @@ -153,13 +153,17 @@ class clsPessoaFisica extends clsPessoaFj $where = ''; if (is_string($str_nome) && $str_nome != '') { + $str_nome = addslashes($str_nome); $str_nome = str_replace(' ', '%', $str_nome); - $where .= "{$whereAnd} nome ILIKE '%{$str_nome}%' "; + + $where .= "{$whereAnd} nome ILIKE E'%{$str_nome}%' "; $whereAnd = ' AND '; } if (is_string($numeric_cpf)) { - $where .= "{$whereAnd} cpf ILIKE '%{$numeric_cpf}%' "; + $numeric_cpf = addslashes($numeric_cpf); + + $where .= "{$whereAnd} cpf ILIKE E'%{$numeric_cpf}%' "; $whereAnd = ' AND '; } diff --git a/ieducar/intranet/include/pessoa/clsPessoa_.inc.php b/ieducar/intranet/include/pessoa/clsPessoa_.inc.php index b4fc196..44f88d1 100755 --- a/ieducar/intranet/include/pessoa/clsPessoa_.inc.php +++ b/ieducar/intranet/include/pessoa/clsPessoa_.inc.php @@ -84,13 +84,11 @@ class clsPessoa_ $valores .= ", '$this->idpes_cad' "; } - $this->nome = str_replace("'", "", $this->nome); - $db = new clsBanco(); $db->Consulta("INSERT INTO {$this->schema_cadastro}.{$this->tabela_pessoa} (nome, data_cad,tipo,situacao,origem_gravacao, idsis_cad, operacao $campos) VALUES ('$this->nome', NOW(), '$this->tipo', 'P', 'U', 17, 'I' $valores)"); $this->idpes = $db->InsertId("{$this->schema_cadastro}.seq_pessoa"); - + return $this->idpes; } } @@ -115,7 +113,6 @@ class clsPessoa_ } if($this->nome || $this->nome==="") { - $this->nome = eregi_replace( " +\$", "", $this->nome ); $set .= "$gruda nome = '$this->nome' "; $gruda = ", "; } @@ -390,7 +387,7 @@ class clsPessoa_ list($this->idpes, $this->nome, $this->idpes_cad, $this->data_cad, $this->url, $this->tipo, $this->idpes_rev, $this->data_rev, $this->situacao, $this->origem_gravacao, $this->email ) = $tupla; return $tupla; } - } + } return false; } } diff --git a/ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php b/ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php index 17b710c..6570235 100644 --- a/ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php +++ b/ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php @@ -759,6 +759,8 @@ class clsPmieducarAluno } if (is_string($str_nome_aluno)) { + $str_nome_aluno = addslashes($str_nome_aluno); + $filtros .= "{$whereAnd} EXISTS ( SELECT 1 @@ -868,18 +870,24 @@ class clsPmieducarAluno $and_where = ''; if (!empty($str_nm_pai2)) { + $str_nm_pai2 = addslashes($str_nm_pai2); + $complemento_sql .= ' LEFT OUTER JOIN cadastro.pessoa AS pessoa_pai ON (pessoa_pai.idpes = f.idpes_pai)'; $complemento_where .= "{$and_where} (nm_pai ILIKE ('%{$str_nm_pai2}%') OR pessoa_pai.nome ILIKE ('%{$str_nm_pai2}%'))"; $and_where = ' AND '; } if (!empty($str_nm_mae2)) { + $str_nm_mae2 = addslashes($str_nm_mae2); + $complemento_sql .= ' LEFT OUTER JOIN cadastro.pessoa AS pessoa_mae ON (pessoa_mae.idpes = f.idpes_mae)'; $complemento_where .= "{$and_where} (nm_mae ILIKE ('%{$str_nm_mae2}%') OR pessoa_mae.nome ILIKE ('%{$str_nm_mae2}%'))"; $and_where = ' AND '; } if (!empty($str_nm_responsavel2)) { + $str_nm_responsavel2 = addslashes($str_nm_responsavel2); + $complemento_sql .= " LEFT OUTER JOIN cadastro.pessoa AS pessoa_responsavel ON (pessoa_responsavel.idpes = f.idpes_responsavel)"; $complemento_where .= "{$and_where} (pessoa_responsavel.nome ILIKE ('%{$str_nm_responsavel2}%'))"; $and_where = " AND "; diff --git a/ieducar/intranet/include/public/clsPublicBairro.inc.php b/ieducar/intranet/include/public/clsPublicBairro.inc.php index f8a2c75..e419ade 100755 --- a/ieducar/intranet/include/public/clsPublicBairro.inc.php +++ b/ieducar/intranet/include/public/clsPublicBairro.inc.php @@ -319,7 +319,7 @@ class clsPublicBairro if (is_string($this->nome)) { $campos .= "{$gruda}nome"; - $valores .= "{$gruda}'{$this->nome}'"; + $valores .= "{$gruda}'" . addslashes($this->nome) . "'"; $gruda = ', '; } @@ -407,7 +407,7 @@ class clsPublicBairro } if (is_string($this->nome)) { - $set .= "{$gruda}nome = '{$this->nome}'"; + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'"; $gruda = ', '; } @@ -522,7 +522,7 @@ class clsPublicBairro } if (is_string($str_nome)) { - $filtros .= "{$whereAnd} b.nome LIKE '%{$str_nome}%'"; + $filtros .= "{$whereAnd} b.nome LIKE E'%" . addslashes($str_nome) . "%'"; $whereAnd = ' AND '; } diff --git a/ieducar/intranet/include/public/clsPublicLogradouro.inc.php b/ieducar/intranet/include/public/clsPublicLogradouro.inc.php index c6f4d8c..add169e 100755 --- a/ieducar/intranet/include/public/clsPublicLogradouro.inc.php +++ b/ieducar/intranet/include/public/clsPublicLogradouro.inc.php @@ -110,7 +110,7 @@ class clsPublicLogradouro /** * Construtor (PHP 4) - * + * * @param integer idlog * @param string idtlog * @param string nome @@ -341,7 +341,7 @@ class clsPublicLogradouro if( is_string( $this->nome ) ) { $campos .= "{$gruda}nome"; - $valores .= "{$gruda}'{$this->nome}'"; + $valores .= "{$gruda}'" . addslashes($this->nome) . "'"; $gruda = ", "; } if( is_numeric( $this->idmun ) ) @@ -435,7 +435,7 @@ class clsPublicLogradouro } if( is_string( $this->nome ) ) { - $set .= "{$gruda}nome = '{$this->nome}'"; + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'"; $gruda = ", "; } if( is_numeric( $this->idmun ) ) @@ -506,7 +506,7 @@ class clsPublicLogradouro /** * Retorna uma lista filtrados de acordo com os parametros - * + * * @param string str_idtlog * @param string str_nome * @param integer int_idmun @@ -529,7 +529,7 @@ class clsPublicLogradouro { $select = ", m.nome AS nm_municipio, m.sigla_uf, u.nome AS nm_estado, u.idpais, p.nome AS nm_pais "; $from = "l, public.municipio m, public.uf u, public.pais p "; - + $sql = "SELECT {$this->_campos_lista}{$select} FROM {$this->_tabela} {$from}"; $whereAnd = " AND "; @@ -547,7 +547,7 @@ class clsPublicLogradouro } if( is_string( $str_nome ) ) { - $filtros .= "{$whereAnd} l.nome LIKE '%{$str_nome}%'"; + $filtros .= "{$whereAnd} l.nome LIKE E'%" . addslashes($str_nome) . "%'"; $whereAnd = " AND "; } if( is_numeric( $int_idmun ) ) diff --git a/ieducar/intranet/include/public/clsPublicMunicipio.inc.php b/ieducar/intranet/include/public/clsPublicMunicipio.inc.php index bd83ace..b0209ca 100755 --- a/ieducar/intranet/include/public/clsPublicMunicipio.inc.php +++ b/ieducar/intranet/include/public/clsPublicMunicipio.inc.php @@ -114,7 +114,7 @@ class clsPublicMunicipio /** * Construtor (PHP 4) - * + * * @param integer idmun * @param string nome * @param string sigla_uf @@ -407,7 +407,7 @@ class clsPublicMunicipio if( is_string( $this->nome ) ) { $campos .= "{$gruda}nome"; - $valores .= "{$gruda}'{$this->nome}'"; + $valores .= "{$gruda}'" . addslashes($this->nome) . "'"; $gruda = ", "; } if( is_string( $this->sigla_uf ) ) @@ -526,7 +526,7 @@ class clsPublicMunicipio if( is_string( $this->nome ) ) { - $set .= "{$gruda}nome = '{$this->nome}'"; + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'"; $gruda = ", "; } if( is_string( $this->sigla_uf ) ) @@ -622,7 +622,7 @@ class clsPublicMunicipio /** * Retorna uma lista filtrados de acordo com os parametros - * + * * @param string str_nome * @param string str_sigla_uf * @param integer int_area_km2 @@ -659,7 +659,7 @@ class clsPublicMunicipio } if( is_string( $str_nome ) ) { - $filtros .= "{$whereAnd} nome LIKE '%{$str_nome}%'"; + $filtros .= "{$whereAnd} nome LIKE E'%" . addslashes($str_nome) . "%'"; $whereAnd = " AND "; } if( is_string( $str_sigla_uf ) ) diff --git a/ieducar/intranet/include/public/clsPublicPais.inc.php b/ieducar/intranet/include/public/clsPublicPais.inc.php index 46275d5..9a39c78 100755 --- a/ieducar/intranet/include/public/clsPublicPais.inc.php +++ b/ieducar/intranet/include/public/clsPublicPais.inc.php @@ -99,7 +99,7 @@ class clsPublicPais /** * Construtor (PHP 4) - * + * * @param integer idpais * @param string nome * @param string geom @@ -149,7 +149,7 @@ class clsPublicPais if( is_string( $this->nome ) ) { $campos .= "{$gruda}nome"; - $valores .= "{$gruda}'{$this->nome}'"; + $valores .= "{$gruda}'" . addslashes($this->nome) . "'"; $gruda = ", "; } if( is_string( $this->geom ) ) @@ -182,7 +182,7 @@ class clsPublicPais if( is_string( $this->nome ) ) { - $set .= "{$gruda}nome = '{$this->nome}'"; + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'"; $gruda = ", "; } if( is_string( $this->geom ) ) @@ -203,7 +203,7 @@ class clsPublicPais /** * Retorna uma lista filtrados de acordo com os parametros - * + * * @param string str_nome * @param string str_geom * @@ -223,7 +223,7 @@ class clsPublicPais } if( is_string( $str_nome ) ) { - $filtros .= "{$whereAnd} nome LIKE '%{$str_nome}%'"; + $filtros .= "{$whereAnd} nome LIKE E'%" . addslashes($str_nome) . "%'"; $whereAnd = " AND "; } if( is_string( $str_geom ) ) diff --git a/ieducar/intranet/include/public/clsPublicUf.inc.php b/ieducar/intranet/include/public/clsPublicUf.inc.php index f304626..1949cec 100755 --- a/ieducar/intranet/include/public/clsPublicUf.inc.php +++ b/ieducar/intranet/include/public/clsPublicUf.inc.php @@ -100,7 +100,7 @@ class clsPublicUf /** * Construtor (PHP 4) - * + * * @param string sigla_uf * @param string nome * @param string geom @@ -185,7 +185,7 @@ class clsPublicUf if( is_string( $this->nome ) ) { $campos .= "{$gruda}nome"; - $valores .= "{$gruda}'{$this->nome}'"; + $valores .= "{$gruda}'" . addslashes($this->nome) . "'"; $gruda = ", "; } if( is_string( $this->geom ) ) @@ -223,7 +223,7 @@ class clsPublicUf if( is_string( $this->nome ) ) { - $set .= "{$gruda}nome = '{$this->nome}'"; + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'"; $gruda = ", "; } if( is_string( $this->geom ) ) @@ -249,7 +249,7 @@ class clsPublicUf /** * Retorna uma lista filtrados de acordo com os parametros - * + * * @param string str_nome * @param string str_geom * @param integer int_idpais @@ -270,7 +270,7 @@ class clsPublicUf } if( is_string( $str_nome ) ) { - $filtros .= "{$whereAnd} uf.nome LIKE '%{$str_nome}%'"; + $filtros .= "{$whereAnd} uf.nome LIKE E'%" . addslashes($str_nome) . "%'"; $whereAnd = " AND "; } if( is_string( $str_geom ) ) diff --git a/ieducar/intranet/public_uf_det.php b/ieducar/intranet/public_uf_det.php index b21b2fd..6312afb 100755 --- a/ieducar/intranet/public_uf_det.php +++ b/ieducar/intranet/public_uf_det.php @@ -46,18 +46,18 @@ class indice extends clsDetalhe * @var int */ var $titulo; - + var $sigla_uf; var $nome; var $geom; var $idpais; - + function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); - + $this->titulo = "Uf - Detalhe"; $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); @@ -65,13 +65,13 @@ class indice extends clsDetalhe $tmp_obj = new clsPublicUf( $this->sigla_uf ); $registro = $tmp_obj->detalhe(); - + if( ! $registro ) { header( "location: public_uf_lst.php" ); die(); } - + if( class_exists( "clsPais" ) ) { $obj_idpais = new clsPais( $registro["idpais"] ); diff --git a/ieducar/intranet/public_uf_lst.php b/ieducar/intranet/public_uf_lst.php index 54bd7cf..ded5d5e 100755 --- a/ieducar/intranet/public_uf_lst.php +++ b/ieducar/intranet/public_uf_lst.php @@ -98,9 +98,9 @@ class indice extends clsListagem { $objTemp = new clsPais(); $lista = $objTemp->lista( false, false, false, false, false, "nome ASC" ); - if ( is_array( $lista ) && count( $lista ) ) + if ( is_array( $lista ) && count( $lista ) ) { - foreach ( $lista as $registro ) + foreach ( $lista as $registro ) { $opcoes["{$registro['idpais']}"] = "{$registro['nome']}"; } @@ -129,7 +129,8 @@ class indice extends clsListagem $lista = $obj_uf->lista( $this->nome, $this->geom, - $this->idpais + $this->idpais, + $this->sigla_uf ); $total = $obj_uf->_total; diff --git a/ieducar/lib/Portabilis/Controller/Page/ListController.php b/ieducar/lib/Portabilis/Controller/Page/ListController.php index 7fe8e73..05c6ea1 100644 --- a/ieducar/lib/Portabilis/Controller/Page/ListController.php +++ b/ieducar/lib/Portabilis/Controller/Page/ListController.php @@ -50,13 +50,6 @@ class Portabilis_Controller_Page_ListController extends Core_Controller_Page_Lis parent::__construct(); } - protected function inputsHelper() { - if (! isset($this->_inputsHelper)) - $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this); - - return $this->_inputsHelper; - } - protected function loadResourceAssets($dispatcher){ $rootPath = $_SERVER['DOCUMENT_ROOT']; $controllerName = ucwords($dispatcher->getControllerName()); diff --git a/ieducar/modules/Api/Views/AlunoController.php b/ieducar/modules/Api/Views/AlunoController.php index 741f774..fb5289a 100644 --- a/ieducar/modules/Api/Views/AlunoController.php +++ b/ieducar/modules/Api/Views/AlunoController.php @@ -311,8 +311,17 @@ class AlunoController extends ApiCoreController $pessoa->idpes = $this->getRequest()->pessoa_id; $pessoa->nome_responsavel = ''; + $_pessoa = $pessoa->detalhe(); + if ($this->getRequest()->tipo_responsavel == 'outra_pessoa') $pessoa->idpes_responsavel = $this->getRequest()->responsavel_id; + + elseif($this->getRequest()->tipo_responsavel == 'pai' && $_pessoa['idpes_pai']) + $pessoa->idpes_responsavel = $_pessoa['idpes_pai']; + + elseif($this->getRequest()->tipo_responsavel == 'mae' && $_pessoa['idpes_mae']) + $pessoa->idpes_responsavel = $_pessoa['idpes_mae']; + else $pessoa->idpes_responsavel = 'NULL'; @@ -338,7 +347,7 @@ class AlunoController extends ApiCoreController $aluno = new clsPmieducarAluno(); $aluno->cod_aluno = $id; - $aluno->aluno_estado_id = $this->getRequest()->aluno_estado_id; + $aluno->aluno_estado_id = Portabilis_String_Utils::toLatin1($this->getRequest()->aluno_estado_id); // após cadastro não muda mais id pessoa if (is_null($id)) @@ -592,6 +601,7 @@ class AlunoController extends ApiCoreController $aluno['tipo_responsavel'] = $this->tipoResponsavel($aluno); $aluno['aluno_inep_id'] = $this->loadAlunoInepId($id); $aluno['ativo'] = $aluno['ativo'] == 1; + $aluno['aluno_estado_id'] = Portabilis_String_Utils::toUtf8($aluno['aluno_estado_id']); $aluno['alfabetizado'] = $aluno['analfabeto'] == 0; unset($aluno['analfabeto']); @@ -705,7 +715,6 @@ class AlunoController extends ApiCoreController else $this->messenger->append('Aparentemente o cadastro não pode ser alterado, por favor, verifique.', 'error', false, 'error'); - return array('id' => $id); } diff --git a/ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js b/ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js index 3e0575e..e5f802c 100644 --- a/ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js +++ b/ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js @@ -20,11 +20,15 @@ resourceOptions.handlePost = function(dataResponse) { if (! dataResponse.any_error_msg) window.setTimeout(function() { document.location = '/intranet/educar_aluno_det.php?cod_aluno=' + resource.id(); }, 500); + else + $submitButton.removeAttr('disabled').val('Gravar'); } resourceOptions.handlePut = function(dataResponse) { if (! dataResponse.any_error_msg) window.setTimeout(function() { document.location = '/intranet/educar_aluno_det.php?cod_aluno=' + resource.id(); }, 500); + else + $submitButton.removeAttr('disabled').val('Gravar'); } resourceOptions.handleGet = function(dataResponse) { diff --git a/ieducar/modules/Cadastro/Assets/Javascripts/PessoaFisica.js b/ieducar/modules/Cadastro/Assets/Javascripts/PessoaFisica.js index 2ed22e6..192ee28 100644 --- a/ieducar/modules/Cadastro/Assets/Javascripts/PessoaFisica.js +++ b/ieducar/modules/Cadastro/Assets/Javascripts/PessoaFisica.js @@ -183,8 +183,6 @@ $j(document).ready(function() { // style fixup - $j('#pais_origem_nome').css('width', '150px'); - // agrupado zebra por tipo documento, branco => .formlttd, colorido => .formmdtd $j('#tr_uf_emissao_certidao_civil td').removeClass('formmdtd'); diff --git a/ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Resource.js b/ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Resource.js index db2bfb2..9d42ef7 100644 --- a/ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Resource.js +++ b/ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Resource.js @@ -50,6 +50,8 @@ var resourceOptions = { }, handlePost : function(dataResponse) { + if (dataResponse && dataResponse.any_error_msg) + $submitButton.removeAttr('disabled').val('Gravar'); }, _handlePost : function(dataResponse) { @@ -62,6 +64,8 @@ var resourceOptions = { }, handlePut : function(dataResponse) { + if (dataResponse && dataResponse.any_error_msg) + $submitButton.removeAttr('disabled').val('Gravar'); }, @@ -193,6 +197,8 @@ var resourceOptions = { safeLog('dataResponse details:'); safeLog(dataResponse); + $submitButton.removeAttr('disabled').val('Gravar'); + throw error; } } @@ -201,6 +207,8 @@ var resourceOptions = { function handleError(response) { handleMessages([{type : 'error', msg : 'Erro ao realizar operação, por favor tente novamente, detalhes:' + response.responseText}], ''); + $submitButton.removeAttr('disabled').val('Gravar'); + safeLog('response details:'); safeLog(response); } diff --git a/ieducar/modules/Portabilis/Assets/Version.php b/ieducar/modules/Portabilis/Assets/Version.php index 41d09d0..9ae6374 100644 --- a/ieducar/modules/Portabilis/Assets/Version.php +++ b/ieducar/modules/Portabilis/Assets/Version.php @@ -4,7 +4,7 @@ usado pelo metodos loadJavascript e loadStylesheet do helper Portabilis_View_Helper_Application */ class Portabilis_Assets_Version { - const VERSION = "0_0_0_1009"; + const VERSION = '1'; } ?> -- libgit2 0.21.2