Overview
Comment:Make sure we don't change a transaction from another year
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: 22085f3be3fcb2cccd7632a580b49ffaf9d8ae55
User & Date: bohwaz on 2020-12-07 19:07:07
Other Links: manifest | tags
Context
2020-12-07
19:26
Accounting export was breaking multi-line transactions in multiple transactions check-in: c583021c03 user: bohwaz tags: trunk, stable
19:07
Make sure we don't change a transaction from another year check-in: 22085f3be3 user: bohwaz tags: trunk, stable
16:49
Fix decryption in edit form check-in: 6abc5e4b43 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Accounting/Transactions.php from [6561462819] to [cb3bc58a9a].

187
188
189
190
191
192
193
194




195
196
197
198
199
200
201
202
203
204
205
						throw new UserException('cette ligne n\'est reliée à aucune écriture');
					}

					if ($row->id) {
						$transaction = self::get((int)$row->id);

						if (!$transaction) {
							throw new UserException(sprintf('l\'écriture %d est introuvable', $row->id));




						}

						if ($transaction->validated) {
							throw new UserException(sprintf('l\'écriture %d est validée et ne peut être modifiée', $row->id));
						}
					}
					else {
						$transaction = new Transaction;
						$transaction->id_creator = $user_id;
						$transaction->id_year = $year->id();
					}







|
>
>
>
>



|







187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
						throw new UserException('cette ligne n\'est reliée à aucune écriture');
					}

					if ($row->id) {
						$transaction = self::get((int)$row->id);

						if (!$transaction) {
							throw new UserException(sprintf('l\'écriture #%d est introuvable', $row->id));
						}

						if (!$transaction->id_year != $year->id()) {
							throw new UserException(sprintf('l\'écriture #%d appartient à un autre exercice', $row->id));
						}

						if ($transaction->validated) {
							throw new UserException(sprintf('l\'écriture #%d est validée et ne peut être modifiée', $row->id));
						}
					}
					else {
						$transaction = new Transaction;
						$transaction->id_creator = $user_id;
						$transaction->id_year = $year->id();
					}