Commit 53db9b745e8cc225349ac3274e361bdbbd94b7bf

Authored by Lucas D'Avila
2 parents 35190368 6f9c6d8e
Exists in master

Merge branch 'correcao-campos-string-cadastro-pessoa-fisica'

ieducar/intranet/atendidos_cad.php
... ... @@ -94,7 +94,6 @@ class indice extends clsCadastro
94 94 var $ddd_telefone_fax;
95 95 var $telefone_fax;
96 96 var $email;
97   - var $http;
98 97 var $tipo_pessoa;
99 98 var $sexo;
100 99 var $busca_pessoa;
... ... @@ -110,8 +109,6 @@ class indice extends clsCadastro
110 109 var $caminho_det;
111 110 var $caminho_lst;
112 111  
113   - var $alterado;
114   -
115 112 function Inicializar()
116 113 {
117 114 $this->cod_pessoa_fj = @$_GET['cod_pessoa_fj'];
... ... @@ -125,7 +122,7 @@ class indice extends clsCadastro
125 122 $this->ddd_telefone_1, $this->telefone_1, $this->ddd_telefone_2,
126 123 $this->telefone_2, $this->ddd_telefone_mov, $this->telefone_mov,
127 124 $this->ddd_telefone_fax, $this->telefone_fax, $this->email,
128   - $this->http, $this->tipo_pessoa, $this->sexo, $this->cidade,
  125 + $this->tipo_pessoa, $this->sexo, $this->cidade,
129 126 $this->bairro, $this->logradouro, $this->cep, $this->idlog, $this->idbai,
130 127 $this->idtlog, $this->sigla_uf, $this->complemento, $this->numero,
131 128 $this->bloco, $this->apartamento, $this->andar, $this->zona_localizacao, $this->estado_civil,
... ... @@ -136,7 +133,7 @@ class indice extends clsCadastro
136 133 $objPessoa->queryRapida(
137 134 $this->cod_pessoa_fj, 'nome', 'cpf', 'data_nasc', 'ddd_1', 'fone_1',
138 135 'ddd_2', 'fone_2', 'ddd_mov', 'fone_mov', 'ddd_fax', 'fone_fax', 'email',
139   - 'url', 'tipo', 'sexo', 'cidade', 'bairro', 'logradouro', 'cep', 'idlog',
  136 + 'tipo', 'sexo', 'cidade', 'bairro', 'logradouro', 'cep', 'idlog',
140 137 'idbai', 'idtlog', 'sigla_uf', 'complemento', 'numero', 'bloco', 'apartamento',
141 138 'andar', 'zona_localizacao', 'ideciv', 'idpes_pai', 'idpes_mae', 'nacionalidade',
142 139 'idpais_estrangeiro', 'idmun_nascimento', 'letra'
... ... @@ -798,17 +795,8 @@ class indice extends clsCadastro
798 795 $this->inputTelefone('2', 'Telefone adicional');
799 796 $this->inputTelefone('fax', 'Fax');
800 797  
801   - $this->campoTexto('http', 'Site', $this->http, '50', '255', FALSE);
802   -
803 798 $this->campoTexto('email', 'E-mail', $this->email, '50', '255', FALSE);
804 799  
805   - /*if ($this->cod_pessoa_fj) {
806   - $this->campoRotulo('documentos', '<b><i>Documentos</i></b>',
807   - "<a href='#' onclick=\"windowUtils.open('adicionar_documentos_cad.php?id_pessoa={$this->cod_pessoa_fj}'); \"><img src='imagens/nvp_bot_ad_doc.png' border='0'></a>");
808   -
809   - $this->campoCheck('alterado', 'Alterado', $this->alterado);
810   - }*/
811   -
812 800  
813 801 // after change pessoa pai / mae
814 802  
... ... @@ -828,189 +816,15 @@ class indice extends clsCadastro
828 816 Portabilis_View_Helper_Application::loadJavascript($this, $script);
829 817 }
830 818  
831   - function Novo()
832   - {
833   -
834   - if (! $this->validatesCpf($this->id_federal))
835   - return false;
836   -
837   - // pessoa
838   -
839   - $objPessoa = new clsPessoa_(FALSE, $this->nm_pessoa, $this->currentUserId(), $this->http,
840   - 'F', FALSE, FALSE, $this->email);
841   -
842   - $idpes = $objPessoa->cadastra();
843   -
844   - // pessoa fisica
845   -
846   - $fisica = new clsFisica();
847   -
848   - $fisica->idpes = $idpes;
849   - $fisica->data_nasc = Portabilis_Date_Utils::brToPgSQL($this->data_nasc);
850   - $fisica->sexo = $this->sexo;
851   - $fisica->ref_cod_sistema = 'NULL';
852   - $fisica->cpf = idFederal2int($this->id_federal);
853   - $fisica->ideciv = $this->estado_civil_id;
854   - $fisica->idpes_pai = $this->pai_id;
855   - $fisica->idpes_mae = $this->mae_id;
856   - $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade'];
857   - $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id'];
858   - $fisica->idmun_nascimento = $_REQUEST['naturalidade_id'];
859   -
860   - $fisica->cadastra();
861   -
862   - $this->createOrUpdateDocumentos($idpes);
863   -
864   - $objTelefone = new clsPessoaTelefone($idpes, 1, $this->telefone_1, $this->ddd_telefone_1);
865   - $objTelefone->cadastra();
866   -
867   - $objTelefone = new clsPessoaTelefone($idpes, 2, $this->telefone_2, $this->ddd_telefone_2);
868   - $objTelefone->cadastra();
869   -
870   - $objTelefone = new clsPessoaTelefone($idpes, 3, $this->telefone_mov, $this->ddd_telefone_mov);
871   - $objTelefone->cadastra();
872   -
873   - $objTelefone = new clsPessoaTelefone($idpes, 4, $this->telefone_fax, $this->ddd_telefone_fax);
874   - $objTelefone->cadastra();
875   -
876   - if ($this->cep && $this->idbai && $this->idlog) {
877   - $this->cep = idFederal2Int($this->cep);
878   - $objEndereco = new clsPessoaEndereco($idpes);
879   - $objEndereco2 = new clsPessoaEndereco($idpes, $this->cep, $this->idlog,
880   - $this->idbai, $this->numero, $this->complemento, FALSE, $this->letra,
881   - $this->bloco, $this->apartamento, $this->andar);
882   -
883   - if ($objEndereco->detalhe()) {
884   - $objEndereco2->edita();
885   - }
886   - else {
887   - $objEndereco2->cadastra();
888   - }
889   - }
890   - elseif($this->cep_) {
891   - $this->cep_ = idFederal2int($this->cep_);
892   -
893   - $objEnderecoExterno = new clsEnderecoExterno($idpes);
894   - $objEnderecoExterno2 = new clsEnderecoExterno($idpes, '1', $this->idtlog,
895   - $this->logradouro, $this->numero, $this->letra, $this->complemento,
896   - $this->bairro, $this->cep_, $this->cidade, $this->sigla_uf, FALSE,
897   - $this->bloco, $this->apartamento, $this->andar, FALSE, FALSE,
898   - $this->zona_localizacao);
899   -
900   - if ($objEnderecoExterno->detalhe()) {
901   - $objEnderecoExterno2->edita();
902   - }
903   - else {
904   - $objEnderecoExterno2->cadastra();
905   - }
906   - }
907   -
908   - // Cadastra raça.
909   - $this->_cadastraRaca($idpes, $this->cor_raca);
910   -
911   - $this->afterChangePessoa($idpes);
912   - return TRUE;
  819 + function Novo() {
  820 + return $this->createOrUpdate();
913 821 }
914 822  
915   - function Editar()
916   - {
917   - if (! $this->validatesCpf($this->id_federal))
918   - return false;
919   -
920   - // pessoa
921   -
922   - $objPessoa = new clsPessoa_($this->cod_pessoa_fj, $this->nm_pessoa, FALSE,
923   - $this->p_http, FALSE, $this->currentUserId(),
924   - date('Y-m-d H:i:s', time()), $this->email);
925   -
926   - $objPessoa->edita();
927   -
928   - // pessoa fisica
929   -
930   - $fisica = new clsFisica();
931   -
932   - $fisica->idpes = $this->cod_pessoa_fj;
933   - $fisica->data_nasc = Portabilis_Date_Utils::brToPgSQL($this->data_nasc);
934   - $fisica->sexo = $this->sexo;
935   - $fisica->ref_cod_sistema = 'NULL';
936   - $fisica->cpf = $this->id_federal ? idFederal2int($this->id_federal) : 'NULL';
937   - $fisica->ideciv = $this->estado_civil_id;
938   - $fisica->idpes_pai = $this->pai_id ? $this->pai_id : "NULL";
939   - $fisica->idpes_mae = $this->mae_id ? $this->mae_id : "NULL";
940   - $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade'];
941   - $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id'];
942   - $fisica->idmun_nascimento = $_REQUEST['naturalidade_id'];
943   -
944   - $fisica->edita();
945   -
946   - $this->createOrUpdateDocumentos($this->cod_pessoa_fj);
947   -
948   - if ($this->alterado) {
949   - $db = new clsBanco();
950   - $db->Consulta("UPDATE cadastro.fisica SET alterado = 'TRUE' WHERE idpes = '$this->cod_pessoa_fj'");
951   - }
952   -
953   - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 1,
954   - $this->telefone_1, $this->ddd_telefone_1);
955   - $objTelefone->cadastra();
956   -
957   - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 2,
958   - $this->telefone_2, $this->ddd_telefone_2);
959   - $objTelefone->cadastra();
960   -
961   - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 3,
962   - $this->telefone_mov, $this->ddd_telefone_mov);
963   - $objTelefone->cadastra();
964   -
965   - $objTelefone = new clsPessoaTelefone($this->cod_pessoa_fj, 4,
966   - $this->telefone_fax, $this->ddd_telefone_fax);
967   - $objTelefone->cadastra();
968   -
969   - $objEndereco = new clsPessoaEndereco($this->cod_pessoa_fj);
970   -
971   - $this->cep = idFederal2Int($this->cep);
972   -
973   - $objEndereco2 = new clsPessoaEndereco($this->cod_pessoa_fj, $this->cep,
974   - $this->idlog, $this->idbai, $this->numero, $this->complemento, FALSE,
975   - $this->letra, $this->bloco, $this->apartamento,$this->andar);
976   -
977   - if ($objEndereco->detalhe() && $this->cep && $this->idlog && $this->idbai) {
978   - $objEndereco2->edita();
979   - }
980   - elseif ($this->cep && $this->idlog && $this->idbai) {
981   - $objEndereco2->cadastra();
982   - }
983   - elseif ($objEndereco->detalhe()) {
984   - $objEndereco2->exclui();
985   - }
986   - else {
987   - $this->cep_ = idFederal2int($this->cep_);
988   - $objEnderecoExterno = new clsEnderecoExterno($this->cod_pessoa_fj);
989   -
990   - $objEnderecoExterno2 = new clsEnderecoExterno($this->cod_pessoa_fj, '1',
991   - $this->idtlog, $this->logradouro, $this->numero, $this->letra,
992   - $this->complemento, $this->bairro, $this->cep_, $this->cidade,
993   - $this->sigla_uf, FALSE, $this->bloco, $this->apartamento, $this->andar,
994   - FALSE, FALSE, $this->zona_localizacao);
995   -
996   - if ($objEnderecoExterno->detalhe()) {
997   - $objEnderecoExterno2->edita();
998   - }
999   - else {
1000   - $objEnderecoExterno2->cadastra();
1001   - }
1002   - }
1003   -
1004   - // Atualizada raça.
1005   - $this->_cadastraRaca($this->cod_pessoa_fj, $this->cor_raca);
1006   -
1007   - $this->afterChangePessoa($this->cod_pessoa_fj);
1008   -
1009   - return TRUE;
  823 + function Editar() {
  824 + return $this->createOrUpdate($this->cod_pessoa_fj);
1010 825 }
1011 826  
1012   - function Excluir()
1013   - {
  827 + function Excluir() {
1014 828 echo '<script>document.location="atendidos_lst.php";</script>';
1015 829 return TRUE;
1016 830 }
... ... @@ -1032,28 +846,6 @@ class indice extends clsCadastro
1032 846 ", $afterReady = true);
1033 847 }
1034 848  
1035   - /**
1036   - * Cadastra ou atualiza a raça de uma pessoa.
1037   - *
1038   - * @access protected
1039   - * @param int $pessoaId
1040   - * @param int $corRaca
1041   - * @return bool
1042   - * @since Método disponível desde a versão 1.2.0
1043   - */
1044   - function _cadastraRaca($pessoaId, $corRaca)
1045   - {
1046   - $pessoaId = (int) $pessoaId;
1047   - $corRaca = (int) $corRaca;
1048   -
1049   - $raca = new clsCadastroFisicaRaca($pessoaId, $corRaca);
1050   - if ($raca->existe()) {
1051   - return $raca->edita();
1052   - }
1053   -
1054   - return $raca->cadastra();
1055   - }
1056   -
1057 849 protected function loadAlunoByPessoaId($id) {
1058 850 $aluno = new clsPmieducarAluno();
1059 851 $aluno->ref_idpes = $id;
... ... @@ -1127,6 +919,79 @@ class indice extends clsCadastro
1127 919 return $isValid;
1128 920 }
1129 921  
  922 + protected function createOrUpdate($pessoaIdOrNull = null) {
  923 + if (! $this->validatesCpf($this->id_federal))
  924 + return false;
  925 +
  926 + $pessoaId = $this->createOrUpdatePessoa($pessoaIdOrNull);
  927 +
  928 + $this->createOrUpdatePessoaFisica($pessoaId);
  929 + $this->createOrUpdateDocumentos($pessoaId);
  930 + $this->createOrUpdateTelefones($pessoaId);
  931 + $this->createOrUpdateEndereco($pessoaId);
  932 +
  933 + $this->afterChangePessoa($pessoaId);
  934 + return true;
  935 + }
  936 +
  937 + protected function createOrUpdatePessoa($pessoaId = null) {
  938 + $pessoa = new clsPessoa_();
  939 + $pessoa->idpes = $pessoaId;
  940 + $pessoa->nome = addslashes($this->nm_pessoa);
  941 + $pessoa->email = addslashes($this->email);
  942 +
  943 + $sql = "select 1 from cadastro.pessoa WHERE idpes = $1 limit 1";
  944 +
  945 + if (! $pessoaId || Portabilis_Utils_Database::selectField($sql, $pessoaId) != 1) {
  946 + $pessoa->tipo = 'F';
  947 + $pessoa->idpes_cad = $this->currentUserId();
  948 + $pessoaId = $pessoa->cadastra();
  949 + }
  950 + else {
  951 + $pessoa->idpes_rev = $this->currentUserId();
  952 + $pessoa->data_rev = date('Y-m-d H:i:s', time());
  953 + $pessoa->edita();
  954 + }
  955 +
  956 + return $pessoaId;
  957 + }
  958 +
  959 + protected function createOrUpdatePessoaFisica($pessoaId) {
  960 + $fisica = new clsFisica();
  961 + $fisica->idpes = $pessoaId;
  962 + $fisica->data_nasc = Portabilis_Date_Utils::brToPgSQL($this->data_nasc);
  963 + $fisica->sexo = $this->sexo;
  964 + $fisica->ref_cod_sistema = 'NULL';
  965 + $fisica->cpf = $this->id_federal ? idFederal2int($this->id_federal) : 'NULL';
  966 + $fisica->ideciv = $this->estado_civil_id;
  967 + $fisica->idpes_pai = $this->pai_id ? $this->pai_id : "NULL";
  968 + $fisica->idpes_mae = $this->mae_id ? $this->mae_id : "NULL";
  969 + $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade'];
  970 + $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id'];
  971 + $fisica->idmun_nascimento = $_REQUEST['naturalidade_id'];
  972 +
  973 + $sql = "select 1 from cadastro.fisica WHERE idpes = $1 limit 1";
  974 +
  975 + if (Portabilis_Utils_Database::selectField($sql, $pessoaId) != 1)
  976 + $fisica->cadastra();
  977 + else
  978 + $fisica->edita();
  979 +
  980 + $this->createOrUpdateRaca($pessoaId, $this->cor_raca);
  981 + }
  982 +
  983 + function createOrUpdateRaca($pessoaId, $corRaca) {
  984 + $pessoaId = (int) $pessoaId;
  985 + $corRaca = (int) $corRaca;
  986 +
  987 + $raca = new clsCadastroFisicaRaca($pessoaId, $corRaca);
  988 +
  989 + if ($raca->existe())
  990 + return $raca->edita();
  991 +
  992 + return $raca->cadastra();
  993 + }
  994 +
