. */ /* */ /*************************************************************************************/ include_once __DIR__ . '/../../fonctions/error_reporting.php'; include_once(__DIR__ . "/../../classes/Navigation.class.php"); include_once(__DIR__ . "/../../classes/Administrateur.class.php"); include_once(__DIR__ . "/../../fonctions/modules.php"); session_start(); $commande = new Commande(); $commande->charger_ref($_GET['ref']); // Si un client est identifié mais n'est pas celui qui a commandé ou que la commande n'est pas payée // ou qu'un admin identifié n'est pas autorisé if( ! ((isset($_SESSION['navig']) && $_SESSION['navig']->connecte && $_SESSION['navig']->client->id == $commande->client && $commande->facture != "") || (isset($_SESSION["util"]) && est_autorise("acces_commandes")))) exit; // Compatibilité 1.4 -> On utilise le modèle PDF si il existe if (file_exists(__DIR__.'/modeles/facture.php')) { include_once(__DIR__ . "/../../classes/Commande.class.php"); include_once(__DIR__ . "/../../classes/Client.class.php"); include_once(__DIR__ . "/../../classes/Venteprod.class.php"); include_once(__DIR__ . "/../../classes/Produit.class.php"); include_once(__DIR__ . "/../../classes/Adresse.class.php"); include_once(__DIR__ . "/../../classes/Zone.class.php"); include_once(__DIR__ . "/../../classes/Pays.class.php"); include_once(__DIR__ . "/../../fonctions/divers.php"); $client = new Client(); $client->charger_id($commande->client); $pays = new Pays(); $pays->charger($client->pays); $zone = new Zone(); $zone->charger($pays->zone); include_once(__DIR__ . "/modeles/facture.php"); $facture = new Facture(); $facture->creer($_GET['ref']); exit(); } // Le moteur ne sortira pas le contenu de $res $sortie = false; // Le fond est le template de facture. $reptpl = __DIR__ . "/template/"; $fond = "facture.html"; $lang = $commande->lang; // Compatibilité avec le moteur. $_REQUEST['commande'] = $_GET['ref']; require_once(__DIR__ . "/../../fonctions/moteur.php"); require_once(__DIR__ . "/../../classes/Pdf.class.php"); // clean the output buffer ob_clean(); Pdf::instance()->generer($res, $_GET['ref'] . ".pdf"); ?>