Overview
Comment:Possibilité de faire un rappel le jour de l'expiration
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: da117a9e3e50db111b2bf20dd687f04f7c918dc1
User & Date: bohwaz on 2014-03-26 17:06:07
Other Links: manifest | tags
Context
2014-03-26
17:29
Ajout configuration d'exemple + ajout gestion tâche automatisées check-in: 94082a8d1f user: bohwaz tags: trunk
17:06
Possibilité de faire un rappel le jour de l'expiration check-in: da117a9e3e user: bohwaz tags: trunk
16:47
déterminer automatiquement le délimiteur check-in: cd99ccd274 user: bohwaz tags: trunk
Changes

Modified src/include/class.rappels.php from [ca754749c8] to [257856f691].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
        	|| !$db->simpleQuerySingle('SELECT 1 FROM cotisations WHERE id = ?;', false, (int) $data['id_cotisation']))
        {
            throw new UserException('Cotisation inconnue.');
        }

		$data['id_cotisation'] = (int) $data['id_cotisation'];

		if (empty($data['delai']) || !is_numeric($data['delai']))
		{
			throw new UserException('Délai avant rappel invalide : doit être indiqué en nombre de jours.');
		}

		$data['delai'] = (int) $data['delai'];

		if (!isset($data['sujet']) || trim($data['sujet']) === '')







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
        	|| !$db->simpleQuerySingle('SELECT 1 FROM cotisations WHERE id = ?;', false, (int) $data['id_cotisation']))
        {
            throw new UserException('Cotisation inconnue.');
        }

		$data['id_cotisation'] = (int) $data['id_cotisation'];

		if ((trim($data['delai']) === '') || !is_numeric($data['delai']))
		{
			throw new UserException('Délai avant rappel invalide : doit être indiqué en nombre de jours.');
		}

		$data['delai'] = (int) $data['delai'];

		if (!isset($data['sujet']) || trim($data['sujet']) === '')

Modified src/templates/admin/membres/cotisations/gestion/rappel_modifier.tpl from [e01ae6689d] to [636a160065].

35
36
37
38
39
40
41
42

43




44



45
46
47
48
49
50
51
                    </option>
                    {/foreach}
                </select>
            </dd>
            <dt><label for="f_sujet">Sujet du mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="sujet" id="f_sujet" value="{form_field name=sujet data=$rappel}" required="required" size="50" /></dd>
            <dt><label for="f_delai">Délai d'envoi</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="number" name="delai" step="1" min="1" max="900" size="5" id="f_delai" value="{form_field name=delai data=$rappel}" required="required" /> jours</dd>

            <dd><label><input type="radio" name="delai_pre" value="1" {form_field name="delai_pre" checked=1 data=$rappel} /> Avant l'expiration de la cotisation</label></dd>




            <dd><label><input type="radio" name="delai_pre" value="0" {form_field name="delai_pre" checked=0 data=$rappel} /> Après l'expiration de la cotisation</label></dd>



            <dt><label for="f_texte">Texte du mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><textarea name="texte" id="f_texte" cols="70" rows="15" required="required">{form_field name=texte data=$rappel}</textarea></dd>
            <dd class="help">Astuce : pour inclure dans le contenu du mail le nom du membre, utilisez #IDENTITE, pour inclure le délai de l'envoi utilisez #NB_JOURS.</dd>
        </dl>
    </fieldset>

    <p class="submit">







|
>
|
>
>
>
>
|
>
>
>







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
                    </option>
                    {/foreach}
                </select>
            </dd>
            <dt><label for="f_sujet">Sujet du mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="sujet" id="f_sujet" value="{form_field name=sujet data=$rappel}" required="required" size="50" /></dd>
            <dt><label for="f_delai">Délai d'envoi</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><label><input type="radio" name="delai_choix" value="0" {form_field name="delai_choix" checked=0 default=0 data=$rappel} /> Le jour de l'expiration de la cotisation</label></dd>
            <dd>
                <input type="radio" name="delai_choix" id="f_delai_pre" value="-1" {form_field name="delai_choix" checked=-1 data=$rappel} />
                <input type="number" name="delai_pre" id="f_delai_pre_nb" step="1" min="1" max="900" size="4" id="f_delai" value="{form_field name=delai_pre data=$rappel default=30}" required="required" />
                <label for="f_delai_pre">jours avant expiration</label>
            </dd>
            <dd>
                <input type="radio" name="delai_choix" id="f_delai_post" value="1" {form_field name="delai_choix" checked=1 data=$rappel} /> 
                <input type="number" name="delai_post" id="f_delai_post_nb" step="1" min="1" max="900" size="4" id="f_delai" value="{form_field name=delai_post default=30 data=$rappel}" required="required" />
                <label for="f_delai_post">jours après expiration</label>
            </dd>
            <dt><label for="f_texte">Texte du mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><textarea name="texte" id="f_texte" cols="70" rows="15" required="required">{form_field name=texte data=$rappel}</textarea></dd>
            <dd class="help">Astuce : pour inclure dans le contenu du mail le nom du membre, utilisez #IDENTITE, pour inclure le délai de l'envoi utilisez #NB_JOURS.</dd>
        </dl>
    </fieldset>

    <p class="submit">

