function taiga_edit_issue_by_ref($auth, $id) { if ($issue = taiga_get_issue_by_ref($auth, $id)) { $version = $issue['version']; $process = curl_init(TAIGA_HOST . "issues/{$issue['id']}"); curl_setopt($process, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8', "Authorization: Bearer {$auth}")); curl_setopt($process, CURLOPT_CUSTOMREQUEST, "PATCH"); curl_setopt($process, CURLOPT_POSTFIELDS, json_encode(array('project' => TAIGA_PROJECT, 'type' => filter_post('type', FILTER_VALIDATE_INT), 'severity' => filter_post('level', FILTER_VALIDATE_INT), 'subject' => filter_post('subject'), 'description' => filter_post('description'), 'version' => $version))); curl_setopt($process, CURLOPT_RETURNTRANSFER, true); $issue = curl_exec($process); if ($issue !== false) { taiga_edit_issue_attributes($auth, $issue['id']); $issue = $id; } curl_close($process); } return $issue; }
} else { $result = 'Takk! <a href="' . $ref . '">Tilbakemelding ' . $ref . '</a> er registrert. '; if (notify('Tilbakemelding ' . $ref . ' er registrert', $email, $name, $result)) { $result .= 'Kvittering er sendt til ' . $email . '. '; } $result .= 'Vi vil ta kontakt når din tilbakemelding er behandlet.'; } $result = '<div class="alert alert-success">' . $result . '</div>'; } } if (!isset($result) && !($errSubject || $errDesc || $errType || $errLevel || $errName || $errEmail || $errHuman)) { $result = '<div class="alert alert-danger">Beklager, din henvendelse kunne ikke registres.</div>'; } } else { if ($id) { if ($issue = taiga_get_issue_by_ref($auth, $id)) { $subject = isset_get($issue, 'subject'); $type = isset_get($issue, 'type'); $status = isset_get($issue, 'status_extra_info'); $assigned = isset_get($issue, 'assigned_to_extra_info'); $level = isset_get($issue, 'severity'); $description = isset_get($issue, 'description'); if ($attrs = taiga_get_issue_attributes($auth, $issue['id'])) { $attrs = $attrs['attributes_values']; $name = isset_get($attrs, '1671'); $email = isset_get($attrs, '1672'); } $comments = taiga_get_issue_comments($auth, $issue['id']); } } }