Overview
Comment:comptage du nombre d'écritures liées et avertissement avant suppression, et ne pas supprimer les liaisons membre <-> écriture, simplement indiquer qu'elles ne sont plus liées à une cotisation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fea5d3bdbea1abf33e0a663e4ccddca73e4838b5
User & Date: bohwaz on 2015-03-28 16:33:22
Other Links: manifest | tags
Context
2015-03-28
16:48
éviter les problèmes de foreign key en mettant à NULL id_cotisation dans membres_operations, et prévenir de l'effet check-in: 87b5f2fd4f user: bohwaz tags: trunk
16:33
comptage du nombre d'écritures liées et avertissement avant suppression, et ne pas supprimer les liaisons membre <-> écriture, simplement indiquer qu'elles ne sont plus liées à une cotisation check-in: fea5d3bdbe user: bohwaz tags: trunk
2015-03-11
00:11
correction numérotage automatique des comptes fix [26b1f1a224dcd294542c56bbb057f0ab1a5aeb7d] check-in: 39e72e6333 user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/Membres/Cotisations.php from [005dd4e3b1] to [ec88714c70].

133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
	 * Supprimer un événement de cotisation
	 * @param  integer $id ID de l'événement à supprimer
	 * @return integer true en cas de succès
	 */
	public function delete($id)
	{
		$db = DB::getInstance();
		$db->simpleExec('DELETE FROM membres_operations WHERE id_cotisation = ?;', (int)$id);
		return $db->simpleExec('DELETE FROM cotisations_membres WHERE id = ?;', (int) $id);
	}

	public function get($id)
	{
		$db = DB::getInstance();
		return $db->simpleQuerySingle('SELECT * FROM cotisations_membres WHERE id = ?;', true, (int)$id);







|







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
	 * Supprimer un événement de cotisation
	 * @param  integer $id ID de l'événement à supprimer
	 * @return integer true en cas de succès
	 */
	public function delete($id)
	{
		$db = DB::getInstance();
		$db->simpleExec('UPDATE membres_operations SET id_cotisation = NULL WHERE id_cotisation = ?;', (int)$id);
		return $db->simpleExec('DELETE FROM cotisations_membres WHERE id = ?;', (int) $id);
	}

	public function get($id)
	{
		$db = DB::getInstance();
		return $db->simpleQuerySingle('SELECT * FROM cotisations_membres WHERE id = ?;', true, (int)$id);
155
156
157
158
159
160
161








162
163
164
165
166
167
168
	public function listOperationsCompta($id)
	{
		$db = DB::getInstance();
		return $db->simpleStatementFetch('SELECT * FROM compta_journal
			WHERE id IN (SELECT id_operation FROM membres_operations
				WHERE id_cotisation = ?);', \SQLITE3_ASSOC, (int)$id);
	}









	/**
	 * Ajouter une écriture comptable pour un paiemement membre
	 * @param int $id Numéro de la cotisation membre
	 * @param array $data Données
	 */
	public function addOperationCompta($id, $data)







>
>
>
>
>
>
>
>







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
	public function listOperationsCompta($id)
	{
		$db = DB::getInstance();
		return $db->simpleStatementFetch('SELECT * FROM compta_journal
			WHERE id IN (SELECT id_operation FROM membres_operations
				WHERE id_cotisation = ?);', \SQLITE3_ASSOC, (int)$id);
	}

	/**
	 * Compte les opérations comptables liées à cette cotisation
	 */
	public function countOperationsCompta($id)
	{
		return DB::getInstance()->simpleQuerySingle('SELECT COUNT(*) FROM membres_operations WHERE id_cotisation = ?;', false, (int)$id);
	}

	/**
	 * Ajouter une écriture comptable pour un paiemement membre
	 * @param int $id Numéro de la cotisation membre
	 * @param array $data Données
	 */
	public function addOperationCompta($id, $data)

Modified src/templates/admin/membres/cotisations/supprimer.tpl from [4689fee8b9] to [3b17df39a6].

16
17
18
19
20
21
22

23

24






25
26
27
28
29
30
31
32
33
34
35
<form method="post" action="{$self_url|escape}">
    <fieldset>
        <legend>Supprimer une cotisation membre</legend>
        <h3 class="warning">
            Êtes-vous sûr de vouloir supprimer la cotisation membre
            du {$cotisation.date|format_sqlite_date_to_french}&nbsp;?
        </h3>

        <p class="alert">Attention si des écritures comptables sont liées à cette cotisation

            elles ne seront pas supprimées.</p>






    </fieldset>
    </fieldset>

    <p class="submit">
        {csrf_field key="del_cotisation_`$cotisation.id`"}
        <input type="submit" name="delete" value="Supprimer &rarr;" />
    </p>
</form>


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







>
|
>
|
>
>
>
>
>
>











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
<form method="post" action="{$self_url|escape}">
    <fieldset>
        <legend>Supprimer une cotisation membre</legend>
        <h3 class="warning">
            Êtes-vous sûr de vouloir supprimer la cotisation membre
            du {$cotisation.date|format_sqlite_date_to_french}&nbsp;?
        </h3>
        {if $nb_operations > 0}
            <p class="alert">
                Attention il y a {$nb_operations|escape} écritures comptables liées à cette cotisation.
                Celles-ci ne seront pas supprimées lors de la suppression de la cotisation membre.
            </p>
        {else}
            <p class="help">
                Aucune écriture comptable n'est liée à cette cotisation.
            </p>
        {/if}
    </fieldset>
    </fieldset>

    <p class="submit">
        {csrf_field key="del_cotisation_`$cotisation.id`"}
        <input type="submit" name="delete" value="Supprimer &rarr;" />
    </p>
</form>


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

Modified src/www/admin/membres/cotisations/supprimer.php from [4a224c8077] to [46518bea34].

54
55
56
57
58
59
60

61
62
        }
    }
}

$tpl->assign('error', $error);
$tpl->assign('membre', $membre);
$tpl->assign('cotisation', $co);


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







>


54
55
56
57
58
59
60
61
62
63
        }
    }
}

$tpl->assign('error', $error);
$tpl->assign('membre', $membre);
$tpl->assign('cotisation', $co);
$tpl->assign('nb_operations', $m_cotisations->countOperationsCompta($co['id']));

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