From 274d288b2f088dd5a9e2b531ec7d7fdfc7b2abe0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20Borbo=C3=ABn?= <ponsfrilus@gmail.com>
Date: Mon, 11 Jan 2021 22:37:42 +0100
Subject: [PATCH] [fix] warning between new and edit

---
 canapEPFL/models/PersonnalData.php | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/canapEPFL/models/PersonnalData.php b/canapEPFL/models/PersonnalData.php
index 252fb12..acb65b8 100644
--- a/canapEPFL/models/PersonnalData.php
+++ b/canapEPFL/models/PersonnalData.php
@@ -66,7 +66,9 @@ class PersonnalData {
         $this->setStages();
         $this->setDejacand();
         $this->anneeFinScolarite = $postedData['anneeFin'];
-        $this->fichiers = $this->setFiles($postedFiles, $postedData['files']);
+
+        $this->fichiers = $this->setFiles($postedFiles, $postedData);
+
     }
     #endregion
 
@@ -131,7 +133,11 @@ class PersonnalData {
             if ($file['error'] != 0) {
                 unset($postedFiles[$key]);
             } else {
-                $postedFiles[$key]['id'] = $ids[$key];
+                // My guess is that code is only needed when editing a postulation,
+                // and run into warning when creating a new one. NBO 2021-01-11
+                if (isset($ids['files'][$key])) {
+                    $postedFiles[$key]['id'] = $ids['files'][$key];
+                }
             }
         }
         return $postedFiles;
-- 
GitLab