Fix inserimento checklist non associate ad utenti o gruppi

This commit is contained in:
Luca 2023-02-20 15:59:39 +01:00
parent 8677b6aec8
commit 5bc8ba3a9a
2 changed files with 16 additions and 8 deletions

View File

@ -259,11 +259,15 @@ elseif (filter('op') == 'copia-checklist') {
$content = post('content');
$checklist_id = post('checklist');
$users = post('assigned_users');
$users = array_clean($users);
$group_id = post('group_id');
if (!empty(post('assigned_users'))){
$users = post('assigned_users');
$users = array_clean($users);
}
if (!empty(post('group_id'))){
$group_id = post('group_id');
}
$checklist = Checklist::find($checklist_id);
$checklist->copia($user, $id_record, $users, $group_id);
}
@ -273,10 +277,14 @@ elseif (filter('op') == 'aggiungi-check') {
$content = post('content');
$parent_id = post('parent') ?: null;
$users = post('assigned_users');
$users = array_clean($users);
if (!empty(post('assigned_users'))){
$users = post('assigned_users');
$users = array_clean($users);
}
$group_id = post('group_id');
if (!empty(post('group_id'))){
$group_id = post('group_id');
}
$check = Check::build($user, $structure, $id_record, $content, $parent_id);
$check->setAccess($users, $group_id);

View File

@ -34,7 +34,7 @@ echo '
<form action="" method="post" id="check-form">
<div class="row">
<div class="col-md-12">
{[ "type": "select", "label": "'.tr('Checklist').'", "name": "checklist", "values": '.json_encode($list).' ]}
{[ "type": "select", "label": "'.tr('Checklist').'", "name": "checklist", "values": '.json_encode($list).', "required": 1 ]}
</div>
</div>