Overview
SHA1:20568ca832ba178f473ab7d04cbad6ce9ff362b8
Date: 2018-09-04 23:22:59
User: bohwaz
Comment:Corriger divers détails sur la recherche avancée
Timelines: family | ancestors | descendants | both | dev
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2018-09-06
21:43
[3bbb95ed9f] Mettre à jour la liste des comptes pour corriger le souci avec le champ parent qui n'était pas forcément positionné correctement (la faute au formulaire qui permettait de choisir un compte qui n'était pas le parent le plus proche) (user: bohwaz, tags: dev)
2018-09-04
23:22
[20568ca832] Corriger divers détails sur la recherche avancée (user: bohwaz, tags: dev)
00:25
[4dbda990af] Ajout option de tri et de limite dans la recherche avancée (user: bohwaz, tags: dev)
Changes

Modified src/include/lib/Garradin/Membres.php from [da2dddadc6] to [9cbfc1c785].

334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
...
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
                }

                $colonnes[] = $condition['column'];
                $champ = $champs->get($condition['column']);

                if ($champs->isText($condition['column']))
                {
                    $query = sprintf('transliterate_to_ascii(%s) %s', $db->quoteIdentifier($condition['column']), $condition['operator']);
                }
                else
                {
                    $query = sprintf('%s %s', $db->quoteIdentifier($condition['column']), $condition['operator']);
                }

                $values = isset($condition['values']) ? $condition['values'] : [];

                array_walk($values, ['Garradin\Utils', 'transliterateToAscii']);
                
                if ($champ->type == 'tel')
                {
                    // Normaliser le numéro de téléphone
                    array_walk($values, ['Garradin\Utils', 'normalizePhoneNumber']);
                }

                if ($condition['operator'] == '&')
                {
                    $new_query = [];

                    foreach ($values as $value)
................................................................................
        $colonnes = array_unique($colonnes);

        if (!in_array($config->get('champ_identite'), $colonnes))
        {
            array_unshift($colonnes, $config->get('champ_identite'));
        }

        array_walk($colonnes, [$db, 'quoteIdentifier']);

        if ($champs->isText($order))
        {
            $order = sprintf('transliterate_to_ascii(%s)', $db->quoteIdentifier($order));
        }
        else
        {
            $order = $db->quoteIdentifier($order);
        }

        $sql_query = sprintf('SELECT id, %s FROM membres WHERE %s ORDER BY %s %s LIMIT 0,%d;',
            implode(', ', $colonnes),
            '(' . implode(') AND (', $query_groups) . ')',
            $order,
            $desc ? 'DESC' : 'ASC',
            (int) $limit);

        return $sql_query;







|








|




|







 







|



|






|







334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
...
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
                }

                $colonnes[] = $condition['column'];
                $champ = $champs->get($condition['column']);

                if ($champs->isText($condition['column']))
                {
                    $query = sprintf('transliterate_to_ascii(%s) COLLATE NOCASE %s', $db->quoteIdentifier($condition['column']), $condition['operator']);
                }
                else
                {
                    $query = sprintf('%s %s', $db->quoteIdentifier($condition['column']), $condition['operator']);
                }

                $values = isset($condition['values']) ? $condition['values'] : [];

                $values = array_map(['Garradin\Utils', 'transliterateToAscii'], $values);
                
                if ($champ->type == 'tel')
                {
                    // Normaliser le numéro de téléphone
                    $values = array_map(['Garradin\Utils', 'normalizePhoneNumber'], $values);
                }

                if ($condition['operator'] == '&')
                {
                    $new_query = [];

                    foreach ($values as $value)
................................................................................
        $colonnes = array_unique($colonnes);

        if (!in_array($config->get('champ_identite'), $colonnes))
        {
            array_unshift($colonnes, $config->get('champ_identite'));
        }

        $colonnes = array_map([$db, 'quoteIdentifier'], $colonnes);

        if ($champs->isText($order))
        {
            $order = sprintf('transliterate_to_ascii(%s) COLLATE NOCASE', $db->quoteIdentifier($order));
        }
        else
        {
            $order = $db->quoteIdentifier($order);
        }

        $sql_query = sprintf('SELECT id, %s FROM membres WHERE %s ORDER BY %s %s LIMIT %d;',
            implode(', ', $colonnes),
            '(' . implode(') AND (', $query_groups) . ')',
            $order,
            $desc ? 'DESC' : 'ASC',
            (int) $limit);

        return $sql_query;

Modified src/templates/admin/membres/recherche.tpl from [deac15b972] to [0b60246b36].

103
104
105
106
107
108
109

110
111
112
113
114
115
116


{if $session->canAccess('membres', Garradin\Membres::DROIT_ECRITURE)}
	<form method="post" action="{$admin_url}membres/action.php" class="memberList">
{/if}

{if !empty($result)}

	<table class="list search">
		<thead>
			<tr>
				{if $session->canAccess('membres', Garradin\Membres::DROIT_ADMIN)}<td class="check"><input type="checkbox" value="Tout cocher / décocher" onclick="g.checkUncheck();" /></td>{/if}
				{foreach from=$result_header key="c" item="cfg"}
					<td>{$cfg.title}</td>
				{/foreach}







>







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117


{if $session->canAccess('membres', Garradin\Membres::DROIT_ECRITURE)}
	<form method="post" action="{$admin_url}membres/action.php" class="memberList">
{/if}

{if !empty($result)}
	<p class="help">{$result|count} membres trouvés pour cette recherche.</p>
	<table class="list search">
		<thead>
			<tr>
				{if $session->canAccess('membres', Garradin\Membres::DROIT_ADMIN)}<td class="check"><input type="checkbox" value="Tout cocher / décocher" onclick="g.checkUncheck();" /></td>{/if}
				{foreach from=$result_header key="c" item="cfg"}
					<td>{$cfg.title}</td>
				{/foreach}

Modified src/www/admin/static/admin.css from [052cd9f4f6] to [91aba5da71].

614
615
616
617
618
619
620
621
622
623




624
625
626
627
628
629
630

table.search th {
    background: rgb(217, 134, 40);
    background: rgba(217, 134, 40, 0.5);
    background: rgba(var(--gSecondColor), 0.5);
}

#queryBuilder p select {
    max-width: 15em;
}





.userOrder .cur {
    background: rgb(217, 134, 40);
    background: rgba(var(--gSecondColor), 1.0);
    color: #fff;
    color: rgb(var(--gBgColor));
}







|


>
>
>
>







614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634

table.search th {
    background: rgb(217, 134, 40);
    background: rgba(217, 134, 40, 0.5);
    background: rgba(var(--gSecondColor), 0.5);
}

#queryBuilder .column select {
    max-width: 15em;
}

#queryBuilder table td {
    vertical-align: top;
}

.userOrder .cur {
    background: rgb(217, 134, 40);
    background: rgba(var(--gSecondColor), 1.0);
    color: #fff;
    color: rgb(var(--gBgColor));
}