Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

DashletOtrsQueue: add alarming, configuration option for locked/unloc…

…ked tickets
  • Loading branch information...
michael-batz committed Nov 4, 2015
1 parent c96a704 commit d8b2c823d98b4d19808a5ddc22bb91d120182791
@@ -57,10 +57,11 @@ function __construct($soapUrl, $soapUser, $soapPassword)
* Gets tickets from OTRS
* @param $queues array of queues to get tickets
* @param $states array of ticket states to search
* @param $lock array of ticket lock states to search
* @param $limit max count of output entries
* @return array with ticketIDs
*/
public function getTickets($queues, $states, $limit)
public function getTickets($queues, $states, $lock, $limit)
{
//soap call to get all new or open tickets of queue $queue
$soapClient = new SoapClient(null, $this->soapOptions);
@@ -77,7 +78,7 @@ public function getTickets($queues, $states, $limit)
{
$soapMessage[] = new SoapParam($state, "States");
}
$soapMessage[] = new SoapParam("unlock", "Locks");
$soapMessage[] = new SoapParam($lock, "Locks");
$soapMessage[] = new SoapParam("Down", "OrderBy");
$soapMessage[] = new SoapParam("Age", "SortBy");
//returns a single ticketId or an array of ticketIds, if multiple tickets were found
@@ -41,20 +41,40 @@ public function getHtmlContentString()
$soapPassword = $this->parameter->getValue("soapPassword");
$queue = $this->parameter->getValueArray("queue");
$ticketStates = $this->parameter->getValueArray("ticketState");
$ticketLock = $this->parameter->getValueArray("ticketLock");
$maxEntries = $this->parameter->getValue("maxEntries");
$linkUrlBase = $this->parameter->getValue("linkUrlBase");
//open connector
$connector = new ConnectorOtrs($soapUrl, $soapUser, $soapPassword);
$createAlarms = $this->parameter->getValue("createAlarms");
$alarmMinTime = $this->parameter->getValue("alarmMinTime");
$alarmMaxTime = $this->parameter->getValue("alarmMaxTime");
//set default values
if($alarmMinTime == "")
{
$alarmMinTime = 0;
}
if($alarmMaxTime == "")
{
$alarmMaxTime = 300;
}
//set default value for ticketState
if(count($ticketStates) == 0)
{
$ticketStates = Array("new", "open");
}
//set default value for ticketLock
if(count($ticketLock) == 0)
{
$ticketLock = Array("unlock");
}
//open connector
$connector = new ConnectorOtrs($soapUrl, $soapUser, $soapPassword);
//get ticketIDs
$tickets = $connector->getTickets($queue, $ticketStates, $maxEntries + 1);
$tickets = $connector->getTickets($queue, $ticketStates, $ticketLock, $maxEntries + 1);
//start output
$output = "<h1 class=\"text-center\">$title</h1>";
@@ -69,6 +89,13 @@ public function getHtmlContentString()
break;
}
$ticket = $connector->getTicketSummary($ticketId);
//create alarm if configured for every alarm in the given interval
if($createAlarms == "true" && $ticket['Age'] >= $alarmMinTime && $ticket['Age'] <= $alarmMaxTime )
{
echo "<script type=\"text/javascript\">addAlarm('otrsticket-".$ticket["TicketID"]."');</script>";
}
$output .= "<tr class=\"dashboard-severity-warning\">";
$output .= "<td><a href=\"$linkUrlBase/index.pl?Action=AgentTicketZoom;TicketID={$ticket['TicketID']}\" target=\"_blank\">{$ticket['TicketNumber']}</a></td>";
@@ -1,4 +1,4 @@
<alarm-configuration>
<enabled>1</enabled>
<soundfile>audio/alarm.wav</soundfile>
<soundfile>audio/notify.wav</soundfile>
</alarm-configuration>
File renamed without changes.
BIN +224 KB web/audio/notify.wav
Binary file not shown.

0 comments on commit d8b2c82

Please sign in to comment.
You can’t perform that action at this time.