From c0d1759bed12cc0f9bc3ce1f03e356dcfe4d9234 Mon Sep 17 00:00:00 2001 From: afornerot Date: Tue, 1 Sep 2020 11:54:55 +0200 Subject: [PATCH] distinguer les vacations sur le flag validateholiday (fixes #29) --- src/schedule-2.0/scripts/migration/migration.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/schedule-2.0/scripts/migration/migration.php b/src/schedule-2.0/scripts/migration/migration.php index 91a2b94..17ae0d2 100644 --- a/src/schedule-2.0/scripts/migration/migration.php +++ b/src/schedule-2.0/scripts/migration/migration.php @@ -182,14 +182,25 @@ while($row=$queryold->fetch()) { writeligne(""); writeligne("== Récupération Event"); -$q="SELECT * FROM schedule_event"; +$q="SELECT * FROM schedule_event, schedule_task WHERE event_task=task_id"; $queryold=$bddold->prepare($q); $queryold->execute(); while($row=$queryold->fetch()) { + // Event vacation ? + $isvacation=false; + if($row["task_id"]<=-70) $isvacation=true; + if($row["task_id"]==-85 || $row["task_id"]==-70) $isvacation=true; + + // Validation + $validate=$row["event_validate"]; + $validateholiday=false; + if($isvacation) $validateholiday=$row["event_validate"]; + + // Génération de l'event writeligne($row["event_id"]); $q="INSERT IGNORE INTO event (id, description, start, end, allday, duration, validate, validateholiday, task_id, user_id ) VALUES (?,?,?,?,?,?,?,?,?,?)"; $query=$bddnew->prepare($q); - $query->execute([$row["event_id"],$row["event_description"],$row["event_start"],$row["event_end"],$row["event_allday"],$row["event_duration"],$row["event_validate"],$row["event_validate"],$row["event_task"],$row["event_user"] ]); + $query->execute([$row["event_id"],$row["event_description"],$row["event_start"],$row["event_end"],$row["event_allday"],$row["event_duration"],$validate,$validateholiday,$row["event_task"],$row["event_user"] ]); } writeligne("");