Overview
Comment: | Création d'une recherche par défaut à l'installation |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
96bf857cc18fbfa5795e1562f3b6910a |
User & Date: | bohwaz on 2018-10-09 16:46:59 |
Other Links: | branch diff | manifest | tags |
Context
2018-10-09
| ||
16:50 | Rejeter les recherches invalides check-in: ef3a17cedd user: bohwaz tags: dev | |
16:46 | Création d'une recherche par défaut à l'installation check-in: 96bf857cc1 user: bohwaz tags: dev | |
2018-10-08
| ||
13:01 | Envoi de message collectif check-in: e77b5d23b2 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Install.php from [683f6f27e6] to [c6e1ea55f9].
︙ | ︙ | |||
55 56 57 58 59 60 61 | $config->setVersion(garradin_version()); $champs = Membres\Champs::importInstall(); $champs->save(false); // Pas de copie car pas de table membres existante $config->set('champ_identifiant', 'email'); $config->set('champ_identite', 'nom'); | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | $config->setVersion(garradin_version()); $champs = Membres\Champs::importInstall(); $champs->save(false); // Pas de copie car pas de table membres existante $config->set('champ_identifiant', 'email'); $config->set('champ_identite', 'nom'); // Création catégories $cats = new Membres\Categories; $id = $cats->add([ 'nom' => 'Membres actifs', ]); $config->set('categorie_membres', $id); |
︙ | ︙ | |||
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | $ex = new Compta\Exercices; $ex->add([ 'libelle' => 'Premier exercice', 'debut' => date('Y-01-01'), 'fin' => date('Y-12-31') ]); return $config->save(); } static public function checkAndCreateDirectories() { // Vérifier que les répertoires vides existent, sinon les créer $paths = [DATA_ROOT, PLUGINS_ROOT, CACHE_ROOT, CACHE_ROOT . '/static', CACHE_ROOT . '/compiled']; foreach ($paths as $path) { Utils::safe_mkdir($path); | > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | $ex = new Compta\Exercices; $ex->add([ 'libelle' => 'Premier exercice', 'debut' => date('Y-01-01'), 'fin' => date('Y-12-31') ]); // Ajout d'une recherche avancée en exemple $query = [ 'query' => [[ 'operator' => 'AND', 'conditions' => [ [ 'column' => 'lettre_infos', 'operator' => '= 1', 'values' => [], ], ], ]], 'order' => 'numero', 'desc' => true, 'limit' => '10000', ]; $recherche = new Recherche; $recherche->add('Membres inscrits à la lettre d\'information', null, $recherche::TYPE_JSON, 'membres', $query); return $config->save(); } static public function checkAndCreateDirectories() { // Vérifier que les répertoires vides existent, sinon les créer $paths = [DATA_ROOT, PLUGINS_ROOT, CACHE_ROOT, CACHE_ROOT . '/static', CACHE_ROOT . '/compiled']; foreach ($paths as $path) { Utils::safe_mkdir($path); if (!is_dir($path)) { throw new UserException('Le répertoire '.$path.' n\'existe pas ou n\'est pas un répertoire.'); } // On en profite pour vérifier qu'on peut y lire et écrire if (!is_writable($path) || !is_readable($path)) { throw new UserException('Le répertoire '.$path.' n\'est pas accessible en lecture/écriture.'); } } return true; } static public function setLocalConfig($key, $value) { $path = ROOT . DIRECTORY_SEPARATOR . 'config.local.php'; $new_line = sprintf('const %s = %s;', $key, var_export($value, true)); if (file_exists($path)) { $config = file_get_contents($path); $pattern = sprintf('/^.*(?:const\s+%s|define\s*\(.*%1$s).*$/m', $key); $config = preg_replace($pattern, $new_line, $config, -1, $count); if (!$count) { $config = preg_replace('/\?>.*/s', '', $config); $config .= PHP_EOL . $new_line . PHP_EOL; } |
︙ | ︙ |
Modified src/include/lib/Garradin/Recherche.php from [731bbdf536] to [4a862884ec].
︙ | ︙ | |||
285 286 287 288 289 290 291 | { $query = sprintf('%s %s', $db->quoteIdentifier($condition['column']), $condition['operator']); } $values = isset($condition['values']) ? $condition['values'] : []; $values = array_map(['Garradin\Utils', 'transliterateToAscii'], $values); | | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | { $query = sprintf('%s %s', $db->quoteIdentifier($condition['column']), $condition['operator']); } $values = isset($condition['values']) ? $condition['values'] : []; $values = array_map(['Garradin\Utils', 'transliterateToAscii'], $values); if ($column->type == 'tel') { // Normaliser le numéro de téléphone $values = array_map(['Garradin\Utils', 'normalizePhoneNumber'], $values); } // L'opérateur binaire est un peu spécial |
︙ | ︙ | |||
360 361 362 363 364 365 366 | { $order = sprintf('transliterate_to_ascii(%s) COLLATE NOCASE', $db->quoteIdentifier($order)); } else { $order = $db->quoteIdentifier($order); } | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | { $order = sprintf('transliterate_to_ascii(%s) COLLATE NOCASE', $db->quoteIdentifier($order)); } else { $order = $db->quoteIdentifier($order); } $query_columns = array_map([$db, 'quoteIdentifier'], $query_columns); $sql_query = sprintf('SELECT id, %s FROM %s WHERE %s ORDER BY %s %s LIMIT %d;', implode(', ', $query_columns), $target, '(' . implode(') AND (', $query_groups) . ')', $order, |
︙ | ︙ |
Modified src/www/admin/config/donnees/local.php from [26c48b632d] to [c67b3c1387].
︙ | ︙ | |||
44 45 46 47 48 49 50 | Utils::redirect(ADMIN_URL . 'config/donnees/local.php?ok=remove'); } catch (UserException $e) { $form->addError($e->getMessage()); } } } | < | 44 45 46 47 48 49 50 51 52 53 54 55 | Utils::redirect(ADMIN_URL . 'config/donnees/local.php?ok=remove'); } catch (UserException $e) { $form->addError($e->getMessage()); } } } $tpl->assign('ok_code', qg('code')); $tpl->assign('ok', qg('ok')); $tpl->assign('liste', $s->getList()); $tpl->display('admin/config/donnees/local.tpl'); |