1130 995 protected function createOrUpdateDocumentos($pessoaId) {
1131 996 $documentos = new clsDocumento();
1132 997 $documentos->idpes = $pessoaId;
... ... @@ -1171,8 +1036,7 @@ class indice extends clsCadastro
1171 1036 );
1172 1037  
1173 1038 $documentos->sigla_uf_cert_civil = $_REQUEST['uf_emissao_certidao_civil'];
1174   - $documentos->cartorio_cert_civil = $_REQUEST['cartorio_emissao_certidao_civil'];
1175   -
  1039 + $documentos->cartorio_cert_civil = addslashes($_REQUEST['cartorio_emissao_certidao_civil']);
1176 1040  
1177 1041  
1178 1042 // carteira de trabalho
... ... @@ -1207,6 +1071,77 @@ class indice extends clsCadastro
1207 1071 $documentos->edita();
1208 1072 }
1209 1073  
  1074 + protected function _createOrUpdatePessoaEndereco($pessoaId) {
  1075 + $endereco = new clsPessoaEndereco(
  1076 + $pessoaId,
  1077 + idFederal2Int($this->cep),
  1078 + $this->idlog,
  1079 + $this->idbai,
  1080 + $this->numero,
  1081 + addslashes($this->complemento),
  1082 + FALSE,
  1083 + addslashes($this->letra),
  1084 + addslashes($this->bloco),
  1085 + $this->apartamento,
  1086 + $this->andar
  1087 + );
  1088 +
  1089 + // forçado exclusão, assim ao cadastrar endereco_pessoa novamente,
  1090 + // será excluido endereco_externo (por meio da trigger fcn_aft_ins_endereco_pessoa).
  1091 + $endereco->exclui();
  1092 + $endereco->cadastra();
  1093 + }
  1094 +
  1095 + protected function _createOrUpdateEnderecoExterno($pessoaId) {
  1096 + $endereco = new clsEnderecoExterno(
  1097 + $pessoaId,
  1098 + '1',
  1099 + $this->idtlog,
  1100 + addslashes($this->logradouro),
  1101 + $this->numero,
  1102 + addslashes($this->letra),
  1103 + addslashes($this->complemento),
  1104 + addslashes($this->bairro),
  1105 + idFederal2int($this->cep_),
  1106 + addslashes($this->cidade),
  1107 + $this->sigla_uf,
  1108 + FALSE,
  1109 + addslashes($this->bloco),
  1110 + $this->apartamento,
  1111 + $this->andar,
  1112 + FALSE,
  1113 + FALSE,
  1114 + $this->zona_localizacao
  1115 + );
  1116 +
  1117 + // forçado exclusão, assim ao cadastrar endereco_externo novamente,
  1118 + // será excluido endereco_pessoa (por meio da trigger fcn_aft_ins_endereco_externo).
  1119 + $endereco->exclui();
  1120 + $endereco->cadastra();
  1121 + }
  1122 +
  1123 + protected function createOrUpdateEndereco($pessoaId) {
  1124 + $enderecoExterno = ! empty($this->cep_);
  1125 +
  1126 + if (! $enderecoExterno && $this->cep && $this->idbai && $this->idlog)
  1127 + $this->_createOrUpdatePessoaEndereco($pessoaId);
  1128 +
  1129 + elseif($enderecoExterno)
  1130 + $this->_createOrUpdateEnderecoExterno($pessoaId);
  1131 + }
  1132 +
  1133 + protected function createOrUpdateTelefones($pessoaId) {
  1134 + $telefones = array();
  1135 +
  1136 + $telefones[] = new clsPessoaTelefone($pessoaId, 1, $this->telefone_1, $this->ddd_telefone_1);
  1137 + $telefones[] = new clsPessoaTelefone($pessoaId, 2, $this->telefone_2, $this->ddd_telefone_2);
  1138 + $telefones[] = new clsPessoaTelefone($pessoaId, 3, $this->telefone_mov, $this->ddd_telefone_mov);
  1139 + $telefones[] = new clsPessoaTelefone($pessoaId, 4, $this->telefone_fax, $this->ddd_telefone_fax);
  1140 +
  1141 + foreach ($telefones as $telefone)
  1142 + $telefone->cadastra();
  1143 + }
  1144 +
