From 52d60059293699ec77dffe2f2a3cdaa47118935a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 18 Nov 2007 14:59:34 +0000 Subject: [PATCH] =?UTF-8?q?Add:=20possibilit=E9=20d'utiliser=20l'adresse?= =?UTF-8?q?=20du=20contact=20suivi=20commande=20dans=20le=20document=20Add?= =?UTF-8?q?:=20patch=20de=20Team=20Raider=20qui=20permet=20d'afficher=20le?= =?UTF-8?q?s=20nom=20de=20contact=20si=20d=E9fini=20dans=20les=20documents?= =?UTF-8?q?=20Fix:=20uniformisation=20du=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/commande.php | 62 ++-- .../modules/commande/pdf_einstein.modules.php | 294 ++++++++++-------- .../modules/facture/pdf_crabe.modules.php | 68 ++-- .../propale/pdf_propale_azur.modules.php | 84 ++--- htdocs/langs/en_US/orders.lang | 2 + htdocs/langs/en_US/propal.lang | 2 +- htdocs/langs/fr_FR/orders.lang | 2 + 7 files changed, 301 insertions(+), 213 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index bd154916b5c..2ffc78b8a6b 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Andre Cianfarani + * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Andre Cianfarani + * Copyright (C) 2005-2007 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 @@ -122,16 +123,29 @@ if ($_GET["action"] == 'setmod') // par appel methode canBeActivated dolibarr_set_const($db, "COMMANDE_ADDON",$_GET["value"]); + Header("Location: commande.php"); + exit; } if ($_POST["action"] == 'setvalidorder') { dolibarr_set_const($db, "COMMANDE_VALID_AFTER_CLOSE_PROPAL",$_POST["validorder"]); + Header("Location: commande.php"); + exit; } if ($_POST["action"] == 'deliverycostline') { dolibarr_set_const($db, "COMMANDE_ADD_DELIVERY_COST_LINE",$_POST["addline"]); + Header("Location: commande.php"); + exit; +} + +if ($_POST["action"] == 'set_use_customer_contact_as_recipient') +{ + dolibarr_set_const($db, "COMMANDE_USE_CUSTOMER_CONTACT_AS_RECIPIENT",$_POST["use_customer_contact_as_recipient"]); + Header("Location: commande.php"); + exit; } // défini les constantes du modèle saphir @@ -348,36 +362,44 @@ print_titre($langs->trans("OtherOptions")); print ''; print ''; print ''; -print ''; +print ''; +print "\n"; print "\n"; $var=true; // Valider la commande après cloture de la propale // permet de na pas passer par l'option commande provisoire $var=! $var; - -print '\n"; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; // Ajouter une ligne de frais port indiquant le poids de la commande $var=! $var; - -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +// Utiliser le contact de la commande dans le document +$var=! $var; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; -print "\n"; diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php index 542d6a53c74..f5825833916 100644 --- a/htdocs/includes/modules/commande/pdf_einstein.modules.php +++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php @@ -18,7 +18,6 @@ * or see http://www.gnu.org/ * * $Id$ - * $Source$ */ /** @@ -742,143 +741,190 @@ class pdf_einstein extends ModelePDFCommandes */ function _pagehead(&$pdf, $object, $showadress=1, $outputlangs) { - global $conf,$langs; + global $conf,$langs; - $outputlangs->load("main"); - $outputlangs->load("bills"); - $outputlangs->load("propal"); - $outputlangs->load("companies"); + $outputlangs->load("main"); + $outputlangs->load("bills"); + $outputlangs->load("propal"); + $outputlangs->load("companies"); - $pdf->SetTextColor(0,0,60); - $pdf->SetFont('Arial','B',13); + $pdf->SetTextColor(0,0,60); + $pdf->SetFont('Arial','B',13); - $posy=$this->marge_haute; + $posy=$this->marge_haute; - $pdf->SetXY($this->marge_gauche,$posy); - - // Logo - $logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo; - if ($this->emetteur->logo) - { - if (is_readable($logo)) - { - $pdf->Image($logo, $this->marge_gauche, $posy, 0, 24); - } - else - { - $pdf->SetTextColor(200,0,0); - $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); - } - } - else if (defined("FAC_PDF_INTITULE")) - { - $pdf->MultiCell(100, 4, FAC_PDF_INTITULE, 0, 'L'); + $pdf->SetXY($this->marge_gauche,$posy); + + // Logo + $logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo; + if ($this->emetteur->logo) + { + if (is_readable($logo)) + { + $pdf->Image($logo, $this->marge_gauche, $posy, 0, 24); + } + else + { + $pdf->SetTextColor(200,0,0); + $pdf->SetFont('Arial','B',8); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); } + } + else if (defined("FAC_PDF_INTITULE")) + { + $pdf->MultiCell(100, 4, FAC_PDF_INTITULE, 0, 'L'); + } + + $pdf->SetFont('Arial','B',13); + $pdf->SetXY(100,$posy); + $pdf->SetTextColor(0,0,60); + $title=$outputlangs->transnoentities("Order"); + $pdf->MultiCell(100, 4, $title, '' , 'R'); + + $pdf->SetFont('Arial','B',12); + + $posy+=6; + $pdf->SetXY(100,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $object->ref, '', 'R'); + + $posy+=1; + $pdf->SetFont('Arial','',10); - $pdf->SetFont('Arial','B',13); - $pdf->SetXY(100,$posy); - $pdf->SetTextColor(0,0,60); - $title=$outputlangs->transnoentities("Order"); - $pdf->MultiCell(100, 4, $title, '' , 'R'); - - $pdf->SetFont('Arial','B',12); - - $posy+=6; - $pdf->SetXY(100,$posy); - $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $object->ref, '', 'R'); - - $posy+=1; - $pdf->SetFont('Arial','',10); - - $posy+=5; - $pdf->SetXY(100,$posy); - $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dolibarr_print_date($object->date,"%d %b %Y"), '', 'R'); + $posy+=5; + $pdf->SetXY(100,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dolibarr_print_date($object->date,"%d %b %Y"), '', 'R'); + + if ($showadress) + { + // Emetteur + $posy=42; + $hautcadre=40; + $pdf->SetTextColor(0,0,0); + $pdf->SetFont('Arial','',8); + $pdf->SetXY($this->marge_gauche,$posy-5); + $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":"); - - if ($showadress) - { - // Emetteur - $posy=42; - $hautcadre=40; - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('Arial','',8); - $pdf->SetXY($this->marge_gauche,$posy-5); - $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":"); + $pdf->SetXY($this->marge_gauche,$posy); + $pdf->SetFillColor(230,230,230); + $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); - $pdf->SetXY($this->marge_gauche,$posy); - $pdf->SetFillColor(230,230,230); - $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); + $pdf->SetXY($this->marge_gauche+2,$posy+3); + // Nom emetteur + $pdf->SetTextColor(0,0,60); + $pdf->SetFont('Arial','B',11); + if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L'); + else $pdf->MultiCell(80, 4, $this->emetteur->nom, 0, 'L'); - $pdf->SetXY($this->marge_gauche+2,$posy+3); + // Caractéristiques emetteur + $carac_emetteur = ''; + if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE; + else { + $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$this->emetteur->adresse; + $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$this->emetteur->cp.' '.$this->emetteur->ville; + } + $carac_emetteur .= "\n"; + + // Tel + if (defined("FAC_PDF_TEL") && FAC_PDF_TEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".FAC_PDF_TEL; + elseif ($this->emetteur->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$this->emetteur->tel; + + // Fax + if (defined("FAC_PDF_FAX") && FAC_PDF_FAX) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".FAC_PDF_FAX; + elseif ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$this->emetteur->fax; + + // EMail + if (defined("FAC_PDF_MEL") && FAC_PDF_MEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".FAC_PDF_MEL; + elseif ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$this->emetteur->email; + + // Web + if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".FAC_PDF_WWW; + elseif ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$this->emetteur->url; - // Nom emetteur - $pdf->SetTextColor(0,0,60); - $pdf->SetFont('Arial','B',11); - if (defined("FAC_PDF_SOCIETE_NOM") && FAC_PDF_SOCIETE_NOM) $pdf->MultiCell(80, 4, FAC_PDF_SOCIETE_NOM, 0, 'L'); - else $pdf->MultiCell(80, 4, $this->emetteur->nom, 0, 'L'); + $pdf->SetFont('Arial','',9); + $pdf->SetXY($this->marge_gauche+2,$posy+8); + $pdf->MultiCell(80,4, $carac_emetteur); - // Caractéristiques emetteur - $carac_emetteur = ''; - if (defined("FAC_PDF_ADRESSE") && FAC_PDF_ADRESSE) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).FAC_PDF_ADRESSE; - else { - $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$this->emetteur->adresse; - $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$this->emetteur->cp.' '.$this->emetteur->ville; - } - $carac_emetteur .= "\n"; - // Tel - if (defined("FAC_PDF_TEL") && FAC_PDF_TEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".FAC_PDF_TEL; - elseif ($this->emetteur->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$this->emetteur->tel; - // Fax - if (defined("FAC_PDF_FAX") && FAC_PDF_FAX) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".FAC_PDF_FAX; - elseif ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$this->emetteur->fax; - // EMail - if (defined("FAC_PDF_MEL") && FAC_PDF_MEL) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".FAC_PDF_MEL; - elseif ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$this->emetteur->email; - // Web - if (defined("FAC_PDF_WWW") && FAC_PDF_WWW) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".FAC_PDF_WWW; - elseif ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$this->emetteur->url; - - $pdf->SetFont('Arial','',9); - $pdf->SetXY($this->marge_gauche+2,$posy+8); - $pdf->MultiCell(80,4, $carac_emetteur); - - // Client destinataire - $posy=42; - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('Arial','',8); - $pdf->SetXY(102,$posy-5); - $pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":"); - $object->fetch_client(); - - // Cadre client destinataire - $pdf->rect(100, $posy, 100, $hautcadre); - - // Nom client - $pdf->SetXY(102,$posy+3); - $pdf->SetFont('Arial','B',11); - $pdf->MultiCell(106,4, $object->client->nom, 0, 'L'); - - // Caractéristiques client - $carac_client=$object->client->adresse; - $carac_client.="\n".$object->client->cp . " " . $object->client->ville."\n"; - if ($this->emetteur->pays_code != $object->client->pays_code) - { - $carac_client.=$object->client->pays."\n"; - } - if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; - $pdf->SetFont('Arial','',9); - $pdf->SetXY(102,$posy+8); - $pdf->MultiCell(86,4, $carac_client); - } - - } + // Client destinataire + $posy=42; + $pdf->SetTextColor(0,0,0); + $pdf->SetFont('Arial','',8); + $pdf->SetXY(102,$posy-5); + $pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":"); + $object->fetch_client(); + + // Cadre client destinataire + $pdf->rect(100, $posy, 100, $hautcadre); + + // If CUSTOMER contact defined on invoice, we use it + $usecontact=false; + if ($conf->global->COMMANDE_USE_CUSTOMER_CONTACT_AS_RECIPIENT) + { + $arrayidcontact=$object->getIdContact('external','CUSTOMER'); + if (sizeof($arrayidcontact) > 0) + { + $usecontact=true; + $result=$object->fetch_contact($arrayidcontact[0]); + } + } + + if ($usecontact) + { + // Nom societe + $pdf->SetXY(102,$posy+3); + $pdf->SetFont('Arial','B',11); + $pdf->MultiCell(106,4, $object->client->nom, 0, 'L'); + $posy+=4; + + // Nom client + $pdf->SetXY(102,$posy+4); + $pdf->SetFont('Arial','',9); + $pdf->MultiCell(106,4, $object->contact->getFullName($outputlangs,1), 0, 'L'); + + // Caractéristiques client + $carac_client=$object->contact->adresse; + $carac_client.="\n".$object->contact->cp . " " . $object->contact->ville."\n"; + if ($this->emetteur->pays_code != $object->contact->pays_code) + { + $carac_client.=$object->contact->pays."\n"; + } + } + else + { + // Nom client + $pdf->SetXY(102,$posy+3); + $pdf->SetFont('Arial','B',11); + $pdf->MultiCell(106,4, $object->client->nom, 0, 'L'); + + // Nom du contact suivi commande si c'est une société + $arrayidcontact = $object->getIdContact('external','CUSTOMER'); + if (sizeof($arrayidcontact) > 0) + { + $object->fetch_contact($arrayidcontact[0]); + // On vérifie si c'est une société ou un particulier + if( !preg_match('#'.$object->contact->getFullName($outputlangs,1).'#isU',$object->client->nom) ) + { + $carac_client .= "\n".$object->contact->getFullName($outputlangs,1); + } + } + + // Caractéristiques client + $carac_client.="\n".$object->client->adresse; + $carac_client.="\n".$object->client->cp . " " . $object->client->ville."\n"; + if ($this->emetteur->pays_code != $object->client->pays_code) $carac_client.=$object->client->pays."\n"; + } + // Numéro TVA intracom + if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; + $pdf->SetFont('Arial','',9); + $pdf->SetXY(102,$posy+6); + $pdf->MultiCell(86,4, $carac_client); + } + } /* * \brief Affiche le pied de page diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index 5c6e440211b..173cb816e8f 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -1,23 +1,24 @@ -* -* 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 -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* or see http://www.gnu.org/ -* -* $Id$ -*/ + * Copyright (C) 2005-2007 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * or see http://www.gnu.org/ + * + * $Id$ + */ /** \file htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -1032,10 +1033,6 @@ class pdf_crabe extends ModelePDFFactures { $carac_client.=$object->contact->pays."\n"; } - if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; - $pdf->SetFont('Arial','',9); - $pdf->SetXY(102,$posy+8); - $pdf->MultiCell(86,4, $carac_client); } else { @@ -1043,22 +1040,33 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY(102,$posy+3); $pdf->SetFont('Arial','B',11); $pdf->MultiCell(106,4, $object->client->nom, 0, 'L'); + + // Nom du contact facturation si c'est une société + $arrayidcontact = $object->getIdContact('external','BILLING'); + if (sizeof($arrayidcontact) > 0) + { + $object->fetch_contact($arrayidcontact[0]); + // On vérifie si c'est une société ou un particulier + if( !preg_match('#'.$object->contact->getFullName($outputlangs,1).'#isU',$object->client->nom) ) + { + $carac_client .= "\n".$object->contact->getFullName($outputlangs,1); + } + } // Caractéristiques client - $carac_client=$object->client->adresse; + $carac_client.="\n".$object->client->adresse; $carac_client.="\n".$object->client->cp . " " . $object->client->ville."\n"; if ($this->emetteur->pays_code != $object->client->pays_code) { $carac_client.=$object->client->pays."\n"; } - if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; - $pdf->SetFont('Arial','',9); - $pdf->SetXY(102,$posy+8); - $pdf->MultiCell(86,4, $carac_client); } - } - - } + if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; + $pdf->SetFont('Arial','',9); + $pdf->SetXY(102,$posy+6); + $pdf->MultiCell(86,4, $carac_client); + } + } /* * \brief Affiche le pied de page diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index ed576c4605f..3bc962d56a5 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -1,23 +1,24 @@ -* -* 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 -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* or see http://www.gnu.org/ -* -* $Id$ -*/ + * Copyright (C) 2005-2007 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * or see http://www.gnu.org/ + * + * $Id$ + */ /** \file htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -907,33 +908,40 @@ class pdf_propale_azur extends ModelePDFPropales { $carac_client.=$object->contact->pays."\n"; } - if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; - $pdf->SetFont('Arial','',9); - $pdf->SetXY(102,$posy+8); - $pdf->MultiCell(86,4, $carac_client); } else { // Nom client - $pdf->SetXY(102,$posy+3); - $pdf->SetFont('Arial','B',11); - $pdf->MultiCell(106,4, $object->client->nom, 0, 'L'); + $pdf->SetXY(102,$posy+3); + $pdf->SetFont('Arial','B',11); + $pdf->MultiCell(106,4, $object->client->nom, 0, 'L'); + + // Nom du contact suivi propal si c'est une société + $arrayidcontact = $object->getIdContact('external','CUSTOMER'); + if (sizeof($arrayidcontact) > 0) + { + $object->fetch_contact($arrayidcontact[0]); + // On vérifie si c'est une société ou un particulier + if( !preg_match('#'.$object->contact->getFullName($outputlangs,1).'#isU',$object->client->nom) ) + { + $carac_client .= "\n".$object->contact->getFullName($outputlangs,1); + } + } // Caractéristiques client - $carac_client=$object->client->adresse; - $carac_client.="\n".$object->client->cp . " " . $object->client->ville."\n"; - if ($this->emetteur->pays_code != $object->client->pays_code) - { - $carac_client.=$object->client->pays."\n"; - } - if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; - $pdf->SetFont('Arial','',9); - $pdf->SetXY(102,$posy+8); - $pdf->MultiCell(86,4, $carac_client); + $carac_client.="\n".$object->client->adresse; + $carac_client.="\n".$object->client->cp . " " . $object->client->ville."\n"; + if ($this->emetteur->pays_code != $object->client->pays_code) + { + $carac_client.=$object->client->pays."\n"; + } } - } - - } + if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$object->client->tva_intra; + $pdf->SetFont('Arial','',9); + $pdf->SetXY(102,$posy+6); + $pdf->MultiCell(86,4, $carac_client); + } + } /* * \brief Affiche le pied de page diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 418d6621281..6199d7fd014 100755 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -94,6 +94,8 @@ Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constant COMMANDE_SUPPLIER_ADDON not de Error_COMMANDE_ADDON_NotDefined=Constant COMMANDE_ADDON not defined Error_FailedToLoad_COMMANDE_SUPPLIER_ADDON_File=Failed to load module file '%s' Error_FailedToLoad_COMMANDE_ADDON_File=Failed to load module file '%s' +UseCustomerContactAsOrderRecipientIfExist=Use customer contact address if defined instead of third party address as order recipient address + # Sources OrderSource0=Commercial proposal OrderSource1=Internet diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 07f45a100e8..f4518fa73e0 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -74,7 +74,7 @@ SetDateLivraison=Set shipping date CopyPropalFrom=Create commercial proposal by copying existing proposal CreateEmptyPropal=Create empty commercial proposals vierge or from list of products/services DefaultProposalDurationValidity=Default commercial proposal validity duration (in days) -UseCustomerContactAsPropalRecipientIfExist=Use customer contact adress if defined instead of third party address as proposal recipient address +UseCustomerContactAsPropalRecipientIfExist=Use customer contact address if defined instead of third party address as proposal recipient address # azur PDF Model PDFAzurDescription=A complete proposal model (logo...) diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index d6fa46e1e72..636be6c4adc 100755 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -94,6 +94,8 @@ Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constante COMMANDE_SUPPLIER_ADDON non d Error_COMMANDE_ADDON_NotDefined=Constante COMMANDE_ADDON non définie Error_FailedToLoad_COMMANDE_SUPPLIER_ADDON_File=Echec chargement du fichier module '%s' Error_FailedToLoad_COMMANDE_ADDON_File=Echec chargement du fichier module '%s' +UseCustomerContactAsOrderRecipientIfExist=Utiliser adresse contact suivi client si défini plutot que adresse tiers comme destinataire des commandes + # Sources OrderSource0=Proposition commerciale OrderSource1=Internet
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Value").' 
'; -print $langs->trans("ValidOrderAfterPropalClosed"); -print ''; print '
'; print ''; -print $html->selectyesno("validorder",$conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL,1); -print ''; -print "
\n"; -print "
'.$langs->trans("ValidOrderAfterPropalClosed").''.$html->selectyesno("validorder",$conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL,1).'
'; -print $langs->trans("AddDeliveryCostLine"); -print ''; print '
'; print ''; -print $html->selectyesno("addline",$conf->global->COMMANDE_ADD_DELIVERY_COST_LINE,1); -print ''; +print '
'.$langs->trans("AddDeliveryCostLine").''.$html->selectyesno("addline",$conf->global->COMMANDE_ADD_DELIVERY_COST_LINE,1).'
'.$langs->trans("UseCustomerContactAsOrderRecipientIfExist").''.$html->selectyesno("use_customer_contact_as_recipient",$conf->global->COMMANDE_USE_CUSTOMER_CONTACT_AS_RECIPIENT,1).'