Overview
Comment:Modernisation code
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 10e35860a4ee788f01c098da1de49c0309f79715
User & Date: bohwaz on 2017-08-31 07:24:47
Other Links: branch diff | manifest | tags
Context
2017-08-31
07:52
Utilisation des cascades pour nettoyer les foreign keys dans les tables (merci SQLite!) check-in: 2bcf7bd531 user: bohwaz tags: dev
07:24
Modernisation code check-in: 10e35860a4 user: bohwaz tags: dev
07:24
Utilisation de la nouvelle version de \KD2\Image check-in: 6de6092e2e user: bohwaz tags: dev
Changes

Modified src/templates/admin/compta/comptes/ajouter.tpl from [70b4d7b40b] to [f0cf451809].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{include file="admin/_head.tpl" title="Ajouter un compte" current="compta/categories"}

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

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

    <fieldset>
        <legend>Ajouter un compte</legend>
        <dl>
            <dt><label for="f_parent">Compte parent</label> <b title="(Champ obligatoire)">obligatoire</b></dt>


<
<
|
<
<







1
2


3


4
5
6
7
8
9
10
{include file="admin/_head.tpl" title="Ajouter un compte" current="compta/categories"}



{form_errors}



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

    <fieldset>
        <legend>Ajouter un compte</legend>
        <dl>
            <dt><label for="f_parent">Compte parent</label> <b title="(Champ obligatoire)">obligatoire</b></dt>

Modified src/templates/admin/compta/comptes/supprimer.tpl from [2f8741c6f4] to [89dec94900].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{include file="admin/_head.tpl" title="Supprimer un compte" current="compta/categories"}

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

{if !$can_delete && !$can_disable}
    <p class="alert">
        Ce compte ne peut être supprimé ou désactivé.
        Pour pouvoir supprimer ou désactiver un compte aucune catégorie ou écriture comptable ne doit y faire référence.
        Pour pouvoir désactiver un compte aucune écriture comptable ne doit y faire référence dans l'exercice en cours.
    </p>


<
<
|
<
<







1
2


3


4
5
6
7
8
9
10
{include file="admin/_head.tpl" title="Supprimer un compte" current="compta/categories"}



{form_errors}



{if !$can_delete && !$can_disable}
    <p class="alert">
        Ce compte ne peut être supprimé ou désactivé.
        Pour pouvoir supprimer ou désactiver un compte aucune catégorie ou écriture comptable ne doit y faire référence.
        Pour pouvoir désactiver un compte aucune écriture comptable ne doit y faire référence dans l'exercice en cours.
    </p>

Modified src/templates/admin/config/site.tpl from [64d5969a69] to [012fc113de].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{include file="admin/_head.tpl" title="Configuration — Site public" current="config" js=1}

{if $error && $error != 'OK'}
    <p class="error">
        {$error}
    </p>
{/if}

{include file="admin/config/_menu.tpl" current="site"}

{if isset($edit)}
    <form method="post" action="{$self_url}">
        <h3>Éditer un squelette</h3>

        {if $error == 'OK'}
        <p class="confirm">
            Modifications enregistrées.
        </p>
        {/if}

        <fieldset class="skelEdit">
            <legend>{$edit.file}</legend>


<
<
|
<
<







|







1
2


3


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{include file="admin/_head.tpl" title="Configuration — Site public" current="config" js=1}



{form_errors}



{include file="admin/config/_menu.tpl" current="site"}

{if isset($edit)}
    <form method="post" action="{$self_url}">
        <h3>Éditer un squelette</h3>

        {if $ok}
        <p class="confirm">
            Modifications enregistrées.
        </p>
        {/if}

        <fieldset class="skelEdit">
            <legend>{$edit.file}</legend>

Modified src/templates/admin/membres/cotisations/gestion/modifier.tpl from [43e7213c19] to [dfba86b914].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{include file="admin/_head.tpl" title="Modifier une cotisation" current="membres/cotisations" js=1}

<ul class="actions">
    <li class="current"><a href="{$admin_url}membres/cotisations/">Cotisations</a></li>
    <li><a href="{$admin_url}membres/cotisations/ajout.php">Saisie d'une cotisation</a></li>
    {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN}
        <li><a href="{$admin_url}membres/cotisations/gestion/rappels.php">Gestion des rappels automatiques</a></li>
    {/if}
</ul>

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

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

    <fieldset>
        <legend>Modifier une cotisation</legend>
        <dl>
            <dt><label for="f_intitule">Intitulé</label> <b title="(Champ obligatoire)">obligatoire</b></dt>










<
<
|
<
<







1
2
3
4
5
6
7
8
9
10


11


12
13
14
15
16
17
18
{include file="admin/_head.tpl" title="Modifier une cotisation" current="membres/cotisations" js=1}

<ul class="actions">
    <li class="current"><a href="{$admin_url}membres/cotisations/">Cotisations</a></li>
    <li><a href="{$admin_url}membres/cotisations/ajout.php">Saisie d'une cotisation</a></li>
    {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN}
        <li><a href="{$admin_url}membres/cotisations/gestion/rappels.php">Gestion des rappels automatiques</a></li>
    {/if}
</ul>



{form_errors}



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

    <fieldset>
        <legend>Modifier une cotisation</legend>
        <dl>
            <dt><label for="f_intitule">Intitulé</label> <b title="(Champ obligatoire)">obligatoire</b></dt>

