Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ function getOptions() {
'length' => 200
],
]),
'teams-csv-departmentid' => new TextboxField([
'label' => $__('Ignore department ids'),
'hint' => $__('Comma delimited, ints'),
'configuration' => [
'size' => 30,
'length' => 200
],
]),
'teams-message-display' => new BooleanField([
'label' => $__('Display ticket message body in notification.'),
'hint' => $__('Uncheck to hide messages.'),
Expand Down
13 changes: 12 additions & 1 deletion teams.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,18 @@ function sendToTeams(Ticket $ticket, $type, $colour = 'good') {
error_log("$ticket_subject didn't trigger $regex_subject_ignore");
}

// Build the payload with the formatted data:
// Check the department id, see if we want to filter it
$teams_csv_departmentid = explode(',',$this->getConfig()->get('teams-csv-departmentid'));
if(in_array($ticket->getDeptId(),$teams_csv_departmentid)){
$ost->logDebug('Ignored Message', 'Teams notification was not sent because the departmentID (' . $ticket->getDeptId() . ') matched (' . json_encode($teams_csv_departmentid) . ').');
return;
}
else{
error_log('DepartmentID: '.$ticket->getDeptId() ." didn't trigger ".json_encode($teams_csv_departmentid));
}


// Build the payload with the formatted data:
$payload = $this->createJsonMessage($ticket, $type);

try {
Expand Down