Overview
Comment: | Autorise une valeur décimale dans les champs à choix multiple, utile pour l'import |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
8b07624fcde73f0ed919d34d523bf376 |
User & Date: | bohwaz on 2017-09-20 06:21:24 |
Other Links: | branch diff | manifest | tags |
Context
2017-09-20
| ||
06:31 | Correction affichage choix multiple dans fiche de membre check-in: 41e771b47c user: bohwaz tags: dev | |
06:21 | Autorise une valeur décimale dans les champs à choix multiple, utile pour l'import check-in: 8b07624fcd user: bohwaz tags: dev | |
01:46 | Correction prévisualisation couleurs interface check-in: b74ed0e552 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Membres.php from [d6d6216f68] to [924a6da939].
︙ | ︙ | |||
94 95 96 97 98 99 100 | } elseif ($config->type == 'select' && !in_array($data[$key], $config->options)) { throw new UserException('Le champ "' . $config->title . '" ne correspond pas à un des choix proposés.'); } elseif ($config->type == 'multiple') { | | | > > | | | | | | | | | > > > > > | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | } elseif ($config->type == 'select' && !in_array($data[$key], $config->options)) { throw new UserException('Le champ "' . $config->title . '" ne correspond pas à un des choix proposés.'); } elseif ($config->type == 'multiple') { if (empty($data[$key])) { $data[$key] = null; continue; } if (is_array($data[$key])) { $binary = 0; foreach ($data[$key] as $k => $v) { if (array_key_exists($k, $config->options) && !empty($v)) { $binary |= 0x01 << $k; } } $data[$key] = $binary; } elseif (!is_numeric($data[$key]) || $data[$key] < 0 || $data[$key] > PHP_INT_MAX) { throw new UserException('Le champs "%s" ne contient pas une valeur binaire.'); } } // Un champ texte vide c'est un champ NULL if (is_string($data[$key]) && trim($data[$key]) === '') { $data[$key] = null; } |
︙ | ︙ |
Modified src/include/lib/Garradin/Membres/Import.php from [88c627e4f9] to [9f36948de3].
︙ | ︙ | |||
222 223 224 225 226 227 228 229 230 231 | if (!empty($data['numero']) && $data['numero'] > 0) { $numero = (int)$data['numero']; } else { $numero = false; } | > < < | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | if (!empty($data['numero']) && $data['numero'] > 0) { $numero = (int)$data['numero']; } else { unset($data['numero']); $numero = false; } try { if ($numero && ($id = $membres->getIDWithNumero($numero))) { $membres->edit($id, $data); } else { |
︙ | ︙ | |||
265 266 267 268 269 270 271 | 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)) { | | | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | 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)) { unset($row->passe); if (!$header) { fputcsv($fp, array_keys($row)); $header = true; } fputs($fp, Utils::CSVLine($row) . "\n"); } fclose($fp); return true; } } |
Modified src/include/lib/Garradin/Utils.php from [d3d713c466] to [06255be23d].
︙ | ︙ | |||
670 671 672 673 674 675 676 | arsort($delims); reset($delims); rewind($fp); return key($delims); } | | > > > > > > > > > > > | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | arsort($delims); reset($delims); rewind($fp); return key($delims); } static public function row_to_csv($row) { $row = (array) $row; array_walk($row, function ($field) { return str_replace('"', '""', $field); }); return '"' . implode('", "', $row) . '"'; } } |