Skip to content
Snippets Groups Projects
Commit 52cb1d8b authored by Jared Hancock's avatar Jared Hancock
Browse files

lists: Fix update of ticket status name

Maybe fixes #3084
parent 907ec36b
No related branches found
No related tags found
No related merge requests found
......@@ -149,22 +149,32 @@ class DynamicFormsAjaxAPI extends AjaxController {
Http::response(403, 'Login required');
$list = DynamicList::lookup($list_id);
if (!$list)
Http::response(404, 'No such list item');
$list = CustomListHandler::forList($list);
if (!$list || !($item = $list->getItem( (int) $item_id)))
Http::response(404, 'No such list item');
$item_form = $list->getListItemBasicForm($_POST, $item);
if ($valid = $item_form->isValid()) {
// Update basic information
$basic = $item_form->getClean();
$item->extra = $basic['extra'];
$item->value = $basic['value'];
if ($_item = DynamicListItem::lookup(array(
'list_id' => $list->getId(), 'value'=>$item->value)))
'list_id' => $list->getId(), 'value'=>$item->getValue()))
) {
if ($_item && $_item->id != $item->id)
$item_form->getField('value')->addError(
__('Value already in use'));
}
if ($item_form->isValid()) {
// Update basic information
$basic = $item_form->getClean();
$item->update([
'name' => $basic['name'],
'value' => $basic['value'],
'extra' => $basic['extra'],
]);
}
}
// Context
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment