Overview
Comment:Fix wrongly required date format
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev | 1.0.0-alpha6
Files: files | file ages | folders
SHA1: 4feef1ca5f29ab1d9f51b9939d487c298b9c4c6b
User & Date: bohwaz on 2020-11-11 15:54:01
Other Links: branch diff | manifest | tags
Context
2020-11-11
16:04
Allow services without fees, thanks @zou check-in: bc3ab3badc user: bohwaz tags: dev, 1.0.0-alpha6
15:54
Fix wrongly required date format check-in: 4feef1ca5f user: bohwaz tags: dev, 1.0.0-alpha6
15:49
Fix negative values in expense/revenue (thanks @Fred) check-in: 9e0fbf1dd9 user: bohwaz tags: dev, 1.0.0-alpha6
Changes

Modified src/include/lib/Garradin/Entity.php from [7b7a325745] to [f3c9fc3145].

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
		if ($type == 'date') {
			if (preg_match('!^\d{2}/\d{2}/\d{2}$!', $value)) {
				return \DateTime::createFromFormat('d/m/y', $value);
			}
			elseif (preg_match('!^\d{2}/\d{2}/\d{4}$!', $value)) {
				return \DateTime::createFromFormat('d/m/Y', $value);
			}
			else {
				throw new ValidationException('Format de date invalide (merci d\'utiliser le format) JJ/MM/AAAA) : ' . $value);
			}
		}
		else {
			return parent::filterUserValue($type, $value, $key);
		}
	}








|
|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
		if ($type == 'date') {
			if (preg_match('!^\d{2}/\d{2}/\d{2}$!', $value)) {
				return \DateTime::createFromFormat('d/m/y', $value);
			}
			elseif (preg_match('!^\d{2}/\d{2}/\d{4}$!', $value)) {
				return \DateTime::createFromFormat('d/m/Y', $value);
			}
			elseif (null !== $value) {
				throw new ValidationException('Format de date invalide (merci d\'utiliser le format JJ/MM/AAAA) : ' . $value);
			}
		}
		else {
			return parent::filterUserValue($type, $value, $key);
		}
	}