コード例 #1
0
ファイル: membre_cotisation.php プロジェクト: fferriere/web
// Impossible to access the file itself
if (!defined('PAGE_LOADED_USING_INDEX')) {
    trigger_error("Direct access forbidden.", E_USER_ERROR);
    exit;
}
$action = verifierAction(array('payer', 'telecharger_facture', 'envoyer_facture'));
$smarty->assign('action', $action);
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Personnes_Morales.php';
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Personnes_Physiques.php';
$personnes_physiques = new AFUP_Personnes_Physiques($bdd);
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Pays.php';
$pays = new AFUP_Pays($bdd);
$formulaire =& instancierFormulaire();
$identifiant = $droits->obtenirIdentifiant();
$champs = $personnes_physiques->obtenir($identifiant);
$cotisation = $personnes_physiques->obtenirDerniereCotisation($identifiant);
unset($champs['mot_de_passe']);
$cotisations = new AFUP_Cotisations($bdd);
if (!$cotisation) {
    $message = empty($_GET['hash']) ? 'Est-ce vraiment votre première cotisation ?' : '';
} else {
    $endSubscription = $cotisations->finProchaineCotisation($cotisation);
    $message = sprintf('Votre dernière cotisation -- %s %s -- est valable jusqu\'au %s. <br />
        Si vous renouvellez votre cotisation maintenant, celle-ci sera valable jusqu\'au %s', $cotisation['montant'], EURO, date("d/m/Y", $cotisation['date_fin']), $endSubscription->format('d/m/Y'));
}
if (isset($_GET['action']) && $_GET['action'] == 'envoyer_facture') {
    if ($cotisations->envoyerFacture($_GET['id'])) {
        AFUP_Logs::log('Envoi par email de la facture pour la cotisation n°' . $_GET['id']);
        afficherMessage('La facture a été envoyée par mail', 'index.php?page=membre_cotisation');
    } else {
        afficherMessage("La facture n'a pas pu être envoyée par mail", 'index.php?page=membre_cotisation', true);