1210 1145 // inputs usados em Gerar,
1211 1146 // implementado estes metodos para não duplicar código
1212 1147 // uma vez que estes campos são usados várias vezes em Gerar.
... ...
ieducar/intranet/educar_aluno_cad.php
... ... @@ -262,11 +262,6 @@ class indice extends clsCadastro
262 262 $this->campoOculto('ref_idpes', $this->ref_idpes);
263 263 $this->campoAdicionaTab('Dados Pessoais', $this->tab_habilitado);
264 264  
265   - if ($this->cod_aluno) {
266   - $obj_matricula = new clsPmieducarMatricula();
267   - $lst_matricula = $obj_matricula->lista(NULL, NULL, NULL, NULL, NULL, NULL, $this->cod_aluno);
268   - }
269   -
270 265 if (!empty($this->ref_idpes)) {
271 266 $obj_aluno = new clsPmieducarAluno();
272 267 $lista_aluno = $obj_aluno->lista(NULL, NULL, NULL, NULL, NULL,
... ...
ieducar/intranet/educar_pesquisa_cep_log_bairro.php
... ... @@ -108,27 +108,28 @@ class miolo1 extends clsListagem
108 108 $this->campoTexto('nm_logradouro', 'Logradouro', $_GET['nm_logradouro'], 50, 255);
109 109 $this->campoTexto('cidade', 'Cidade', $_GET['cidade'], 60, 60);
110 110  
111   - $obj_uf = new clsUf(FALSE, FALSE, 1);
112   - $lst_uf = $obj_uf->lista(FALSE, FALSE, FALSE, FALSE, FALSE, 'sigla_uf');
  111 + // uf
113 112  
114   - $array_uf;
115   - foreach ($lst_uf as $uf) {
116   - $array_uf[$uf['sigla_uf']] = $uf['nome'];
117   - }
118   - if (! $_GET['ref_sigla_uf']) {
119   - $_GET['ref_sigla_uf'] = $coreExt['Config']->app->locale->province;
120   - }
121   - /* Portabilis: Foi comentada a linha abaixo e adicionado 'SC' no lugar de $_GET['ref_sigla_uf'],
122   - para trazer o estado como defaut */
123   - /*$this->campoLista('ref_sigla_uf', 'UF', $array_uf, $_GET['ref_sigla_uf'],
124   - '', FALSE, '');*/
125   -
126   - $this->campoLista('ref_sigla_uf', 'UF', $array_uf, 'SC',
127   - '', FALSE, '');
  113 + $defaultProvince = isset($_GET['ref_sigla_uf']) ? $_GET['ref_sigla_uf'] : $coreExt['Config']->app->locale->province;
  114 +
  115 + $options = array(
  116 + 'required' => false,
  117 + 'label' => 'Estado',
  118 + 'value' => $defaultProvince
  119 + );
  120 +
  121 + $helperOptions = array(
  122 + 'attrName' => 'ref_sigla_uf'
  123 + );
  124 +
  125 + $this->inputsHelper()->uf($options, $helperOptions);
128 126  
129 127  
130 128 $this->addCabecalhos(array('Bairro', 'CEP', 'Logradouro', 'UF', 'Cidade'));
131 129  
  130 +
  131 + // consulta dados
  132 +
132 133 $select = '
133 134 SELECT
134 135 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
143 144 l.idtlog = t.idtlog AND
144 145 m.sigla_uf = u.sigla_uf';
145 146  
146   - $select_count = '
147   - SELECT
148   - COUNT(*)
149   - FROM
150   - urbano.cep_logradouro_bairro c, public.bairro b, public.logradouro l,
151   - public.municipio m, public.uf u, urbano.tipo_logradouro t
152   - WHERE
153   - c.idlog = l.idlog AND
154   - c.idbai = b.idbai AND
155   - l.idmun = b.idmun AND
156   - l.idmun = m.idmun AND
157   - l.idtlog = t.idtlog AND
158   - m.sigla_uf = u.sigla_uf';
  147 + $params = array();
  148 +
  149 + if (isset($_GET['nr_cep']))
  150 + $params['c.cep'] = idFederal2int($_GET['nr_cep']);
  151 +
  152 + if (isset($_GET['nm_bairro']))
  153 + $params['b.nome'] = $_GET['nm_bairro'];
159 154  
160   - if (
161   - $_GET['nm_bairro'] || $_GET['nr_cep'] || $_GET['nm_logradouro'] ||
162   - $_GET['ref_sigla_uf'] || $_GET['cidade']
163   - ) {
164   - if ($_GET['nr_cep']) {
165   - $num_cep = idFederal2int($_GET['nr_cep']);
166   - $select .= sprintf(' AND c.cep ILIKE \'%%%s%%\'', $num_cep);
167   - $select_count .= sprintf(' AND c.cep ILIKE \'%%%s%%\'', $num_cep);
168   - }
169   -
170   - if ($_GET['nm_bairro']) {
171   - $select .= sprintf(' AND b.nome ILIKE \'%%%s%%\'', $_GET['nm_bairro']);
172   - $select_count .= sprintf(' AND b.nome ILIKE \'%%%s%%\'', $_GET['nm_bairro']);
173   - }
174   -
175   - if ($_GET['nm_logradouro']) {
176   - $select .= sprintf(' AND l.nome ILIKE \'%%%s%%\'', $_GET['nm_logradouro']);
177   - $select_count .= sprintf(' AND l.nome ILIKE \'%%%s%%\'', $_GET['nm_logradouro']);
178   - }
179   -
180   - if ($_GET['ref_sigla_uf']) {
181   - $select .= sprintf(' AND u.sigla_uf ILIKE \'%%%s%%\'', $_GET['ref_sigla_uf']);
182   - $select_count .= sprintf(' AND u.sigla_uf ILIKE \'%%%s%%\'', $_GET['ref_sigla_uf']);
183   - }
184   -
185   - if ($_GET['cidade']) {
186   - $select .= sprintf(' AND m.nome ILIKE \'%%%s%%\'', $_GET['cidade']);
187   - $select_count .= sprintf(' AND m.nome ILIKE \'%%%s%%\'', $_GET['cidade']);
188   - }
  155 + if (isset($_GET['nm_logradouro']))
  156 + $params['l.nome'] = $_GET['nm_logradouro'];
  157 +
  158 + if (isset($_GET['ref_sigla_uf']))
  159 + $params['u.sigla_uf'] = $_GET['ref_sigla_uf'];
  160 +
  161 + if (isset($_GET['cidade']))
  162 + $params['m.nome'] = $_GET['cidade'];
  163 +
  164 + $paramCount = 1;
  165 +
  166 + foreach ($params as $name => $value) {
  167 + $select .= " AND $name ILIKE '%'||\$$paramCount||'%'";
  168 + $paramCount++;
189 169 }
190 170  
191 171 $select .= sprintf(' LIMIT %s OFFSET %s', $limite, $iniciolimit);
192 172  
193   - $db = new clsBanco();
194   - $total = $db->CampoUnico($select_count);
  173 + $result = Portabilis_Utils_Database::fetchPreparedQuery($select, array('params' => array_values($params)));
  174 + $total = count($result);
195 175  
196   - $db->Consulta($select);
  176 + foreach ($result as $record) {
  177 + list($idlog, $cep, $idbai, $uf, $cidade, $tipoLogradouroId, $id_mun, $zona) = $record;
197 178  
198   - while ($db->ProximoRegistro()) {
199   - list($idlog, $cep, $idbai, $uf, $cidade, $descricao,$id_mun, $zona) =
200   - array('', '', '', '', '', '', '', '');
  179 + $cidade = addslashes($cidade);
201 180  
202   - list($idlog, $cep, $idbai, $uf, $cidade, $descricao, $id_mun, $zona) = $db->Tupla();
  181 + $logradouro = new clsLogradouro($idlog);
  182 + $logradouro = $logradouro->detalhe();
  183 + $logradouro = addslashes($logradouro['nome']);
203 184  
204   - $logradouro = new clsLogradouro($idlog);
205   - $detalhe_logradouro = $logradouro->detalhe();
206   -
207   - $bairro = new clsBairro($idbai);
208   - $detalhe_bairro = $bairro->detalhe();
  185 + $bairro = new clsBairro($idbai);
  186 + $bairro = $bairro->detalhe();
  187 + $bairro = addslashes($bairro['nome']);
209 188  
210 189 $cep2 = int2CEP($cep);
211 190 $s_end = '0';
212 191  
213   - $descricao = urlencode($descricao);
214   -
215   - if ($_GET['param']) {
216   - $url = sprintf(
217   - '<a href="javascript:void(0);" onclick="setaCamposOuvidoria(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\')">%%s</a>',
218   - $cep, $cep2, $uf, $uf, $id_mun, $cidade, $detalhe_bairro['idbai'], $detalhe_bairro['nome'], $descricao, $descricao, $detalhe_logradouro['idlog'], $detalhe_logradouro['nome']
219   - );
220   -
221   - $this->addLinhas(array(
222   - sprintf($url, $detalhe_bairro['nome']),
223   - sprintf($url, $cep2),
224   - sprintf($url, $detalhe_logradouro["nome"]),
225   - sprintf($url, $uf),
226   - sprintf($url, $cidade)
227   - ));
228   - }
229   - else {
230   - $url = sprintf(
231   - '<a href="javascript:void(0);" onclick="cv_set_campo(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\');">%%s</a>',
232   - $_SESSION['campo1'], $detalhe_bairro["nome"], $_SESSION['campo2'],
233   - $detalhe_bairro["idbai"], $_SESSION['campo3'], $cep,
234   - $_SESSION['campo4'], $detalhe_logradouro["nome"],
235   - $_SESSION['campo5'], $detalhe_logradouro["idlog"],
236   - $_SESSION['campo6'], $uf, $_SESSION['campo7'], $cidade,
237   - $_SESSION['campo8'], $descricao, $_SESSION['campo9'], $s_end,
238   - $_SESSION['campo10'], $cep2, $_SESSION['campo11'], $uf,
239   - $_SESSION['campo12'], $_SESSION['campo13'], $id_mun,
240   - $_SESSION['campo14'], $zona
241   - );
242   -
243   - $this->addLinhas(array(
244   - sprintf($url, $detalhe_bairro['nome']),
245   - sprintf($url, $cep2),
246   - sprintf($url, $detalhe_logradouro['nome']),
247   - sprintf($url, $uf),
248   - sprintf($url, $cidade)
249   - ));
250   - }
  192 + $url = sprintf(
  193 + '<a href="javascript:void(0);" onclick="cv_set_campo(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\');">%%s</a>',
  194 + $_SESSION['campo1'], $bairro, $_SESSION['campo2'],
  195 + $idbai, $_SESSION['campo3'], $cep,
  196 + $_SESSION['campo4'], $logradouro,
  197 + $_SESSION['campo5'], $idlog,
  198 + $_SESSION['campo6'], $uf, $_SESSION['campo7'], $cidade,
  199 + $_SESSION['campo8'], $tipoLogradouroId, $_SESSION['campo9'], $s_end,
  200 + $_SESSION['campo10'], $cep2, $_SESSION['campo11'], $uf,
  201 + $_SESSION['campo12'], $_SESSION['campo13'], $id_mun,
  202 + $_SESSION['campo14'], $zona
  203 + );
  204 +
  205 + $this->addLinhas(array(
  206 + sprintf($url, $bairro),
  207 + sprintf($url, $cep2),
  208 + sprintf($url, $logradouro),
  209 + sprintf($url, $uf),
  210 + sprintf($url, $cidade)
  211 + ));
251 212 }
252 213  
253 214 $this->largura = '100%';
... ...
ieducar/intranet/include/clsListagem.inc.php
... ... @@ -35,6 +35,7 @@ if (class_exists(&#39;clsPmiajudaPagina&#39;)) {
35 35 }
36 36  
37 37 require_once 'Portabilis/View/Helper/Application.php';
  38 +require_once 'Portabilis/View/Helper/Inputs.php';
38 39  
39 40 define('alTopLeft', 'valign=top align=left');
40 41 define('alTopCenter', 'valign=top align=center');
... ... @@ -745,4 +746,11 @@ class clsListagem extends clsCampos
745 746 {
746 747 die("<div style='width: 300px; height: 100px; font: 700 11px Arial,Helv,Sans; background-color: #f6f6f6; color: #e11; position: absolute; left: 50%; top: 50%; margin-top: -20px; margin-left: -100px; text-align: center; border: solid 1px #a1a1f1;'>{$msg}</div><script>setTimeout('window.location=\'$redir\'',5000);</script>");
747 748 }
  749 +
  750 + public function inputsHelper() {
  751 + if (! isset($this->_inputsHelper))
  752 + $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this);
  753 +
  754 + return $this->_inputsHelper;
  755 + }
748 756 }
... ...
ieducar/intranet/include/pessoa/clsPessoaFisica.inc.php
... ... @@ -153,13 +153,17 @@ class clsPessoaFisica extends clsPessoaFj
153 153 $where = '';
154 154  
155 155 if (is_string($str_nome) && $str_nome != '') {
  156 + $str_nome = addslashes($str_nome);
156 157 $str_nome = str_replace(' ', '%', $str_nome);
157   - $where .= "{$whereAnd} nome ILIKE '%{$str_nome}%' ";
  158 +
  159 + $where .= "{$whereAnd} nome ILIKE E'%{$str_nome}%' ";
158 160 $whereAnd = ' AND ';
159 161 }
160 162  
161 163 if (is_string($numeric_cpf)) {
162   - $where .= "{$whereAnd} cpf ILIKE '%{$numeric_cpf}%' ";
  164 + $numeric_cpf = addslashes($numeric_cpf);
  165 +
  166 + $where .= "{$whereAnd} cpf ILIKE E'%{$numeric_cpf}%' ";
163 167 $whereAnd = ' AND ';
164 168 }
165 169  
... ...
ieducar/intranet/include/pessoa/clsPessoa_.inc.php
... ... @@ -84,13 +84,11 @@ class clsPessoa_
84 84 $valores .= ", '$this->idpes_cad' ";
85 85 }
86 86  
87   - $this->nome = str_replace("'", "", $this->nome);
88   -
89 87 $db = new clsBanco();
90 88  
91 89 $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)");
92 90 $this->idpes = $db->InsertId("{$this->schema_cadastro}.seq_pessoa");
93   -
  91 +
94 92 return $this->idpes;
95 93 }
96 94 }
... ... @@ -115,7 +113,6 @@ class clsPessoa_
115 113 }
116 114 if($this->nome || $this->nome==="")
117 115 {
118   - $this->nome = eregi_replace( " +\$", "", $this->nome );
119 116 $set .= "$gruda nome = '$this->nome' ";
120 117 $gruda = ", ";
121 118 }
... ... @@ -390,7 +387,7 @@ class clsPessoa_
390 387 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;
391 388 return $tupla;
392 389 }
393   - }
  390 + }
