Overview
Comment:Correction recherche de membre
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 9211225bb19185142108103a8dbc730352abe619
User & Date: bohwaz on 2017-10-02 00:48:09
Other Links: branch diff | manifest | tags
Context
2017-10-02
23:03
Permettre de supprimer un exercice vide, même clôturé check-in: 8b5dae6458 user: bohwaz tags: dev
00:48
Correction recherche de membre check-in: 9211225bb1 user: bohwaz tags: dev
2017-09-25
23:22
Afficher le bon lien selon si rubrique/article check-in: 313fc97f1e user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Membres.php from [fe70506edd] to [655cc8c2c5].

303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
        if (!$champs->get($field))
        {
            throw new \UnexpectedValueException($field . ' is not a valid field');
        }

        $champ = $champs->get($field);

        if ($champ['type'] == 'multiple')
        {
            $where = 'WHERE '.$field.' & (1 << '.(int)$query.')';
            $order = false;
        }
        elseif ($champ['type'] == 'tel')
        {
            $query = Utils::normalizePhoneNumber($query);
            $query = preg_replace('!^0+!', '', $query);

            if ($query == '')
            {
                return false;







|




|







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
        if (!$champs->get($field))
        {
            throw new \UnexpectedValueException($field . ' is not a valid field');
        }

        $champ = $champs->get($field);

        if ($champ->type == 'multiple')
        {
            $where = 'WHERE '.$field.' & (1 << '.(int)$query.')';
            $order = false;
        }
        elseif ($champ->type == 'tel')
        {
            $query = Utils::normalizePhoneNumber($query);
            $query = preg_replace('!^0+!', '', $query);

            if ($query == '')
            {
                return false;
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
        }
        else
        {
            $where = sprintf('WHERE transliterate_to_ascii(%s) LIKE %s', $field, $db->quote('%' . Utils::transliterateToAscii($query) . '%'));
            $order = sprintf('transliterate_to_ascii(%s) COLLATE NOCASE', $field);
        }

        $fields = array_keys($champs->getListedFields());

        if (!in_array($field, $fields))
        {
            $fields[] = $field;
        }

        if (!in_array('email', $fields))







|







332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
        }
        else
        {
            $where = sprintf('WHERE transliterate_to_ascii(%s) LIKE %s', $field, $db->quote('%' . Utils::transliterateToAscii($query) . '%'));
            $order = sprintf('transliterate_to_ascii(%s) COLLATE NOCASE', $field);
        }

        $fields = array_keys((array)$champs->getListedFields());

        if (!in_array($field, $fields))
        {
            $fields[] = $field;
        }

        if (!in_array('email', $fields))

Modified src/templates/admin/membres/recherche.tpl from [fc0fa13904] to [f0aae1c0da].

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
        <tbody>
            {foreach from=$liste item="membre"}
                <tr>
                    {if $session->canAccess('membres', Garradin\Membres::DROIT_ADMIN)}<td class="check"><input type="checkbox" name="selected[]" value="{$membre.id}" /></td>{/if}
                    <td class="num"><a href="{$admin_url}membres/fiche.php?id={$membre.id}">{$membre.id}</a></th>
                    {foreach from=$champs_entete key="c" item="cfg"}
                        {if $champ == $c}
                            <th><strong>{$membre[$c]|raw|display_champ_membre:$cfg}</strong></th>
                        {else}
                            <td>{$membre[$c]|raw|display_champ_membre:$cfg}</td>
                        {/if}
                    {/foreach}
                    <td class="actions">
                        {if !empty($membre.email)}<a class="icn" href="{$www_url}admin/membres/message.php?id={$membre.id}" title="Envoyer un message">✉</a> {/if}
                        <a class="icn" href="modifier.php?id={$membre.id}" title="Modifier la fiche membre">✎</a>
                    </td>
                </tr>







|

|







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
        <tbody>
            {foreach from=$liste item="membre"}
                <tr>
                    {if $session->canAccess('membres', Garradin\Membres::DROIT_ADMIN)}<td class="check"><input type="checkbox" name="selected[]" value="{$membre.id}" /></td>{/if}
                    <td class="num"><a href="{$admin_url}membres/fiche.php?id={$membre.id}">{$membre.id}</a></th>
                    {foreach from=$champs_entete key="c" item="cfg"}
                        {if $champ == $c}
                            <th><strong>{$membre->$c|raw|display_champ_membre:$cfg}</strong></th>
                        {else}
                            <td>{$membre->$c|raw|display_champ_membre:$cfg}</td>
                        {/if}
                    {/foreach}
                    <td class="actions">
                        {if !empty($membre.email)}<a class="icn" href="{$www_url}admin/membres/message.php?id={$membre.id}" title="Envoyer un message">✉</a> {/if}
                        <a class="icn" href="modifier.php?id={$membre.id}" title="Modifier la fiche membre">✎</a>
                    </td>
                </tr>