]> git.agnieray.net Git - galette.git/commitdiff
Few fixes on import
authorJohan Cwiklinski <johan@x-tnd.be>
Wed, 10 Apr 2024 12:11:53 +0000 (14:11 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Wed, 10 Apr 2024 12:11:53 +0000 (14:11 +0200)
galette/lib/Galette/Entity/Adherent.php
galette/lib/Galette/Util/Password.php

index 074ed0340ed86643da654e6eb8d42b9a1ac438ae..ee75684a94019b6cb251f6b57f4c10379a0f881d 100644 (file)
@@ -1830,7 +1830,7 @@ class Adherent
                 case 'sname':
                     return $this->getNameWithCase($this->name, $this->surname);
                 case 'rbirthdate':
-                    return $this->birthdate;
+                    return $this->birthdate ?? null;
                 case 'sgender':
                     switch ($this->gender) {
                         case self::MAN:
index e12e0b738b0532c5ca9b8170ed3ee601c1e540f1..16718c56c7372cf1696870f766c709aca980c348 100644 (file)
@@ -252,14 +252,16 @@ class Password
         ];
 
         //handle date formats
-        $bdate = \DateTime::createFromFormat('Y-m-d', $adh->rbirthdate);
-        if ($bdate !== false) {
-            $infos[] = $bdate->format('Y-m-d'); //standard format
-            //TRANS: see https://www.php.net/manual/datetime.format.php
-            $infos[] = $bdate->format(__('Y-m-d')); //localized format
-            $infos[] = $bdate->format('Ymd');
-            $infos[] = $bdate->format('dmY');
-            $infos[] = $bdate->format('Ydm');
+        if ($adh->rbirthdate !== null) {
+            $bdate = \DateTime::createFromFormat('Y-m-d', $adh->rbirthdate);
+            if ($bdate !== false) {
+                $infos[] = $bdate->format('Y-m-d'); //standard format
+                //TRANS: see https://www.php.net/manual/datetime.format.php
+                $infos[] = $bdate->format(__('Y-m-d')); //localized format
+                $infos[] = $bdate->format('Ymd');
+                $infos[] = $bdate->format('dmY');
+                $infos[] = $bdate->format('Ydm');
+            }
         }
 
         //some possible combinations