Overview
Comment:Ne pas faire de recherche quand on ne cherche rien + utilisation correcte de trim grumpf
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6fc285dd46ea29a1026652dc7c5501f17fc42ffc
User & Date: bohwaz on 2013-01-31 16:33:13
Other Links: manifest | tags
Context
2013-01-31
18:09
Configuration : sauvegardes et restauration check-in: e95cd814fb user: bohwaz tags: trunk
16:33
Ne pas faire de recherche quand on ne cherche rien + utilisation correcte de trim grumpf check-in: 6fc285dd46 user: bohwaz tags: trunk
16:25
Correction de bugs en pagaille pour les champs membres + gestion dynamique des options pour select et multiple check-in: 9dbb21bd78 user: bohwaz tags: trunk
Changes

Modified include/class.champs_membres.php from [65d032fca6] to [05d6e18335].

216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
            }
            elseif ($key == 'options')
            {
                $value = (array) $value;

                foreach ($value as $option_key=>$option_value)
                {
                    if (!trim($option_value))
                    {
                        unset($value[$option_key]);
                    }
                }
            }
        }








|







216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
            }
            elseif ($key == 'options')
            {
                $value = (array) $value;

                foreach ($value as $option_key=>$option_value)
                {
                    if (trim($option_value) == '')
                    {
                        unset($value[$option_key]);
                    }
                }
            }
        }

Modified include/class.membres.php from [f7d52f6be3] to [b94d4fbb71].

241
242
243
244
245
246
247
248
249
250
251
252
253
254
255

    public function _checkFields(&$data, $check_mandatory = true)
    {
        $champs = Config::getInstance()->get('champs_membres');

        foreach ($champs->getAll() as $key=>$config)
        {
            if (!isset($data[$key]) || empty($data[$key]) || (!is_array($data[$key]) && !trim($data[$key])))
            {
                if (!empty($config['mandatory']) && $check_mandatory)
                {
                    throw new UserException('Le champ "' . $config['title'] . '" doit obligatoirement être renseigné.');
                }
                elseif (!empty($config['mandatory']))
                {







|







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255

    public function _checkFields(&$data, $check_mandatory = true)
    {
        $champs = Config::getInstance()->get('champs_membres');

        foreach ($champs->getAll() as $key=>$config)
        {
            if (!isset($data[$key]) || empty($data[$key]) || (!is_array($data[$key]) && trim($data[$key]) == ''))
            {
                if (!empty($config['mandatory']) && $check_mandatory)
                {
                    throw new UserException('Le champ "' . $config['title'] . '" doit obligatoirement être renseigné.');
                }
                elseif (!empty($config['mandatory']))
                {
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353

        if (!empty($data['email'])
            && $db->simpleQuerySingle('SELECT 1 FROM membres WHERE email = ? LIMIT 1;', false, $data['email']))
        {
            throw new UserException('Cette adresse e-mail est déjà utilisée par un autre membre, il faut en choisir une autre.');
        }

        if (!empty($data['passe']) && trim($data['passe']))
        {
            $data['passe'] = $this->_hashPassword($data['passe']);
        }
        else
        {
            unset($data['passe']);
        }







|







339
340
341
342
343
344
345
346
347
348
349
350
351
352
353

        if (!empty($data['email'])
            && $db->simpleQuerySingle('SELECT 1 FROM membres WHERE email = ? LIMIT 1;', false, $data['email']))
        {
            throw new UserException('Cette adresse e-mail est déjà utilisée par un autre membre, il faut en choisir une autre.');
        }

        if (isset($data['passe']) && trim($data['passe']) != '')
        {
            $data['passe'] = $this->_hashPassword($data['passe']);
        }
        else
        {
            unset($data['passe']);
        }

Modified templates/admin/membres/recherche.tpl from [4bc6bcc820] to [407454e99d].

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
                <tr>
                    {if $user.droits.membres == Garradin\Membres::DROIT_ADMIN}<td class="check"><input type="checkbox" name="selected[]" value="{$membre.id|escape}" /></td>{/if}
                    <td class="num"><a href="{$admin_url}membres/fiche.php?id={$membre.id|escape}">{$membre.id|escape}</a></th>
                    {foreach from=$champs_entete key="c" item="cfg"}
                        {if $champ == $c}
                            <th><strong>{$membre[$c]|escape|display_champ_membre:$cfg}</strong></th>
                        {else}
                            <td>{$membre[$c]|escape}</td>
                        {/if}
                    {/foreach}
                    {if empty($membre.date_cotisation)}
                        <td class="error">jamais réglée</td>
                    {elseif $membre.date_cotisation > strtotime('12 months ago')}
                        <td class="confirm">à jour</td>
                    {else}







|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
                <tr>
                    {if $user.droits.membres == Garradin\Membres::DROIT_ADMIN}<td class="check"><input type="checkbox" name="selected[]" value="{$membre.id|escape}" /></td>{/if}
                    <td class="num"><a href="{$admin_url}membres/fiche.php?id={$membre.id|escape}">{$membre.id|escape}</a></th>
                    {foreach from=$champs_entete key="c" item="cfg"}
                        {if $champ == $c}
                            <th><strong>{$membre[$c]|escape|display_champ_membre:$cfg}</strong></th>
                        {else}
                            <td>{$membre[$c]|escape|display_champ_membre:$cfg}</td>
                        {/if}
                    {/foreach}
                    {if empty($membre.date_cotisation)}
                        <td class="error">jamais réglée</td>
                    {elseif $membre.date_cotisation > strtotime('12 months ago')}
                        <td class="confirm">à jour</td>
                    {else}
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
        <em>Pour les membres cochés :</em>
        <input type="submit" name="move" value="Changer de catégorie" />
        <input type="submit" name="delete" value="Supprimer" />
        {csrf_field key="membres_action"}
    </p>
    {/if}

    {else}
    <p class="alert">
        Aucun membre trouvé.
    </p>
    {/if}

    </form>








|







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
        <em>Pour les membres cochés :</em>
        <input type="submit" name="move" value="Changer de catégorie" />
        <input type="submit" name="delete" value="Supprimer" />
        {csrf_field key="membres_action"}
    </p>
    {/if}

    {elseif $recherche != ''}
    <p class="alert">
        Aucun membre trouvé.
    </p>
    {/if}

    </form>

Modified www/admin/membres/recherche.php from [643dee6d8f] to [f06f6ef465].

53
54
55
56
57
58
59



60

61
62
63
64
65
66
        $champs_entete
    );
}

$tpl->assign('champs_entete', $champs_entete);
$tpl->assign('champs_liste', $champs_liste);
$tpl->assign('champ', $champ);



$tpl->assign('liste', $membres->search($champ, $recherche));


$tpl->assign('recherche', $recherche);

$tpl->display('admin/membres/recherche.tpl');

?>







>
>
>
|
>






53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
        $champs_entete
    );
}

$tpl->assign('champs_entete', $champs_entete);
$tpl->assign('champs_liste', $champs_liste);
$tpl->assign('champ', $champ);

if ($recherche != '')
{
    $tpl->assign('liste', $membres->search($champ, $recherche));
}

$tpl->assign('recherche', $recherche);

$tpl->display('admin/membres/recherche.tpl');

?>