Overview
Comment:A more explicit error message
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: f5c04a59a44817ef7906029fcfd4d463e921c947
User & Date: bohwaz on 2021-01-10 16:36:16
Other Links: manifest | tags
Context
2021-01-10
16:57
Revert migration of checkboxes because with arrays it can fail check-in: e67c44ef5f user: bohwaz tags: trunk, stable
16:36
A more explicit error message check-in: f5c04a59a4 user: bohwaz tags: trunk, stable
16:22
Allow to pass a null value check-in: 95de6be3a1 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Entities/Accounting/Transaction.php from [560406ee34] to [873ffbb797].

289
290
291
292
293
294
295
296
297
298
299
300
301
302
303

		return $sum;
	}

	public function save(): bool
	{
		if ($this->validated && !isset($this->_modified['validated'])) {
			throw new ValidationException('Il n\'est pas possible de modifier une écriture qui a été validé');
		}

		$db = DB::getInstance();

		if ($db->test(Year::TABLE, 'id = ? AND closed = 1', $this->id_year)) {
			throw new ValidationException('Il n\'est pas possible de créer ou modifier une écriture dans un exercice clôturé');
		}







|







289
290
291
292
293
294
295
296
297
298
299
300
301
302
303

		return $sum;
	}

	public function save(): bool
	{
		if ($this->validated && !isset($this->_modified['validated'])) {
			throw new ValidationException('Il n\'est pas possible de modifier une écriture qui a été validée');
		}

		$db = DB::getInstance();

		if ($db->test(Year::TABLE, 'id = ? AND closed = 1', $this->id_year)) {
			throw new ValidationException('Il n\'est pas possible de créer ou modifier une écriture dans un exercice clôturé');
		}

Modified src/include/lib/Garradin/Entities/Services/Service_User.php from [4e65f9f372] to [9cb86069a3].

142
143
144
145
146
147
148

149









150
151
152
153
154
155
156
		}

		$su->save();

		if ($su->id_fee && $su->fee()->id_account
			&& !empty($source['amount'])
			&& !empty($source['create_payment'])) {

			$su->addPayment($user_id, $source);









		}

		$db->commit();

		return $su;
	}
}







>
|
>
>
>
>
>
>
>
>
>







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
		}

		$su->save();

		if ($su->id_fee && $su->fee()->id_account
			&& !empty($source['amount'])
			&& !empty($source['create_payment'])) {
			try {
				$su->addPayment($user_id, $source);
			}
			catch (ValidationException $e) {
				if ($e->getMessage() == 'Il n\'est pas possible de créer ou modifier une écriture dans un exercice clôturé') {
					throw new ValidationException('Impossible d\'enregistrer l\'inscription : ce tarif d\'activité est lié à un exercice clôturé. Merci de modifier le tarif et choisir un autre exercice.', 0, $e);
				}
				else {
					throw $e;
				}
			}
		}

		$db->commit();

		return $su;
	}
}