You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
require_once("bd.php");
$id = $_GET["id"] ?? "0";
$numReg = 0;
$query = "select count(*) from pbx_eventos_agentes where id_motivo_pausa = $id";
$result = @pg_query($dbcon, $query);
if ($result) {
// Verifica se existem usu<EFBFBD>rio incluidos neste grupo
$row = @pg_fetch_row($result);
$numReg = $row[0];
if ($numReg == 0) {
$query = "begin";
$result = @pg_query($dbcon, $query);
if ($result) {
$query = "delete from pbx_motivos_pausas where id = $id";
$result = @pg_query($dbcon, $query);
}
if ($result) {
$query = "commit";
@pg_query($dbcon, $query);
echo "OK; Registro excluido com sucesso!";
} else {
$query = "rollback";
@pg_query($dbcon, $query);
echo "ERRO; N<EFBFBD>o <EFBFBD> poss<EFBFBD>vel excluir este registro! Erro: " . pg_last_error();
}
} else {
echo "ERRO; N<EFBFBD>o <EFBFBD> poss<EFBFBD>vel excluir este registro, o mesmo j<EFBFBD> foi utilizada na movimenta<EFBFBD><EFBFBD>o!";
}
}
?>