From f191dfc7e68d1e1eabd5667b5626b8a5983407ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Jul 2006 13:45:06 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Le=20composant=20show=5Fdocument=20renvo?= =?UTF-8?q?i=20le=20model=20sous=20le=20nom=20'model'=20partout=20(certain?= =?UTF-8?q?es=20parties=20de=20code=20utilisaient=20'model',=20d'autre=20'?= =?UTF-8?q?modelpdf').=20On=20prendre=20'model'=20car=20l'architecture=20D?= =?UTF-8?q?olibarr=20peut=20tres=20bien=20g=E9n=E9r=E9=20des=20documents?= =?UTF-8?q?=20non=20pdf,=20tout=20depend=20uniquement=20du=20module=20de?= =?UTF-8?q?=20generation=20(exemple=20les=20dons=20generent=20des=20modele?= =?UTF-8?q?s=20html).=20Trad:=20Traduction=20etat=20promesses=20de=20dons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/addpropal.php | 2 +- htdocs/comm/propal.php | 12 +- htdocs/commande/fiche.php | 14 +- htdocs/compta/commande/fiche.php | 2 +- htdocs/compta/dons/liste.php | 2 +- htdocs/compta/facture.php | 16 +- htdocs/don.class.php | 24 +-- htdocs/expedition/fiche.php | 2 +- .../pdf/pdf_expedition_dorade.modules.php | 162 +++++++++++------- .../mods/pdf/pdf_expedition_merou.modules.php | 150 ++++++++++------ .../pdf/pdf_expedition_rouget.modules.php | 140 +++++++++++---- htdocs/exports/export.php | 2 +- htdocs/fichinter/fiche.php | 10 +- htdocs/fourn/commande/fiche.php | 3 +- htdocs/html.form.class.php | 2 +- htdocs/langs/en_US/donations.lang | 9 +- htdocs/langs/fr_FR/donations.lang | 7 +- htdocs/livraison/fiche.php | 2 +- 18 files changed, 363 insertions(+), 198 deletions(-) diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index 52ae082fc4c..4f059f45ab7 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -230,7 +230,7 @@ if ($_GET["action"] == 'create') print ''; $model=new ModelePDFPropales(); $liste=$model->liste_modeles($db); - $html->select_array("modelpdf",$liste,$conf->global->PROPALE_ADDON_PDF); + $html->select_array('model',$liste,$conf->global->PROPALE_ADDON_PDF); print ""; // Projet diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index e61380e27f5..d9d1500c3fb 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -184,7 +184,7 @@ if ($_POST['action'] == 'add') $propal->socidp = $_POST['socidp']; $propal->contactid = $_POST['contactidp']; $propal->projetidp = $_POST['projetidp']; - $propal->modelpdf = $_POST['modelpdf']; + $propal->modelpdf = $_POST['model']; $propal->author = $user->id; $propal->note = $_POST['note']; $propal->ref = $_POST['ref']; @@ -208,7 +208,7 @@ if ($_POST['action'] == 'add') $propal->contactid = $_POST['contactidp']; $propal->projetidp = $_POST['projetidp']; - $propal->modelpdf = $_POST['modelpdf']; + $propal->modelpdf = $_POST['model']; $propal->author = $user->id; $propal->note = $_POST['note']; $propal->ref_client = $_POST['ref_client']; @@ -258,7 +258,7 @@ if ($_POST['action'] == 'add') $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - propale_pdf_create($db, $id, $_POST['modelpdf'], $outputlangs); + propale_pdf_create($db, $id, $_REQUEST['model'], $outputlangs); dolibarr_syslog('Redirect to '.$_SERVER["PHP_SELF"].'?propalid='.$id); Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id); exit; @@ -540,9 +540,9 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer) { $propal = new Propal($db); $propal->fetch($_GET['propalid']); - if ($_POST['modelpdf']) + if ($_REQUEST['model']) { - $propal->set_pdf_model($user, $_POST['modelpdf']); + $propal->set_pdf_model($user, $_REQUEST['model']); } if ($_REQUEST['lang_id']) @@ -1498,7 +1498,7 @@ if ($_GET['propalid'] > 0) $var=true; - $html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); + $somethingshown=$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); /* diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 8482b910350..020e5bd8428 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -97,7 +97,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer) //$commande->remise_absolue = $_POST['remise_absolue']; //la remise était appliquée sur les lignes et sur le total //$commande->remise_percent = $_POST['remise_percent']; $commande->ref_client = $_POST['ref_client']; - $commande->modelpdf = $_POST['modelpdf']; + $commande->modelpdf = $_POST['model']; $commande->cond_reglement_id = $_POST['cond_reglement_id']; $commande->mode_reglement_id = $_POST['mode_reglement_id']; $commande->date_livraison = $datelivraison; @@ -449,9 +449,9 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post // Sauvegarde le dernier modèle choisi pour générer un document $commande = new Commande($db, 0, $_REQUEST['id']); $commande->fetch($_REQUEST['id']); - if ($_REQUEST['modelpdf']) + if ($_REQUEST['model']) { - $commande->set_pdf_model($user, $_REQUEST['modelpdf']); + $commande->set_pdf_model($user, $_REQUEST['model']); } if ($_REQUEST['lang_id']) @@ -774,13 +774,13 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) print ''.$langs->trans('Source').''; $html->selectSourcesCommande('','source_id',1); print ''; - print ''.$langs->trans("Model").''; + print ''.$langs->trans('Model').''; print ''; // pdf include_once(DOL_DOCUMENT_ROOT.'/includes/modules/commande/modules_commande.php'); $model=new ModelePDFCommandes(); $liste=$model->liste_modeles($db); - $html->select_array("modelpdf",$liste,$conf->global->COMMANDE_ADDON_PDF); + $html->select_array('model',$liste,$conf->global->COMMANDE_ADDON_PDF); print ""; if ($propalid > 0) @@ -1646,7 +1646,7 @@ else $genallowed=$user->rights->commande->creer; $delallowed=$user->rights->commande->supprimer; - $html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); + $somethingshown=$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); /* * Liste des factures @@ -1809,7 +1809,7 @@ else $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - $result=commande_pdf_create($db, $_REQUEST['id'], '', $_REQUEST['modelpdf'], $outputlangs); + $result=commande_pdf_create($db, $_REQUEST['id'], '', $_REQUEST['model'], $outputlangs); if ($result <= 0) { dolibarr_print_error($db,$result); diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 8d269a9f26f..2c3d97b780c 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -553,7 +553,7 @@ if ($_GET["id"] > 0) $genallowed=0; $delallowed=0; - $html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); + $somethingshown=$html->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); /* * Liste des factures diff --git a/htdocs/compta/dons/liste.php b/htdocs/compta/dons/liste.php index dc3d9d91808..b6fcfc3f7d6 100644 --- a/htdocs/compta/dons/liste.php +++ b/htdocs/compta/dons/liste.php @@ -18,7 +18,6 @@ * * $Id$ * $Source$ - * */ /** @@ -31,6 +30,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT ."/don.class.php"); +$langs->load("companies"); $langs->load("donations"); $sortorder=$_GET["sortorder"]; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 62ea8fbb3d9..b08f95987a9 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -195,7 +195,7 @@ if ($_POST['action'] == 'add') $facture->note_public = $_POST['note_public']; $facture->note = $_POST['note']; $facture->ref_client = $_POST['ref_client']; - $facture->modelpdf = $_POST['modelpdf']; + $facture->modelpdf = $_POST['model']; if ($_POST['fac_rec'] > 0) { @@ -701,9 +701,9 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post $facture = new Facture($db, 0, $_GET['facid']); $facture->fetch($_GET['facid']); - if ($_REQUEST['modelpdf']) + if ($_REQUEST['model']) { - $facture->set_pdf_model($user, $_REQUEST['modelpdf']); + $facture->set_pdf_model($user, $_REQUEST['model']); } if ($_REQUEST['lang_id']) @@ -914,13 +914,13 @@ if ($_GET['action'] == 'create') print ''; } - print ''.$langs->trans("Model").''; - print ''; + print ''.$langs->trans('Model').''; + print ''; // pdf include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php'); $model=new ModelePDFFactures(); $liste=$model->liste_modeles($db); - $html->select_array("modelpdf",$liste,$conf->global->FACTURE_ADDON_PDF); + $html->select_array('model',$liste,$conf->global->FACTURE_ADDON_PDF); print ""; // Note publique @@ -2334,7 +2334,7 @@ else $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - $result=facture_pdf_create($db, $fac->id, '', $_REQUEST['modelpdf'], $outputlangs); + $result=facture_pdf_create($db, $fac->id, '', $_REQUEST['model'], $outputlangs); if ($result <= 0) { dolibarr_print_error($db,$result); @@ -2389,7 +2389,7 @@ else $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - $result=facture_pdf_create($db, $fac->id, '', $_REQUEST['modelpdf'], $outputlangs); + $result=facture_pdf_create($db, $fac->id, '', $_REQUEST['model'], $outputlangs); if ($result <= 0) { dolibarr_print_error($db,$result); diff --git a/htdocs/don.class.php b/htdocs/don.class.php index 989b609d99d..9c60d497456 100644 --- a/htdocs/don.class.php +++ b/htdocs/don.class.php @@ -70,9 +70,12 @@ class Don $this->modepaiementid = 0; $langs->load("donations"); - $this->labelstatut[0]=$langs->trans("DonationStatusPromessNotValidated"); - $this->labelstatut[1]=$langs->trans("DonationStatusPromessValidated"); + $this->labelstatut[0]=$langs->trans("DonationStatusPromiseNotValidated"); + $this->labelstatut[1]=$langs->trans("DonationStatusPromiseValidated"); $this->labelstatut[2]=$langs->trans("DonationStatusPayed"); + $this->labelstatutshort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort"); + $this->labelstatutshort[1]=$langs->trans("DonationStatusPromiseValidatedShort"); + $this->labelstatutshort[2]=$langs->trans("DonationStatusPayedShort"); } @@ -98,20 +101,17 @@ class Don if ($mode == 0) { - $prefix=''; return $this->labelstatut[$statut]; } if ($mode == 1) { - $prefix='Short'; - return $this->labelstatut[$statut]; + return $this->labelstatutshort[$statut]; } if ($mode == 2) { - $prefix='Short'; - if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatut[$statut]; - if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; - if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; + if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatutshort[$statut]; + if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatutshort[$statut]; + if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatutshort[$statut]; } if ($mode == 3) { @@ -129,9 +129,9 @@ class Don if ($mode == 5) { $prefix='Short'; - if ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); - if ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); - if ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); + if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); + if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); + if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); } } diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 1c622e3e08d..bbbb6afc1a5 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -583,7 +583,7 @@ else //$genallowed=1; //$delallowed=0; - $result=$html->show_documents('expedition',$expeditionref,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf); + $somethingshown=$html->show_documents('expedition',$expeditionref,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf); /* * Déjà livre diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php index 0e830b7b6bd..8d4ad762525 100644 --- a/htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php +++ b/htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php @@ -22,14 +22,34 @@ * $Source$ */ +/** + \file htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php + \ingroup expedition + \brief Fichier de la classe permettant de générer les bordereaux envoi au modèle Dorade + \version $Revision$ +*/ + require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php"; +/** + \class pdf_expedition_dorade + \brief Classe permettant de générer les borderaux envoi au modèle Dorade +*/ + Class pdf_expedition_dorade extends ModelePdfExpedition { + var $emetteur; // Objet societe qui emet + + /** + \brief Constructeur + \param db Handler accès base de donnée + */ function pdf_expedition_dorade($db=0) { + global $conf,$langs,$mysoc; + $this->db = $db; $this->name = "dorade"; $this->description = "Modèle identique au rouget utilisé pour debug uniquement."; @@ -40,6 +60,10 @@ Class pdf_expedition_dorade extends ModelePdfExpedition $this->format = array($this->page_largeur,$this->page_hauteur); $this->option_logo = 0; + + // Recupere emmetteur + $this->emetteur=$mysoc; + if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini } @@ -87,7 +111,7 @@ Class pdf_expedition_dorade extends ModelePdfExpedition function generate(&$objExpe, $filename, $outputlangs='') { - global $user,$conf,$langs,$mysoc; + global $user,$conf,$langs; if (! is_object($outputlangs)) $outputlangs=$langs; $outputlangs->load("main"); @@ -98,70 +122,92 @@ Class pdf_expedition_dorade extends ModelePdfExpedition $outputlangs->setPhpLang(); - $this->expe = $objExpe; - - $this->expe->fetch_commande(); - - // Définition de $dir et $file - if ($this->expe->specimen) + if ($conf->expedition->dir_output) { - $dir = $conf->propal->dir_output; - $file = $dir . "/SPECIMEN.pdf"; - } - else - { - $expref = sanitize_string($this->expe->ref); - $dir = $conf->expedition->dir_output . "/" . $expref; - $file = $dir . "/" . $expref . ".pdf"; - } + $this->expe = $objExpe; + $this->expe->fetch_commande(); - if (! file_exists($dir)) - { - if (create_exdir($dir) < 0) + // Définition de $dir et $file + if ($this->expe->specimen) { - $this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); - return 0; + $dir = $conf->expedition->dir_output; + $file = $dir . "/SPECIMEN.pdf"; + } + else + { + $expref = sanitize_string($this->expe->ref); + $dir = $conf->expedition->dir_output . "/" . $expref; + $file = $dir . "/" . $expref . ".pdf"; } - } - - $filename=$file; - - $this->pdf = new ModelePdfExpedition(); - $this->pdf->expe = &$this->expe; - $this->pdf->Open(); - $this->pdf->AliasNbPages(); - $this->pdf->AddPage(); + if (! file_exists($dir)) + { + if (create_exdir($dir) < 0) + { + $this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); + return 0; + } + } - $this->pdf->SetTitle($objExpe->ref); - $this->pdf->SetSubject("Bordereau d'expedition"); - $this->pdf->SetCreator("Dolibarr ".DOL_VERSION); - //$this->pdf->SetAuthor($user->fullname); - - /* - * - */ - $this->pdf->SetTextColor(0,0,0); - $this->pdf->SetFont('Arial','', 16); - - $this->expe->fetch_lignes(); - - for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++) - { - $a = $this->pdf->tableau_top + 14 + ($i * 16); - - $this->pdf->i25(8, ($a - 2), "000000".$this->expe->lignes[$i]->fk_product, 1, 8); - - $this->pdf->Text(40, $a, $this->expe->lignes[$i]->description); - - $this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande); - - $this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition); - } - - $this->pdf->Output($filename); + if (file_exists($dir)) + { + $filename=$file; + + $this->pdf = new ModelePdfExpedition(); + $this->pdf->expe = &$this->expe; + + $this->pdf->Open(); + $this->pdf->AliasNbPages(); + $this->pdf->AddPage(); + + $this->pdf->SetTitle($objExpe->ref); + $this->pdf->SetSubject("Bordereau d'expedition"); + $this->pdf->SetCreator("Dolibarr ".DOL_VERSION); + //$this->pdf->SetAuthor($user->fullname); + + /* + * + */ + $this->pdf->SetTextColor(0,0,0); + $this->pdf->SetFont('Arial','', 16); + + $this->expe->fetch_lignes(); + + for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++) + { + $a = $this->pdf->tableau_top + 14 + ($i * 16); + + $this->pdf->i25(8, ($a - 2), "000000".$this->expe->lignes[$i]->fk_product, 1, 8); + + $this->pdf->Text(40, $a, $this->expe->lignes[$i]->description); + + $this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande); + + $this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition); + } + + $this->pdf->Output($filename); + + $langs->setPhpLang(); // On restaure langue session + return 1; + } + else + { + $this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); + $langs->setPhpLang(); // On restaure langue session + return 0; + } + } + else + { + $this->error=$outputlangs->trans("ErrorConstantNotDefined","EXP_OUTPUTDIR"); + $langs->setPhpLang(); // On restaure langue session + return 0; + } + $this->error=$outputlangs->trans("ErrorUnknown"); + $langs->setPhpLang(); // On restaure langue session + return 0; // Erreur par defaut - return 1; } } ?> diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php index 7a78bd60bec..baacab0a024 100644 --- a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php +++ b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php @@ -1,7 +1,7 @@ - * Copyright (C) 2005 Laurent Destailleur - * Copyright (C) 2005 Regis Houssin +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2006 Laurent Destailleur + * Copyright (C) 2005 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,14 +22,34 @@ * $Source$ */ +/** + \file htdocs/expedition/mods/pdf/pdf_expedition_dorade.modules.php + \ingroup expedition + \brief Fichier de la classe permettant de générer les bordereaux envoi au modèle Merou + \version $Revision$ +*/ + require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php"; require_once DOL_DOCUMENT_ROOT."/contact.class.php"; +/** + \class pdf_expedition_dorade + \brief Classe permettant de générer les borderaux envoi au modèle Merou +*/ + Class pdf_expedition_merou extends ModelePdfExpedition { + var $emetteur; // Objet societe qui emet + + /** + \brief Constructeur + \param db Handler accès base de donnée + */ function pdf_expedition_merou($db=0) { + global $conf,$langs,$mysoc; + $this->db = $db; $this->name = "Merou"; $this->description = "Modele Merou 2xA5 \n @@ -46,15 +66,20 @@ Class pdf_expedition_merou extends ModelePdfExpedition $this->format = array($this->page_largeur,$this->page_hauteur); $this->option_logo = 1; // Affiche logo + + // Recupere emmetteur + $this->emetteur=$mysoc; + if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini } + //***************************** //Creation du Document //Initialisation des données //***************************** function generate(&$objExpe, $file, $outputlangs='') { - global $user,$conf,$langs,$mysoc; + global $user,$conf,$langs; if (! is_object($outputlangs)) $outputlangs=$langs; $outputlangs->load("main"); @@ -65,51 +90,54 @@ Class pdf_expedition_merou extends ModelePdfExpedition $outputlangs->setPhpLang(); - //Initialisation des langues - $langs->load("main"); - $langs->load("bills"); - $langs->load("products"); //Generation de la fiche $this->expe = $objExpe; $this->expe->fetch_commande(); - //Creation du Client - $soc = new Societe($this->db); - $soc->fetch($this->expe->commande->socidp); - - //Creation de l expediteur - $this->expediteur = $soc; - //Creation du destinataire - $this->destinataire = new Contact($this->db); -// $pdf->expe->commande->fetch($pdf->commande->id); -//print_r($pdf->expe); - $idcontact = $this->expe->commande->getIdContact('external','DESTINATAIRE'); - $this->destinataire->fetch($idcontact[0]); - - //Creation du livreur - $idcontact = $this->expe->commande->getIdContact('internal','LIVREUR'); - $this->livreur = new User($this->db,$idcontact[0]); - if ($idcontact[0]) $this->livreur->fetch(); - //Verification de la configuration if ($conf->expedition->dir_output) { - $expeditionref = sanitize_string($this->expe->ref); - $dir = $conf->expedition->dir_output . "/" . $expeditionref; - $file = $dir . "/" . $expeditionref . ".pdf"; + //Creation du Client + $soc = new Societe($this->db); + $soc->fetch($this->expe->commande->socidp); + + //Creation de l expediteur + $this->expediteur = $soc; + //Creation du destinataire + $this->destinataire = new Contact($this->db); + // $pdf->expe->commande->fetch($pdf->commande->id); + //print_r($pdf->expe); + $idcontact = $this->expe->commande->getIdContact('external','DESTINATAIRE'); + $this->destinataire->fetch($idcontact[0]); + + //Creation du livreur + $idcontact = $this->expe->commande->getIdContact('internal','LIVREUR'); + $this->livreur = new User($this->db,$idcontact[0]); + if ($idcontact[0]) $this->livreur->fetch(); + - //Si le dossier n existe pas - if (! file_exists($dir)) - { - umask(0); - - //On tente de le creer - if (! mkdir($dir, 0755)) - { - $pdf->error=$langs->trans("ErrorCanNotCreateDir",$dir); - return 0; - } - } + // Définition de $dir et $file + if ($this->expe->specimen) + { + $dir = $conf->expedition->dir_output; + $file = $dir . "/SPECIMEN.pdf"; + } + else + { + $expref = sanitize_string($this->expe->ref); + $dir = $conf->expedition->dir_output . "/" . $expref; + $file = $dir . "/" . $expref . ".pdf"; + } + + if (! file_exists($dir)) + { + if (create_exdir($dir) < 0) + { + $this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); + return 0; + } + } + //Si le dossier existe if (file_exists($dir)) { @@ -179,16 +207,34 @@ Class pdf_expedition_merou extends ModelePdfExpedition $pdf->SetFont('Arial','', 7); } } - //Insertio ndu pied de page - $this->_pagefoot($pdf); - $pdf->AliasNbPages(); - //Cloture du pdf - $pdf->Close(); - //Ecriture du pdf - $pdf->Output($file); - return 1; + //Insertion du pied de page + $this->_pagefoot($pdf); + $pdf->AliasNbPages(); + //Cloture du pdf + $pdf->Close(); + //Ecriture du pdf + $pdf->Output($file); + + $langs->setPhpLang(); // On restaure langue session + return 1; } + else + { + $this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); + $langs->setPhpLang(); // On restaure langue session + return 0; + } } + else + { + $this->error=$outputlangs->trans("ErrorConstantNotDefined","EXP_OUTPUTDIR"); + $langs->setPhpLang(); // On restaure langue session + return 0; + } + $this->error=$outputlangs->trans("ErrorUnknown"); + $langs->setPhpLang(); // On restaure langue session + return 0; // Erreur par defaut + } //******************************** @@ -239,7 +285,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition //******************************** function _pagehead(&$pdf, $exp) { - global $conf, $langs, $mysoc; + global $conf, $langs; $tab4_top = 60; $tab4_hl = 6; @@ -247,8 +293,8 @@ Class pdf_expedition_merou extends ModelePdfExpedition $ligne = 2; //*********************LOGO**************************** - $logo=$conf->societe->dir_logos.'/'.$mysoc->logo; - if ($mysoc->logo) + $logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo; + if ($this->emetteur->logo) { if (is_readable($logo)) { diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php index 807b7cfd4f0..56d4fe8bfcb 100644 --- a/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php +++ b/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php @@ -21,14 +21,34 @@ * $Source$ */ +/** + \file htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php + \ingroup expedition + \brief Fichier de la classe permettant de générer les bordereaux envoi au modèle Rouget + \version $Revision$ +*/ + require_once DOL_DOCUMENT_ROOT."/expedition/mods/pdf/ModelePdfExpedition.class.php"; +/** + \class pdf_expedition_dorade + \brief Classe permettant de générer les borderaux envoi au modèle Rouget +*/ + Class pdf_expedition_rouget extends ModelePdfExpedition { + var $emetteur; // Objet societe qui emet + + /** + \brief Constructeur + \param db Handler accès base de donnée + */ function pdf_expedition_rouget($db=0) { + global $conf,$langs,$mysoc; + $this->db = $db; $this->name = "rouget"; $this->description = "Modèle simple."; @@ -39,6 +59,10 @@ Class pdf_expedition_rouget extends ModelePdfExpedition $this->format = array($this->page_largeur,$this->page_hauteur); $this->option_logo = 0; + + // Recupere emmetteur + $this->emetteur=$mysoc; + if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini } function Header() @@ -68,7 +92,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition function generate(&$objExpe, $filename, $outputlangs='') { - global $user,$conf,$langs,$mysoc; + global $user,$conf,$langs; if (! is_object($outputlangs)) $outputlangs=$langs; $outputlangs->load("main"); @@ -79,43 +103,87 @@ Class pdf_expedition_rouget extends ModelePdfExpedition $outputlangs->setPhpLang(); - $this->expe = $objExpe; - - $this->pdf = new FPDF(); - $this->pdf->expe = &$this->expe; - - $this->pdf->Open(); - $this->pdf->AliasNbPages(); - $this->pdf->AddPage(); - - $this->pdf->SetTitle($objExpe->ref); - $this->pdf->SetSubject($langs->trans("Sending")); - $this->pdf->SetCreator("Dolibarr ".DOL_VERSION); - //$this->pdf->SetAuthor($user->fullname); - - /* - * - */ - - $this->pdf->SetTextColor(0,0,0); - $this->pdf->SetFont('Arial','', 14); - - $this->expe->fetch_lignes(); - - for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++) + if ($conf->expedition->dir_output) { - $a = $this->pdf->tableau_top + 14 + ($i * 7); - - $this->pdf->Text(8, $a, $this->expe->lignes[$i]->description); - - $this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande); - - $this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition); - } - - $this->pdf->Output($filename); + $this->expe = $objExpe; - return 1; + // Définition de $dir et $file + if ($this->expe->specimen) + { + $dir = $conf->expedition->dir_output; + $file = $dir . "/SPECIMEN.pdf"; + } + else + { + $expref = sanitize_string($this->expe->ref); + $dir = $conf->expedition->dir_output . "/" . $expref; + $file = $dir . "/" . $expref . ".pdf"; + } + + if (! file_exists($dir)) + { + if (create_exdir($dir) < 0) + { + $this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); + return 0; + } + } + + if (file_exists($dir)) + { + $this->pdf = new FPDF(); + $this->pdf->expe = &$this->expe; + + $this->pdf->Open(); + $this->pdf->AliasNbPages(); + $this->pdf->AddPage(); + + $this->pdf->SetTitle($objExpe->ref); + $this->pdf->SetSubject($langs->trans("Sending")); + $this->pdf->SetCreator("Dolibarr ".DOL_VERSION); + //$this->pdf->SetAuthor($user->fullname); + + /* + * + */ + + $this->pdf->SetTextColor(0,0,0); + $this->pdf->SetFont('Arial','', 14); + + $this->expe->fetch_lignes(); + + for ($i = 0 ; $i < sizeof($this->expe->lignes) ; $i++) + { + $a = $this->pdf->tableau_top + 14 + ($i * 7); + + $this->pdf->Text(8, $a, $this->expe->lignes[$i]->description); + + $this->pdf->Text(170, $a, $this->expe->lignes[$i]->qty_commande); + + $this->pdf->Text(194, $a, $this->expe->lignes[$i]->qty_expedition); + } + + $this->pdf->Output($filename); + + $langs->setPhpLang(); // On restaure langue session + return 1; + } + else + { + $this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); + $langs->setPhpLang(); // On restaure langue session + return 0; + } + } + else + { + $this->error=$outputlangs->trans("ErrorConstantNotDefined","EXP_OUTPUTDIR"); + $langs->setPhpLang(); // On restaure langue session + return 0; + } + $this->error=$outputlangs->trans("ErrorUnknown"); + $langs->setPhpLang(); // On restaure langue session + return 0; // Erreur par defaut } } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index fe121423692..c9f78eeffe1 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -117,7 +117,7 @@ if ($step == 1 || $action == 'cleanselect') if ($action == 'builddoc') { // Genère le fichier - $result=$objexport->build_file($user, $_POST["model"], $datatoexport, $array_selected); + $result=$objexport->build_file($user, $_POST['model'], $datatoexport, $array_selected); if ($result < 0) { $mesg='
'.$objexport->error.'
'; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 9268b25c88f..44d4a55daf5 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -126,7 +126,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post llxHeader(); -$sel = new Form($db); +$html = new Form($db); /* * @@ -176,7 +176,7 @@ if ($_GET["action"] == 'create') print "".$langs->trans("Company")."".$societe->getNomUrl(1).""; print "".$langs->trans("Date").""; - $sel->select_date(time(),"p",'','','','fichinter'); + $html->select_date(time(),"p",'','','','fichinter'); print ""; print ""; @@ -265,7 +265,7 @@ if ($_GET["action"] == 'edit') // Date print "".$langs->trans("Date").""; - $sel->select_date($fichinter->date,'','','','','update'); + $html->select_date($fichinter->date,'','','','','update'); print ""; print ''.$langs->trans("Duration")." (".$langs->trans("days").')'; @@ -274,7 +274,7 @@ if ($_GET["action"] == 'edit') { // Projet associé print ''.$langs->trans("Project").''; - $sel->select_projects($fichinter->societe_id,$fichinter->projet_id,"projetidp"); + $html->select_projects($fichinter->societe_id,$fichinter->projet_id,"projetidp"); print ''; } @@ -397,7 +397,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit') $var=true; print "
\n"; - $sel->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$ficheinter->modelpdf); + $somethingshown=$html->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$ficheinter->modelpdf); print ""; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 93ed9072304..9ff10b8b5cd 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -615,8 +615,7 @@ if ($_GET["id"] > 0) print '
'; } */ - //$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); - $html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$commande->statut>0?1:0,$delallowed,$commande->modelpdf); + $somethingshown=$html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$commande->statut>0?1:0,$delallowed,$commande->modelpdf); print ''; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 3246711a17e..3f97af430f1 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -2468,7 +2468,7 @@ class Form print ''; print ''.$langs->trans('Model').''; print ''; - $this->select_array('modelpdf',$modellist,$modelselected,0,0,1); + $this->select_array('model',$modellist,$modelselected,0,0,1); $texte=$langs->trans('Generate'); print ''; print ''; diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 9b0422f3a35..5e04bbcee9c 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -13,8 +13,11 @@ DonationsReceived=Donations received PublicDonation=Public donation DonationsNumber=Donation number DonationsArea=Donations area -DonationStatusPromessNotValidated=Draft promess -DonationStatusPromessValidated=Validated promess +DonationStatusPromiseNotValidated=Draft promise +DonationStatusPromiseValidated=Validated promise DonationStatusPayed=Donation received -ValidPromess=Validate promess +DonationStatusPromiseNotValidatedShort=Draft +DonationStatusPromiseValidatedShort=Validated +DonationStatusPayedShort=Received +ValidPromise=Validate promise BuildDonationReceipt=Build receipt diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index 4f6696a790f..919a08317b9 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -13,8 +13,11 @@ DonationsReceived=Dons encaiss PublicDonation=Don public DonationsNumber=Nombre de dons DonationsArea=Espace Dons -DonationStatusPromessNotValidated=Promesse non validée -DonationStatusPromessValidated=Promesse validée +DonationStatusPromiseNotValidated=Promesse non validée +DonationStatusPromiseValidated=Promesse validée DonationStatusPayed=Don payé +DonationStatusPromiseNotValidatedShort=Non validée +DonationStatusPromiseValidatedShort=Validée +DonationStatusPayedShort=Payé ValidPromess=Valider promesse BuildDonationReceipt=Créer reçu \ No newline at end of file diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index f9a51a3914b..412e01051c6 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -557,7 +557,7 @@ else //$genallowed=1; //$delallowed=0; - $result=$html->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf); + $somethingshown=$html->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf); /* * Déjà livre