Exemplo n.º 1
0
<?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();
Exemplo n.º 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');
Exemplo n.º 3
0
<?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'));
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);
Exemplo n.º 4
0
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 rappel manquant.");
}
$rappels = new Rappels();
$rappel = $rappels->get(Utils::get('id'));
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');
Exemplo n.º 5
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');
Exemplo n.º 6
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.");
}
$cotisations = new Cotisations();
if ($user['droits']['membres'] >= Membres::DROIT_ADMIN) {
    $cats = new Compta\Categories();
    $error = false;
    if (!empty($_POST['save'])) {
        if (!Utils::CSRF_check('new_cotisation')) {
            $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->add(['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();
            }
        }
    }
    $tpl->assign('error', $error);
    $tpl->assign('categories', $cats->getList(Compta\Categories::RECETTES));
}
Exemplo n.º 7
0
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;
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();
        }