Modified src/templates/admin/membres/cotisations/gestion/rappels.tpl from [f787858143] to [e999dc8178].

1
2
3
4
5
6
7
8
{include file="admin/_head.tpl" title="Gestion des rappels automatiques" 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>
|







1
2
3
4
5
6
7
8
{include file="admin/_head.tpl" title="Gestion des rappels automatiques" current="membres/cotisations" js=1}

<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>
31
32
33
34
35
36
37





38



39
40
41
42
43
44
45
                        — {if $rappel.duree}pour {$rappel.duree|escape} jours
                        {elseif $rappel.debut}
                            du {$rappel.debut|format_sqlite_date_to_french} au {$rappel.fin|format_sqlite_date_to_french}
                        {else}
                            ponctuelle
                        {/if}
                    </td>





                    <td>{$rappel.delai|abs|escape} jours {if $rappel.delai > 0}après{else}avant{/if} expiration</td>



                    <th><a href="{$admin_url}membres/cotisations/rappel.php?id={$rappel.id|escape}">{$rappel.sujet|escape}</a></th>
                    <td class="actions">
                        <a class="icn" href="{$admin_url}membres/cotisations/gestion/rappel_modifier.php?id={$rappel.id|escape}" title="Modifier">✎</a>
                        <a class="icn" href="{$admin_url}membres/cotisations/gestion/rappel_supprimer.php?id={$rappel.id|escape}" title="Supprimer">✘</a>
                    </td>
                </tr>
            {/foreach}







>
>
>
>
>
|
>
>
>







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
                        — {if $rappel.duree}pour {$rappel.duree|escape} jours
                        {elseif $rappel.debut}
                            du {$rappel.debut|format_sqlite_date_to_french} au {$rappel.fin|format_sqlite_date_to_french}
                        {else}
                            ponctuelle
                        {/if}
                    </td>
                    <td>
                        {if $rappel.delai == 0}le jour de l'expiration
                        {else}
                            {$rappel.delai|abs|escape}
                            {if abs($rappel.delai) > 1}jours{else}jour{/if}
                            {if $rappel.delai > 0}après{else}avant{/if}
                            expiration
                        {/if}
                    </td>
                    <th><a href="{$admin_url}membres/cotisations/rappel.php?id={$rappel.id|escape}">{$rappel.sujet|escape}</a></th>
                    <td class="actions">
                        <a class="icn" href="{$admin_url}membres/cotisations/gestion/rappel_modifier.php?id={$rappel.id|escape}" title="Modifier">✎</a>
                        <a class="icn" href="{$admin_url}membres/cotisations/gestion/rappel_supprimer.php?id={$rappel.id|escape}" title="Supprimer">✘</a>
                    </td>
                </tr>
            {/foreach}
75
76
77
78
79
80
81
82

83




84



85
86
87
88
89
90
91
92
93
94
95
96
97













98
                    </option>
                    {/foreach}
                </select>
            </dd>
            <dt><label for="f_sujet">Sujet du mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="sujet" id="f_sujet" value="{form_field name=sujet default=$default_subject}" required="required" size="50" /></dd>
            <dt><label for="f_delai">Délai d'envoi</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="number" name="delai" step="1" min="1" max="900" size="5" id="f_delai" value="{form_field name=delai default=30}" required="required" /> jours</dd>

            <dd><label><input type="radio" name="delai_pre" value="1" {form_field name="delai_pre" checked=1 default=1} /> Avant l'expiration de la cotisation</label></dd>




            <dd><label><input type="radio" name="delai_pre" value="0" {form_field name="delai_pre" checked=0} /> Après l'expiration de la cotisation</label></dd>



            <dt><label for="f_texte">Texte du mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><textarea name="texte" id="f_texte" cols="70" rows="15" required="required">{form_field name=texte default=$default_text}</textarea></dd>
            <dd class="help">Astuce : pour inclure dans le contenu du mail le nom du membre, utilisez #IDENTITE, pour inclure le délai de l'envoi utilisez #NB_JOURS.</dd>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="new_rappel"}
        <input type="submit" name="save" value="Ajouter &rarr;" />
    </p>

</form>














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







|
>
|
>
>
>
>
|
>
>
>













>
>
>
>
>
>
>
>
>
>
>
>
>

83
84
85
86
87
88
89
90
91
92
93
94
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
                    </option>
                    {/foreach}
                </select>
            </dd>
            <dt><label for="f_sujet">Sujet du mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="sujet" id="f_sujet" value="{form_field name=sujet default=$default_subject}" required="required" size="50" /></dd>
            <dt><label for="f_delai">Délai d'envoi</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><label><input type="radio" name="delai_choix" value="0" {form_field name="delai_choix" checked=0 default=0} /> Le jour de l'expiration de la cotisation</label></dd>
            <dd>
                <input type="radio" name="delai_choix" id="f_delai_pre" value="-1" {form_field name="delai_choix" checked=-1} />
                <input type="number" name="delai_pre" id="f_delai_pre_nb" step="1" min="1" max="900" size="4" id="f_delai" value="{form_field name=delai_pre default=30}" required="required" />
                <label for="f_delai_pre">jours avant expiration</label>
            </dd>
            <dd>
                <input type="radio" name="delai_choix" id="f_delai_post" value="1" {form_field name="delai_choix" checked=1} /> 
                <input type="number" name="delai_post" id="f_delai_post_nb" step="1" min="1" max="900" size="4" id="f_delai" value="{form_field name=delai_post default=30}" required="required" />
                <label for="f_delai_post">jours après expiration</label>
            </dd>
            <dt><label for="f_texte">Texte du mail</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><textarea name="texte" id="f_texte" cols="70" rows="15" required="required">{form_field name=texte default=$default_text}</textarea></dd>
            <dd class="help">Astuce : pour inclure dans le contenu du mail le nom du membre, utilisez #IDENTITE, pour inclure le délai de l'envoi utilisez #NB_JOURS.</dd>
        </dl>
    </fieldset>

    <p class="submit">
        {csrf_field key="new_rappel"}
        <input type="submit" name="save" value="Ajouter &rarr;" />
    </p>

</form>

<script type="text/javascript">
{literal}
(function () {
    $('#f_delai_pre_nb').onclick = function () {
        $('#f_delai_pre').checked = true;
    };
    $('#f_delai_post_nb').onclick = function () {
        $('#f_delai_post').checked = true;
    };
})();
{/literal}
</script>

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

Modified src/www/admin/membres/cotisations/gestion/rappel_modifier.php from [e83ba15aae] to [cd4b083482].

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
65
66
67
    if (!utils::CSRF_check('edit_rappel_' . $rappel['id']))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {



        	$delai = (int) utils::post('delai');

            $delai = utils::post('delai_pre') ? -$delai : $delai;

            $rappels->edit($rappel['id'], [
                'sujet'		=>	utils::post('sujet'),
                'texte'		=>	utils::post('texte'),
                'delai'		=>	$delai,
                'id_cotisation'	=>	utils::post('id_cotisation'),
            ]);

            utils::redirect('/admin/membres/cotisations/gestion/rappels.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

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

$rappel['delai_pre'] = $rappel['delai'] > 0 ? 0 : 1;
$rappel['delai'] = abs($rappel['delai']);

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

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

?>







>
>
>
|
>
|



















|
|







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
65
66
67
68
69
70
71
    if (!utils::CSRF_check('edit_rappel_' . $rappel['id']))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            if (utils::post('delai_choix') == 0)
               $delai = 0;
            elseif (utils::post('delai_choix') > 0)
                $delai = (int) utils::post('delai_post');
            else
                $delai = -(int) utils::post('delai_pre');

            $rappels->edit($rappel['id'], [
                'sujet'		=>	utils::post('sujet'),
                'texte'		=>	utils::post('texte'),
                'delai'		=>	$delai,
                'id_cotisation'	=>	utils::post('id_cotisation'),
            ]);

            utils::redirect('/admin/membres/cotisations/gestion/rappels.php');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

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

$rappel['delai_pre'] = $rappel['delai_post'] = abs($rappel['delai']) ?: 30;
$rappel['delai_choix'] = $rappel['delai'] == 0 ? 0 : ($rappel['delai'] > 0 ? 1 : -1);

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

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

?>

Modified src/www/admin/membres/cotisations/gestion/rappels.php from [4e1ead9eee] to [7046d6875b].

18
19
20
21
22
23
24



25

26
27
28
29
30
31
32
33
    if (!utils::CSRF_check('new_rappel'))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {



        	$delai = (int) utils::post('delai');

            $delai = utils::post('delai_pre') ? -$delai : $delai;

            $rappels->add([
                'sujet'		=>	utils::post('sujet'),
                'texte'		=>	utils::post('texte'),
                'delai'		=>	$delai,
                'id_cotisation'	=>	utils::post('id_cotisation'),
            ]);







>
>
>
|
>
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    if (!utils::CSRF_check('new_rappel'))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            if (utils::post('delai_choix') == 0)
        	   $delai = 0;
            elseif (utils::post('delai_choix') > 0)
                $delai = (int) utils::post('delai_post');
            else
                $delai = -(int) utils::post('delai_pre');

            $rappels->add([
                'sujet'		=>	utils::post('sujet'),
                'texte'		=>	utils::post('texte'),
                'delai'		=>	$delai,
                'id_cotisation'	=>	utils::post('id_cotisation'),
            ]);