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

Zendesk API Issue Fix

parent b87826cc
...@@ -87,14 +87,7 @@ class LogicSupport extends SupportModelClass { ...@@ -87,14 +87,7 @@ class LogicSupport extends SupportModelClass {
$this -> getSendParamsForAdmin($rs) $this -> getSendParamsForAdmin($rs)
); );
if($this -> isLoopData($rs)){ $template["full_name"] = $this -> getInquirerName();
$rowData = $this -> getRowData($rs);
$firstName = $this -> getColumnData($rowData, PARAM_FIRST_NAME);
$lastName = $this -> getColumnData($rowData, PARAM_LAST_NAME);
$template["full_name"] = "{$firstName} {$lastName}";
}
$errorDetails = []; $errorDetails = [];
if(!$this -> createZendeskTicket($template, $errorDetails)){ if(!$this -> createZendeskTicket($template, $errorDetails)){
...@@ -103,8 +96,9 @@ class LogicSupport extends SupportModelClass { ...@@ -103,8 +96,9 @@ class LogicSupport extends SupportModelClass {
"Response String: {$errorDetails["response_str"]}\n\n". "Response String: {$errorDetails["response_str"]}\n\n".
"Ticket Body:\n\n {$errorDetails["ticket_body"]}"; "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' $this -> sendMailByTmp('send_mail_for_user.xml'
...@@ -138,7 +132,7 @@ class LogicSupport extends SupportModelClass { ...@@ -138,7 +132,7 @@ class LogicSupport extends SupportModelClass {
], ],
"requester" => [ "requester" => [
"locale_id" => $this -> getZendeskLocaleCode(), "locale_id" => $this -> getZendeskLocaleCode(),
"name" => isset($template["full_name"]) ? $template["full_name"] : NO_STRING, "name" => $template["full_name"],
"email" => $this -> getEmail() "email" => $this -> getEmail()
] ]
] ]
...@@ -177,19 +171,23 @@ class LogicSupport extends SupportModelClass { ...@@ -177,19 +171,23 @@ class LogicSupport extends SupportModelClass {
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* @function_name: Slackへのエラー通知 * @function_name: 通知をSlackへ送信する機能
* @parameter : details * @parameter : details
* @return : なし * @return : なし
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
private function notifyErrorToSlack($details){ private function sendNotificationToSlack($notificationType, $details){
$slackChannels = $this -> getSettingConfiguration("slack_notif_channel"); $slackChannels = $this -> getSettingConfiguration("slack_notif_channel");
$handle = curl_init(); $handle = curl_init();
$message = ["text" => $details]; $message = ["text" => $details];
$channel = $notificationType === 1 ?
$slackChannels -> successfully_submitted_tickets :
$slackChannels -> user_details_channel;
curl_setopt_array($handle, [ curl_setopt_array($handle, [
CURLOPT_URL => $slackChannels -> user_details_channel, CURLOPT_URL => $channel,
CURLOPT_RETURNTRANSFER => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true, CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "utf8", CURLOPT_ENCODING => "utf8",
......
...@@ -561,5 +561,14 @@ class SupportModelClass extends ModelClassEx { ...@@ -561,5 +561,14 @@ class SupportModelClass extends ModelClassEx {
return 1; 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