Overview
Comment:Validation error when trying to create a transaction to a non-existing user or year
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 93aeaacac61113081f8633cfa4484a2913669aa7a382a2bdd4314ca9aba9c7ec
User & Date: bohwaz on 2021-03-12 19:22:04
Other Links: manifest | tags
References
2021-05-10
12:19
Re-add missing merges before [93aeaacac6] check-in: 561aebe80c user: bohwaz tags: trunk, stable
Context
2021-05-10
12:19
Re-add missing merges before [93aeaacac6] check-in: 561aebe80c user: bohwaz tags: trunk, stable
2021-03-22
13:17
Exclude volunteering accounts from graphs check-in: 41ea740544 user: bohwaz tags: trunk, stable
2021-03-19
23:09
Merge trunk fixes check-in: 0e4057ab65 user: bohwaz tags: dev
2021-03-12
19:22
Validation error when trying to create a transaction to a non-existing user or year check-in: 93aeaacac6 user: bohwaz tags: trunk, stable
19:16
Make sure that the correct chart is shown as it can change between one fee and the other check-in: 365aa02d2a user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Entities/Accounting/Transaction.php from [75ac40b29e] to [6a877f3358].

387
388
389
390
391
392
393



394
395
396
397
398
399
400
		if (0 !== $total) {
			throw new ValidationException(sprintf('Écriture non équilibrée : déséquilibre (%s) entre débits et crédits', Utils::money_format($total)));
		}

		if (!array_key_exists($this->type, self::TYPES_NAMES)) {
			throw new ValidationException('Type d\'écriture inconnu : ' . $this->type);
		}



	}

	public function importFromDepositForm(?array $source = null): void
	{
		if (null === $source) {
			$source = $_POST;
		}







>
>
>







387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
		if (0 !== $total) {
			throw new ValidationException(sprintf('Écriture non équilibrée : déséquilibre (%s) entre débits et crédits', Utils::money_format($total)));
		}

		if (!array_key_exists($this->type, self::TYPES_NAMES)) {
			throw new ValidationException('Type d\'écriture inconnu : ' . $this->type);
		}

		$this->assert($db->test('acc_years', 'id = ?', $this->id_year), 'L\'exercice sélectionné n\'existe pas');
		$this->assert($this->id_creator === null || $db->test('membres', 'id = ?', $this->id_creator), 'Le compte membre créateur de l\'écriture n\'existe pas');
	}

	public function importFromDepositForm(?array $source = null): void
	{
		if (null === $source) {
			$source = $_POST;
		}