From f8bb4c1e556d5286944b3e70dee8e012ba0e6347 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 27 Jun 2006 11:40:14 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20s=E9lection=20du=20mod=E8le=20pdf=20=E0?= =?UTF-8?q?=20la=20cr=E9ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/facture.php | 16 +++++++++++++--- htdocs/facture.class.php | 5 +++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 4d3380d1b1f..c50df1c51ec 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -147,7 +147,7 @@ if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user-> $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - facture_pdf_create($db, $fac->id, '', $_REQUEST['model'], $outputlangs); + facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs); } } @@ -185,6 +185,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']; if ($_POST['fac_rec'] > 0) { @@ -896,6 +897,15 @@ if ($_GET['action'] == 'create') $html->select_projects($societe_id, $projetid, 'projetid'); 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); + print ""; // Note publique print ''; @@ -2135,8 +2145,8 @@ else $filename=sanitize_string($fac->ref); $filedir=$conf->facture->dir_output . '/' . sanitize_string($fac->ref); $urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id; - $genallowed=($fac->statut == 1 && $user->rights->facture->creer); - $delallowed=$user->rights->facture->supprimer; + $genallowed=($fac->statut == 1 && $user->rights->facture->creer); + $delallowed=$user->rights->facture->supprimer; $var=true; diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 19d2776f607..7814b3e4293 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -70,6 +70,7 @@ class Facture extends CommonObject var $cond_reglement_code; var $mode_reglement_id; var $mode_reglement_code; + var $modelpdf; // Pour board var $nbtodo; @@ -165,7 +166,7 @@ class Facture extends CommonObject $sql.= ' note_public,'; $sql.= ' ref_client,'; $sql.= ' fk_user_author, fk_projet,'; - $sql.= ' fk_cond_reglement, fk_mode_reglement, date_lim_reglement) '; + $sql.= ' fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf) '; $sql.= " VALUES ("; $sql.= "'$number','$socid', now(), '$totalht', '".$this->remise_absolue."'"; $sql.= ",'".$this->remise_percent."', ".$this->db->idate($this->date); @@ -176,7 +177,7 @@ class Facture extends CommonObject $sql.= ",".($this->projetid?$this->projetid:"null"); $sql.= ','.$this->cond_reglement_id; $sql.= ",".$this->mode_reglement_id; - $sql.= ','.$this->db->idate($datelim).")"; + $sql.= ",".$this->db->idate($datelim).", '".$this->modelpdf."')"; $resql=$this->db->query($sql); if ($resql)