Overview
Comment:Ajout case à cocher "à encaisser" pour chèques et CB pour enregistrement de cotisation aussi
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 965655fde1d230728723106c165756bb18a9ceab
User & Date: bohwaz on 2017-10-11 05:21:23
Other Links: branch diff | manifest | tags
Context
2017-10-11
22:21
Objets manquants au commit check-in: edc1d8f065 user: bohwaz tags: dev
05:21
Ajout case à cocher "à encaisser" pour chèques et CB pour enregistrement de cotisation aussi check-in: 965655fde1 user: bohwaz tags: dev
05:09
Mention du nom du membre dans le libellé (corrige [e0e31b676809fa82cfc38535a602fc63d41a7e70]) check-in: d0463fc9a5 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Membres/Cotisations.php from [3bd6b92cd5] to [acd3145da8].

1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
<?php

namespace Garradin\Membres;

use Garradin\Config;
use Garradin\DB;
use Garradin\Utils;
use Garradin\UserException;
use Garradin\Plugin;
use Garradin\Membres;


class Cotisations
{
	const ITEMS_PER_PAGE = 100;

	/**
	 * Vérification des champs fournis pour la modification de donnée










>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

namespace Garradin\Membres;

use Garradin\Config;
use Garradin\DB;
use Garradin\Utils;
use Garradin\UserException;
use Garradin\Plugin;
use Garradin\Membres;
use Garradin\Compta\Comptes;

class Cotisations
{
	const ITEMS_PER_PAGE = 100;

	/**
	 * Vérification des champs fournis pour la modification de donnée
184
185
186
187
188
189
190






191
192
193
194
195
196
197
198
		if (!isset($data['montant']) || !is_numeric($data['montant']) || (float)$data['montant'] < 0)
		{
			throw new UserException('Le montant doit être un nombre positif et valide.');
		}

		$data['montant'] = (float) $data['montant'];







		if ($data['moyen_paiement'] != 'ES')
		{
			$debit = $data['banque'];
		}
		else
		{
			$debit = \Garradin\Compta\Comptes::CAISSE;
		}







>
>
>
>
>
>
|







185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
		if (!isset($data['montant']) || !is_numeric($data['montant']) || (float)$data['montant'] < 0)
		{
			throw new UserException('Le montant doit être un nombre positif et valide.');
		}

		$data['montant'] = (float) $data['montant'];

		if (!empty($data['a_encaisser']) && ($data['moyen_paiement'] == 'CH' || $data['moyen_paiement'] == 'CB'))
		{
            $debit = $data['moyen_paiement'] == 'CH' 
                ? Comptes::CHEQUE_A_ENCAISSER
                : Comptes::CARTE_A_ENCAISSER;
		}
		elseif ($data['moyen_paiement'] != 'ES')
		{
			$debit = $data['banque'];
		}
		else
		{
			$debit = \Garradin\Compta\Comptes::CAISSE;
		}

Modified src/templates/admin/membres/cotisations/ajout.tpl from [0355c20a97] to [ad66be9029].

63
64
65
66
67
68
69




70
71
72
73
74
75
76
77
78
79
80
            <dd class="f_compta">
                <select name="moyen_paiement" id="f_moyen_paiement">
                {foreach from=$moyens_paiement item="moyen"}
                    <option value="{$moyen.code}"{if $moyen.code == $moyen_paiement} selected="selected"{/if}>{$moyen.nom}</option>
                {/foreach}
                </select>
            </dd>




            <dt class="f_cheque"><label for="f_numero_cheque">Numéro de chèque</label></dt>
            <dd class="f_cheque"><input type="text" name="numero_cheque" id="f_numero_cheque" value="{form_field name=numero_cheque}" /></dd>
            <dt class="f_banque"><label for="f_banque">Compte bancaire</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd class="f_banque">
                <select name="banque" id="f_banque">
                {foreach from=$comptes_bancaires item="compte"}
                    <option value="{$compte.id}"{if $compte.id == $banque} selected="selected"{/if}>{$compte.libelle} - {$compte.banque}</option>
                {/foreach}
                </select>
            </dd>
            <dt class="f_compta"><label for="f_numero_piece">Numéro de pièce comptable</label></dt>







>
>
>
>
|
|
|
|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
            <dd class="f_compta">
                <select name="moyen_paiement" id="f_moyen_paiement">
                {foreach from=$moyens_paiement item="moyen"}
                    <option value="{$moyen.code}"{if $moyen.code == $moyen_paiement} selected="selected"{/if}>{$moyen.nom}</option>
                {/foreach}
                </select>
            </dd>
            <dd class="f_compta f_a_encaisser">
                <input type="checkbox" name="a_encaisser" value="1" id="f_a_encaisser" {form_field name=a_encaisser checked="1"} />
                <label for="f_a_encaisser">En attente d'encaissement</label>
            </dd>
            <dt class="f_compta f_cheque"><label for="f_numero_cheque">Numéro de chèque</label></dt>
            <dd class="f_compta f_cheque"><input type="text" name="numero_cheque" id="f_numero_cheque" value="{form_field name=numero_cheque}" /></dd>
            <dt class="f_compta f_banque"><label for="f_banque">Compte bancaire</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd class="f_compta f_banque">
                <select name="banque" id="f_banque">
                {foreach from=$comptes_bancaires item="compte"}
                    <option value="{$compte.id}"{if $compte.id == $banque} selected="selected"{/if}>{$compte.libelle} - {$compte.banque}</option>
                {/foreach}
                </select>
            </dd>
            <dt class="f_compta"><label for="f_numero_piece">Numéro de pièce comptable</label></dt>
95
96
97
98
99
100
101



102
103






104

105
106

107
108
109
110
111
112
113

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
{literal}
(function () {
    window.changeMoyenPaiement = function()
    {
        var elm = $('#f_moyen_paiement');
        g.toggle('.f_cheque', elm.value == 'CH');
        g.toggle('.f_banque', elm.value != 'ES');



    };







    changeMoyenPaiement();


    $('#f_moyen_paiement').onchange = changeMoyenPaiement;


    $('#f_id_cotisation').onchange = function () {
        if (this.options[this.selectedIndex].getAttribute('data-compta'))
        {
            $('#f_montant').value = this.options[this.selectedIndex].getAttribute('data-amount'); 
            g.toggle('.f_compta', true);
            changeMoyenPaiement();

        }
        else
        {
            g.toggle('.f_compta', false);
            changeMoyenPaiement();
        }
    };

    if (!$('#f_id_cotisation').options[$('#f_id_cotisation').selectedIndex].getAttribute('data-compta'))
    {
        g.toggle('.f_compta', false);
    }
} ());
{/literal}
</script>

{include file="admin/_foot.tpl"}







>
>
>


>
>
>
>
>
>

>


>







>




<












99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

134
135
136
137
138
139
140
141
142
143
144
145
{literal}
(function () {
    window.changeMoyenPaiement = function()
    {
        var elm = $('#f_moyen_paiement');
        g.toggle('.f_cheque', elm.value == 'CH');
        g.toggle('.f_banque', elm.value != 'ES');

        g.toggle('.f_a_encaisser', elm.value == 'CB' || elm.value == 'CH');
        cocherAEncaisser();
    };

    function cocherAEncaisser()
    {
        var elm = $('#f_a_encaisser');
        g.toggle('.f_banque', !elm.checked);
    }

    changeMoyenPaiement();
    cocherAEncaisser();

    $('#f_moyen_paiement').onchange = changeMoyenPaiement;
    $('#f_a_encaisser').onchange = cocherAEncaisser;

    $('#f_id_cotisation').onchange = function () {
        if (this.options[this.selectedIndex].getAttribute('data-compta'))
        {
            $('#f_montant').value = this.options[this.selectedIndex].getAttribute('data-amount'); 
            g.toggle('.f_compta', true);
            changeMoyenPaiement();
            cocherAEncaisser();
        }
        else
        {
            g.toggle('.f_compta', false);

        }
    };

    if (!$('#f_id_cotisation').options[$('#f_id_cotisation').selectedIndex].getAttribute('data-compta'))
    {
        g.toggle('.f_compta', false);
    }
} ());
{/literal}
</script>

{include file="admin/_foot.tpl"}

Modified src/www/admin/membres/cotisations/ajout.php from [f07e5f3c25] to [b23cdfe11b].

58
59
60
61
62
63
64

65
66
67
68
69
70
71
            $compta = [
                'montant'        =>  f('montant'),
                'moyen_paiement' =>  f('moyen_paiement'),
                'numero_cheque'  =>  f('numero_cheque'),
                'banque'         =>  f('banque'),
                'numero_piece'   =>  f('numero_piece'),
                'remarques'      =>  f('remarques'),

            ];

            $m_cotisations->add($data, $compta);

            Utils::redirect('/admin/membres/cotisations.php?id=' . $id_membre);
        }
        catch (UserException $e)







>







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
            $compta = [
                'montant'        =>  f('montant'),
                'moyen_paiement' =>  f('moyen_paiement'),
                'numero_cheque'  =>  f('numero_cheque'),
                'banque'         =>  f('banque'),
                'numero_piece'   =>  f('numero_piece'),
                'remarques'      =>  f('remarques'),
                'a_encaisser'    =>  f('a_encaisser'),
            ];

            $m_cotisations->add($data, $compta);

            Utils::redirect('/admin/membres/cotisations.php?id=' . $id_membre);
        }
        catch (UserException $e)