394 391 return false;
395 392 }
396 393 }
... ...
ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php
... ... @@ -759,6 +759,8 @@ class clsPmieducarAluno
759 759 }
760 760  
761 761 if (is_string($str_nome_aluno)) {
  762 + $str_nome_aluno = addslashes($str_nome_aluno);
  763 +
762 764 $filtros .= "{$whereAnd} EXISTS (
763 765 SELECT
764 766 1
... ... @@ -868,18 +870,24 @@ class clsPmieducarAluno
868 870 $and_where = '';
869 871  
870 872 if (!empty($str_nm_pai2)) {
  873 + $str_nm_pai2 = addslashes($str_nm_pai2);
  874 +
871 875 $complemento_sql .= ' LEFT OUTER JOIN cadastro.pessoa AS pessoa_pai ON (pessoa_pai.idpes = f.idpes_pai)';
872 876 $complemento_where .= "{$and_where} (nm_pai ILIKE ('%{$str_nm_pai2}%') OR pessoa_pai.nome ILIKE ('%{$str_nm_pai2}%'))";
873 877 $and_where = ' AND ';
874 878 }
875 879  
876 880 if (!empty($str_nm_mae2)) {
  881 + $str_nm_mae2 = addslashes($str_nm_mae2);
  882 +
877 883 $complemento_sql .= ' LEFT OUTER JOIN cadastro.pessoa AS pessoa_mae ON (pessoa_mae.idpes = f.idpes_mae)';
878 884 $complemento_where .= "{$and_where} (nm_mae ILIKE ('%{$str_nm_mae2}%') OR pessoa_mae.nome ILIKE ('%{$str_nm_mae2}%'))";
879 885 $and_where = ' AND ';
880 886 }
881 887  
882 888 if (!empty($str_nm_responsavel2)) {
  889 + $str_nm_responsavel2 = addslashes($str_nm_responsavel2);
  890 +
883 891 $complemento_sql .= " LEFT OUTER JOIN cadastro.pessoa AS pessoa_responsavel ON (pessoa_responsavel.idpes = f.idpes_responsavel)";
884 892 $complemento_where .= "{$and_where} (pessoa_responsavel.nome ILIKE ('%{$str_nm_responsavel2}%'))";
885 893 $and_where = " AND ";
... ...
ieducar/intranet/include/public/clsPublicBairro.inc.php
... ... @@ -319,7 +319,7 @@ class clsPublicBairro
319 319  
320 320 if (is_string($this->nome)) {
321 321 $campos .= "{$gruda}nome";
322   - $valores .= "{$gruda}'{$this->nome}'";
  322 + $valores .= "{$gruda}'" . addslashes($this->nome) . "'";
323 323 $gruda = ', ';
324 324 }
325 325  
... ... @@ -407,7 +407,7 @@ class clsPublicBairro
407 407 }
408 408  
409 409 if (is_string($this->nome)) {
410   - $set .= "{$gruda}nome = '{$this->nome}'";
  410 + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'";
411 411 $gruda = ', ';
412 412 }
413 413  
... ... @@ -522,7 +522,7 @@ class clsPublicBairro
522 522 }
523 523  
524 524 if (is_string($str_nome)) {
525   - $filtros .= "{$whereAnd} b.nome LIKE '%{$str_nome}%'";
  525 + $filtros .= "{$whereAnd} b.nome LIKE E'%" . addslashes($str_nome) . "%'";
526 526 $whereAnd = ' AND ';
527 527 }
528 528  
... ...
ieducar/intranet/include/public/clsPublicLogradouro.inc.php
... ... @@ -110,7 +110,7 @@ class clsPublicLogradouro
110 110  
111 111 /**
112 112 * Construtor (PHP 4)
113   - *
  113 + *
114 114 * @param integer idlog
115 115 * @param string idtlog
116 116 * @param string nome
... ... @@ -341,7 +341,7 @@ class clsPublicLogradouro
341 341 if( is_string( $this->nome ) )
342 342 {
343 343 $campos .= "{$gruda}nome";
344   - $valores .= "{$gruda}'{$this->nome}'";
  344 + $valores .= "{$gruda}'" . addslashes($this->nome) . "'";
345 345 $gruda = ", ";
346 346 }
347 347 if( is_numeric( $this->idmun ) )
... ... @@ -435,7 +435,7 @@ class clsPublicLogradouro
435 435 }
436 436 if( is_string( $this->nome ) )
437 437 {
438   - $set .= "{$gruda}nome = '{$this->nome}'";
  438 + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'";
439 439 $gruda = ", ";
440 440 }
441 441 if( is_numeric( $this->idmun ) )
... ... @@ -506,7 +506,7 @@ class clsPublicLogradouro
506 506  
507 507 /**
508 508 * Retorna uma lista filtrados de acordo com os parametros
509   - *
  509 + *
510 510 * @param string str_idtlog
511 511 * @param string str_nome
512 512 * @param integer int_idmun
... ... @@ -529,7 +529,7 @@ class clsPublicLogradouro
529 529 {
530 530 $select = ", m.nome AS nm_municipio, m.sigla_uf, u.nome AS nm_estado, u.idpais, p.nome AS nm_pais ";
531 531 $from = "l, public.municipio m, public.uf u, public.pais p ";
532   -
  532 +
533 533 $sql = "SELECT {$this->_campos_lista}{$select} FROM {$this->_tabela} {$from}";
534 534 $whereAnd = " AND ";
535 535  
... ... @@ -547,7 +547,7 @@ class clsPublicLogradouro
547 547 }
548 548 if( is_string( $str_nome ) )
549 549 {
550   - $filtros .= "{$whereAnd} l.nome LIKE '%{$str_nome}%'";
  550 + $filtros .= "{$whereAnd} l.nome LIKE E'%" . addslashes($str_nome) . "%'";
551 551 $whereAnd = " AND ";
552 552 }
553 553 if( is_numeric( $int_idmun ) )
... ...
ieducar/intranet/include/public/clsPublicMunicipio.inc.php
... ... @@ -114,7 +114,7 @@ class clsPublicMunicipio
114 114  
115 115 /**
116 116 * Construtor (PHP 4)
117   - *
  117 + *
118 118 * @param integer idmun
119 119 * @param string nome
120 120 * @param string sigla_uf
... ... @@ -407,7 +407,7 @@ class clsPublicMunicipio
407 407 if( is_string( $this->nome ) )
408 408 {
409 409 $campos .= "{$gruda}nome";
410   - $valores .= "{$gruda}'{$this->nome}'";
  410 + $valores .= "{$gruda}'" . addslashes($this->nome) . "'";
411 411 $gruda = ", ";
412 412 }
413 413 if( is_string( $this->sigla_uf ) )
... ... @@ -526,7 +526,7 @@ class clsPublicMunicipio
526 526  
527 527 if( is_string( $this->nome ) )
528 528 {
529   - $set .= "{$gruda}nome = '{$this->nome}'";
  529 + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'";
530 530 $gruda = ", ";
531 531 }
532 532 if( is_string( $this->sigla_uf ) )
... ... @@ -622,7 +622,7 @@ class clsPublicMunicipio
622 622  
623 623 /**
624 624 * Retorna uma lista filtrados de acordo com os parametros
625   - *
  625 + *
626 626 * @param string str_nome
627 627 * @param string str_sigla_uf
628 628 * @param integer int_area_km2
... ... @@ -659,7 +659,7 @@ class clsPublicMunicipio
659 659 }
660 660 if( is_string( $str_nome ) )
661 661 {
662   - $filtros .= "{$whereAnd} nome LIKE '%{$str_nome}%'";
  662 + $filtros .= "{$whereAnd} nome LIKE E'%" . addslashes($str_nome) . "%'";
663 663 $whereAnd = " AND ";
664 664 }
665 665 if( is_string( $str_sigla_uf ) )
... ...
ieducar/intranet/include/public/clsPublicPais.inc.php
... ... @@ -99,7 +99,7 @@ class clsPublicPais
99 99  
100 100 /**
101 101 * Construtor (PHP 4)
102   - *
  102 + *
103 103 * @param integer idpais
104 104 * @param string nome
105 105 * @param string geom
... ... @@ -149,7 +149,7 @@ class clsPublicPais
149 149 if( is_string( $this->nome ) )
150 150 {
151 151 $campos .= "{$gruda}nome";
152   - $valores .= "{$gruda}'{$this->nome}'";
  152 + $valores .= "{$gruda}'" . addslashes($this->nome) . "'";
153 153 $gruda = ", ";
154 154 }
155 155 if( is_string( $this->geom ) )
... ... @@ -182,7 +182,7 @@ class clsPublicPais
182 182  
183 183 if( is_string( $this->nome ) )
184 184 {
185   - $set .= "{$gruda}nome = '{$this->nome}'";
  185 + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'";
186 186 $gruda = ", ";
187 187 }
188 188 if( is_string( $this->geom ) )
... ... @@ -203,7 +203,7 @@ class clsPublicPais
203 203  
204 204 /**
205 205 * Retorna uma lista filtrados de acordo com os parametros
206   - *
  206 + *
207 207 * @param string str_nome
208 208 * @param string str_geom
209 209 *
... ... @@ -223,7 +223,7 @@ class clsPublicPais
223 223 }
224 224 if( is_string( $str_nome ) )
225 225 {
226   - $filtros .= "{$whereAnd} nome LIKE '%{$str_nome}%'";
  226 + $filtros .= "{$whereAnd} nome LIKE E'%" . addslashes($str_nome) . "%'";
227 227 $whereAnd = " AND ";
228 228 }
229 229 if( is_string( $str_geom ) )
... ...
ieducar/intranet/include/public/clsPublicUf.inc.php
... ... @@ -100,7 +100,7 @@ class clsPublicUf
100 100  
101 101 /**
102 102 * Construtor (PHP 4)
103   - *
  103 + *
104 104 * @param string sigla_uf
105 105 * @param string nome
106 106 * @param string geom
... ... @@ -185,7 +185,7 @@ class clsPublicUf
185 185 if( is_string( $this->nome ) )
186 186 {
187 187 $campos .= "{$gruda}nome";
188   - $valores .= "{$gruda}'{$this->nome}'";
  188 + $valores .= "{$gruda}'" . addslashes($this->nome) . "'";
189 189 $gruda = ", ";
190 190 }
191 191 if( is_string( $this->geom ) )
... ... @@ -223,7 +223,7 @@ class clsPublicUf
223 223  
224 224 if( is_string( $this->nome ) )
225 225 {
226   - $set .= "{$gruda}nome = '{$this->nome}'";
  226 + $set .= "{$gruda}nome = '" . addslashes($this->nome) . "'";
227 227 $gruda = ", ";
228 228 }
229 229 if( is_string( $this->geom ) )
... ... @@ -249,7 +249,7 @@ class clsPublicUf
249 249  
250 250 /**
251 251 * Retorna uma lista filtrados de acordo com os parametros
252   - *
  252 + *
253 253 * @param string str_nome
254 254 * @param string str_geom
255 255 * @param integer int_idpais
... ... @@ -270,7 +270,7 @@ class clsPublicUf
270 270 }
271 271 if( is_string( $str_nome ) )
272 272 {
273   - $filtros .= "{$whereAnd} uf.nome LIKE '%{$str_nome}%'";
  273 + $filtros .= "{$whereAnd} uf.nome LIKE E'%" . addslashes($str_nome) . "%'";
274 274 $whereAnd = " AND ";
275 275 }
276 276 if( is_string( $str_geom ) )
... ...
ieducar/intranet/public_uf_det.php
... ... @@ -46,18 +46,18 @@ class indice extends clsDetalhe
46 46 * @var int
47 47 */
48 48 var $titulo;
49   -
  49 +
