Overview
Comment:Spécifier la transaction obligatoire d'une catégorie
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7a6b1015d384cf5baa30c0a719bb561ab11b9454
User & Date: bohwaz on 2014-01-28 21:24:43
Other Links: manifest | tags
Context
2014-01-29
16:25
Versions de PHP et SQLite pour débugger check-in: 87f7ff5f6d user: bohwaz tags: trunk
2014-01-28
21:24
Spécifier la transaction obligatoire d'une catégorie check-in: 7a6b1015d3 user: bohwaz tags: trunk
17:55
Modification de transaction check-in: c87258e24b user: bohwaz tags: trunk
Changes

Modified src/include/class.membres_categories.php from [ce05ccdb66] to [c2d9915c09].

16
17
18
19
20
21
22


23
24
25
26












27
28
29
30
31
32
33
    static public function getDroitsDefaut()
    {
        return $this->droits;
    }

    protected function _checkData(&$data)
    {


        if (!isset($data['nom']) || !trim($data['nom']))
        {
            throw new UserException('Le nom de catégorie ne peut rester vide.');
        }












    }

    public function add($data)
    {
        $this->_checkData($data);

        if (!isset($data['description']))







>
>




>
>
>
>
>
>
>
>
>
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
    static public function getDroitsDefaut()
    {
        return $this->droits;
    }

    protected function _checkData(&$data)
    {
        $db = DB::getInstance();

        if (!isset($data['nom']) || !trim($data['nom']))
        {
            throw new UserException('Le nom de catégorie ne peut rester vide.');
        }

        if (!empty($data['id_transaction_obligatoire']) 
            && !$db->simpleQuerySingle('SELECT 1 FROM transactions WHERE id = ?;', 
                false, (int)$data['id_transaction_obligatoire']))
        {
            throw new UserException('Numéro de transaction (cotisation) inconnu.');
        }

        if (isset($data['id_transaction_obligatoire']) && empty($data['id_transaction_obligatoire']))
        {
            $data['id_transaction_obligatoire'] = null;
        }
    }

    public function add($data)
    {
        $this->_checkData($data);

        if (!isset($data['description']))

Modified src/include/class.transactions.php from [4c64fbd050] to [01e3d71710].

138
139
140
141
142
143
144






145
146
147
	}

	public function listByName()
	{
		$db = DB::getInstance();
		return $db->simpleStatementFetch('SELECT * FROM transactions ORDER BY intitule;');
	}






}

?>







>
>
>
>
>
>



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	}

	public function listByName()
	{
		$db = DB::getInstance();
		return $db->simpleStatementFetch('SELECT * FROM transactions ORDER BY intitule;');
	}

	public function listCurrent()
	{
		$db = DB::getInstance();
		return $db->simpleStatementFetch('SELECT * FROM transactions WHERE fin >= date(\'now\') OR fin IS NULL ORDER BY intitule;');
	}
}

?>

Modified src/templates/admin/membres/cat_modifier.tpl from [f47150ca7f] to [a34dc2cef1].

16
17
18
19
20
21
22
23

























24
25
26
27
28
29
30
            <dt><label for="f_description">Description</label></dt>
            <dd><textarea name="description" id="f_description" rows="5" cols="50">{form_field data=$cat name=description}</textarea></dd>
            <dt>
                <input type="checkbox" name="cacher" value="1" id="f_cacher" {if $cat.cacher}checked="checked"{/if} />
                <label for="f_cacher">Catégorie cachée</label>
            </dt>
            <dd class="help">
                Cette catégorie ne sera visible qu'aux administrateurs.

























            </dd>
        </dl>
    </fieldset>

    <fieldset>
        <legend>Droits</legend>
        <dl class="droits">







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
            <dt><label for="f_description">Description</label></dt>
            <dd><textarea name="description" id="f_description" rows="5" cols="50">{form_field data=$cat name=description}</textarea></dd>
            <dt>
                <input type="checkbox" name="cacher" value="1" id="f_cacher" {if $cat.cacher}checked="checked"{/if} />
                <label for="f_cacher">Catégorie cachée</label>
            </dt>
            <dd class="help">
                Si coché cette catégorie ne sera visible qu'aux administrateurs et ne recevra pas
                de messages collectifs ou de rappels.
            </dd>
        </dl>
    </fieldset>

    <fieldset>
        <legend>Cotisation obligatoire</legend>
        <dl>
            <dt><label for="f_id_transaction_obligatoire">Cotisation obligatoire</label></dt>
            <dd>
                <select name="id_transaction_obligatoire" id="f_id_transaction_obligatoire">
                    <option value="">-- Non</option>
                    {foreach from=$transactions item="transaction"}
                    <option value="{$transaction.id|escape}" {form_field name="id_transaction_obligatoire" selected=$transaction.id data=$cat}>
                        {$transaction.intitule|escape} 
                        — {$transaction.montant|html_money} {$config.monnaie|escape}
                        — {if $transaction.duree}pour {$transaction.duree|escape} jours
                        {elseif $transaction.debut}
                            du {$transaction.debut|format_sqlite_date_to_french} au {$transaction.fin|format_sqlite_date_to_french}
                        {else}
                            ponctuelle
                        {/if}
                    </option>
                    {/foreach}
                </select>
            </dd>
        </dl>
    </fieldset>

    <fieldset>
        <legend>Droits</legend>
        <dl class="droits">

Modified src/www/admin/membres/cat_modifier.php from [556b6628f5] to [6c92b20a0b].

41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66



67
68
69
                'droit_wiki'    =>  (int) utils::post('droit_wiki'),
                'droit_compta'  =>  (int) utils::post('droit_compta'),
                'droit_config'  =>  (int) utils::post('droit_config'),
                'droit_membres' =>  (int) utils::post('droit_membres'),
                'droit_connexion' => (int) utils::post('droit_connexion'),
                'droit_inscription' => (int) utils::post('droit_inscription'),
                'cacher'        =>  (int) utils::post('cacher'),

            ));

            if ($id == $user['id_categorie'])
            {
                $membres->updateSessionData();
            }

            utils::redirect('/admin/membres/categories.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

$tpl->assign('cat', $cat);
$tpl->assign('error', $error);




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

?>







>



















>
>
>



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
                'droit_wiki'    =>  (int) utils::post('droit_wiki'),
                'droit_compta'  =>  (int) utils::post('droit_compta'),
                'droit_config'  =>  (int) utils::post('droit_config'),
                'droit_membres' =>  (int) utils::post('droit_membres'),
                'droit_connexion' => (int) utils::post('droit_connexion'),
                'droit_inscription' => (int) utils::post('droit_inscription'),
                'cacher'        =>  (int) utils::post('cacher'),
                'id_transaction_obligatoire' => (int) utils::post('id_transaction_obligatoire'),
            ));

            if ($id == $user['id_categorie'])
            {
                $membres->updateSessionData();
            }

            utils::redirect('/admin/membres/categories.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

$tpl->assign('cat', $cat);
$tpl->assign('error', $error);

$transactions = new Transactions;
$tpl->assign('transactions', $transactions->listCurrent());

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

?>