Overview
Comment:Vérifier le format d'entrée des champs date
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: 0977e93dc827d19a5a2f3bc13cfaba2ff3998f57
User & Date: bohwaz on 2020-07-18 20:33:50
Other Links: manifest | tags
Context
2020-07-18
20:34
Afficher un message en cas de besoin d'upgrade et d'utilisation en CLI check-in: 5937370ae0 user: bohwaz tags: trunk, stable
20:33
Vérifier le format d'entrée des champs date check-in: 0977e93dc8 user: bohwaz tags: trunk, stable
2020-07-03
02:10
Fix nom de colonne liste des cotisations check-in: 4ea98fe3d5 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Membres.php from [06d3eb225c] to [1c694ab262].

43
44
45
46
47
48
49
50



51
52
53
54
55



56
57
58
59
60
61
62
                }
            }

            if (isset($data[$key]))
            {
                if ($config->type == 'datetime' && trim($data[$key]) !== '')
                {
                    $dt = new \DateTime($data[$key]);



                    $data[$key] = $dt->format('Y-m-d H:i');
                }
                elseif ($config->type == 'date' && trim($data[$key]) !== '')
                {
                    $dt = new \DateTime($data[$key]);



                    $data[$key] = $dt->format('Y-m-d');
                }
                elseif ($config->type == 'tel')
                {
                    $data[$key] = Utils::normalizePhoneNumber($data[$key]);
                }
                elseif ($config->type == 'country')







|
>
>
>




|
>
>
>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
                }
            }

            if (isset($data[$key]))
            {
                if ($config->type == 'datetime' && trim($data[$key]) !== '')
                {
                    $dt = \DateTime::createFromFormat('Y-m-d H:i', $data[$key]);
                    if (!$dt) {
                        throw new UserException(sprintf('Format invalide pour le champ "%s": AAAA-MM-JJ HH:mm attendu.', $config->title));
                    }
                    $data[$key] = $dt->format('Y-m-d H:i');
                }
                elseif ($config->type == 'date' && trim($data[$key]) !== '')
                {
                    $dt = \DateTime::createFromFormat('Y-m-d', $data[$key]);
                    if (!$dt) {
                        throw new UserException(sprintf('Format invalide pour le champ "%s": AAAA-MM-JJ attendu.', $config->title));
                    }
                    $data[$key] = $dt->format('Y-m-d');
                }
                elseif ($config->type == 'tel')
                {
                    $data[$key] = Utils::normalizePhoneNumber($data[$key]);
                }
                elseif ($config->type == 'country')