<?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."); } if (empty($_GET['id']) || !is_numeric($_GET['id'])) { throw new UserException("Argument du numéro de cotisation manquant."); } $id = (int) $_GET['id']; $cotisations = new Cotisations(); $m_cotisations = new Membres\Cotisations(); $co = $cotisations->get($id); if (!$co) { throw new UserException("Cette cotisation n'existe pas."); } $page = (int) Utils::get('p') ?: 1; $tpl->assign('page', $page); $tpl->assign('bypage', Membres\Cotisations::ITEMS_PER_PAGE); $tpl->assign('total', $m_cotisations->countMembersForCotisation($co['id'])); $tpl->assign('pagination_url', Utils::getSelfUrl(true) . '?id=' . $co['id'] . '&p=[ID]'); $tpl->assign('cotisation', $co); $tpl->assign('order', Utils::get('o') ?: 'date'); $tpl->assign('desc', !isset($_GET['a'])); $tpl->assign('liste', $m_cotisations->listMembersForCotisation($co['id'], $page, Utils::get('o'), isset($_GET['a']) ? false : true)); $tpl->display('admin/membres/cotisations/voir.tpl');
namespace Garradin; require_once __DIR__ . '/../_inc.php'; $journal = new Compta\Journal(); if (empty($_GET['id']) || !is_numeric($_GET['id'])) { throw new UserException("Argument du numéro de cotisation manquant."); } $id = (int) $_GET['id']; $m_cotisations = new Membres\Cotisations(); $cotisations = new Cotisations(); $mco = $m_cotisations->get($id); if (!$mco) { throw new UserException("La cotisation demandée n'existe pas."); } $co = $cotisations->get($mco['id_cotisation']); $membre = $membres->get($mco['id_membre']); if (!$membre) { throw new UserException("Le membre demandé n'existe pas."); } $liste_comptes = $comptes->getListAll(); function get_nom_compte($compte) { if (is_null($compte)) { return ''; } global $liste_comptes; return $liste_comptes[$compte]; } $tpl->register_modifier('get_nom_compte', 'Garradin\\get_nom_compte'); $tpl->assign('journal', $m_cotisations->listOperationsCompta($mco['id']));
<?php namespace Garradin; require_once __DIR__ . '/../../../_inc.php'; if ($user['droits']['membres'] < Membres::DROIT_ADMIN) { throw new UserException("Vous n'avez pas le droit d'accéder à cette page."); } if (!Utils::get('id') || !is_numeric(Utils::get('id'))) { throw new UserException("Argument du numéro de cotisation manquant."); } $cotisations = new Cotisations(); $co = $cotisations->get(Utils::get('id')); $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' => (double) 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();
$error = $e->getMessage(); } } } $tpl->assign('error', $error); $tpl->assign('membre', $membre); $tpl->assign('cotisations', $cotisations->listCurrent()); $tpl->assign('default_co', null); $tpl->assign('default_amount', 0.0); $tpl->assign('default_date', date('Y-m-d')); $tpl->assign('default_compta', null); $tpl->assign('moyens_paiement', $cats->listMoyensPaiement()); $tpl->assign('moyen_paiement', Utils::post('moyen_paiement') ?: 'ES'); $tpl->assign('comptes_bancaires', $banques->getList()); $tpl->assign('banque', Utils::post('banque')); if (Utils::get('cotisation')) { $co = $cotisations->get(Utils::get('cotisation')); if (!$co) { throw new UserException("La cotisation indiquée en paramètre n'existe pas."); } $tpl->assign('default_co', $co['id']); $tpl->assign('default_compta', $co['id_categorie_compta']); $tpl->assign('default_amount', $co['montant']); } elseif ($membre) { if (!empty($categorie['id_cotisation_obligatoire'])) { $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');