PABX da Simples IP
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.

37 lines
1.2 KiB

<?php
$tpLayout = 1;
$ramal = $_GET['ramal'];
if ($_GET['acao'] == "deleta") {
/*
* VERIFICA SE EXISTE O RAMAL NA TABELA
*/
$ramal = $_GET['id'];
$query = "SELECT rma_telefone FROM pbx_ramais_agenda WHERE rma_telefone='$ramal' ";
$result = pg_query($dbcon, $query);
if (pg_num_rows($result) >= 1) {
/*
* DELETA O RAMAL
*/
$deleta = "DELETE FROM pbx_ramais_agenda WHERE rma_telefone='$ramal'";
$result = pg_query($dbcon, $deleta);
/*
* VERIFICA SE O RAMAL FOI DELETADO
*/
$query = "SELECT rma_telefone FROM pbx_ramais_agenda WHERE rma_telefone='$ramal'";
$result = pg_query(dbcon, $query);
if (pg_num_rows($result) >= 1) {
$mes = "<td colspan='2' style='color:#900000;font-weight:bold;'>N<EFBFBD>o foi possivel excluir o ramal!</td>";
} else {
$mes = "<td colspan='2' style='color:#009900;font-weight:bold;'>Ramal deletado com sucesso!</td>";
}
} else {
$mes = "<td colspan='2' style='color:#900000;font-weigth:bold;'>Ramal n<EFBFBD>o encontrado, talvez ja deletado!</td>";
}
}
$smarty->assign('ramal', $ramal);
$smarty->assign('mes', $mes);
$smarty->display("agendaRamais/ramais/ramaisDelete.html");
?>