Overview
Comment: | modification de paiement membre |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
fcbb4978f26fae578ff45fa0b859f580 |
User & Date: | bohwaz on 2014-02-03 16:56:56 |
Other Links: | manifest | tags |
Context
2014-02-03
| ||
17:21 | Correction date et menu sélectionné check-in: bba50c927a user: bohwaz tags: trunk | |
16:56 | modification de paiement membre check-in: fcbb4978f2 user: bohwaz tags: trunk | |
16:44 | Simplification statut cotisation obligatoire check-in: d62276773e user: bohwaz tags: trunk | |
Changes
Modified src/include/class.membres_transactions.php from [4da2164ab2] to [006d1472dc].
︙ | ︙ | |||
38 39 40 41 42 43 44 | { throw new UserException('Type de transaction inconnu.'); } $data['id_transaction'] = $data['id_transaction'] ? (int) $data['id_transaction'] : null; } | | > | < > > > > > > | 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 | { throw new UserException('Type de transaction inconnu.'); } $data['id_transaction'] = $data['id_transaction'] ? (int) $data['id_transaction'] : null; } if (isset($data['id_membre'])) { if (!$db->simpleQuerySingle('SELECT 1 FROM membres WHERE id = ?;', false, (int) $data['id_membre'])) { throw new UserException('Membre inconnu ou invalide.'); } $data['id_membre'] = (int) $data['id_membre']; } } /** * Ajouter une transaction * @param array $data Tableau des champs à insérer * @return integer ID de la transaction créée */ public function add($data) { $db = DB::getInstance(); $this->_checkFields($data); if (empty($data['id_membre'])) { throw new UserException('Membre inconnu ou invalide.'); } $db->simpleInsert('membres_transactions', $data); $id = $db->lastInsertRowId(); // FIXME création écriture comptable return $id; |
︙ | ︙ | |||
152 153 154 155 156 157 158 | INNER JOIN transactions AS tr ON tr.id = mtr.id_transaction WHERE mtr.id_membre = ? AND ( (tr.duree IS NOT NULL AND mtr.date >= date(\'now\', \'-\'||tr.duree||\' days\')) OR (tr.fin IS NOT NULL AND tr.fin >= date(\'now\')) OR (tr.fin IS NULL AND tr.duree IS NULL) ) GROUP BY mtr.id_transaction | | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | INNER JOIN transactions AS tr ON tr.id = mtr.id_transaction WHERE mtr.id_membre = ? AND ( (tr.duree IS NOT NULL AND mtr.date >= date(\'now\', \'-\'||tr.duree||\' days\')) OR (tr.fin IS NOT NULL AND tr.fin >= date(\'now\')) OR (tr.fin IS NULL AND tr.duree IS NULL) ) GROUP BY mtr.id_transaction ORDER BY tr.intitule;', \SQLITE3_ASSOC, (int)$id); } public function isMemberUpToDate($id, $id_transaction) { $db = DB::getInstance(); return $db->simpleQuerySingle(' SELECT |
︙ | ︙ |
Added src/templates/admin/membres/transactions/modifier.tpl version [438f7b3562].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | {if $membre} {include file="admin/_head.tpl" title="Modifier un paiement pour le membre n°`$membre.id`" current="membres/transactions" js=1} <ul class="actions"> <li><a href="{$admin_url}membres/fiche.php?id={$membre.id|escape}">Membre n°{$membre.id|escape}</a></li> <li><a href="{$admin_url}membres/modifier.php?id={$membre.id|escape}">Modifier</a></li> {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN} <li><a href="{$admin_url}membres/supprimer.php?id={$membre.id|escape}">Supprimer</a></li> {/if} <li><a href="{$admin_url}membres/transactions.php?id={$membre.id|escape}">Suivi des paiements</a></li> <li class="current"><a href="{$admin_url}membres/transactions/ajout.php?id={$membre.id|escape}">Enregistrer un paiement</a></li> </ul> {else} {include file="admin/_head.tpl" title="Modifier un paiement" current="membres/transactions" js=1} <ul class="actions"> <li><a href="{$admin_url}membres/transactions/">Suivi des paiements</a></li> <li class="current"><a href="{$admin_url}membres/transactions/ajout.php">Saisie d'un paiement</a></li> <li><a href="{$admin_url}membres/transactions/rappels.php">État des rappels</a></li> </ul> {/if} {if $error} <p class="error">{$error|escape}</p> {/if} <form method="post" action="{$self_url|escape}"> <fieldset> <legend>Modifier un paiement</legend> <dl> <dt><label for="f_id_transaction">Cotisation ou activité liée</label></dt> <dd> <select id="f_id_transaction" name="id_transaction"> <option value="0" {form_field name="id_transaction" selected=0 data=$transaction}>-- Aucune, paiement non lié</option> {foreach from=$transactions item="tr"} <option value="{$tr.id|escape}" {form_field name="id_transaction" selected=$tr.id data=$transaction}> {$tr.intitule|escape} — {$tr.montant|html_money} {$config.monnaie|escape} — {if $tr.duree}pour {$tr.duree|escape} jours {elseif $tr.debut} du {$tr.debut|format_sqlite_date_to_french} au {$tr.fin|format_sqlite_date_to_french} {else} ponctuelle {/if} </option> {/foreach} </select> </dd> <dd class="help"> Un paiement non relié à une activité ou cotisation peut être par exemple un don ponctuel. </dd> <dt><label for="f_montant">Montant</label></dt> <dd><input type="number" size="5" name="montant" id="f_montant" value="{form_field name=montant data=$transaction}" min="0.00" step="0.01" /> {$config.monnaie|escape}</dd> <dt><label for="f_libelle">Libellé</label></dt> <dd><input type="text" name="libelle" id="f_libelle" value="{form_field name=libelle data=$transaction}" /></dd> <dt><label for="f_date">Date</label></dt> <dd><input type="date" name="date" id="f_date" value="{form_field name=date data=$transaction}" /></dd> </dl> </fieldset> <p class="submit"> {csrf_field key="edit_transaction_`$transaction.id`"} <input type="submit" name="edit" value="Enregistrer →" /> </p> </form> {include file="admin/_foot.tpl"} |
Added src/www/admin/membres/transactions/modifier.php version [8873051626].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?php namespace Garradin; require_once __DIR__ . '/../../_inc.php'; if ($user['droits']['membres'] < Membres::DROIT_ECRITURE) { throw new UserException("Vous n'avez pas le droit d'accéder à cette page."); } $membre = false; $transactions = new Transactions; $m_transactions = new Membres_Transactions; if (empty($_GET['id']) || !is_numeric($_GET['id'])) { throw new UserException("Argument du numéro de transaction manquant."); } $id = (int) $_GET['id']; $tr = $m_transactions->get($id); if (!$tr) { throw new UserException("Ce paiement n'existe pas."); } $membre = $membres->get($tr['id_membre']); if (!$membre) { throw new UserException("Le membre lié au paiement n'existe pas ou plus."); } $error = false; if (!empty($_POST['edit'])) { if (!utils::CSRF_check('edit_transaction_' . $tr['id'])) { $error = 'Une erreur est survenue, merci de renvoyer le formulaire.'; } else { try { $m_transactions->edit($tr['id'], [ 'libelle' => utils::post('libelle'), 'date' => utils::post('date'), 'id_transaction' => utils::post('id_transaction'), 'montant' => (float) utils::post('montant'), ]); utils::redirect('/admin/membres/transactions.php?id=' . $membre['id']); } catch (UserException $e) { $error = $e->getMessage(); } } } $tpl->assign('error', $error); $tpl->assign('membre', $membre); $tpl->assign('transaction', $tr); $tpl->assign('transactions', $transactions->listCurrent()); $tpl->display('admin/membres/transactions/modifier.tpl'); ?> |