Upload via GUI (30 Dateien)
This commit is contained in:
@@ -71,13 +71,17 @@ class Deskhub_Tickets_Client
|
||||
public function create_ticket(array $data)
|
||||
{
|
||||
$fields = $data['fields'] ?? null;
|
||||
unset($data['fields']);
|
||||
$attachments = $data['attachments'] ?? null;
|
||||
unset($data['fields'], $data['attachments']);
|
||||
$payload = array_filter($data, static function ($v) {
|
||||
return $v !== null && $v !== '' && $v !== 0;
|
||||
});
|
||||
if (is_array($fields)) {
|
||||
$payload['fields'] = (object) $fields; // auch leer senden: Damit prüft DeskHub die Angaben gegen das Kundenformular
|
||||
}
|
||||
if (is_array($attachments) && $attachments) {
|
||||
$payload['attachments'] = array_values($attachments);
|
||||
}
|
||||
$res = $this->request('POST', [], $payload);
|
||||
if (is_wp_error($res)) {
|
||||
return $res;
|
||||
|
||||
Reference in New Issue
Block a user