Overview
Comment:suppression de rappel automatique
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1bb95bcff2c7811d482577359662dad424b38c39
User & Date: bohwaz on 2014-03-14 15:47:39
Other Links: manifest | tags
Context
2014-03-14
18:10
Méthodes listes et comptage des rappels envoyés check-in: 3fcdfaaeb4 user: bohwaz tags: trunk
15:47
suppression de rappel automatique check-in: 1bb95bcff2 user: bohwaz tags: trunk
14:37
Modification de rappel automatique check-in: 03eb33c212 user: bohwaz tags: trunk
Changes

Modified src/include/class.rappels.php from [01eb6766b1] to [ca754749c8].

74
75
76
77
78
79
80

81
82
83
84
85
86
87



88






89
90
91
92
93
94
95
96

		return $db->simpleUpdate('rappels', $data, 'id = ' . (int)$id);
	}

	/**
	 * Supprimer un rappel automatique
	 * @param  integer $id Numéro du rappel

	 * @return boolean     TRUE en cas de succès
	 */
	public function delete($id)
	{
		$db = DB::getInstance();

		$db->exec('BEGIN;');



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






		$db->simpleExec('DELETE FROM rappels_envoyes WHERE id_rappel = ?;', (int) $id);
		$db->exec('END;');

		return true;
	}

	/**
	 * Renvoie les données sur un rappel







>


|




>
>
>
|
>
>
>
>
>
>
|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

		return $db->simpleUpdate('rappels', $data, 'id = ' . (int)$id);
	}

	/**
	 * Supprimer un rappel automatique
	 * @param  integer $id Numéro du rappel
	 * @param  boolean $delete_history Effacer aussi l'historique des rappels envoyés
	 * @return boolean     TRUE en cas de succès
	 */
	public function delete($id, $delete_history = false)
	{
		$db = DB::getInstance();

		$db->exec('BEGIN;');

		if ($delete_history)
		{
			$db->simpleExec('DELETE FROM rappels_envoyes WHERE id_rappel = ?;', (int) $id);
		}
		else
		{
			$db->simpleExec('UPDATE rappels_envoyes SET id_rappel = NULL WHERE id_rappel = ?;', (int) $id);
		}

		$db->simpleExec('DELETE FROM rappels WHERE id = ?;', (int) $id);
		$db->exec('END;');

		return true;
	}

	/**
	 * Renvoie les données sur un rappel

Added src/templates/admin/membres/cotisations/gestion/rappel_supprimer.tpl version [decb9f66e0].































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
{include file="admin/_head.tpl" title="Supprimer un rappel automatique" current="membres/cotisations"}

<ul class="actions">
    <li><a href="{$admin_url}membres/cotisations/">Cotisations</a></li>
    <li><a href="{$admin_url}membres/cotisations/ajout.php">Saisie d'une cotisation</a></li>
    <li><a href="{$admin_url}membres/cotisations/rappels.php">État des rappels</a></li>
    <li class="current"><a href="{$admin_url}membres/cotisations/gestion/rappels.php">Gestion des rappels automatiques</a></li>
</ul>

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

<form method="post" action="{$self_url|escape}">

    <fieldset>
        <legend>Supprimer ce rappel automatique ?</legend>
        <h3 class="warning">
            Êtes-vous sûr de vouloir supprimer le rappel «&nbsp;{$rappel.sujet|escape}&nbsp;» ?
        </h3>
        <dl>
            <dt><label for="f_delete_history">Effacer aussi l'historique des e-mails envoyés par le biais de ce rappel&nbsp;?</label></dt>
            <dd>
                <label>
                    <input type="radio" name="delete_history" value="0" checked="checked" />
                    Non, conserver l'historique
                </label> (toutefois il ne sera plus associé à ce rappel)
            </dd>
            <dd>
                <label>
                    <input type="radio" name="delete_history" value="1" />
                    Oui, effacer l'historique des e-mails envoyés
                </label>
            </dd>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="delete_rappel_"|cat:$rappel.id}
        <input type="submit" name="delete" value="Supprimer &rarr;" />
    </p>

</form>

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

Added src/www/admin/membres/cotisations/gestion/rappel_supprimer.php version [f4a5906826].









































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
<?php
namespace Garradin;

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

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

if (!utils::get('id') || !is_numeric(utils::get('id')))
{
    throw new UserException("Argument du numéro de rappel manquant.");
}

$rappels = new Rappels;

$rappel = $rappels->get(utils::get('id'));

if (!$rappel)
{
    throw new UserException("Ce rappel n'existe pas.");
}

$error = false;

if (!empty($_POST['delete']))
{
    if (!utils::CSRF_check('delete_rappel_' . $rappel['id']))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $rappels->delete($rappel['id'], (bool) utils::post('delete_history'));
            utils::redirect('/admin/membres/cotisations/gestion/rappels.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

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

$tpl->assign('rappel', $rappel);

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

?>