fix selected category of new resource lost on automatic submit

This commit is contained in:
ralf 2022-12-02 09:35:44 +01:00
parent f3cf760d4f
commit 3defd83b0c

View File

@ -480,7 +480,7 @@ class resources_ui
if (isset($_GET['res_id'])) $res_id = $_GET['res_id'];
if (isset($nm_session_data['filter2']) && $nm_session_data['filter2'] > 0) $accessory_of = $nm_session_data['filter2'];
if (isset($_GET['accessory_of'])) $accessory_of = $_GET['accessory_of'];
$content = is_array($content) ? $content : array('res_id' => $res_id);
$content = is_array($content) ? $content : array('res_id' => $res_id, 'cat_id' => $content['cat_id']);
if ($res_id > 0)
{
$content = array_merge($this->bo->read($res_id), $content);
@ -500,7 +500,7 @@ class resources_ui
}
$content['cat_id'] = $owner['cat_id'];
$content['bookable'] = true;
} else {
} elseif (count($content) === 2) {
// New resource
$content['cat_id'] = $nm_session_data['filter'];
$content['bookable'] = true;
@ -585,4 +585,4 @@ class resources_ui
return $this->tmpl->exec('resources.resources_ui.edit',$content,$sel_options,$read_only,$preserv,2);
}
}
}