Modified src/templates/admin/membres/cotisations/gestion/rappel_modifier.tpl from [00fa91360e] to [b2128e65d7].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{include file="admin/_head.tpl" title="Modifier un rappel automatique" 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 class="current"><a href="{$admin_url}membres/cotisations/gestion/rappels.php">Gestion des rappels automatiques</a></li>
</ul>

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

<form method="post" action="{$self_url}" id="f_add">

    <fieldset>
        <legend>Modifier un rappel automatique</legend>
        <dl>
            <dt><label for="f_id_cotisation">Cotisation associée</label> <b title="(Champ obligatoire)">obligatoire</b></dt>








<
<
|
<
<







1
2
3
4
5
6
7
8


9


10
11
12
13
14
15
16
{include file="admin/_head.tpl" title="Modifier un rappel automatique" 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 class="current"><a href="{$admin_url}membres/cotisations/gestion/rappels.php">Gestion des rappels automatiques</a></li>
</ul>



{form_errors}



<form method="post" action="{$self_url}" id="f_add">

    <fieldset>
        <legend>Modifier un rappel automatique</legend>
        <dl>
            <dt><label for="f_id_cotisation">Cotisation associée</label> <b title="(Champ obligatoire)">obligatoire</b></dt>

Modified src/templates/admin/membres/cotisations/gestion/rappel_supprimer.tpl from [50e8d9fa01] to [e3f2d395a4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{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 class="current"><a href="{$admin_url}membres/cotisations/gestion/rappels.php">Gestion des rappels automatiques</a></li>
</ul>

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

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

    <fieldset>
        <legend>Supprimer ce rappel automatique ?</legend>
        <h3 class="warning">
            Êtes-vous sûr de vouloir supprimer le rappel «&nbsp;{$rappel.sujet}&nbsp;» ?








<
<
|
<
<







1
2
3
4
5
6
7
8


9


10
11
12
13
14
15
16
{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 class="current"><a href="{$admin_url}membres/cotisations/gestion/rappels.php">Gestion des rappels automatiques</a></li>
</ul>



{form_errors}



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

    <fieldset>
        <legend>Supprimer ce rappel automatique ?</legend>
        <h3 class="warning">
            Êtes-vous sûr de vouloir supprimer le rappel «&nbsp;{$rappel.sujet}&nbsp;» ?

Modified src/templates/admin/membres/cotisations/gestion/rappels.tpl from [8159177598] to [2f62692021].

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
                    </td>
                </tr>
            {/foreach}
        </tbody>
    </table>
{/if}

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

<form method="post" action="{$self_url}" id="f_add">

    <fieldset>
        <legend>Ajouter un rappel automatique</legend>
        <dl>
            <dt><label for="f_id_cotisation">Cotisation associée</label> <b title="(Champ obligatoire)">obligatoire</b></dt>







<
<
|
<
<







50
51
52
53
54
55
56


57


58
59
60
61
62
63
64
                    </td>
                </tr>
            {/foreach}
        </tbody>
    </table>
{/if}



{form_errors}



<form method="post" action="{$self_url}" id="f_add">

    <fieldset>
        <legend>Ajouter un rappel automatique</legend>
        <dl>
            <dt><label for="f_id_cotisation">Cotisation associée</label> <b title="(Champ obligatoire)">obligatoire</b></dt>

Modified src/templates/admin/membres/cotisations/gestion/supprimer.tpl from [9ac215b33b] to [dae32493dc].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{include file="admin/_head.tpl" title="Supprimer une cotisation" current="membres/cotisations"}

<ul class="actions">
    <li class="current"><a href="{$admin_url}membres/cotisations/">Cotisations</a></li>
    <li><a href="{$admin_url}membres/cotisations/ajout.php">Saisie d'une cotisation</a></li>
    {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN}
        <li><a href="{$admin_url}membres/cotisations/gestion/rappels.php">Gestion des rappels automatiques</a></li>
    {/if}
</ul>

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

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

    <fieldset>
        <legend>Supprimer cette cotisation ?</legend>
        <h3 class="warning">
            Êtes-vous sûr de vouloir supprimer la cotisation «&nbsp;{$cotisation.intitule}&nbsp;» ?










<
<
|
<
<







1
2
3
4
5
6
7
8
9
10


11


12
13
14
15
16
17
18
{include file="admin/_head.tpl" title="Supprimer une cotisation" current="membres/cotisations"}

<ul class="actions">
    <li class="current"><a href="{$admin_url}membres/cotisations/">Cotisations</a></li>
    <li><a href="{$admin_url}membres/cotisations/ajout.php">Saisie d'une cotisation</a></li>
    {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN}
        <li><a href="{$admin_url}membres/cotisations/gestion/rappels.php">Gestion des rappels automatiques</a></li>
    {/if}
</ul>



{form_errors}



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

    <fieldset>
        <legend>Supprimer cette cotisation ?</legend>
        <h3 class="warning">
            Êtes-vous sûr de vouloir supprimer la cotisation «&nbsp;{$cotisation.intitule}&nbsp;» ?

Modified src/templates/admin/membres/cotisations/supprimer.tpl from [7f2b5597c6] to [5a72f2a137].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{include file="admin/_head.tpl" title="Supprimer une cotisation pour le membre n°%s"|args:$membre.id current="membres/cotisations"}

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

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

<form method="post" action="{$self_url}">
    <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;?











|
<
<







1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
{include file="admin/_head.tpl" title="Supprimer une cotisation pour le membre n°%s"|args:$membre.id current="membres/cotisations"}

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

{form_errors}



<form method="post" action="{$self_url}">
    <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;?

Modified src/templates/admin/wiki/recent.tpl from [e1e2925aea] to [35548681bf].

8
9
10
11
12
13
14
15
16
17
18
19
20
            <th><a href="{$www_url}admin/wiki/?{$page.uri}">{$page.titre}</a></th>
            <td>{$page.date_modification|date_fr:'d/m/Y à H:i'}</td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {pagination url="?p=[ID]" page=$page bypage=$bypage total=$total}
{else}
    <p class="alert">Pas de modification récente.</p>
{/if}

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







|





8
9
10
11
12
13
14
15
16
17
18
19
20
            <th><a href="{$www_url}admin/wiki/?{$page.uri}">{$page.titre}</a></th>
            <td>{$page.date_modification|date_fr:'d/m/Y à H:i'}</td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {pagination url="?p=[ID]" page=$current_page bypage=$bypage total=$total}
{else}
    <p class="alert">Pas de modification récente.</p>
{/if}

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

Modified src/www/admin/compta/categories/supprimer.php from [974d7c46fd] to [9ae189a650].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$cat = $cats->get($id);

if (!$cat)
{
    throw new UserException('Cette catégorie n\'existe pas.');
}

$error = false;

if (f('delete') && $form->check('delete_compta_cat_' . $cat->id))
{
    try
    {
        $cats->delete($id);
        Utils::redirect('/admin/compta/categories/');
    }







<
<







14
15
16
17
18
19
20


21
22
23
24
25
26
27
$cat = $cats->get($id);

if (!$cat)
{
    throw new UserException('Cette catégorie n\'existe pas.');
}



if (f('delete') && $form->check('delete_compta_cat_' . $cat->id))
{
    try
    {
        $cats->delete($id);
        Utils::redirect('/admin/compta/categories/');
    }

Modified src/www/admin/compta/comptes/ajouter.php from [df1d8630ca] to [3acb83e2fa].

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
$classe = (int) qg('classe');

if (!$classe || $classe < 1 || $classe > 9)
{
    throw new UserException("Cette classe de compte n'existe pas.");
}

$error = false;

if (!empty($_POST['add']))
{
    if (!Utils::CSRF_check('compta_ajout_compte'))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $comptes->add([
                'id'            =>  Utils::post('numero'),
                'libelle'       =>  Utils::post('libelle'),
                'parent'        =>  Utils::post('parent'),
                'position'      =>  Utils::post('position'),
            ]);

            Utils::redirect('/admin/compta/comptes/?classe='.$classe);
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

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

$parent = $comptes->get(Utils::post('parent') ?: $classe);

$tpl->assign('positions', $comptes->getPositions());
$tpl->assign('position', Utils::post('position') ?: $parent['position']);
$tpl->assign('comptes', $comptes->listTree($classe));

$tpl->display('admin/compta/comptes/ajouter.tpl');







<
|
<

|
<
<
<
<




|
|
|
|






|




<
<
|


|



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
$classe = (int) qg('classe');

if (!$classe || $classe < 1 || $classe > 9)
{
    throw new UserException("Cette classe de compte n'existe pas.");
}


if (f('add'))

{
    if ($form->check('compta_ajout_compte'))




    {
        try
        {
            $id = $comptes->add([
                'id'       =>  f('numero'),
                'libelle'  =>  f('libelle'),
                'parent'   =>  f('parent'),
                'position' =>  f('position'),
            ]);

            Utils::redirect('/admin/compta/comptes/?classe='.$classe);
        }
        catch (UserException $e)
        {
            $form->addError($e->getMessage());
        }
    }
}



$parent = $comptes->get(f('parent') ?: $classe);

$tpl->assign('positions', $comptes->getPositions());
$tpl->assign('position', f('position') ?: $parent->position);
$tpl->assign('comptes', $comptes->listTree($classe));

$tpl->display('admin/compta/comptes/ajouter.tpl');

Modified src/www/admin/compta/comptes/modifier.php from [acafab3508] to [869c173d06].

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
$compte = $comptes->get($id);

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}

$error = false;

if (!empty($_POST['save']))
{
    if (!Utils::CSRF_check('compta_edit_compte_'.$compte['id']))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $id = $comptes->edit($compte['id'], [
                'libelle'       =>  Utils::post('libelle'),
                'position'      =>  Utils::post('position'),
            ]);

            Utils::redirect('/admin/compta/comptes/?classe='.substr($compte['id'], 0, 1));
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

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

$tpl->assign('positions', $comptes->getPositions());
$tpl->assign('position', Utils::post('position') ?: $compte['position']);
$tpl->assign('compte', $compte);

$tpl->display('admin/compta/comptes/modifier.tpl');







<
|
<

|

<
<
<
<


|
|
|


|



|




<
<

|



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
$compte = $comptes->get($id);

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}


if (f('save'))

{
    if ($form->check('compta_edit_compte_' . $compte->id))
    {




        try
        {
            $id = $comptes->edit($compte->id, [
                'libelle'  =>  f('libelle'),
                'position' =>  f('position'),
            ]);

            Utils::redirect('/admin/compta/comptes/?classe='.substr($compte->id, 0, 1));
        }
        catch (UserException $e)
        {
            $form->addError($e->getMessage());
        }
    }
}



$tpl->assign('positions', $comptes->getPositions());
$tpl->assign('position', f('position') ?: $compte->position);
$tpl->assign('compte', $compte);

$tpl->display('admin/compta/comptes/modifier.tpl');

Modified src/www/admin/compta/comptes/supprimer.php from [0e50aca974] to [bd3d2bd55c].

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
$compte = $comptes->get($id);

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}

$error = false;

if (!empty($_POST['delete']))
{
    if (!Utils::CSRF_check('compta_delete_compte_'.$compte['id']))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $comptes->delete($compte['id']);
            Utils::redirect('/admin/compta/comptes/?classe='.substr($compte['id'], 0, 1));
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}
elseif (!empty($_POST['disable']))
{
    if (!Utils::CSRF_check('compta_disable_compte_'.$compte['id']))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try
        {
            $comptes->disable($compte['id']);
            Utils::redirect('/admin/compta/comptes/?classe='.substr($compte['id'], 0, 1));
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

$tpl->assign('can_delete', $comptes->canDelete($compte['id']));
$tpl->assign('can_disable', $comptes->canDisable($compte['id']));

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

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

$tpl->display('admin/compta/comptes/supprimer.tpl');







<
<
<
<
|
|
<
<
<
<
|
|
|
|
|
|
|
|
|
|
<
<
<
|
|
<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
<
|
|
<
<




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
$compte = $comptes->get($id);

if (!$compte)
{
    throw new UserException('Le compte demandé n\'existe pas.');
}





if (f('delete') && $form->check('compta_delete_compte_' . $compte->id))
{




    try
    {
        $comptes->delete($compte->id);
        Utils::redirect('/admin/compta/comptes/?classe=' . substr($compte->id, 0, 1));
    }
    catch (UserException $e)
    {
        $form->addError($e->getMessage());
    }
}



elseif (f('disable') && $form->check('compta_disable_compte_' . $compte->id))
{




    try
    {
        $comptes->disable($compte->id);
        Utils::redirect('/admin/compta/comptes/?classe='.substr($compte->id, 0, 1));
    }
    catch (UserException $e)
    {
        $form->addError($e->getMessage());
    }
}


$tpl->assign('can_delete', $comptes->canDelete($compte->id));
$tpl->assign('can_disable', $comptes->canDisable($compte->id));



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

$tpl->display('admin/compta/comptes/supprimer.tpl');

Modified src/www/admin/compta/import.php from [bd5c2b226a] to [8dcdde991d].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
    header('Content-type: application/csv');
    header('Content-Disposition: attachment; filename="Export comptabilité - ' . $config->get('nom_asso') . ' - ' . date('Y-m-d') . '.csv"');
    $import->toCSV($e->getCurrentId());
    exit;
}

$error = false;

if (f('import'))
{
    $form->check('compta_import', [
        'upload' => 'file|required',
        'type'   => 'required|in:citizen,garradin',
    ]);








<
<







12
13
14
15
16
17
18


19
20
21
22
23
24
25
{
    header('Content-type: application/csv');
    header('Content-Disposition: attachment; filename="Export comptabilité - ' . $config->get('nom_asso') . ' - ' . date('Y-m-d') . '.csv"');
    $import->toCSV($e->getCurrentId());
    exit;
}



if (f('import'))
{
    $form->check('compta_import', [
        'upload' => 'file|required',
        'type'   => 'required|in:citizen,garradin',
    ]);

Modified src/www/admin/compta/operations/saisir.php from [0528898813] to [84a95ced43].

110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
                elseif ($type === Compta\Categories::RECETTES)
                {
                    $debit = $a;
                    $credit = $b;
                }
                elseif ($type === 'dette')
                {
                    $debit = $cat['compte'];
                    $credit = f('compte');
                }

                $id = $journal->add([
                    'libelle'       =>  f('libelle'),
                    'montant'       =>  f('montant'),
                    'date'          =>  f('date'),







|







110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
                elseif ($type === Compta\Categories::RECETTES)
                {
                    $debit = $a;
                    $credit = $b;
                }
                elseif ($type === 'dette')
                {
                    $debit = $cat->compte;
                    $credit = f('compte');
                }

                $id = $journal->add([
                    'libelle'       =>  f('libelle'),
                    'montant'       =>  f('montant'),
                    'date'          =>  f('date'),

Modified src/www/admin/compta/pie.php from [f0385456c4] to [502f5f0839].

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	$max = count($colors);
	$i = 0;

	foreach ($data as $row)
	{
		if ($i++ >= $max)
		{
			$others += $row['somme'];
		}
		else
		{
			$cat = $categories[$row->id_categorie];
			$pie->add(new \KD2\SVGPie_Data($row->somme, substr($cat->intitule, 0, 50), $colors[$i-1]));
		}
	}







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	$max = count($colors);
	$i = 0;

	foreach ($data as $row)
	{
		if ($i++ >= $max)
		{
			$others += $row->somme;
		}
		else
		{
			$cat = $categories[$row->id_categorie];
			$pie->add(new \KD2\SVGPie_Data($row->somme, substr($cat->intitule, 0, 50), $colors[$i-1]));
		}
	}

Modified src/www/admin/config/site.php from [3c72b37ce7] to [b5431c03a1].

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
65
66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';

$error = false;

if (!empty($_POST['save']))
{
    if (!Utils::CSRF_check('config_site'))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $config->set('champs_obligatoires', Utils::post('champs_obligatoires'));
            $config->set('champs_modifiables_membre', Utils::post('champs_modifiables_membre'));
            $config->set('categorie_membres', Utils::post('categorie_membres'));
            $config->save();

            Utils::redirect('/admin/config/site.php?ok');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

if (Utils::post('select') && Utils::post('reset'))
{
    if (!Utils::CSRF_check('squelettes'))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            foreach (Utils::post('select') as $source)
            {
                if (!Squelette::resetSource($source))
                {
                    throw new UserException('Impossible de réinitialiser le squelette.');
                }
            }
        
            Utils::redirect('/admin/config/site.php?reset_ok');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}


if (qg('edit'))
{
    $source = Squelette::getSource(qg('edit'));

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

    $csrf_key = 'edit_skel_'.md5(qg('edit'));

    if (Utils::post('save'))
    {
        if (!Utils::CSRF_check($csrf_key))
        {
            $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';

        }
        else
        {
            if (Squelette::editSource(qg('edit'), Utils::post('content')))
            {
                $fullscreen = null !== qg('fullscreen') ? '#fullscreen' : '';
                Utils::redirect('/admin/config/site.php?edit='.rawurlencode(qg('edit')).'&ok'.$fullscreen);
            }
            else
            {
                $error = "Impossible d'enregistrer le squelette.";
            }
        }
    }

    $tpl->assign('edit', ['file' => trim(qg('edit')), 'content' => $source]);
    $tpl->assign('csrf_key', $csrf_key);
}

$tpl->assign('sources', Squelette::listSources());

$tpl->assign('reset_ok', qg('reset_ok'));
$tpl->assign('error', $error);
$tpl->display('admin/config/site.tpl');





<
<
<
<
|
|
<
<
<
<
|
|
|
|
|

|
|
|
|
|
|
|
|
<
<
<
|
|
<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<













|

|

|

|
>



<
<
<
<
<
<
<
|
<









|
|

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
65
66
67
68
69
70
71
72
73
74
<?php
namespace Garradin;

require_once __DIR__ . '/_inc.php';





if (f('save') && $form->check('config_site'))
{




    try {
        $config->set('champs_obligatoires', f('champs_obligatoires'));
        $config->set('champs_modifiables_membre', f('champs_modifiables_membre'));
        $config->set('categorie_membres', f('categorie_membres'));
        $config->save();

        Utils::redirect('/admin/config/site.php?ok');
    }
    catch (UserException $e)
    {
        $form->addError($e->getMessage());
    }
}




if (f('select') && f('reset') && $form->check('squelettes'))
{




    try {
        foreach (f('select') as $source)
        {
            if (!Squelette::resetSource($source))
            {
                throw new UserException('Impossible de réinitialiser le squelette.');
            }
        }
    
        Utils::redirect('/admin/config/site.php?reset_ok');
    }
    catch (UserException $e)
    {
        $form->addError($e->getMessage());

    }
}


if (qg('edit'))
{
    $source = Squelette::getSource(qg('edit'));

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

    $csrf_key = 'edit_skel_' . md5(qg('edit'));

    if (f('save') && $form->check($csrf_key))
    {
        if (Squelette::editSource(qg('edit'), f('content')))
        {
            $fullscreen = null !== qg('fullscreen') ? '#fullscreen' : '';
            Utils::redirect('/admin/config/site.php?edit='.rawurlencode(qg('edit')).'&ok'.$fullscreen);
        }
        else
        {







            $form->addError("Impossible d'enregistrer le squelette.");

        }
    }

    $tpl->assign('edit', ['file' => trim(qg('edit')), 'content' => $source]);
    $tpl->assign('csrf_key', $csrf_key);
}

$tpl->assign('sources', Squelette::listSources());

$tpl->assign('reset_ok', qg('reset_ok') !== null);
$tpl->assign('ok', qg('ok') !== null);
$tpl->display('admin/config/site.tpl');

Modified src/www/admin/membres/cotisations/ajout.php from [4c34f02825] to [c2c1d14ae5].

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

$cotisations = new Cotisations;
$m_cotisations = new Membres\Cotisations;

$cats = new Compta\Categories;
$banques = new Compta\Comptes_Bancaires;

$error = false;

if (f('add'))
{
    $form->check('add_cotisation', [
        'date'          => 'date_format:Y-m-d|required',
        'id_cotisation' => 'numeric|required|in_table:cotisations,id',
        'id_membre'     => 'numeric|required|in_table:membres,id',
    ]);







<
<







26
27
28
29
30
31
32


33
34
35
36
37
38
39

$cotisations = new Cotisations;
$m_cotisations = new Membres\Cotisations;

$cats = new Compta\Categories;
$banques = new Compta\Comptes_Bancaires;



if (f('add'))
{
    $form->check('add_cotisation', [
        'date'          => 'date_format:Y-m-d|required',
        'id_cotisation' => 'numeric|required|in_table:cotisations,id',
        'id_membre'     => 'numeric|required|in_table:membres,id',
    ]);

Modified src/www/admin/membres/cotisations/gestion/modifier.php from [644f361485] to [8acb887d25].

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
65
66
$cats = new Compta\Categories;

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

$error = false;

if (!empty($_POST['save']))
{
    if (!Utils::CSRF_check('edit_co_' . $co->id))
    {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    }
    else
    {
        try {
            $duree = Utils::post('periodicite') == 'jours' ? (int) Utils::post('duree') : null;
            $debut = Utils::post('periodicite') == 'date' ? Utils::post('debut') : null;
            $fin = Utils::post('periodicite') == 'date' ? Utils::post('fin') : null;
            $id_cat = Utils::post('categorie') ? (int) Utils::post('id_categorie_compta') : null;

            $cotisations->edit($co->id, [
                'intitule'          =>  Utils::post('intitule'),
                'description'       =>  Utils::post('description'),
                'montant'           =>  (float) Utils::post('montant'),
                'duree'             =>  $duree,
                'debut'             =>  $debut,
                'fin'               =>  $fin,
                'id_categorie_compta'=> $id_cat,
            ]);

            Utils::redirect('/admin/membres/cotisations/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

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

$co->periodicite = $co->duree ? 'jours' : ($co->debut ? 'date' : 'ponctuel');
$co->categorie = $co->id_categorie_compta ? 1 : 0;

$tpl->assign('cotisation', $co);
$tpl->assign('categories', $cats->getList(Compta\Categories::RECETTES));

$tpl->display('admin/membres/cotisations/gestion/modifier.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
44
45
46
47
48


49
50
51
52
53
54
55
56
$cats = new Compta\Categories;

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





if (f('save') && $form->check('edit_co_' . $co->id))
{




    try {
        $duree = f('periodicite') == 'jours' ? (int) f('duree') : null;
        $debut = f('periodicite') == 'date' ? f('debut') : null;
        $fin = f('periodicite') == 'date' ? f('fin') : null;
        $id_cat = f('categorie') ? (int) f('id_categorie_compta') : null;

        $cotisations->edit($co->id, [
            'intitule'            => f('intitule'),
            'description'         => f('description'),
            'montant'             => (float) f('montant'),
            'duree'               => $duree,
            'debut'               => $debut,
            'fin'                 => $fin,
            'id_categorie_compta' => $id_cat,
        ]);

        Utils::redirect('/admin/membres/cotisations/');
    }
    catch (UserException $e)
    {
        $form->addError($e->getMessage());
    }
}




$co->periodicite = $co->duree ? 'jours' : ($co->debut ? 'date' : 'ponctuel');
$co->categorie = $co->id_categorie_compta ? 1 : 0;

$tpl->assign('cotisation', $co);
$tpl->assign('categories', $cats->getList(Compta\Categories::RECETTES));

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

Modified src/www/admin/membres/cotisations/gestion/rappel_modifier.php from [0c22168424] to [c65c98d3c1].

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
65
66
67
68
if (!$rappel)
{
    throw new UserException("Ce rappel n'existe pas.");
}

$cotisations = new Cotisations;

$error = false;

if (!empty($_POST['save']))
{
    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');







<
<
<
<
|
|
<
<
<
<
|
|
|
|
|
|
|

|
|
|
|
|
|

|
|
|
|
|
|
|
<
<
<










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
if (!$rappel)
{
    throw new UserException("Ce rappel n'existe pas.");
}

$cotisations = new Cotisations;





if (f('save') && $form->check('edit_rappel_' . $rappel->id))
{




    try {
        if (f('delai_choix') == 0)
           $delai = 0;
        elseif (f('delai_choix') > 0)
            $delai = (int) f('delai_post');
        else
            $delai = -(int) f('delai_pre');

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

        Utils::redirect('/admin/membres/cotisations/gestion/rappels.php');
    }
    catch (UserException $e)
    {
        $form->addError($e->getMessage());
    }
}




$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/rappel_supprimer.php from [cb00bde925] to [45609acaa5].

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
$rappel = $rappels->get(qg('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');







<
<
<
<
|
|
<
<
<
<
|
|
|
|
|
|
|
|
|
|
<
<
<



15
16
17
18
19
20
21




22
23




24
25
26
27
28
29
30
31
32
33



34
35
36
$rappel = $rappels->get(qg('id'));

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





if (f('delete') && $form->check('delete_rappel_' . $rappel->id))
{




    try {
        $rappels->delete($rappel->id, (bool) f('delete_history'));
        Utils::redirect('/admin/membres/cotisations/gestion/rappels.php');
    }
    catch (UserException $e)
    {
        $form->addError($e->getMessage());
    }
}




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

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

Modified src/www/admin/membres/cotisations/gestion/rappels.php from [88eacf9866] to [cc1d420b98].

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

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

$session->requireAccess('membres', Membres::DROIT_ADMIN);

$rappels = new Rappels;
$cotisations = new Cotisations;

$error = false;

if (!empty($_POST['save']))
{
    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'),
            ]);

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

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

$tpl->assign('liste', $rappels->listByCotisation());
$tpl->assign('cotisations', $cotisations->listCurrent());

$tpl->assign('default_subject', '[#NOM_ASSO] Échéance de cotisation');
$tpl->assign('default_text', "Bonjour #IDENTITE,\n\nVotre cotisation arrive à échéance dans #NB_JOURS jours.\n\n"
	.	"Merci de nous contacter pour renouveler votre cotisation.\n\nCordialement.\n\n"
    .   "--\n#NOM_ASSO\n#ADRESSE_ASSO\nE-Mail : #EMAIL_ASSO\nSite web : #SITE_ASSO");

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










<
<
<
<
|
|
<
<
<
<
|
|
|
|
|
|
|

|
|
|
|
|
|

|
|
|
|
|
|
|
<
<
<










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

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

$session->requireAccess('membres', Membres::DROIT_ADMIN);

$rappels = new Rappels;
$cotisations = new Cotisations;





if (f('save') && $form->check('new_rappel'))
{




    try {
        if (f('delai_choix') == 0)
    	   $delai = 0;
        elseif (f('delai_choix') > 0)
            $delai = (int) f('delai_post');
        else
            $delai = -(int) f('delai_pre');

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

        Utils::redirect('/admin/membres/cotisations/gestion/rappels.php');
    }
    catch (UserException $e)
    {
        $form->addError($e->getMessage());
    }
}




$tpl->assign('liste', $rappels->listByCotisation());
$tpl->assign('cotisations', $cotisations->listCurrent());

$tpl->assign('default_subject', '[#NOM_ASSO] Échéance de cotisation');
$tpl->assign('default_text', "Bonjour #IDENTITE,\n\nVotre cotisation arrive à échéance dans #NB_JOURS jours.\n\n"
	.	"Merci de nous contacter pour renouveler votre cotisation.\n\nCordialement.\n\n"
    .   "--\n#NOM_ASSO\n#ADRESSE_ASSO\nE-Mail : #EMAIL_ASSO\nSite web : #SITE_ASSO");

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

Modified src/www/admin/membres/cotisations/gestion/supprimer.php from [7dd927668a] to [922d19657c].

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
$co = $cotisations->get(qg('id'));

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

$error = false;

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

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

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

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







<
<
<
<
|
|
<
<
<
<
|
|
|
|
|
|
|
|
|
|
<
<
<



15
16
17
18
19
20
21




22
23




24
25
26
27
28
29
30
31
32
33



34
35
36
$co = $cotisations->get(qg('id'));

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





if (f('delete') && $form->check('delete_co_' . $co->id))
{




    try {
        $cotisations->delete($co->id);
        Utils::redirect('/admin/membres/cotisations/');
    }
    catch (UserException $e)
    {
        $form->addError($e->getMessage());
    }
}




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

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

Modified src/www/admin/mes_infos.php from [ff993f6636] to [b50076e4e6].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

            $session->editUser($data);

            Utils::redirect('/admin/');
        }
        catch (UserException $e)
        {
            $error = $e->getMessage();
        }
    }
}

$tpl->assign('champs', $champs->getAll());

$tpl->assign('membre', $session->getUser());

$tpl->display('admin/mes_infos.tpl');







|









24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

            $session->editUser($data);

            Utils::redirect('/admin/');
        }
        catch (UserException $e)
        {
            $form->addError($e->getMessage());
        }
    }
}

$tpl->assign('champs', $champs->getAll());

$tpl->assign('membre', $session->getUser());

$tpl->display('admin/mes_infos.tpl');

Modified src/www/admin/password.php from [26d86ab12a] to [6c727bdeb9].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php

namespace Garradin;

use Garradin\Membres\Session;

const LOGIN_PROCESS = true;

require_once __DIR__ . '/_inc.php';

$error = false;

if (trim(qg('c')))
{
    if (Session::recoverPasswordConfirm(qg('c')))
    {
        Utils::redirect('/admin/password.php?new_sent');
    }











<
<







1
2
3
4
5
6
7
8
9
10


11
12
13
14
15
16
17
<?php

namespace Garradin;

use Garradin\Membres\Session;

const LOGIN_PROCESS = true;

require_once __DIR__ . '/_inc.php';



if (trim(qg('c')))
{
    if (Session::recoverPasswordConfirm(qg('c')))
    {
        Utils::redirect('/admin/password.php?new_sent');
    }

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
            Utils::redirect('/admin/password.php?sent');
        }

        $form->addError('Ce membre n\'a pas d\'adresse email enregistrée ou n\'a pas le droit de se connecter.');
    }
}

if (!$error && null !== qg('sent'))
{
    $tpl->assign('sent', true);
}
elseif (!$error && null !== qg('new_sent'))
{
    $tpl->assign('new_sent', true);
}


$champs = $config->get('champs_membres');

$champ = $champs->get($config->get('champ_identifiant'));

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

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

$tpl->display('admin/password.tpl');







|



|











<
<

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52


53
            Utils::redirect('/admin/password.php?sent');
        }

        $form->addError('Ce membre n\'a pas d\'adresse email enregistrée ou n\'a pas le droit de se connecter.');
    }
}

if (!$form->hasErrors() && null !== qg('sent'))
{
    $tpl->assign('sent', true);
}
elseif (!$form->hasErrors() && null !== qg('new_sent'))
{
    $tpl->assign('new_sent', true);
}


$champs = $config->get('champs_membres');

$champ = $champs->get($config->get('champ_identifiant'));

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



$tpl->display('admin/password.tpl');

Modified src/www/admin/upgrade.php from [1d7fc72053] to [bdc9f57de5].

143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    $id_cat_cotisation = $db->firstColumn('SELECT id FROM compta_categories WHERE compte = 756 LIMIT 1;');

    // Conversion des cotisations de catégories en cotisations indépendantes
    foreach ($list as $cat)
    {
        $db->simpleInsert('cotisations', [
            'id_categorie_compta'   =>  null,
            'intitule'              =>  $cat['nom'],
            'montant'               =>  (float) $cat['montant_cotisation'],
            // Convertir un nombre de mois en nombre de jours
            'duree'                 =>  round($cat['duree_cotisation'] * 30.44),
            'description'           =>  'Créé automatiquement depuis les catégories de membres (version 0.5.x)',
        ]);

        $args = [
            'id_cotisation' =>  (int)$db->lastInsertRowId(),
            'id_categorie'  =>  (int)$cat['id'],
        ];

        // import des dates de cotisation existantes comme paiements
        $db->simpleExec('INSERT INTO cotisations_membres 
            (id_membre, id_cotisation, date)
            SELECT id, :id_cotisation, date(date_cotisation) FROM membres
            WHERE date_cotisation IS NOT NULL AND date_cotisation != \'\' AND id_categorie = :id_categorie;',







|
|

|





|







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    $id_cat_cotisation = $db->firstColumn('SELECT id FROM compta_categories WHERE compte = 756 LIMIT 1;');

    // Conversion des cotisations de catégories en cotisations indépendantes
    foreach ($list as $cat)
    {
        $db->simpleInsert('cotisations', [
            'id_categorie_compta'   =>  null,
            'intitule'              =>  $cat->nom,
            'montant'               =>  (float) $cat->montant_cotisation,
            // Convertir un nombre de mois en nombre de jours
            'duree'                 =>  round($cat->duree_cotisation * 30.44),
            'description'           =>  'Créé automatiquement depuis les catégories de membres (version 0.5.x)',
        ]);

        $args = [
            'id_cotisation' =>  (int)$db->lastInsertRowId(),
            'id_categorie'  =>  (int)$cat->id,
        ];

        // import des dates de cotisation existantes comme paiements
        $db->simpleExec('INSERT INTO cotisations_membres 
            (id_membre, id_cotisation, date)
            SELECT id, :id_cotisation, date(date_cotisation) FROM membres
            WHERE date_cotisation IS NOT NULL AND date_cotisation != \'\' AND id_categorie = :id_categorie;',
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
    // Changement de syntaxe du Wiki vers SkrivML
    $wiki = new Wiki;
    $res = $db->query('SELECT id_page, contenu, revision, chiffrement FROM wiki_revisions GROUP BY id_page ORDER BY revision DESC;');

    while ($row = $res->fetchArray(\SQLITE3_ASSOC))
    {
        // Ne pas convertir le contenu chiffré, de toute évidence
        if ($row['chiffrement'])
            continue;

        $content = $row['contenu'];
        $content = Utils::HTMLToSkriv($content);
        $content = Utils::SpipToSkriv($content);

        if ($content != $row['contenu'])
        {
            $wiki->editRevision($row['id_page'], $row['revision'], [
                'id_auteur'     =>  null,
                'contenu'       =>  $content,
                'modification'  =>  'Mise à jour 0.7.0 (transformation SPIP vers SkrivML)',
            ]);
        }
    }








|


|



|

|







213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
    // Changement de syntaxe du Wiki vers SkrivML
    $wiki = new Wiki;
    $res = $db->query('SELECT id_page, contenu, revision, chiffrement FROM wiki_revisions GROUP BY id_page ORDER BY revision DESC;');

    while ($row = $res->fetchArray(\SQLITE3_ASSOC))
    {
        // Ne pas convertir le contenu chiffré, de toute évidence
        if ($row->chiffrement)
            continue;

        $content = $row->contenu;
        $content = Utils::HTMLToSkriv($content);
        $content = Utils::SpipToSkriv($content);

        if ($content != $row->contenu)
        {
            $wiki->editRevision($row->id_page, $row->revision, [
                'id_auteur'     =>  null,
                'contenu'       =>  $content,
                'modification'  =>  'Mise à jour 0.7.0 (transformation SPIP vers SkrivML)',
            ]);
        }
    }

Modified src/www/admin/wiki/recent.php from [f963840a1e] to [8a00987ce2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

namespace Garradin;

require_once __DIR__ . '/_inc.php';

$page = (int) qg('p') ?: 1;

$tpl->assign('page', $page);
$tpl->assign('bypage', Wiki::ITEMS_PER_PAGE);
$tpl->assign('total', $wiki->countRecentModifications());
$tpl->assign('list', $wiki->listRecentModifications($page));

$tpl->display('admin/wiki/recent.tpl');








|





1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

namespace Garradin;

require_once __DIR__ . '/_inc.php';

$page = (int) qg('p') ?: 1;

$tpl->assign('current_page', $page);
$tpl->assign('bypage', Wiki::ITEMS_PER_PAGE);
$tpl->assign('total', $wiki->countRecentModifications());
$tpl->assign('list', $wiki->listRecentModifications($page));

$tpl->display('admin/wiki/recent.tpl');