Beispiel #1
0
//$action = verifierAction(array('lister', 'devis','facture','ajouter', 'modifier'));
//$tris_valides = array('Date', 'Evenement', 'catégorie', 'Description');
//$sens_valides = array('asc', 'desc');
$smarty->assign('action', $action);
require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Compta_Facture.php';
$comptaFact = new AFUP_Compta_Facture($bdd);
if ($action == 'lister') {
    $ecritures = $comptaFact->obtenirFacture();
    foreach ($ecritures as &$e) {
        $e['link'] = urlencode(base64_encode(mcrypt_cbc(MCRYPT_TripleDES, 'PaiementFactureAFUP_AFUP', $e['id'], MCRYPT_ENCRYPT, '@PaiFact')));
    }
    $smarty->assign('ecritures', $ecritures);
} elseif ($action == 'telecharger_facture') {
    $comptaFact->genererFacture($_GET['ref']);
} elseif ($action == 'envoyer_facture') {
    if ($comptaFact->envoyerfacture($_GET['ref'])) {
        AFUP_Logs::log('Envoi par email de la facture n°' . $_GET['ref']);
        afficherMessage('La facture a été envoyée', 'index.php?page=compta_facture&action=lister');
    } else {
        afficherMessage("La facture n'a pas pu être envoyée", 'index.php?page=compta_facture&action=lister', true);
    }
} elseif ($action == 'envoyer_facture') {
    if ($comptaFact->envoyerFacture($_GET['ref'])) {
        AFUP_Logs::log('Envoi par email de la facture n°' . $_GET['ref']);
        afficherMessage('La facture a été envoyée', 'index.php?page=compta_facture&action=lister');
    } else {
        afficherMessage("La facture n'a pas pu être envoyée", 'index.php?page=compta_facture&action=lister', true);
    }
} elseif ($action == 'ajouter' || $action == 'modifier') {
    require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Pays.php';
    $pays = new AFUP_Pays($bdd);