Overview
Comment:Fix: set status as paid when creating payoff transaction
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 1ed3d3d18c57c5706b044428df70cacc5525b028a15271b5bd273c26d9ad7161
User & Date: bohwaz on 2021-03-05 19:50:40
Other Links: manifest | tags
Context
2021-05-10
12:19
Re-add missing merges before [93aeaacac6] check-in: 561aebe80c user: bohwaz tags: trunk, stable
2021-03-08
15:30
Fix export of simple list check-in: f42fe0087f user: bohwaz tags: trunk, stable
2021-03-05
19:50
Fix: set status as paid when creating payoff transaction check-in: 1ed3d3d18c user: bohwaz tags: trunk, stable
19:48
Fix default new transaction date check-in: 4571b4f9a4 user: bohwaz tags: trunk, stable
Changes

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

292
293
294
295
296
297
298


299
300
301
302
303
304
305
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307







+
+








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

		$exists = $this->exists();

		$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é');
		}

		if (!parent::save()) {
314
315
316
317
318
319
320
321

322
323
324
325
326
327
328
316
317
318
319
320
321
322

323
324
325
326
327
328
329
330







-
+








		foreach ($this->_old_lines as $line)
		{
			$line->delete();
		}

		// Remove flag
		if ((self::TYPE_DEBT == $this->type || self::TYPE_CREDIT == $this->type) && $this->_related) {
		if (!$exists && $this->_related) {
			$this->_related->markPaid();
			$this->_related->save();
		}

		return true;
	}