From ef839035bd63b2ec2441608b45124c65dca68ead Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 23 Sep 2007 10:08:41 +0000 Subject: [PATCH] Application du patch de Nicolas --- htdocs/fourn/commande/fiche.php | 14 +++---- .../modules/pdf/pdf_muscadet.modules.php | 42 ++++++++++--------- htdocs/fourn/fournisseur.commande.class.php | 31 +++++++------- 3 files changed, 44 insertions(+), 43 deletions(-) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 230cec5dba8..8c2c46ce075 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -347,15 +347,15 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post $commande = new CommandeFournisseur($db, 0, $_REQUEST['id']); $commande->fetch($_REQUEST['id']); if ($_REQUEST['model']) - { - $commande->set_pdf_model($user, $_REQUEST['model']); - } + { + $commande->set_pdf_model($user, $_REQUEST['model']); + } if ($_REQUEST['lang_id']) - { - $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf); - $outputlangs->setDefaultLang($_REQUEST['lang_id']); - } + { + $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf); + $outputlangs->setDefaultLang($_REQUEST['lang_id']); + } $result=supplier_order_pdf_create($db, $commande->id,$commande->modelpdf,$outputlangs); if ($result <= 0) { diff --git a/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php b/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php index f91ff8858e4..80b36e41e80 100644 --- a/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php +++ b/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php @@ -51,7 +51,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { global $conf,$langs,$mysoc; - $langs->load("main"); + $langs->load("main"); $langs->load("bills"); $this->db = $db; @@ -702,7 +702,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','',8); $pdf->SetXY($this->marge_gauche,$posy-5); - $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillTo").":"); + $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":"); $pdf->SetXY($this->marge_gauche,$posy); @@ -747,8 +747,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $posy=42; $pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','',8); - $pdf->SetXY(102,$posy-5); - $pdf->MultiCell(80,5, $outputlangs->transnoentities("BillFrom").":"); + $pdf->SetXY(100,$posy-5); + $pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":"); // $client = new Societe($this->db); $client->fetch($com->socid); @@ -782,40 +782,42 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { global $conf; + $outputlangs->load("dict"); + $html=new Form($this->db); // Premiere ligne d'info réglementaires $ligne1=""; - if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE) + if ($this->emetteur->forme_juridique_code) { - $ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); + $ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($this->emetteur->forme_juridique_code); } - if ($conf->global->MAIN_INFO_CAPITAL) + if ($this->emetteur->capital) { - $ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$conf->global->MAIN_INFO_CAPITAL)." ".$outputlangs->transnoentities("Currency".$conf->monnaie); + $ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$this->emetteur->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie); } - if ($conf->global->MAIN_INFO_SIRET) + if ($this->emetteur->profid2) { - $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId2",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIRET; + $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId2",$this->emetteur->pays_code).": ".$this->emetteur->profid2; } - if ($conf->global->MAIN_INFO_SIREN && (! $conf->global->MAIN_INFO_SIRET || $this->emetteur->code_pays != 'FR')) + if ($this->emetteur->profid1 && (! $this->emetteur->profid2 || $this->emetteur->pays_code != 'FR')) { - $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId1",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIREN; - } - if ($conf->global->MAIN_INFO_APE) - { - $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE; + $ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1; } // Deuxieme ligne d'info réglementaires $ligne2=""; - if ($conf->global->MAIN_INFO_RCS) + if ($this->emetteur->profid3) { - $ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId4",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_RCS; + $ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3; } - if ($conf->global->MAIN_INFO_TVAINTRA != '') + if ($this->emetteur->profid4) { - $ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$conf->global->MAIN_INFO_TVAINTRA; + $ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId4",$this->emetteur->pays_code).": ".$this->emetteur->profid4; + } + if ($this->emetteur->tva_intra != '') + { + $ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$this->emetteur->tva_intra; } $pdf->SetFont('Arial','',8); diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index caf1ee7e919..e94ca5662a9 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -963,22 +963,21 @@ class CommandeFournisseur extends Commande function set_pdf_model($user, $modelpdf) { if ($user->rights->fournisseur->commande->creer) - { - - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET model_pdf = '$modelpdf'"; - $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; - - if ($this->db->query($sql) ) - { - $this->modelpdf=$modelpdf; - return 1; - } - else - { - dolibarr_print_error($this->db); - return 0; - } - } + { + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET model_pdf = '".$modelpdf."'"; + $sql .= " WHERE rowid = ".$this->id." AND fk_statut = 0 ;"; + + if ($this->db->query($sql) ) + { + $this->modelpdf=$modelpdf; + return 1; + } + else + { + dolibarr_print_error($this->db); + return 0; + } + } } /** *