Overview
Comment: | Adaptation à KD2\AbstractEntity |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
1f3d435c32855b6e511a458425059ebb |
User & Date: | bohwaz on 2020-01-17 13:23:39 |
Other Links: | branch diff | manifest | tags |
Context
2020-01-20
| ||
00:12 | Garder les anciens schémas SQL pour les migrations qui les utilisent check-in: 757810afbb user: bohwaz tags: dev | |
2020-01-17
| ||
13:23 | Adaptation à KD2\AbstractEntity check-in: 1f3d435c32 user: bohwaz tags: dev | |
13:22 | Ajout foreign key id_exercice sur les comptes check-in: 9ac4c86495 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Compta/Compte.php from [c219124f46] to [6715611975].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | <?php namespace Garradin\Compta; use Garradin\DB; use Garradin\Utils; use Garradin\UserException; class Compte extends Entity { const PASSIF = 1; const ACTIF = 2; const ACTIF_PASSIF = 3; const PRODUIT = 4; const CHARGE = 5; const PRODUIT_CHARGE = 6; const BANQUE = 7; const CAISSE = 8; const A_ENCAISSER = 9; protected $id; protected $parent; protected $libelle; protected $position; protected $plan_comptable; | > > > > > > | > > > > > > > > > | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | <?php namespace Garradin\Compta; use Garradin\Entity; use Garradin\DB; use Garradin\Utils; use Garradin\UserException; class Compte extends Entity { const TABLE = 'compta_comptes'; const PASSIF = 1; const ACTIF = 2; const ACTIF_PASSIF = 3; const PRODUIT = 4; const CHARGE = 5; const PRODUIT_CHARGE = 6; // Types spéciaux de comptes const BANQUE = 7; const CAISSE = 8; const A_ENCAISSER = 9; protected $id; protected $code; protected $parent; protected $libelle; protected $position; protected $plan_comptable; protected $id_exercice; protected $_types = [ 'code' => 'string', 'parent' => '?int', 'libelle' => 'string', 'position' => 'int', 'plan_comptable' => 'int', 'id_exercice' => '?int', ]; protected $_validation_rules = [ 'id' => 'required|integer', 'libelle' => 'required|string', 'parent' => 'required|integer|in_table:compta_comptes,id', 'position' => 'required|integer', 'plan_comptable' => 'integer|min:0|max:1', 'id_exercice' => 'integer|in_table:compta_exercices,id' ]; } |
Modified src/include/lib/Garradin/Compta/Comptes.php from [9bf36bdeef] to [8e9c8fd0ed].
1 2 3 4 | <?php namespace Garradin\Compta; | > | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?php namespace Garradin\Compta; use Garradin\Entity; use Garradin\DB; use Garradin\Utils; use Garradin\UserException; class Comptes { const CAISSE = '530'; const CHEQUE_A_ENCAISSER = '5112'; const CARTE_A_ENCAISSER = '5115'; |
︙ | ︙ |
Modified src/include/lib/Garradin/Compta/Ligne.php from [b871bf3705] to [b6662c154e].
1 2 3 4 5 6 7 8 9 | <?php namespace Garradin\Compta; use Garradin\Entity; use Garradin\ValidationException; class Ligne extends Entity { | | > | > > > > > > > | | | < < < < | < | < < < < | < < < < | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | <?php namespace Garradin\Compta; use Garradin\Entity; use Garradin\ValidationException; class Ligne extends Entity { const TABLE = 'compta_mouvements_lignes'; protected $id; protected $id_mouvement; protected $credit = 0; protected $debit = 0; protected $compte; protected $_types = [ 'id_mouvement' => 'int', 'credit' => 'int', 'debit' => 'int', 'compte' => 'int', ]; protected $_validation_rules = [ 'id_mouvement' => 'required|integer|in_table:compta_mouvements,id', 'compte' => 'required|integer|in_table:compta_comptes,id', 'credit' => 'required|integer|min:0', 'debit' => 'required|integer|min:0' ]; public function filterUserValue(string $key, $value, array $source) { $value = parent::filterUserValue($key, $value); if ($key == 'credit' || $key == 'debit') { if (!preg_match('/^(\d+)(?:[,.](\d{2}))?$/', $value, $match)) { throw new ValidationException('Le format du montant est invalide. Format accepté, exemple : 142,02'); } $value = $match[1] . sprintf('%02d', $match[2]); } return $value; } public function selfCheck() { parent::selfCheck(); $this->assert($this->credit || $this->debit, 'Aucun montant au débit ou au crédit.'); $this->assert(($this->credit * $this->debit) === 0 && ($this->credit + $this->debit) > 0, 'Ligne non équilibrée : crédit ou débit doit valoir zéro.'); $this->assert($this->id_mouvement, 'Aucun mouvement n\'a été indiqué pour cette ligne.'); } } |
Modified src/include/lib/Garradin/Compta/Mouvement.php from [e4b2eec8c2] to [b67e1a34c6].
1 2 3 4 5 6 7 8 9 10 11 | <?php namespace Garradin\Compta; use Garradin\Entity; use Garradin\ValidationException; use Garradin\DB; use Garradin\Config; class Mouvement extends Entity { | | < | > > > > > > > > > > > > > > > < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | <?php namespace Garradin\Compta; use Garradin\Entity; use Garradin\ValidationException; use Garradin\DB; use Garradin\Config; class Mouvement extends Entity { const TABLE = 'compta_mouvements'; protected $id; protected $libelle; protected $remarques; protected $numero_piece; protected $date; protected $moyen_paiement; protected $validation; protected $hash; protected $prev_hash; protected $id_exercice; protected $id_auteur; protected $id_categorie; protected $id_projet; protected $_types = [ 'libelle' => 'string', 'remarques' => '?string', 'numero_piece' => '?string', 'date' => 'date', 'moyen_paiement' => '?string', 'validation' => 'bool', 'hash' => '?string', 'prev_hash' => '?string', 'id_exercice' => '?int', 'id_auteur' => '?int', 'id_categorie' => '?int', 'id_projet' => '?int', ]; protected $_validation_rules = [ 'libelle' => 'required|string', 'remarques' => 'string|max:20000', 'numero_piece' => 'string|max:200', 'date' => 'required|date', 'moyen_paiement' => 'string|in_table:compta_moyens_paiement,code|required_with:id_categorie', 'validation' => 'bool', 'id_exercice' => 'integer|in_table:compta_exercices,id', 'id_auteur' => 'integer|in_table:membres,id', 'id_categorie' => 'integer|in_table:compta_categories,id', 'id_projet' => 'integer|in_table:compta_projets,id' |
︙ | ︙ |
Modified src/include/lib/Garradin/Entity.php from [60b139db0d] to [e94008659f].
1 2 3 4 5 6 | <?php namespace Garradin; use KD2\Form; | > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <?php namespace Garradin; use KD2\Form; use KD2\AbstractEntity; class Entity extends AbstractEntity { /** * Valider les champs avant enregistrement * @throws ValidationException Si une erreur de validation survient */ public function selfValidate() { $errors = []; if (!Form::validate($this->_fields, $errors, $this->toArray())) { $messages = []; foreach ($errors as $error) { $messages[] = $this->getValidationMessage($error); } throw new ValidationException(implode("\n", $messages)); } } } |
Modified src/include/lib/dependencies.list from [7b518732e5] to [b0f8f3486c].
1 | KD2/data/ | | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 | KD2/data/ KD2/DB/DB.php KD2/DB/SQLite3.php KD2/DB/Entity.php KD2/DB/Entity_Manager.php KD2/ErrorManager.php KD2/FileInfo.php KD2/Form.php KD2/Helpers.php KD2/Image.php KD2/MiniSkel.php KD2/QRCode.php |
︙ | ︙ |