Overview
Comment: | Suppression espaces supplémentaires |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
11ae7223d0263723a41b9668bf07c6af |
User & Date: | bohwaz on 2019-02-15 10:15:37 |
Other Links: | branch diff | manifest | tags |
Context
2019-02-15
| ||
10:16 | Ajout configuration compta expert check-in: b65e46e08c user: bohwaz tags: dev | |
10:15 | Suppression espaces supplémentaires check-in: 11ae7223d0 user: bohwaz tags: dev | |
10:13 | Vérification des clés étrangères à l'import check-in: 9d57ccacf4 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Config.php from [52d2a7f213] to [5c2380cda0].
︙ | ︙ | |||
45 46 47 48 49 50 51 | $object = new \stdClass; $this->fields_types = [ 'nom_asso' => $string, 'adresse_asso' => $string, 'email_asso' => $string, 'site_asso' => $string, | | | | | | | | | | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | $object = new \stdClass; $this->fields_types = [ 'nom_asso' => $string, 'adresse_asso' => $string, 'email_asso' => $string, 'site_asso' => $string, 'monnaie' => $string, 'pays' => $string, 'champs_membres' => $object, 'categorie_membres' => $int, 'categorie_dons' => $int, 'categorie_cotisations' => $int, 'accueil_wiki' => $string, 'accueil_connexion' => $string, 'frequence_sauvegardes' => $int, 'nombre_sauvegardes' => $int, 'champ_identifiant' => $string, 'champ_identite' => $string, 'version' => $string, 'couleur1' => $string, 'couleur2' => $string, 'image_fond' => $string, 'desactiver_site' => $bool, ]; $db = DB::getInstance(); $this->config = $db->getAssoc('SELECT cle, valeur FROM config ORDER BY cle;'); foreach ($this->config as $key=>&$value) |
︙ | ︙ | |||
156 157 158 159 160 161 162 | $db->preparedQuery('INSERT OR REPLACE INTO config (cle, valeur) VALUES (?, ?);', [$key, $value]); } if (!empty($this->modified['champ_identifiant'])) { // Mettre les champs identifiant vides à NULL pour pouvoir créer un index unique | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | $db->preparedQuery('INSERT OR REPLACE INTO config (cle, valeur) VALUES (?, ?);', [$key, $value]); } if (!empty($this->modified['champ_identifiant'])) { // Mettre les champs identifiant vides à NULL pour pouvoir créer un index unique $db->exec('UPDATE membres SET '.$this->get('champ_identifiant').' = NULL WHERE '.$this->get('champ_identifiant').' = "";'); // Création de l'index unique $db->exec('DROP INDEX IF EXISTS membres_identifiant;'); $db->exec('CREATE UNIQUE INDEX membres_identifiant ON membres ('.$this->get('champ_identifiant').');'); } |
︙ | ︙ | |||
182 183 184 185 186 187 188 | throw new \OutOfBoundsException('Ce champ est inconnu.'); } if (!array_key_exists($key, $this->config)) { return null; } | | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | throw new \OutOfBoundsException('Ce champ est inconnu.'); } if (!array_key_exists($key, $this->config)) { return null; } return $this->config[$key]; } public function getVersion() { if (!array_key_exists('version', $this->config)) { |
︙ | ︙ | |||
284 285 286 287 288 289 290 | // Vérification que le champ existe bien if (!$champs->get($value)) { throw new UserException('Le champ '.$value.' n\'existe pas pour la configuration de '.$key); } // Vérification que le champ est unique pour l'identifiant | | | | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | // Vérification que le champ existe bien if (!$champs->get($value)) { throw new UserException('Le champ '.$value.' n\'existe pas pour la configuration de '.$key); } // Vérification que le champ est unique pour l'identifiant if ($key == 'champ_identifiant' && !$db->firstColumn('SELECT (COUNT(DISTINCT lower('.$value.')) = COUNT(*)) FROM membres WHERE '.$value.' IS NOT NULL AND '.$value.' != \'\';')) { throw new UserException('Le champ '.$value.' comporte des doublons et ne peut donc pas servir comme identifiant pour la connexion.'); } break; } case 'categorie_cotisations': |
︙ | ︙ |