Skip to content

Commit f3701fb

Browse files
committed
fix(targetchange): title edition fails
Signed-off-by: btry <tbugier@teclib.com>
1 parent f087ad0 commit f3701fb

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

inc/targetchange.class.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ public function showForm($options = []) {
236236
echo '<tr class="line0">';
237237
echo '<td><strong>' . __('Description') . ' <span style="color:red;">*</span></strong></td>';
238238
echo '<td colspan="3">';
239+
echo '<textarea name="comment" style="width:700px;" rows="15">' . $this->fields['comment'] . '</textarea>';
239240
echo '</td>';
240241
echo '</tr>';
241242

@@ -891,6 +892,20 @@ public function prepareInputForUpdate($input) {
891892
}
892893
}
893894

895+
$target = new PluginFormcreatorTarget();
896+
$target->getFromDBByCrit([
897+
'itemtype' => self::class,
898+
'items_id' => $this->getID()
899+
]);
900+
if (!$target->isNewItem()) {
901+
$target->update([
902+
'id' => $target->getID(),
903+
'name' => $input['name'],
904+
]);
905+
}
906+
$input['name'] = $input['title'];
907+
unset($input['title']);
908+
894909
return $input;
895910
}
896911

inc/targetticket.class.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,16 @@ public function prepareInputForUpdate($input) {
924924
}
925925

926926
$target = new PluginFormcreatorTarget();
927-
$found = $target->find('items_id = ' . $this->getID());
928-
$found = array_shift($found);
929-
$target->update(['id' => $found['id'], 'name' => $input['name']]);
927+
$target->getFromDBByCrit([
928+
'itemtype' => self::class,
929+
'items_id' => $this->getID()
930+
]);
931+
if (!$target->isNewItem()) {
932+
$target->update([
933+
'id' => $target->getID(),
934+
'name' => $input['name'],
935+
]);
936+
}
930937
$input['name'] = $input['title'];
931938
unset($input['title']);
932939

0 commit comments

Comments
 (0)