Overview
Comment: | Utilisation du numéro plutôt que l'ID pour import/export de membre |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
6877253ad296d49cdceb4e7a0864ffcf |
User & Date: | bohwaz on 2017-08-09 07:19:12 |
Other Links: | branch diff | manifest | tags |
Context
2017-08-13
| ||
23:24 | Ajout de l'entête Message-ID dans les mails partants, correction double-encodage des sujets pour l'envoi par SMTP. Via un patch de @daniel merci check-in: a87e131fa4 user: bohwaz tags: dev | |
2017-08-09
| ||
07:19 | Utilisation du numéro plutôt que l'ID pour import/export de membre check-in: 6877253ad2 user: bohwaz tags: dev | |
06:59 | Dédoublement du champ ID en deux champs : ID (interne) et numéro de membre (champ membre modifiable) check-in: 3dfb698790 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Membres/Champs.php from [6b0d0f9ef0] to [9d2926e8e4].
︙ | ︙ | |||
152 153 154 155 156 157 158 159 160 161 162 163 164 165 | return null; if (in_array($this->champs->$champ->type, $this->text_types)) return true; else return false; } public function getAll() { return $this->champs; } public function getList($with_id = false) | > > > > > > > > > > > > > > > > > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | return null; if (in_array($this->champs->$champ->type, $this->text_types)) return true; else return false; } public function getKeys($all = false) { $keys = []; foreach ($this->champs as $key => $config) { if (!$all && $key == 'passe') { continue; } $keys[] = $key; } return $keys; } public function getAll() { return $this->champs; } public function getList($with_id = false) |
︙ | ︙ |
Modified src/include/lib/Garradin/Membres/Import.php from [1629f5904f] to [88c627e4f9].
︙ | ︙ | |||
167 168 169 170 171 172 173 | $membres = new Membres; // On récupère les champs qu'on peut importer $champs = Config::getInstance()->get('champs_membres')->getAll(); $champs = array_keys((array)$champs); $champs[] = 'date_inscription'; //$champs[] = 'date_connexion'; | | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | $membres = new Membres; // On récupère les champs qu'on peut importer $champs = Config::getInstance()->get('champs_membres')->getAll(); $champs = array_keys((array)$champs); $champs[] = 'date_inscription'; //$champs[] = 'date_connexion'; //$champs[] = 'id'; //$champs[] = 'id_categorie'; $line = 0; $delim = Utils::find_csv_delim($fp); while (!feof($fp)) { |
︙ | ︙ | |||
216 217 218 219 220 221 222 | if (!in_array($name, $champs)) continue; if (trim($row[$id]) !== '') $data[$name] = $row[$id]; } | | | | | | > > > > > > > | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | if (!in_array($name, $champs)) continue; if (trim($row[$id]) !== '') $data[$name] = $row[$id]; } if (!empty($data['numero']) && $data['numero'] > 0) { $numero = (int)$data['numero']; } else { $numero = false; } unset($data['numero']); try { if ($numero && ($id = $membres->getIDWithNumero($numero))) { $membres->edit($id, $data); } else { $membres->add($data); } } catch (UserException $e) { $db->rollback(); throw new UserException('Erreur sur la ligne ' . $line . ' : ' . $e->getMessage()); } } $db->commit(); fclose($fp); return true; } public function toCSV() { $db = DB::getInstance(); $champs = Config::getInstance()->get('champs_membres')->getKeys(); $champs = 'm.' . implode(', m.', $champs); $res = $db->prepare('SELECT ' . $champs . ', c.nom AS categorie FROM membres AS m LEFT JOIN membres_categories AS c ON m.id_categorie = c.id ORDER BY c.id;')->execute(); $fp = fopen('php://output', 'w'); $header = false; while ($row = $res->fetchArray(SQLITE3_ASSOC)) { |
︙ | ︙ |