Browse Source

correção cadastro multiempresa

master
Lucas Awade 10 months ago
parent
commit
08198ec7da
  1. 8
      cadastros/organizacao/cadOrganizacao.php

8
cadastros/organizacao/cadOrganizacao.php

@ -116,10 +116,10 @@ function importIdTables($dbcon, $organizacao)
___Gravalog(" [ $sql ] - Não foi possível o ID da tabela {$table};");
}
$query = "CREATE TEMPORARY TABLE t{$table} AS SELECT * FROM {$table} WHERE $column = 1 LIMIT 1; \n";
$query .= "ALTER TABLE t{$table} DROP COLUMN $column; \n";
$query .= "UPDATE {$table} SET org_id = $organizacao WHERE $column = $id;";
$query .= "INSERT INTO {$table} SELECT * FROM t{$table} LIMIT 1; \n";
$query = "CREATE TEMPORARY TABLE t{$table} AS SELECT * FROM {$table} WHERE $column = $id;";
$query .= "ALTER TABLE t{$table} DROP COLUMN $column;";
$query .= "UPDATE t{$table} SET org_id = $organizacao;";
$query .= "INSERT INTO {$table} SELECT * FROM t{$table};";
$result = pg_query($dbcon, $query);
if (!$result) {

Loading…
Cancel
Save