Skip to content

Commit

Permalink
Fixed issue#4 - Check if user name/surname/alias is accessible otherwise
Browse files Browse the repository at this point in the history
display userid. Additionally check if name or surname is missing and
replace it with empty string. If both are empty string display user
alias instead.
  • Loading branch information
zbxwallboard committed Mar 29, 2019
1 parent 11137f1 commit a8ddeb6
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion classes/RemoteData.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,25 @@ public function get_triggers($PARAMS) {
}

public function get_eventdetails($PARAMS) {
return $this->api_fetch_array('event.get',$PARAMS);
$EVENTDETAILS = $this->api_fetch_array('event.get',$PARAMS);
foreach ($EVENTDETAILS[0]['acknowledges'] as $ACKED_KEY => $ACKED_FIELD) {
if (!isset($EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['alias'])) {
$EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['name'] = "Inaccessible UserID";
$EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['surname'] = $EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['userid'];
}
else {
if (!isset($EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['name'])) {
$EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['name'] = '';
}
if (!isset($EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['surname'])) {
$EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['surname'] = '';
}
if ($EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['name'] === '' AND $EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['surname'] === '') {
$EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['name'] = $EVENTDETAILS[0]['acknowledges'][$ACKED_KEY]['alias'];
}
}
}
return $EVENTDETAILS;
}

public function add_acknowledge($EVENTID,$MESSAGE) {
Expand Down

0 comments on commit a8ddeb6

Please sign in to comment.