Overview
Comment:Fix: invert credit and debit in pay-offs
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 59a92f86492d8d1711370802407142c4a3df8743
User & Date: bohwaz on 2020-10-14 13:00:49
Other Links: branch diff | manifest | tags
Context
2020-10-14
15:06
Fix: balance sheet and accounts that can be either assets or liabilities check-in: babf7c84fc user: bohwaz tags: dev
13:00
Fix: invert credit and debit in pay-offs check-in: 59a92f8649 user: bohwaz tags: dev
01:00
Fix opening balance credits and debits check-in: dad85b0427 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Entities/Accounting/Transaction.php from [18fc086a4a] to [22f0e64c1e].

546
547
548
549
550
551
552




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





			$this->add(clone $line);
		}

		return $this->_related;
	}
}







>
>
>
>
|





546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
		foreach ($this->_related->getLines() as $line) {
			if (($this->_related->type == self::TYPE_DEBT && $line->credit)
				|| ($this->_related->type == self::TYPE_CREDIT && $line->debit)) {
				// Skip the type of debt/credit, just keep the thirdparty account
				continue;
			}

			// Invert debit/credit
			$line2 = clone $line;
			$line2->debit = $line->debit ? 0 : $line->credit;
			$line2->credit = $line->credit ? 0 : $line->debit;
			$this->add($line2);
		}

		return $this->_related;
	}
}