Overview
Comment:Fix direction in debt/credit payoff
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: b30208f10fa020d5687b3e6ee19b94136b8a6a970e9fb331f09e37645f1ef601
User & Date: bohwaz on 2022-07-30 19:35:40
Other Links: manifest | tags
Context
2022-07-30
22:17
New version of public website check-in: ca2fc23dd5 user: bohwaz tags: trunk, stable
19:35
Fix direction in debt/credit payoff check-in: b30208f10f user: bohwaz tags: trunk, stable
19:33
Implement create and edit transactions in API check-in: b7cb001be2 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Entities/Accounting/Transaction.php from [7b66ec9286] to [3f25dcd5cb].

762
763
764
765
766
767
768
769
770
771
772
773
774
775
776

		if (empty($source['account']) || !is_array($source['account'])) {
			throw new ValidationException('Aucun compte de règlement sélectionné.');
		}

		$id_account = null;
		// Reverse direction (compared with debt/credit transaction)
		$d1 = ($this->_related->type == self::TYPE_DEBT) ? 'credit' : 'debit';
		$d2 = ($d1 == 'credit') ? 'debit' : 'credit';

		foreach ($this->_related->getLines() as $line) {
			if (($this->_related->type == self::TYPE_DEBT && $line->debit)
				|| ($this->_related->type == self::TYPE_CREDIT && $line->credit)) {
				// Skip the type of debt/credit, just keep the thirdparty account
				continue;







|







762
763
764
765
766
767
768
769
770
771
772
773
774
775
776

		if (empty($source['account']) || !is_array($source['account'])) {
			throw new ValidationException('Aucun compte de règlement sélectionné.');
		}

		$id_account = null;
		// Reverse direction (compared with debt/credit transaction)
		$d1 = ($this->_related->type == self::TYPE_CREDIT) ? 'credit' : 'debit';
		$d2 = ($d1 == 'credit') ? 'debit' : 'credit';

		foreach ($this->_related->getLines() as $line) {
			if (($this->_related->type == self::TYPE_DEBT && $line->debit)
				|| ($this->_related->type == self::TYPE_CREDIT && $line->credit)) {
				// Skip the type of debt/credit, just keep the thirdparty account
				continue;