Exemple #1
0
<?php

namespace Garradin;

require_once __DIR__ . '/_inc.php';
$membre = $membres->getLoggedUser();
if (!$membre) {
    throw new UserException("Ce membre n'existe pas.");
}
$error = false;
$tpl->assign('membre', $membre);
$cats = new Membres\Categories();
$categorie = $cats->get($membre['id_categorie']);
$tpl->assign('categorie', $categorie);
$cotisations = new Membres\Cotisations();
if (!empty($categorie['id_cotisation_obligatoire'])) {
    $tpl->assign('cotisation', $cotisations->isMemberUpToDate($membre['id'], $categorie['id_cotisation_obligatoire']));
} else {
    $tpl->assign('cotisation', false);
}
$tpl->assign('nb_activites', $cotisations->countForMember($membre['id']));
$tpl->assign('cotisations', $cotisations->listForMember($membre['id']));
$tpl->assign('cotisations_membre', $cotisations->listSubscriptionsForMember($membre['id']));
$tpl->display('admin/mes_cotisations.tpl');
Exemple #2
0
<?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'] . '&amp;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');
Exemple #3
0
<?php

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');
Exemple #4
0
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 membre manquant.");
}
$id = (int) $_GET['id'];
$membre = $membres->get($id);
if (!$membre) {
    throw new UserException("Ce membre n'existe pas.");
}
$re = new Rappels_Envoyes();
$cm = new Membres\Cotisations();
$error = false;
if (Utils::post('save')) {
    if (!Utils::CSRF_check('add_rappel_' . $membre['id'])) {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    } else {
        try {
            $re->add(['id_rappel' => NULL, 'id_cotisation' => Utils::post('id_cotisation'), 'id_membre' => $membre['id'], 'media' => Utils::post('media'), 'date' => Utils::post('date')]);
            Utils::redirect('/admin/membres/cotisations/rappels.php?id=' . $membre['id'] . '&ok');
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
}
$tpl->assign('error', $error);
$tpl->assign('ok', isset($_GET['ok']));
Exemple #5
0
if ($user['droits']['membres'] < Membres::DROIT_ECRITURE) {
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}
$membre = false;
if (!empty($_GET['id']) && is_numeric($_GET['id'])) {
    $membre = $membres->get((int) $_GET['id']);
    if (!$membre) {
        throw new UserException("Ce membre n'existe pas.");
    }
    $cats = new Membres\Categories();
    $categorie = $cats->get($membre['id_categorie']);
} else {
    $categorie = ['id_cotisation_obligatoire' => false];
}
$cotisations = new Cotisations();
$m_cotisations = new Membres\Cotisations();
$cats = new Compta\Categories();
$banques = new Compta\Comptes_Bancaires();
$error = false;
if (!empty($_POST['add'])) {
    if (!Utils::CSRF_check('add_cotisation')) {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    } else {
        try {
            $data = ['date' => Utils::post('date'), 'id_cotisation' => Utils::post('id_cotisation'), 'id_membre' => Utils::post('id_membre'), 'id_auteur' => $user['id'], 'montant' => Utils::post('montant'), 'moyen_paiement' => Utils::post('moyen_paiement'), 'numero_cheque' => Utils::post('numero_cheque'), 'banque' => Utils::post('banque')];
            $m_cotisations->add($data);
            Utils::redirect('/admin/membres/cotisations.php?id=' . (int) Utils::post('id_membre'));
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
Exemple #6
0
<?php

namespace Garradin;

require_once __DIR__ . '/_inc.php';
$cats = new Membres\Categories();
$categorie = $cats->get($user['id_categorie']);
$tpl->assign('categorie', $categorie);
$wiki = new Wiki();
$page = $wiki->getByURI($config->get('accueil_connexion'));
$tpl->assign('page', $page);
$cats = new Membres\Categories();
$categorie = $cats->get($user['id_categorie']);
$cotisations = new Membres\Cotisations();
if (!empty($categorie['id_cotisation_obligatoire'])) {
    $tpl->assign('cotisation', $cotisations->isMemberUpToDate($user['id'], $categorie['id_cotisation_obligatoire']));
} else {
    $tpl->assign('cotisation', false);
}
$tpl->display('admin/index.tpl');
flush();
// Si pas de cron on réalise les tâches automatisées à ce moment-là
// c'est pas idéal mais mieux que rien
if (!USE_CRON) {
    require_once ROOT . '/cron.php';
}
Exemple #7
0
<?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;
$cotisations = new Cotisations();
$m_cotisations = new Membres\Cotisations();
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
    throw new UserException("Argument du numéro de cotisation membre manquant.");
}
$id = (int) $_GET['id'];
$co = $m_cotisations->get($id);
if (!$co) {
    throw new UserException("Cette cotisation membre n'existe pas.");
}
$membre = $membres->get($co['id_membre']);
if (!$membre) {
    throw new UserException("Le membre lié à la cotisation n'existe pas ou plus.");
}
$error = false;
if (!empty($_POST['delete'])) {
    if (!Utils::CSRF_check('del_cotisation_' . $co['id'])) {
        $error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
    } else {
        try {
            $m_cotisations->delete($co['id']);
            Utils::redirect('/admin/membres/cotisations.php?id=' . $membre['id']);