Commit 6527d3d0a72d225f5fb0e2dc650accbb3fd7f8c2

Authored by Edmar Moretti
1 parent 0fe0414a

Implanatção do log de transações no editor de operações (gerenciador de usuários) #62

Showing 2 changed files with 21 additions and 18 deletions   Show diff stats
admin/admin.db
No preview for this file type
admin/php/operacoes.php
@@ -112,27 +112,26 @@ switch (strtoupper($funcao)) @@ -112,27 +112,26 @@ switch (strtoupper($funcao))
112 break; 112 break;
113 } 113 }
114 cpjson($retorno); 114 cpjson($retorno);
115 -function alterarOperacoes()  
116 -{ 115 +function alterarOperacoes(){
117 global $id_operacao,$codigo,$descricao; 116 global $id_operacao,$codigo,$descricao;
118 - try  
119 - { 117 + try{
120 include(dirname(__FILE__)."/conexao.php"); 118 include(dirname(__FILE__)."/conexao.php");
121 if($convUTF){ 119 if($convUTF){
122 $descricao = utf8_encode($descricao); 120 $descricao = utf8_encode($descricao);
123 } 121 }
124 if($id_operacao != ""){ 122 if($id_operacao != ""){
125 - $dbhw->query("UPDATE ".$esquemaadmin."i3geousr_operacoes SET codigo='$codigo',descricao='$descricao' WHERE id_operacao = $id_operacao"); 123 + $dataCol = array(
  124 + "codigo" => $codigo,
  125 + "descricao" => $descricao
  126 + );
  127 + i3GeoAdminUpdate($dbhw,"i3geousr_operacoes",$dataCol,"WHERE id_operacao = $id_operacao");
126 $retorna = $id_operacao; 128 $retorna = $id_operacao;
127 } 129 }
128 else{ 130 else{
129 - $idtemp = (rand (9000,10000)) * -1;  
130 - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoes (codigo,descricao) VALUES ('','$idtemp')");  
131 - $id = $dbh->query("SELECT id_operacao FROM ".$esquemaadmin."i3geousr_operacoes WHERE descricao = '$idtemp'");  
132 - $id = $id->fetchAll();  
133 - $id = $id[0]['id_operacao'];  
134 - $dbhw->query("UPDATE ".$esquemaadmin."i3geousr_operacoes SET descricao = '' WHERE id_operacao = $id AND descricao = '$idtemp'");  
135 - $retorna = $id; 131 + $dataCol = array(
  132 + "descricao" => ''
  133 + );
  134 + $retorna = i3GeoAdminInsertUnico($dbhw,"i3geousr_operacoes",$dataCol,"descricao","id_operacao");
136 } 135 }
137 $dbhw = null; 136 $dbhw = null;
138 $dbh = null; 137 $dbh = null;
@@ -144,10 +143,13 @@ function alterarOperacoes() @@ -144,10 +143,13 @@ function alterarOperacoes()
144 } 143 }
145 function adicionaPapelOperacoes(){ 144 function adicionaPapelOperacoes(){
146 global $id_operacao,$id_papel; 145 global $id_operacao,$id_papel;
147 - try  
148 - { 146 + try{
149 include(dirname(__FILE__)."/conexao.php"); 147 include(dirname(__FILE__)."/conexao.php");
150 - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geousr_operacoespapeis (id_operacao,id_papel) VALUES ($id_operacao,$id_papel)"); 148 + $dataCol = array(
  149 + "id_operacao" => $id_operacao,
  150 + "id_papel" => $id_papel
  151 + );
  152 + i3GeoAdminInsert($dbhw,"i3geousr_operacoespapeis",$dataCol);
151 $dbhw = null; 153 $dbhw = null;
152 $dbh = null; 154 $dbh = null;
153 return "ok"; 155 return "ok";
@@ -158,10 +160,11 @@ function adicionaPapelOperacoes(){ @@ -158,10 +160,11 @@ function adicionaPapelOperacoes(){
158 } 160 }
159 function excluirPapelOperacao(){ 161 function excluirPapelOperacao(){
160 global $id_operacao,$id_papel; 162 global $id_operacao,$id_papel;
161 - try  
162 - { 163 + try{
163 include(dirname(__FILE__)."/conexao.php"); 164 include(dirname(__FILE__)."/conexao.php");
164 - $dbhw->query("DELETE from ".$esquemaadmin."i3geousr_operacoespapeis WHERE id_operacao = $id_operacao AND id_papel = $id_papel"); 165 + $sql = "DELETE from ".$esquemaadmin."i3geousr_operacoespapeis WHERE id_operacao = $id_operacao AND id_papel = $id_papel";
  166 + $dbhw->query($sql);
  167 + i3GeoAdminInsertLog($dbhw,$sql);
165 $dbhw = null; 168 $dbhw = null;
166 $dbh = null; 169 $dbh = null;
167 return "ok"; 170 return "ok";