Overview
Comment: | Vérifications sur le numéro de compte et le numéro du parent |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | stable |
Files: | files | file ages | folders |
SHA1: |
d7a2da4080983ab43aecb0ecdea9384a |
User & Date: | bohwaz on 2018-09-06 20:53:49 |
Other Links: | manifest | tags |
Context
2018-09-14
| ||
14:25 | Correction CSS pour IE 11 check-in: 33e69f56cb user: bohwaz tags: trunk, stable | |
2018-09-06
| ||
20:53 | Vérifications sur le numéro de compte et le numéro du parent check-in: d7a2da4080 user: bohwaz tags: trunk, stable | |
2018-08-26
| ||
01:19 | Evitons les conflits de noms de champs quand quelqu'un a déjà créé un champ nommé "catégorie" check-in: 96c5022fb3 user: bohwaz tags: trunk, stable | |
Changes
Modified src/include/lib/Garradin/Compta/Comptes.php from [413403054e] to [0fc00e722e].
︙ | ︙ | |||
87 88 89 90 91 92 93 94 95 96 97 98 99 100 | { throw new UserException('Nombre de sous-comptes maximal atteint pour ce compte parent-ci.'); } } else { $new_id = strtoupper($data['id']); } if (isset($data['position'])) { $position = (int) $data['position']; } else | > > > > > > > > > > > > > > > > > > > > > > > | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | { throw new UserException('Nombre de sous-comptes maximal atteint pour ce compte parent-ci.'); } } else { $new_id = strtoupper($data['id']); $parent = false; $id = $new_id; // Vérification que c'est bien le bon parent ! // Sinon risque par exemple d'avoir parent = 5 et id = 512A ! while (!$parent && strlen($id)) { // On enlève un caractère à la fin jusqu'à trouver un compte parent $id = substr($id, 0, -1); $parent = $db->firstColumn('SELECT id FROM compta_comptes WHERE id = ?;', $id); } if (!$parent || $parent != $data['parent']) { throw new UserException('Le compte parent sélectionné est incorrect, par exemple pour créer un compte 512A il faut sélectionner 512 comme compte parent.'); } } // Vérification que le compte n'existe pas déjà if ($db->test('compta_comptes', 'id = ?', $new_id)) { throw new UserException('Ce numéro de compte existe déjà dans le plan comptable : ' . $new_id); } if (isset($data['position'])) { $position = (int) $data['position']; } else |
︙ | ︙ |