50 50 var $sigla_uf;
51 51 var $nome;
52 52 var $geom;
53 53 var $idpais;
54   -
  54 +
55 55 function Gerar()
56 56 {
57 57 @session_start();
58 58 $this->pessoa_logada = $_SESSION['id_pessoa'];
59 59 session_write_close();
60   -
  60 +
61 61 $this->titulo = "Uf - Detalhe";
62 62 $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" );
63 63  
... ... @@ -65,13 +65,13 @@ class indice extends clsDetalhe
65 65  
66 66 $tmp_obj = new clsPublicUf( $this->sigla_uf );
67 67 $registro = $tmp_obj->detalhe();
68   -
  68 +
69 69 if( ! $registro )
70 70 {
71 71 header( "location: public_uf_lst.php" );
72 72 die();
73 73 }
74   -
  74 +
75 75 if( class_exists( "clsPais" ) )
76 76 {
77 77 $obj_idpais = new clsPais( $registro["idpais"] );
... ...
ieducar/intranet/public_uf_lst.php
... ... @@ -98,9 +98,9 @@ class indice extends clsListagem
98 98 {
99 99 $objTemp = new clsPais();
100 100 $lista = $objTemp->lista( false, false, false, false, false, "nome ASC" );
101   - if ( is_array( $lista ) && count( $lista ) )
  101 + if ( is_array( $lista ) && count( $lista ) )
102 102 {
103   - foreach ( $lista as $registro )
  103 + foreach ( $lista as $registro )
104 104 {
105 105 $opcoes["{$registro['idpais']}"] = "{$registro['nome']}";
106 106 }
... ... @@ -129,7 +129,8 @@ class indice extends clsListagem
129 129 $lista = $obj_uf->lista(
130 130 $this->nome,
131 131 $this->geom,
132   - $this->idpais
  132 + $this->idpais,
  133 + $this->sigla_uf
133 134 );
134 135  
135 136 $total = $obj_uf->_total;
... ...
ieducar/lib/Portabilis/Controller/Page/ListController.php
... ... @@ -50,13 +50,6 @@ class Portabilis_Controller_Page_ListController extends Core_Controller_Page_Lis
50 50 parent::__construct();
51 51 }
52 52  
53   - protected function inputsHelper() {
54   - if (! isset($this->_inputsHelper))
55   - $this->_inputsHelper = new Portabilis_View_Helper_Inputs($this);
56   -
57   - return $this->_inputsHelper;
58   - }
59   -
60 53 protected function loadResourceAssets($dispatcher){
61 54 $rootPath = $_SERVER['DOCUMENT_ROOT'];
62 55 $controllerName = ucwords($dispatcher->getControllerName());
... ...
ieducar/modules/Api/Views/AlunoController.php
... ... @@ -311,8 +311,17 @@ class AlunoController extends ApiCoreController
311 311 $pessoa->idpes = $this->getRequest()->pessoa_id;
312 312 $pessoa->nome_responsavel = '';
313 313  
  314 + $_pessoa = $pessoa->detalhe();
  315 +
314 316 if ($this->getRequest()->tipo_responsavel == 'outra_pessoa')
315 317 $pessoa->idpes_responsavel = $this->getRequest()->responsavel_id;
  318 +
  319 + elseif($this->getRequest()->tipo_responsavel == 'pai' && $_pessoa['idpes_pai'])
  320 + $pessoa->idpes_responsavel = $_pessoa['idpes_pai'];
  321 +
  322 + elseif($this->getRequest()->tipo_responsavel == 'mae' && $_pessoa['idpes_mae'])
  323 + $pessoa->idpes_responsavel = $_pessoa['idpes_mae'];
  324 +
316 325 else
317 326 $pessoa->idpes_responsavel = 'NULL';
318 327  
... ... @@ -338,7 +347,7 @@ class AlunoController extends ApiCoreController
338 347  
339 348 $aluno = new clsPmieducarAluno();
340 349 $aluno->cod_aluno = $id;
341   - $aluno->aluno_estado_id = $this->getRequest()->aluno_estado_id;
  350 + $aluno->aluno_estado_id = Portabilis_String_Utils::toLatin1($this->getRequest()->aluno_estado_id);
342 351  
343 352 // após cadastro não muda mais id pessoa
344 353 if (is_null($id))
... ... @@ -592,6 +601,7 @@ class AlunoController extends ApiCoreController
592 601 $aluno['tipo_responsavel'] = $this->tipoResponsavel($aluno);
593 602 $aluno['aluno_inep_id'] = $this->loadAlunoInepId($id);
594 603 $aluno['ativo'] = $aluno['ativo'] == 1;
  604 + $aluno['aluno_estado_id'] = Portabilis_String_Utils::toUtf8($aluno['aluno_estado_id']);
595 605  
596 606 $aluno['alfabetizado'] = $aluno['analfabeto'] == 0;
597 607 unset($aluno['analfabeto']);
... ... @@ -705,7 +715,6 @@ class AlunoController extends ApiCoreController
705 715 else
706 716 $this->messenger->append('Aparentemente o cadastro não pode ser alterado, por favor, verifique.',
707 717 'error', false, 'error');
708   -
709 718 return array('id' => $id);
710 719 }
711 720  
... ...
ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js
... ... @@ -20,11 +20,15 @@ resourceOptions.handlePost = function(dataResponse) {
20 20  
21 21 if (! dataResponse.any_error_msg)
22 22 window.setTimeout(function() { document.location = '/intranet/educar_aluno_det.php?cod_aluno=' + resource.id(); }, 500);
  23 + else
  24 + $submitButton.removeAttr('disabled').val('Gravar');
23 25 }
24 26  
25 27 resourceOptions.handlePut = function(dataResponse) {
26 28 if (! dataResponse.any_error_msg)
27 29 window.setTimeout(function() { document.location = '/intranet/educar_aluno_det.php?cod_aluno=' + resource.id(); }, 500);
  30 + else
  31 + $submitButton.removeAttr('disabled').val('Gravar');
28 32 }
29 33  
30 34 resourceOptions.handleGet = function(dataResponse) {
... ...
ieducar/modules/Cadastro/Assets/Javascripts/PessoaFisica.js
... ... @@ -183,8 +183,6 @@ $j(document).ready(function() {
183 183  
184 184 // style fixup
185 185  
186   - $j('#pais_origem_nome').css('width', '150px');
187   -
188 186 // agrupado zebra por tipo documento, branco => .formlttd, colorido => .formmdtd
189 187  
190 188 $j('#tr_uf_emissao_certidao_civil td').removeClass('formmdtd');
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Resource.js
... ... @@ -50,6 +50,8 @@ var resourceOptions = {
50 50 },
51 51  
52 52 handlePost : function(dataResponse) {
  53 + if (dataResponse && dataResponse.any_error_msg)
  54 + $submitButton.removeAttr('disabled').val('Gravar');
53 55 },
54 56  
55 57 _handlePost : function(dataResponse) {
... ... @@ -62,6 +64,8 @@ var resourceOptions = {
62 64 },
63 65  
64 66 handlePut : function(dataResponse) {
  67 + if (dataResponse && dataResponse.any_error_msg)
  68 + $submitButton.removeAttr('disabled').val('Gravar');
65 69 },
66 70  
67 71  
... ... @@ -193,6 +197,8 @@ var resourceOptions = {
193 197 safeLog('dataResponse details:');
194 198 safeLog(dataResponse);
195 199  
  200 + $submitButton.removeAttr('disabled').val('Gravar');
  201 +
196 202 throw error;
197 203 }
198 204 }
... ... @@ -201,6 +207,8 @@ var resourceOptions = {
201 207 function handleError(response) {
202 208 handleMessages([{type : 'error', msg : 'Erro ao realizar operação, por favor tente novamente, detalhes:' + response.responseText}], '');
203 209  
  210 + $submitButton.removeAttr('disabled').val('Gravar');
  211 +
204 212 safeLog('response details:');
205 213 safeLog(response);
206 214 }
... ...
ieducar/modules/Portabilis/Assets/Version.php
... ... @@ -4,7 +4,7 @@
4 4 usado pelo metodos loadJavascript e loadStylesheet do helper Portabilis_View_Helper_Application */
5 5  
6 6 class Portabilis_Assets_Version {
7   - const VERSION = "0_0_0_1009";
  7 + const VERSION = '1';
8 8 }
9 9  
10 10 ?>
... ...