Overview
Comment:Fix corner case where a payment is added and the fee does not have a year linked anymore
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: ab9b4caa13417f0479aa64fe49d2f201da4138045539ecfdf48dd001303b9001
User & Date: bohwaz on 2022-02-02 12:08:14
Other Links: manifest | tags
Context
2022-02-02
12:08
Fix PHP 8.1 depreciations check-in: f51318e8bd user: bohwaz tags: trunk
12:08
Fix corner case where a payment is added and the fee does not have a year linked anymore check-in: ab9b4caa13 user: bohwaz tags: trunk, stable
11:53
Fix PHP 8.1 warnings check-in: d4e236356f user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/Entities/Services/Service_User.php from [32122d279b] to [4230a71808].

130
131
132
133
134
135
136




137
138
139
140
141
142
143
		if (null === $source) {
			$source = $_POST;
		}

		if (!$this->id_fee) {
			throw new \RuntimeException('Cannot add a payment to a subscription that is not linked to a fee');
		}





		$transaction = new Transaction;
		$transaction->id_creator = $user_id;
		$transaction->id_year = $this->fee()->id_year;

		$source['type'] = Transaction::TYPE_REVENUE;
		$key = sprintf('account_%d_', $source['type']);







>
>
>
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
		if (null === $source) {
			$source = $_POST;
		}

		if (!$this->id_fee) {
			throw new \RuntimeException('Cannot add a payment to a subscription that is not linked to a fee');
		}

		if (!$this->fee()->id_year) {
			throw new ValidationException('Le tarif indiqué ne possède pas d\'exercice lié');
		}

		$transaction = new Transaction;
		$transaction->id_creator = $user_id;
		$transaction->id_year = $this->fee()->id_year;

		$source['type'] = Transaction::TYPE_REVENUE;
		$key = sprintf('account_%d_', $source['type']);