Skip to content

Commit 859b380

Browse files
committed
refracto 2
1 parent 742a7b4 commit 859b380

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/CommonDBTM.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5594,8 +5594,14 @@ public function addFiles(array $input, $options = [])
55945594
$doc->update($input2);
55955595
}
55965596
} else {
5597-
if (($input['_job'] ?? $this) instanceof Ticket) {
5598-
$ticket_id = $input['_job']->getID() ?? $this->getID();
5597+
5598+
if ($this->getType() == 'Ticket' || (isset($input['_job']) && $input['_job'] instanceof Ticket)) {
5599+
//TRANS: Default document to files attached to tickets : %d is the ticket id
5600+
if (isset($input['_job']) && $input['_job'] instanceof Ticket) {
5601+
$ticket_id = $input['_job']->getID();
5602+
} else {
5603+
$ticket_id = $this->getID();
5604+
}
55995605
$input2["name"] = addslashes(sprintf(__('Document Ticket %d'), $ticket_id));
56005606
$input2["tickets_id"] = $ticket_id;
56015607
$input2['itemtype'] = Ticket::class;

0 commit comments

Comments
 (0)