2009-10-06 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_agents.php: add the function "getNextAgentContact" that return the percentage of time for next contanct of agent (pass as id_agent). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2007 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
a32557839b
commit
c92436fbca
|
@ -1,3 +1,9 @@
|
|||
2009-10-06 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_agents.php: add the function "getNextAgentContact"
|
||||
that return the percentage of time for next contanct of agent (pass as
|
||||
id_agent).
|
||||
|
||||
2009-10-06 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/fgraph.php: lost in the last commit this file, fix the path for
|
||||
|
|
|
@ -397,4 +397,26 @@ function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modu
|
|||
}
|
||||
process_sql ('SET AUTOCOMMIT = 1');
|
||||
}
|
||||
|
||||
function getNextAgentContact($idAgent, $maxModules = false) {
|
||||
|
||||
$agent = get_db_row_sql("SELECT * FROM tagente WHERE id_agente = " . $idAgent);
|
||||
|
||||
|
||||
$difference = get_system_time () - strtotime ($agent["ultimo_contacto"]);
|
||||
|
||||
|
||||
$max = $agent["intervalo"];
|
||||
if ($maxModules) {
|
||||
$sql = sprintf ("SELECT MAX(module_interval) FROM tagente_modulo WHERE id_agente = %d", $id_agente);
|
||||
$maxModules = (int) get_db_sql ($sql);
|
||||
if ($maxModules > 0)
|
||||
$max = $maxModules;
|
||||
}
|
||||
|
||||
if ($max > 0)
|
||||
return round ($difference / (($max * 2) / 100));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue