From 7411c6ea95a2d4170aaf18ba4fd38b0986d51cb1 Mon Sep 17 00:00:00 2001 From: MatteoPistorello Date: Wed, 8 Mar 2023 16:46:57 +0100 Subject: [PATCH] Fix ordinamento checklist --- modules/checklists/src/Check.php | 4 ++-- modules/checklists/src/Checklist.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/checklists/src/Check.php b/modules/checklists/src/Check.php index 3c5e8ef7d..a2969f6e2 100755 --- a/modules/checklists/src/Check.php +++ b/modules/checklists/src/Check.php @@ -46,7 +46,7 @@ class Check extends Model * * @return self */ - public static function build(User $user, $structure, $id_record, $content, $parent_id = null) + public static function build(User $user, $structure, $id_record, $content, $parent_id = null, $order = 99) { $model = new static(); @@ -63,7 +63,7 @@ class Check extends Model $model->content = $content; // Ordinamento temporaneo alla creazione - $model->order = 99; + $model->order = $order; $model->save(); diff --git a/modules/checklists/src/Checklist.php b/modules/checklists/src/Checklist.php index d36aa5cbb..997e19b8b 100755 --- a/modules/checklists/src/Checklist.php +++ b/modules/checklists/src/Checklist.php @@ -64,7 +64,7 @@ class Checklist extends Model $child = $checks->shift(); $id_parent = $child->id_parent ? $relations[$child->id_parent] : null; - $check = Check::build($user, $structure, $id_record, $child->content, $id_parent); + $check = Check::build($user, $structure, $id_record, $child->content, $id_parent, $child->order); $check->setAccess($users, $group_id); $relations[$child->id] = $check->id;