Commit 6527d3d0a72d225f5fb0e2dc650accbb3fd7f8c2
1 parent
0fe0414a
Exists in
master
and in
7 other branches
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 | 112 | break; |
| 113 | 113 | } |
| 114 | 114 | cpjson($retorno); |
| 115 | -function alterarOperacoes() | |
| 116 | -{ | |
| 115 | +function alterarOperacoes(){ | |
| 117 | 116 | global $id_operacao,$codigo,$descricao; |
| 118 | - try | |
| 119 | - { | |
| 117 | + try{ | |
| 120 | 118 | include(dirname(__FILE__)."/conexao.php"); |
| 121 | 119 | if($convUTF){ |
| 122 | 120 | $descricao = utf8_encode($descricao); |
| 123 | 121 | } |
| 124 | 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 | 128 | $retorna = $id_operacao; |
| 127 | 129 | } |
| 128 | 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 | 136 | $dbhw = null; |
| 138 | 137 | $dbh = null; |
| ... | ... | @@ -144,10 +143,13 @@ function alterarOperacoes() |
| 144 | 143 | } |
| 145 | 144 | function adicionaPapelOperacoes(){ |
| 146 | 145 | global $id_operacao,$id_papel; |
| 147 | - try | |
| 148 | - { | |
| 146 | + try{ | |
| 149 | 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 | 153 | $dbhw = null; |
| 152 | 154 | $dbh = null; |
| 153 | 155 | return "ok"; |
| ... | ... | @@ -158,10 +160,11 @@ function adicionaPapelOperacoes(){ |
| 158 | 160 | } |
| 159 | 161 | function excluirPapelOperacao(){ |
| 160 | 162 | global $id_operacao,$id_papel; |
| 161 | - try | |
| 162 | - { | |
| 163 | + try{ | |
| 163 | 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 | 168 | $dbhw = null; |
| 166 | 169 | $dbh = null; |
| 167 | 170 | return "ok"; | ... | ... |