Comment: | Modernisation cotisations |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
4e287c6f32bba53a8866fe4a689d3e07 |
User & Date: | bohwaz on 2017-08-03 05:39:24 |
Other Links: | branch diff | manifest | tags |
2017-08-04
| ||
01:39 | Ré-écriture récupération de mot de passe : ne plus utiliser de session mais un hash HMAC limité en durée (1 heure mini.) check-in: 0077fd0f9a user: bohwaz tags: dev | |
2017-08-03
| ||
05:39 | Modernisation cotisations check-in: 4e287c6f32 user: bohwaz tags: dev | |
05:39 | Erreur : utilisation de first() au lieu de get() check-in: e951b3ec3b user: bohwaz tags: dev | |
Modified src/include/lib/Garradin/Membres/Cotisations.php from [df3fbb87a3] to [5f23efdd6e].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?php namespace Garradin\Membres; use Garradin\Config; use Garradin\DB; use Garradin\Utils; use Garradin\UserException; class Cotisations { const ITEMS_PER_PAGE = 100; /** * Vérification des champs fournis pour la modification de donnée | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?php namespace Garradin\Membres; use Garradin\Config; use Garradin\DB; use Garradin\Utils; use Garradin\UserException; use Garradin\Plugin; class Cotisations { const ITEMS_PER_PAGE = 100; /** * Vérification des champs fournis pour la modification de donnée |
︙ | ︙ | |||
96 97 98 99 100 101 102 | 'date' => $data['date'], 'id_cotisation' => $data['id_cotisation'], 'id_membre' => $data['id_membre'], ]); $id = $db->lastInsertRowId(); | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | 'date' => $data['date'], 'id_cotisation' => $data['id_cotisation'], 'id_membre' => $data['id_membre'], ]); $id = $db->lastInsertRowId(); if ($co->id_categorie_compta && $data['montant'] > 0) { try { $id_operation = $this->addOperationCompta($id, [ 'id_categorie' => $co->id_categorie_compta, 'libelle' => 'Cotisation (automatique)', 'montant' => $data['montant'], 'date' => $data['date'], |
︙ | ︙ |
Modified src/templates/admin/membres/ajouter.tpl from [b89071d52e] to [291bc29f45].
1 2 | {include file="admin/_head.tpl" title="Ajouter un membre" current="membres/ajouter" js=1} | < < | < < | 1 2 3 4 5 6 7 8 9 10 | {include file="admin/_head.tpl" title="Ajouter un membre" current="membres/ajouter" js=1} {form_errors} <form method="post" action="{$self_url}"> <fieldset> <legend>Informations personnelles</legend> <dl> {foreach from=$champs item="champ" key="nom"} |
︙ | ︙ |
Modified src/templates/admin/membres/cotisations/ajout.tpl from [d467fbaa1a] to [d289eec67b].
︙ | ︙ | |||
17 18 19 20 21 22 23 | <li class="current"><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} | | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <li class="current"><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} {form_errors} {if $user.droits.compta >= Garradin\Membres::DROIT_ECRITURE} <p class="help"> Cette page sert à enregistrer les cotisations des membres de l'association. Pour enregistrer un don ou une dépense, comme le paiement d'un prestataire ou une facture, il est possible de <a href="{$admin_url}compta/operations/saisir.php">saisir une opération comptable</a>. </p> {/if} <form method="post" action="{$self_url}"> |
︙ | ︙ |
Modified src/templates/admin/membres/cotisations/index.tpl from [75f3c738a3] to [584a0a21f3].
︙ | ︙ | |||
43 44 45 46 47 48 49 | </tr> {/foreach} </tbody> </table> {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN} | < < | | < | | | | < > | 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 | </tr> {/foreach} </tbody> </table> {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN} {form_errors} <p class="help"> Idée : les cotisations peuvent également être utilisées pour suivre les activités auxquelles sont inscrits les membres de l'association. </p> <form method="post" action="{$self_url}" id="f_add"> <fieldset> <legend>Ajouter une cotisation</legend> <dl> <dt><label for="f_intitule">Intitulé</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd><input type="text" name="intitule" id="f_intitule" value="{form_field name=intitule}" required="required" /></dd> <dt><label for="f_description">Description</label></dt> <dd><textarea name="description" id="f_description" cols="50" rows="3">{form_field name=description}</textarea></dd> <dt><label for="f_montant">Montant minimal</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd class="help">Laisser à <b>0</b> pour une cotisation à prix libre</dd> <dd><input type="number" name="montant" step="0.01" min="0.00" id="f_montant" value="{form_field name=montant default=0.00}" required="required" /></dd> <dt><label for="f_periodicite_jours">Période de validité</label></dt> <dd><input type="radio" name="periodicite" id="f_periodicite_ponctuel" value="ponctuel" {form_field checked="ponctuel" name=periodicite default="ponctuel"} /> <label for="f_periodicite_ponctuel">Pas de période (cotisation ponctuelle)</label></dd> <dd><input type="radio" name="periodicite" id="f_periodicite_jours" value="jours" {form_field checked="jours" name=periodicite} /> <label for="f_periodicite_jours">En nombre de jours</label> <dl class="periode_jours"> |
︙ | ︙ |
Modified src/templates/admin/membres/message.tpl from [657d2ca8e3] to [6ceb73fe1d].
1 2 | {include file="admin/_head.tpl" title="Contacter un membre" current="membres"} | < < | < < | 1 2 3 4 5 6 7 8 9 10 | {include file="admin/_head.tpl" title="Contacter un membre" current="membres"} {form_errors} <form method="post" action="{$self_url}"> <fieldset class="memberMessage"> <legend>Message</legend> <dl> <dt>Expéditeur</dt> <dd>{$user.identite} <{$user.email}></dd> |
︙ | ︙ |
Modified src/templates/admin/membres/modifier.tpl from [01e092296e] to [97ca8d4189].
1 2 3 4 5 6 7 8 9 10 11 | {include file="admin/_head.tpl" title="Modifier un membre" current="membres" js=1} <ul class="actions"> <li><a href="{$admin_url}membres/fiche.php?id={$membre.id}"><b>{$membre.identite}</b></a></li> <li class="current"><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><a href="{$admin_url}membres/cotisations.php?id={$membre.id}">Suivi des cotisations</a></li> </ul> | < < | < < | 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="Modifier un membre" current="membres" js=1} <ul class="actions"> <li><a href="{$admin_url}membres/fiche.php?id={$membre.id}"><b>{$membre.identite}</b></a></li> <li class="current"><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><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>Informations personnelles</legend> <dl> {if $user.droits.membres == Garradin\Membres::DROIT_ADMIN} |
︙ | ︙ |
Modified src/templates/admin/membres/supprimer.tpl from [cc4bfe10cc] to [963f4f7ede].
1 2 3 4 5 6 7 8 9 10 11 | {include file="admin/_head.tpl" title="Supprimer un membre" current="membres"} <ul class="actions"> <li><a href="{$admin_url}membres/fiche.php?id={$membre.id}"><b>{$membre.identite}</b></a></li> <li><a href="{$admin_url}membres/modifier.php?id={$membre.id}">Modifier</a></li> {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN} <li class="current"><a href="{$admin_url}membres/supprimer.php?id={$membre.id}">Supprimer</a></li> {/if} <li><a href="{$admin_url}membres/cotisations.php?id={$membre.id}">Suivi des cotisations</a></li> </ul> | < < | < < | 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 un membre" current="membres"} <ul class="actions"> <li><a href="{$admin_url}membres/fiche.php?id={$membre.id}"><b>{$membre.identite}</b></a></li> <li><a href="{$admin_url}membres/modifier.php?id={$membre.id}">Modifier</a></li> {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN} <li class="current"><a href="{$admin_url}membres/supprimer.php?id={$membre.id}">Supprimer</a></li> {/if} <li><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 ce membre ?</legend> <h3 class="warning"> Êtes-vous sûr de vouloir supprimer le membre « {$membre.identite} » ? |
︙ | ︙ |
Modified src/www/admin/compta/exercices/modifier.php from [c40172abfa] to [8d3dd0276d].
︙ | ︙ | |||
29 30 31 32 33 34 35 | 'debut' => 'required|date', ]); if (!$form->hasErrors()) { try { | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 'debut' => 'required|date', ]); if (!$form->hasErrors()) { try { $id = $e->edit($exercice->id, [ 'libelle' => Utils::post('libelle'), 'debut' => Utils::post('debut'), 'fin' => Utils::post('fin'), ]); Utils::redirect('/admin/compta/exercices/'); } |
︙ | ︙ |
Modified src/www/admin/compta/operations/cotisation.php from [9326164d95] to [98e2b3f517].
︙ | ︙ | |||
16 17 18 19 20 21 22 | if (!$mco) { throw new UserException("La cotisation demandée n'existe pas."); } $co = $cotisations->get($mco->id_cotisation); | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | if (!$mco) { throw new UserException("La cotisation demandée n'existe pas."); } $co = $cotisations->get($mco->id_cotisation); $membre = (new Membres)->get($mco->id_membre); if (!$membre) { throw new UserException("Le membre demandé n'existe pas."); } $liste_comptes = $comptes->getListAll(); |
︙ | ︙ |
Modified src/www/admin/compta/operations/membre.php from [2edb571c2f] to [2f74dbc0da].
︙ | ︙ | |||
13 14 15 16 17 18 19 | throw new UserException('Exercice inconnu.'); } qv(['id' => 'required|numeric']); $id = (int) qg('id'); | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | throw new UserException('Exercice inconnu.'); } qv(['id' => 'required|numeric']); $id = (int) qg('id'); $membre = (new Membres)->get($id); if (!$membre) { throw new UserException("Le membre demandé n'existe pas."); } $liste_comptes = $comptes->getListAll(); |
︙ | ︙ |
Modified src/www/admin/compta/operations/voir.php from [4b9f17ce08] to [267b3ba2b7].
︙ | ︙ | |||
40 41 42 43 44 45 46 | } $tpl->assign('moyen_paiement', $cats->getMoyenPaiement($operation->moyen_paiement)); } if ($operation->id_auteur) { | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | } $tpl->assign('moyen_paiement', $cats->getMoyenPaiement($operation->moyen_paiement)); } if ($operation->id_auteur) { $auteur = (new Membres)->get($operation->id_auteur); $tpl->assign('nom_auteur', $auteur->identite); } $tpl->assign('related_members', $journal->listRelatedMembers($operation->id)); $tpl->display('admin/compta/operations/voir.tpl'); |
Modified src/www/admin/membres/cotisations/ajout.php from [4b74270ede] to [f220d5298d].
︙ | ︙ | |||
28 29 30 31 32 33 34 | $m_cotisations = new Membres\Cotisations; $cats = new Compta\Categories; $banques = new Compta\Comptes_Bancaires; $error = false; | | | < > | > > | < > | | | | | | | | | | < | | | 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 | $m_cotisations = new Membres\Cotisations; $cats = new Compta\Categories; $banques = new Compta\Comptes_Bancaires; $error = false; if (f('add') && $membre) { $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', ]); if (!$form->hasErrors()) { try { $data = [ 'date' => f('date'), 'id_cotisation' => f('id_cotisation'), 'id_membre' => f('id_membre'), 'id_auteur' => $user->id, 'montant' => f('montant'), 'moyen_paiement' => f('moyen_paiement'), 'numero_cheque' => f('numero_cheque'), 'banque' => f('banque'), ]; $m_cotisations->add($data); Utils::redirect('/admin/membres/cotisations.php?id=' . (int)f('id_membre')); } catch (UserException $e) { $form->addError($e->getMessage()); } } } $tpl->assign('membre', $membre); $tpl->assign('cotisations', $cotisations->listCurrent()); $tpl->assign('default_co', null); $tpl->assign('default_amount', 0.00); $tpl->assign('default_date', date('Y-m-d')); $tpl->assign('default_compta', null); $tpl->assign('moyens_paiement', $cats->listMoyensPaiement()); $tpl->assign('moyen_paiement', f('moyen_paiement') ?: 'ES'); $tpl->assign('comptes_bancaires', $banques->getList()); $tpl->assign('banque', f('banque')); if (qg('cotisation')) { $co = $cotisations->get(qg('cotisation')); if (!$co) |
︙ | ︙ | |||
98 99 100 101 102 103 104 105 | { $co = $cotisations->get($categorie->id_cotisation_obligatoire); $tpl->assign('default_co', $co->id); $tpl->assign('default_amount', $co->montant); } } | < | 99 100 101 102 103 104 105 106 107 | { $co = $cotisations->get($categorie->id_cotisation_obligatoire); $tpl->assign('default_co', $co->id); $tpl->assign('default_amount', $co->montant); } } $tpl->display('admin/membres/cotisations/ajout.tpl'); |
Modified src/www/admin/membres/cotisations/index.php from [1dbf7ffdee] to [0bd0159ea0].
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?php namespace Garradin; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('membres', Membres::DROIT_ECRITURE); $cotisations = new Cotisations; if ($session->canAccess('membres', Membres::DROIT_ADMIN)) { $cats = new Compta\Categories; | < | < | < > > > | > > > > > | < > | | | | | | | | | | | | | | | | | | | | | | < < | 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 | <?php namespace Garradin; require_once __DIR__ . '/../_inc.php'; $session->requireAccess('membres', Membres::DROIT_ECRITURE); $cotisations = new Cotisations; if ($session->canAccess('membres', Membres::DROIT_ADMIN)) { $cats = new Compta\Categories; if (f('save')) { $form->check('new_cotisation', [ 'intitule' => 'required|string', 'montant' => 'required|money', 'periodicite' => 'required|in:jours,date,ponctuel', 'duree' => 'required_if:periodicite,jours|numeric|min:0', 'debut' => 'required_if:periodicite,date|date_format:Y-m-d', 'fin' => 'required_if:periodicite,date|date_format:Y-m-d', 'categorie' => 'boolean', 'id_categorie_compta' => 'required_if:categorie,1|numeric|in_table:compta_categories,id', ]); if (!$form->hasErrors()) { 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->add([ '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()); } } } $tpl->assign('categories', $cats->getList(Compta\Categories::RECETTES)); } $tpl->assign('liste', $cotisations->listWithStats()); $tpl->display('admin/membres/cotisations/index.tpl'); |
Modified src/www/admin/membres/cotisations/rappels.php from [6b9cc31b63] to [249872b4ce].
︙ | ︙ | |||
15 16 17 18 19 20 21 | { throw new UserException("Ce membre n'existe pas."); } $re = new Rappels_Envoyes; $cm = new Membres\Cotisations; | | | | | | < > | > > | < > | | | | | | < | 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 | { throw new UserException("Ce membre n'existe pas."); } $re = new Rappels_Envoyes; $cm = new Membres\Cotisations; if (f('save')) { $medias = implode(',', [$re::MEDIA_EMAIL, $re::MEDIA_COURRIER, $re::MEDIA_TELEPHONE, $re::MEDIA_AUTRE]); $form->check('add_rappel_' . $membre->id, [ 'id_cotisation' => 'numeric|required', 'media' => 'numeric|required|in:' . $medias, 'date' => 'required|date_format:Y-m-d' ]); if (!$form->hasErrors()) { try { $re->add([ 'id_rappel' => NULL, 'id_cotisation' => f('id_cotisation'), 'id_membre' => $membre->id, 'media' => f('media'), 'date' => f('date'), ]); Utils::redirect('/admin/membres/cotisations/rappels.php?id=' . $membre->id . '&ok'); } catch (UserException $e) { $form->addError($e->getMessage()); } } } $tpl->assign('ok', null !== qg('ok')); $tpl->assign('membre', $membre); $tpl->assign('cotisations', $cm->listSubscriptionsForMember($membre->id)); $tpl->assign('default_date', date('Y-m-d')); $tpl->assign('rappels', $re->listForMember($membre->id)); $tpl->assign('rappels_envoyes', $re); $tpl->display('admin/membres/cotisations/rappels.tpl'); |
Modified src/www/admin/membres/cotisations/supprimer.php from [01b29d1116] to [8fae79bc11].
︙ | ︙ | |||
24 25 26 27 28 29 30 | $membre = $membres->get($co->id_membre); if (!$membre) { throw new UserException("Le membre lié à la cotisation n'existe pas ou plus."); } | < < | | < < < < | < | 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 | $membre = $membres->get($co->id_membre); if (!$membre) { throw new UserException("Le membre lié à la cotisation n'existe pas ou plus."); } if (f('delete')) { if ($form->check('del_cotisation_' . $co->id)) { try { $m_cotisations->delete($co->id); Utils::redirect('/admin/membres/cotisations.php?id=' . $membre->id); } catch (UserException $e) { $form->addError($e->getMessage()); } } } $tpl->assign('membre', $membre); $tpl->assign('cotisation', $co); $tpl->assign('nb_operations', $m_cotisations->countOperationsCompta($co->id)); $tpl->display('admin/membres/cotisations/supprimer.tpl'); |