Overview
Comment: | Do not treat a transaction as expense/revenue when there's a line with each |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | stable |
Files: | files | file ages | folders |
SHA3-256: |
606ded04562656757062265912c99656 |
User & Date: | bohwaz on 2022-09-14 01:05:23 |
Other Links: | manifest | tags |
Context
2022-09-14
| ||
16:51 | Fix missing line in search code, fix [f1c760fefba310d8452e9638aaa25dc6ad430a18] check-in: 2558721007 user: bohwaz tags: trunk, stable | |
01:05 | Do not treat a transaction as expense/revenue when there's a line with each check-in: 606ded0456 user: bohwaz tags: trunk, stable | |
01:00 | memory_limit does not count towards file size limit check-in: 5bd2bf1ef9 user: bohwaz tags: trunk, stable | |
Changes
Modified src/include/lib/Garradin/Entities/Accounting/Transaction.php from [f348b1e49b] to [bb00e4cc0d].
︙ | ︙ | |||
110 111 112 113 114 115 116 117 118 119 | } public function findTypeFromAccounts(): int { if (count($this->getLines()) != 2) { return self::TYPE_ADVANCED; } foreach ($this->getLinesWithAccounts() as $line) { if ($line->account_position == Account::REVENUE && $line->credit) { | > > | | > > | > > > | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | } public function findTypeFromAccounts(): int { if (count($this->getLines()) != 2) { return self::TYPE_ADVANCED; } $types = []; foreach ($this->getLinesWithAccounts() as $line) { if ($line->account_position == Account::REVENUE && $line->credit) { $types[] = self::TYPE_REVENUE; } elseif ($line->account_position == Account::EXPENSE && $line->debit) { $types[] = self::TYPE_EXPENSE; } } // Did not find a expense/revenue account: fall back to advanced // (or if one line is expense and the other is revenue) if (count($types) != 1) { return self::TYPE_ADVANCED; } return current($types); } public function getLinesWithAccounts(): array { $db = EntityManager::getInstance(Line::class)->DB(); // Merge data from accounts with lines |
︙ | ︙ |