Overview
Comment: | Implement search copy [828073415a] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
0f3045411765df3e30650981333795f7 |
User & Date: | bohwaz on 2020-11-11 23:55:37 |
Other Links: | branch diff | manifest | tags |
Context
2020-11-12
| ||
03:11 | Implement custom background image check-in: 14c79f9194 user: bohwaz tags: dev, 1.0.0-beta1 | |
2020-11-11
| ||
23:55 | Implement search copy [828073415a] check-in: 0f30454117 user: bohwaz tags: dev | |
22:59 | Fix issue with date picker when clicking on non-dates (thanks @zou) check-in: 974c4b227b user: bohwaz tags: dev | |
Changes
Modified src/include/data/1.0.0_migration.sql from [059bf3806f] to [46bbab5f83].
︙ | ︙ | |||
8 9 10 11 12 13 14 | INSERT OR REPLACE INTO compta_comptes (id, parent, libelle, position) VALUES ('891', '89', 'Bilan de clôture', 0); -- N'est pas utilisé DELETE FROM config WHERE cle = 'categorie_dons' OR cle = 'categorie_cotisations'; .read 1.0.0_schema.sql | < < | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | INSERT OR REPLACE INTO compta_comptes (id, parent, libelle, position) VALUES ('891', '89', 'Bilan de clôture', 0); -- N'est pas utilisé DELETE FROM config WHERE cle = 'categorie_dons' OR cle = 'categorie_cotisations'; .read 1.0.0_schema.sql -------- MIGRATION COMPTA --------- INSERT INTO acc_charts (id, country, code, label) VALUES (1, 'FR', 'PCGA1999', 'Plan comptable associatif 1999'); -- Migration comptes de code comme identifiant à ID unique -- Inversement valeurs actif/passif et produit/charge INSERT INTO acc_accounts (id, id_chart, code, label, position, user) SELECT NULL, 1, id, libelle, |
︙ | ︙ |
Modified src/include/lib/Garradin/Recherche.php from [a6f9ee8488] to [df28230a8c].
︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 85 86 | throw new \InvalidArgumentException('JSON invalide pour le type JSON'); } } } return $query; } public function edit($id, $data) { $allowed = ['intitule', 'id_membre', 'type', 'cible', 'contenu']; // Supprimer les champs qui ne sont pas ceux de la BDD $data = array_intersect_key($data, array_flip($allowed)); | > > > > > > | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | throw new \InvalidArgumentException('JSON invalide pour le type JSON'); } } } return $query; } public function duplicate(int $id) { DB::getInstance()->preparedQuery('INSERT INTO recherches (id_membre, intitule, cible, type, contenu) SELECT id_membre, \'Copie de : \' || intitule, cible, type, contenu FROM recherches WHERE id = ?;', [$id]); } public function edit($id, $data) { $allowed = ['intitule', 'id_membre', 'type', 'cible', 'contenu']; // Supprimer les champs qui ne sont pas ceux de la BDD $data = array_intersect_key($data, array_flip($allowed)); |
︙ | ︙ | |||
504 505 506 507 508 509 510 | $query_columns = implode(', ', $query_columns); $query_groups = '(' . implode(') AND (', $query_groups) . ')'; $desc = $desc ? 'DESC' : 'ASC'; if ('compta' === $target) { | | | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | $query_columns = implode(', ', $query_columns); $query_groups = '(' . implode(') AND (', $query_groups) . ')'; $desc = $desc ? 'DESC' : 'ASC'; if ('compta' === $target) { $sql_query = sprintf('SELECT %s FROM acc_transactions AS t INNER JOIN acc_transactions_lines AS l ON l.id_transaction = t.id WHERE %s GROUP BY t.id ORDER BY %s %s LIMIT %d;', $query_columns, $query_groups, $order, $desc, (int) $limit); $sql_query = str_replace(['"t.', '"l.'], ['"t"."', '"l"."'], $sql_query); } else { $sql_query = sprintf('SELECT id, %s FROM %s WHERE %s ORDER BY %s %s LIMIT %d;', $query_columns, $target, $query_groups, $order, $desc, (int) $limit); } |
︙ | ︙ |
Modified src/templates/common/search/saved_searches.tpl from [c2565e81bc] to [d956e06c8f].
︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | <tr> <th><a href="{$search_url}?id={$recherche.id}">{$recherche.intitule}</a></th> <td>{if $recherche.type == Recherche::TYPE_JSON}Avancée{else}SQL{/if}</td> <td>{if !$recherche.id_membre}Publique{else}Privée{/if}</td> <td class="actions"> {linkbutton href="%s?id=%d"|args:$search_url,$recherche.id shape="search" label="Rechercher"} {if $recherche.id_membre || $session->canAccess($target, Membres::DROIT_ADMIN)} {linkbutton href="%s?edit=%d"|args:$self_url_no_qs,$recherche.id shape="edit" label="Modifier"} {linkbutton href="%s?delete=%d"|args:$self_url_no_qs,$recherche.id shape="delete" label="Supprimer"} {/if} </td> </tr> {/foreach} </tbody> </table> {/if} {include file="admin/_foot.tpl"} | > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | <tr> <th><a href="{$search_url}?id={$recherche.id}">{$recherche.intitule}</a></th> <td>{if $recherche.type == Recherche::TYPE_JSON}Avancée{else}SQL{/if}</td> <td>{if !$recherche.id_membre}Publique{else}Privée{/if}</td> <td class="actions"> {linkbutton href="%s?id=%d"|args:$search_url,$recherche.id shape="search" label="Rechercher"} {if $recherche.id_membre || $session->canAccess($target, Membres::DROIT_ADMIN)} {linkbutton href="%s?duplicate=%d"|args:$self_url_no_qs,$recherche.id shape="export" label="Dupliquer"} {linkbutton href="%s?edit=%d"|args:$self_url_no_qs,$recherche.id shape="edit" label="Modifier"} {linkbutton href="%s?delete=%d"|args:$self_url_no_qs,$recherche.id shape="delete" label="Supprimer"} {/if} </td> </tr> {/foreach} </tbody> </table> {/if} {include file="admin/_foot.tpl"} |
Modified src/www/admin/common/saved_searches.php from [08209d1978] to [e1f8499fe1].
1 2 3 4 5 6 7 8 9 10 11 12 | <?php namespace Garradin; require_once __DIR__ . '/../_inc.php'; if (empty($target) || !in_array($target, Recherche::TARGETS)) { throw new UserException('Cible inconnue'); } $recherche = new Recherche; $mode = null; | | | > > > > > | 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 | <?php namespace Garradin; require_once __DIR__ . '/../_inc.php'; if (empty($target) || !in_array($target, Recherche::TARGETS)) { throw new UserException('Cible inconnue'); } $recherche = new Recherche; $mode = null; if (qg('edit') || qg('delete') || qg('duplicate')) { $r = $recherche->get(qg('edit') ?: (qg('delete') ?: qg('duplicate'))); if (!$r) { throw new UserException('Recherche non trouvée'); } if ($r->id_membre !== null && $r->id_membre != $user->id) { throw new UserException('Recherche privée appartenant à un autre membre.'); } if (qg('duplicate')) { $recherche->duplicate($r->id); Utils::redirect(Utils::getSelfURI(false)); } $tpl->assign('recherche', $r); $mode = qg('edit') ? 'edit' : 'delete'; } if ($mode == 'edit' && f('save') && $form->check('edit_recherche_' . $r->id)) |
︙ | ︙ |