Overview
Comment:Correction bug champs dont la valeur est vérifié même s'ils sont vides
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | stable
Files: files | file ages | folders
SHA1: 7f9e78c6c5bbb8dd60e18083519411bdb235243a
User & Date: bohwaz on 2013-06-18 09:09:40
Other Links: manifest | tags
Context
2013-06-19
12:27
Merge stable vers trunk check-in: f8af42f2cf user: bohwaz tags: trunk
12:26
Release 0.5.5 check-in: ecdc3722a7 user: bohwaz tags: stable, 0.5.5
2013-06-18
09:09
Correction bug champs dont la valeur est vérifié même s'ils sont vides check-in: 7f9e78c6c5 user: bohwaz tags: stable
2013-06-08
09:10
Release 0.5.4 check-in: 27a52cdec6 user: bohwaz tags: stable, 0.5.4
Changes

Modified include/class.membres.php from [894265f106] to [ff3b0c8181].

255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
                {
                    continue;
                }
            }

            if (isset($data[$key]))
            {
                if ($config['type'] == 'email' && !filter_var($data[$key], FILTER_VALIDATE_EMAIL))
                {
                    throw new UserException('Adresse e-mail invalide dans le champ "' . $config['title'] . '".');
                }
                elseif ($config['type'] == 'url' && !filter_var($data[$key], FILTER_VALIDATE_URL))
                {
                    throw new UserException('Adresse URL invalide dans le champ "' . $config['title'] . '".');
                }
                elseif ($config['type'] == 'tel')
                {
                    $data[$key] = utils::normalizePhoneNumber($data[$key]);
                }
                elseif ($config['type'] == 'country')
                {
                    $data[$key] = strtoupper(substr($data[$key], 0, 2));
                }
                elseif ($config['type'] == 'checkbox')
                {
                    $data[$key] = empty($data[$key]) ? 0 : 1;
                }
                elseif ($config['type'] == 'number')
                {
                    if (empty($data[$key]))
                    {
                        $data[$key] = 0;
                    }

                    if (!is_numeric($data[$key]))







|



|















|







255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
                {
                    continue;
                }
            }

            if (isset($data[$key]))
            {
                if ($config['type'] == 'email' && trim($data[$key]) != '' && !filter_var($data[$key], FILTER_VALIDATE_EMAIL))
                {
                    throw new UserException('Adresse e-mail invalide dans le champ "' . $config['title'] . '".');
                }
                elseif ($config['type'] == 'url' && trim($data[$key]) != '' && !filter_var($data[$key], FILTER_VALIDATE_URL))
                {
                    throw new UserException('Adresse URL invalide dans le champ "' . $config['title'] . '".');
                }
                elseif ($config['type'] == 'tel')
                {
                    $data[$key] = utils::normalizePhoneNumber($data[$key]);
                }
                elseif ($config['type'] == 'country')
                {
                    $data[$key] = strtoupper(substr($data[$key], 0, 2));
                }
                elseif ($config['type'] == 'checkbox')
                {
                    $data[$key] = empty($data[$key]) ? 0 : 1;
                }
                elseif ($config['type'] == 'number' && trim($data[$key]) != '')
                {
                    if (empty($data[$key]))
                    {
                        $data[$key] = 0;
                    }

                    if (!is_numeric($data[$key]))
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
                    }

                    $data[$key] = $binary;
                }
            }
        }

        if (!empty($data['code_postal']))
        {
            if (!empty($data['pays']) && $data['pays'] == 'FR' && !preg_match('!^\d{5}$!', $data['code_postal']))
            {
                throw new UserException('Code postal invalide.');
            }
        }








|







312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
                    }

                    $data[$key] = $binary;
                }
            }
        }

        if (isset($data['code_postal']) && trim($data['code_postal']) != '')
        {
            if (!empty($data['pays']) && $data['pays'] == 'FR' && !preg_match('!^\d{5}$!', $data['code_postal']))
            {
                throw new UserException('Code postal invalide.');
            }
        }