Overview
Comment: | Fix issue with free/formula fees (thanks @zou!) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev | 1.0.0-alpha6 |
Files: | files | file ages | folders |
SHA1: |
4323146add1fcb063bde4b762227652d |
User & Date: | bohwaz on 2020-11-11 16:13:34 |
Other Links: | branch diff | manifest | tags |
Context
2020-11-11
| ||
16:24 | Fix issue with empty fields check-in: 711c4586c4 user: bohwaz tags: dev, 1.0.0-alpha6 | |
16:13 | Fix issue with free/formula fees (thanks @zou!) check-in: 4323146add user: bohwaz tags: dev, 1.0.0-alpha6 | |
16:04 | Allow services without fees, thanks @zou check-in: bc3ab3badc user: bohwaz tags: dev, 1.0.0-alpha6 | |
Changes
Modified src/include/lib/Garradin/Entities/Services/Fee.php from [5e1f69acfa] to [6f825919cc].
︙ | ︙ | |||
34 35 36 37 38 39 40 | 'id_service' => 'int', 'id_account' => '?int', 'id_year' => '?int', ]; public function filterUserValue(string $type, $value, string $key) { | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 'id_service' => 'int', 'id_account' => '?int', 'id_year' => '?int', ]; public function filterUserValue(string $type, $value, string $key) { if ($key == 'amount' && $value !== null) { $value = Utils::moneyToInteger($value); } return $value; } public function importForm(array $source = null) |
︙ | ︙ | |||
78 79 80 81 82 83 84 | { $db = DB::getInstance(); parent::selfCheck(); $this->assert(trim($this->label) !== '', 'Le libellé doit être renseigné'); $this->assert(strlen($this->label) <= 200, 'Le libellé doit faire moins de 200 caractères'); $this->assert(strlen($this->description) <= 2000, 'La description doit faire moins de 2000 caractères'); | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | { $db = DB::getInstance(); parent::selfCheck(); $this->assert(trim($this->label) !== '', 'Le libellé doit être renseigné'); $this->assert(strlen($this->label) <= 200, 'Le libellé doit faire moins de 200 caractères'); $this->assert(strlen($this->description) <= 2000, 'La description doit faire moins de 2000 caractères'); $this->assert(null === $this->amount || $this->amount > 0, 'Le montant est invalide : ' . $this->amount); $this->assert($this->id_service, 'Aucun service n\'a été indiqué pour ce tarif.'); $this->assert((null === $this->id_account && null === $this->id_year) || (null !== $this->id_account && null !== $this->id_year), 'Le compte doit être indiqué avec l\'exercice'); $this->assert(null === $this->id_account || $db->test(Account::TABLE, 'id = ?', $this->id_account), 'Le compte indiqué n\'existe pas'); $this->assert(null === $this->id_year || $db->test(Year::TABLE, 'id = ?', $this->id_year), 'L\'exercice indiqué n\'existe pas'); $this->assert(null === $this->formula || $this->checkFormula(), 'Formule de calcul invalide'); $this->assert(null === $this->amount || null === $this->formula, 'Il n\'est pas possible de spécifier à la fois une formule et un montant'); |
︙ | ︙ |