Skip to content

Commit b25896a

Browse files
committed
get id ticket in _job when is possible
1 parent d820559 commit b25896a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/CommonDBTM.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5596,9 +5596,14 @@ public function addFiles(array $input, $options = [])
55965596
} else {
55975597
if ($this->getType() == 'Ticket' || (isset($input['_job']) && $input['_job'] instanceof Ticket)) {
55985598
//TRANS: Default document to files attached to tickets : %d is the ticket id
5599-
$input2["name"] = addslashes(sprintf(__('Document Ticket %d'), $this->getID()));
5600-
$input2["tickets_id"] = $this->getID();
5601-
$input2['itemtype'] = Ticket::class;
5599+
if (isset($input['_job']) && $input['_job'] instanceof Ticket) {
5600+
$ticket_id = $input['_job']->getID();
5601+
} else {
5602+
$ticket_id = $this->getID();
5603+
}
5604+
$input2["name"] = addslashes(sprintf(__('Document Ticket %d'), $ticket_id));
5605+
$input2["tickets_id"] = $ticket_id;
5606+
$input2['itemtype'] = Ticket::class;
56025607
}
56035608

56045609
if (isset($input['_tag'][$key])) {

0 commit comments

Comments
 (0)