Overview
Comment:Suppression de cotisation membre
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e9565e856aa6565656ac9ccb88e6eef2bfa7fd66
User & Date: bohwaz on 2014-02-14 00:32:58
Other Links: manifest | tags
Context
2014-02-14
01:13
suppression des dernières références aux transactions check-in: cd375467bb user: bohwaz tags: trunk
00:32
Suppression de cotisation membre check-in: e9565e856a user: bohwaz tags: trunk
00:27
Voir les membres cotisants check-in: 39655ea2ac user: bohwaz tags: trunk
Changes

Modified src/include/class.cotisations_membres.php from [a849dd3104] to [6550259d10].

101
102
103
104
105
106
107






108
109
110
111
112
113
114
	 */
	public function delete($id)
	{
		$db = DB::getInstance();

		return $db->simpleExec('DELETE FROM cotisations_membres WHERE id = ?;', (int) $id);
	}







	/**
	 * Renvoie une liste des écritures comptables liées à un paiement
	 * @param  int $id Numéro du paiement
	 * @return array Liste des écritures
	 */
	public function listOperationsCompta($id)







>
>
>
>
>
>







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
	 */
	public function delete($id)
	{
		$db = DB::getInstance();

		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);
	}

	/**
	 * Renvoie une liste des écritures comptables liées à un paiement
	 * @param  int $id Numéro du paiement
	 * @return array Liste des écritures
	 */
	public function listOperationsCompta($id)

Added src/templates/admin/membres/cotisations/supprimer.tpl version [ad40741d00].



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{include file="admin/_head.tpl" title="Supprimer une cotisation pour le membre n°`$membre.id`" current="membres/cotisations"}

<ul class="actions">
    <li><a href="{$admin_url}membres/fiche.php?id={$membre.id|escape}">Membre n°{$membre.id|escape}</a></li>
    <li><a href="{$admin_url}membres/modifier.php?id={$membre.id|escape}">Modifier</a></li>
    {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN}
        <li><a href="{$admin_url}membres/supprimer.php?id={$membre.id|escape}">Supprimer</a></li>
    {/if}
    <li class="current"><a href="{$admin_url}membres/cotisations.php?id={$membre.id|escape}">Suivi des cotisations</a></li>
</ul>

{if $error}
    <p class="error">{$error|escape}</p>
{/if}

<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>
    </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"}

Added src/www/admin/membres/cotisations/supprimer.php version [517dc47ee8].

































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
56
57
58
59
60
61
62
63
64
<?php
namespace Garradin;

require_once __DIR__ . '/../../_inc.php';

if ($user['droits']['membres'] < Membres::DROIT_ECRITURE)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$membre = false;

$cotisations = new Cotisations;
$m_cotisations = new Cotisations_Membres;

if (empty($_GET['id']) || !is_numeric($_GET['id']))
{
    throw new UserException("Argument du numéro de cotisation membre manquant.");
}

$id = (int) $_GET['id'];

$co = $m_cotisations->get($id);

if (!$co)
{
    throw new UserException("Cette cotisation membre n'existe pas.");
}

$membre = $membres->get($co['id_membre']);

if (!$membre)
{
    throw new UserException("Le membre lié à la cotisation n'existe pas ou plus.");
}

$error = false;

if (!empty($_POST['delete']))
{
    if (!utils::CSRF_check('del_cotisation_' . $co['id']))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $m_cotisations->delete($co['id']);
            utils::redirect('/admin/membres/cotisations.php?id=' . $membre['id']);
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

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

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

?>