#!/usr/bin/php -q 'ATENDIDA' "; $result = pg_query($conexao, $query); $row = pg_fetch_row($result); $agendado = $row[0]; write("NOOP STATUS => $status"); read(); write("NOOP AGENDADO => $agendado"); read(); if (!$agendado && $status == '6') { $query = "update pbx_campanha set cmp_status = '5' where cmp_id = '$cmp_id'"; pg_query($query); pg_close(); } } else if (trim(strtolower($status)) == 'atendida') { mostra_parametro(human); mostra_parametro($status); $query = "update pbx_campanha_contato_fone set conf_status = '$status',conf_data = 'now()' where cont_id = '$id_cli' and substr(conf_fone,(length(conf_fone) - 9),10) = '$fone' and conf_status_lista = '1'"; pg_query($query); $query = "update pbx_campanha_contato set cont_peso = '1',cont_discado = '1' where cont_id = '$id_cli'"; pg_query($query); pg_close(); } else { mostra_parametro($status); $query = "update pbx_campanha_contato_fone set conf_status = '$status',conf_data = 'now()' where cont_id = '$id_cli' and substr(conf_fone,(length(conf_fone) - 9),10) = '$fone' and conf_status_lista = '1'"; pg_query($query); $query = "update pbx_campanha_contato set cont_peso = '0',cont_discado = '0' where cont_id = '$id_cli'"; pg_query($query); $query = "delete from pbx_campanha_canais_discando where id_cliente = '$id_cli' and status = '0'"; pg_query($query); pg_close(); } function mostra_parametro($parametro) { write("EXEC Noop PARAMETRO ==> $parametro"); read(); } // clean up file handlers etc. fclose($in); fclose($stdlog); ?>