Overview
Comment: | Fix more PHP 8.1 depreciations |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
75e0d8d8647a943cd162452e6ca9a96f |
User & Date: | bohwaz on 2022-02-09 23:17:09 |
Other Links: | manifest | tags |
Context
2022-02-09
| ||
23:19 | Change wording: "terminée" -> "expirée" for subscriptions check-in: a91990cac3 user: bohwaz tags: trunk | |
23:17 | Fix more PHP 8.1 depreciations check-in: 75e0d8d864 user: bohwaz tags: trunk | |
21:36 | Fix restore backup where user does not exist anymore: force login as first admin account check-in: 70bfaa52e7 user: bohwaz tags: trunk | |
Changes
Modified src/include/lib/Garradin/Entities/Services/Fee.php from [af385c884c] to [b18507c36f].
︙ | ︙ | |||
14 15 16 17 18 19 20 | class Fee extends Entity { const TABLE = 'services_fees'; protected int $id; protected string $label; | | | | | | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | class Fee extends Entity { const TABLE = 'services_fees'; protected int $id; protected string $label; protected ?string $description = null; protected ?int $amount = null; protected ?string $formula = null; protected int $id_service; protected ?int $id_account = null; protected ?int $id_year = null; protected ?int $id_analytical = null; public function filterUserValue(string $type, $value, string $key) { if ($key == 'amount' && $value !== null) { $value = Utils::moneyToInteger($value); } |
︙ | ︙ | |||
73 74 75 76 77 78 79 | public function selfCheck(): void { $db = DB::getInstance(); parent::selfCheck(); $this->assert(trim($this->label) !== '', 'Le libellé doit être renseigné'); | | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | public function selfCheck(): void { $db = DB::getInstance(); parent::selfCheck(); $this->assert(trim($this->label) !== '', 'Le libellé doit être renseigné'); $this->assert(strlen((string) $this->label) <= 200, 'Le libellé doit faire moins de 200 caractères'); $this->assert(strlen((string) $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->id_account || $db->test(Account::TABLE, 'id = ? AND id_chart = (SELECT id_chart FROM acc_years WHERE id = ?)', $this->id_account, $this->id_year), 'Le compte sélectionné ne correspond pas à l\'exercice'); |
︙ | ︙ |
Modified src/include/lib/Garradin/Entities/Services/Service_User.php from [2bb10f99d8] to [d501fea302].
︙ | ︙ | |||
81 82 83 84 85 86 87 | if (!$service) { throw new \LogicException('The requested service is not found'); } if ($service->duration) { $dt = new \DateTime; $dt->modify(sprintf('+%d days', $service->duration)); | | | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | if (!$service) { throw new \LogicException('The requested service is not found'); } if ($service->duration) { $dt = new \DateTime; $dt->modify(sprintf('+%d days', $service->duration)); $this->set('expiry_date', $dt); } elseif ($service->end_date) { $this->set('expiry_date', $service->end_date); } else { $this->set('expiry_date', null); } } return parent::importForm($source); } public function service(): Service |
︙ | ︙ |
Modified src/include/lib/Garradin/Template.php from [c15c24db4a] to [a43b57e30e].
︙ | ︙ | |||
779 780 781 782 783 784 785 | $b = 0x01 << (int)$k; $field .= sprintf('<input type="checkbox" name="%s[%d]" id="f_%1$s_%2$d" value="1" %s %s /> <label for="f_%1$s_%2$d">%s</label><br />', htmlspecialchars($params['name']), $k, ($value & $b) ? 'checked="checked"' : '', $attributes, htmlspecialchars($v)); } } elseif ($type == 'textarea') { | | | | 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | $b = 0x01 << (int)$k; $field .= sprintf('<input type="checkbox" name="%s[%d]" id="f_%1$s_%2$d" value="1" %s %s /> <label for="f_%1$s_%2$d">%s</label><br />', htmlspecialchars($params['name']), $k, ($value & $b) ? 'checked="checked"' : '', $attributes, htmlspecialchars($v)); } } elseif ($type == 'textarea') { $field .= '<textarea ' . $attributes . 'cols="30" rows="5">' . htmlspecialchars((string) $value, ENT_QUOTES) . '</textarea>'; } elseif ($type == 'date') { $field = self::formInput(['required' => $config->mandatory, 'name' => $params['name'], 'value' => $value, 'type' => 'date', 'default' => $value]); } else { if ($type == 'checkbox') { if (!empty($value)) { $attributes .= 'checked="checked" '; } $value = '1'; } $field .= '<input type="' . $type . '" ' . $attributes . ' value="' . htmlspecialchars((string) $value, ENT_QUOTES) . '" />'; } $out = ' <dt>'; if ($type == 'checkbox') { |
︙ | ︙ |