Commit d669c370 authored by Antonio.Suerte's avatar Antonio.Suerte

Zendesk API Issue Fix

parent b87826cc
......@@ -87,14 +87,7 @@ class LogicSupport extends SupportModelClass {
$this -> getSendParamsForAdmin($rs)
);
if($this -> isLoopData($rs)){
$rowData = $this -> getRowData($rs);
$firstName = $this -> getColumnData($rowData, PARAM_FIRST_NAME);
$lastName = $this -> getColumnData($rowData, PARAM_LAST_NAME);
$template["full_name"] = "{$firstName} {$lastName}";
}
$template["full_name"] = $this -> getInquirerName();
$errorDetails = [];
if(!$this -> createZendeskTicket($template, $errorDetails)){
......@@ -103,8 +96,9 @@ class LogicSupport extends SupportModelClass {
"Response String: {$errorDetails["response_str"]}\n\n".
"Ticket Body:\n\n {$errorDetails["ticket_body"]}";
$this -> notifyErrorToSlack($details);
}
$this -> sendNotificationToSlack(0, $details);
}else
$this -> sendNotificationToSlack(1, $template["body"]);
// ユーザ側へ送信
$this -> sendMailByTmp('send_mail_for_user.xml'
......@@ -138,7 +132,7 @@ class LogicSupport extends SupportModelClass {
],
"requester" => [
"locale_id" => $this -> getZendeskLocaleCode(),
"name" => isset($template["full_name"]) ? $template["full_name"] : NO_STRING,
"name" => $template["full_name"],
"email" => $this -> getEmail()
]
]
......@@ -177,19 +171,23 @@ class LogicSupport extends SupportModelClass {
}
/*-------------------------------------------------------------------------
* @function_name: Slackへのエラー通知
* @function_name: 通知をSlackへ送信する機能
* @parameter : details
* @return : なし
-------------------------------------------------------------------------*/
private function notifyErrorToSlack($details){
private function sendNotificationToSlack($notificationType, $details){
$slackChannels = $this -> getSettingConfiguration("slack_notif_channel");
$handle = curl_init();
$message = ["text" => $details];
$channel = $notificationType === 1 ?
$slackChannels -> successfully_submitted_tickets :
$slackChannels -> user_details_channel;
curl_setopt_array($handle, [
CURLOPT_URL => $slackChannels -> user_details_channel,
CURLOPT_URL => $channel,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "utf8",
......
......@@ -561,5 +561,14 @@ class SupportModelClass extends ModelClassEx {
return 1;
}
}
/*-------------------------------------------------------------------------
* @function_name: 相談者の名前
* @parameter : なし
* @return : string
-------------------------------------------------------------------------*/
function getInquirerName() {
return $this -> name;
}
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment