Overview
Comment:Permettre les cotisations à zéro (ne seront pas enregistrées dans la compta) + fix label submit pour modif de cotisation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fa7fef4b2b552335b8ce95b5cc8a53db75c2435e
User & Date: bohwaz on 2016-09-10 11:12:26
Other Links: manifest | tags
Context
2016-09-28
05:22
Ajout de signaux pour plugins check-in: e015b7c9c2 user: bohwaz tags: trunk
2016-09-10
11:12
Permettre les cotisations à zéro (ne seront pas enregistrées dans la compta) + fix label submit pour modif de cotisation check-in: fa7fef4b2b user: bohwaz tags: trunk
2016-08-30
09:11
Ne pas permettre de modifier sa propre catégorie de membre, sinon risque de se tirer une balle dans le pied check-in: eed84af616 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Cotisations.php from [331a22cb80] to [3a4282d675].

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
		if (isset($data['description']))
		{
			$data['description'] = trim($data['description']);
		}

		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 (isset($data['duree']))
		{
			$data['duree'] = (int) $data['duree'];







|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
		if (isset($data['description']))
		{
			$data['description'] = trim($data['description']);
		}

		if (!isset($data['montant']) || !is_numeric($data['montant']) || (float)$data['montant'] < 0)
		{
			throw new UserException('Le montant doit être un nombre supérieur ou égal à zéro et valide.');
		}

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

		if (isset($data['duree']))
		{
			$data['duree'] = (int) $data['duree'];

Modified src/include/lib/Garradin/Membres/Cotisations.php from [948561ccc7] to [3d57a24c20].

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
	            if (!$db->simpleQuerySingle('SELECT 1 FROM compta_comptes_bancaires WHERE id = ?;',
	            	false, $data['banque']))
	            {
	                throw new UserException('Le compte bancaire choisi n\'existe pas.');
	            }
	        }

	        if (empty($data['montant']) || !is_numeric($data['montant']))
	        {
	        	throw new UserException('Le montant indiqué n\'est pas un nombre valide.');
	        }
	    }
	}

	/**
	 * Enregistrer un événement de cotisation
	 * @param array $data Tableau des champs à insérer







|

|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
	            if (!$db->simpleQuerySingle('SELECT 1 FROM compta_comptes_bancaires WHERE id = ?;',
	            	false, $data['banque']))
	            {
	                throw new UserException('Le compte bancaire choisi n\'existe pas.');
	            }
	        }

	        if (!isset($data['montant']) || !is_numeric($data['montant']) || $data['montant'] < 0)
	        {
	        	throw new UserException('Le montant indiqué n\'est pas un nombre valide : doit être supérieur ou égal à zéro.');
	        }
	    }
	}

	/**
	 * Enregistrer un événement de cotisation
	 * @param array $data Tableau des champs à insérer
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
			'date'				=>	$data['date'],
			'id_cotisation'		=>	$data['id_cotisation'],
			'id_membre'			=>	$data['id_membre'],
			]);

		$id = $db->lastInsertRowId();

		if ($co['id_categorie_compta'] && $co['montant'] > 0)
		{
			try {
		        $id_operation = $this->addOperationCompta($id, [
		        	'id_categorie'	=>	$co['id_categorie_compta'],
		            'libelle'       =>  'Cotisation (automatique)',
		            'montant'       =>  $data['montant'],
		            'date'          =>  $data['date'],







|







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
			'date'				=>	$data['date'],
			'id_cotisation'		=>	$data['id_cotisation'],
			'id_membre'			=>	$data['id_membre'],
			]);

		$id = $db->lastInsertRowId();

		if ($co['id_categorie_compta'] && $data['montant'] > 0)
		{
			try {
		        $id_operation = $this->addOperationCompta($id, [
		        	'id_categorie'	=>	$co['id_categorie_compta'],
		            'libelle'       =>  'Cotisation (automatique)',
		            'montant'       =>  $data['montant'],
		            'date'          =>  $data['date'],

Modified src/templates/admin/membres/cotisations/gestion/modifier.tpl from [bb8cdd962e] to [3c63d754bb].

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
                </select>
            </dd>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="edit_co_`$cotisation.id`"}
        <input type="submit" name="save" value="Ajouter &rarr;" />
    </p>

</form>

<script type="text/javascript">
{literal}
(function () {







|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
                </select>
            </dd>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="edit_co_`$cotisation.id`"}
        <input type="submit" name="save" value="Enregistrer &rarr;" />
    </p>

</form>

<script type="text/javascript">
{literal}
(function () {