From 8ce8bf47ee5259dccdf8db8ade7044062061df80 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Jun 2014 12:48:08 +0200 Subject: [PATCH] Fix: The object deliverycompany was not used anymore and output of details for delivery reports was lost during 3.5. Rewrite code to restore feature. Conflicts: htdocs/core/modules/expedition/doc/pdf_merou.modules.php htdocs/core/modules/expedition/doc/pdf_rouget.modules.php --- ChangeLog | 3 ++ htdocs/core/lib/pdf.lib.php | 32 ++++++++----------- .../expedition/doc/pdf_merou.modules.php | 3 +- .../expedition/doc/pdf_rouget.modules.php | 6 ++-- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index c44642dd3f4..c07a2d37bff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ English Dolibarr ChangeLog -------------------------------------------------------------- ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** +Fix: The object deliverycompany was not used anymore and output of + details for delivery reports was lost during 3.5. Rewrite code to + restore feature. Fix: [ bug #1445 ] html fix : missing Fix: [ bug #1415 ] Intervention document model name and suppliers model names is not shown properly in module configuration diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 76d63a10317..ce82c0a2817 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -287,11 +287,10 @@ function pdf_getHeightForLogo($logo, $url = false) * @param Societe $targetcompany Target company object * @param Contact $targetcontact Target contact object * @param int $usecontact Use contact instead of company - * @param int $mode Address type - * @param Societe $deliverycompany Delivery company object + * @param int $mode Address type ('source', 'target', 'targetwithdetails') * @return string String with full address */ -function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$targetcontact='',$usecontact=0,$mode='source',$deliverycompany='') +function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$targetcontact='',$usecontact=0,$mode='source') { global $conf; @@ -322,7 +321,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target } } - if ($mode == 'target') + if ($mode == 'target' || $mode == 'targetwithdetails') { if ($usecontact) { @@ -341,11 +340,13 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n"; } - - if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS)) + if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails') { // Phone - if ($targetcontact->phone_pro) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->phone_pro); + if (! empty($targetcontact->phone_pro) || ! empty($targetcontact->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": "; + if (! empty($targetcontact->phone_pro)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro); + if (! empty($targetcontact->phone_pro) || ! empty($targetcontact->phone_mobile)) $stringaddress .= " / "; + if (! empty($targetcontact->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile); // Fax if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); // EMail @@ -360,10 +361,13 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target // Country if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n"; - if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS)) + if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails') { // Phone - if ($targetcompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->phone); + if (! empty($targetcompany->phone) || ! empty($targetcompany->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": "; + if (! empty($targetcompany->phone)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone); + if (! empty($targetcompany->phone) || ! empty($targetcompany->phone_mobile)) $stringaddress .= " / "; + if (! empty($targetcompany->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile); // Fax if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax); // EMail @@ -406,16 +410,6 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target } } - if ($mode == 'delivery') // for a delivery address (address + phone/fax) - { - $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($deliverycompany))."\n"; - - // Phone - if ($deliverycompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($deliverycompany->phone); - // Fax - if ($deliverycompany->fax) $stringaddress .= ($stringaddress ? ($deliverycompany->phone ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($deliverycompany->fax); - } - return $stringaddress; } diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index dafff8b81ea..539d62f92a8 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -602,8 +602,7 @@ class pdf_merou extends ModelePdfExpedition $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); } - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target'); - + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails'); $blDestX=$blExpX+55; $blW=50; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index d479d2c8059..13a911977ed 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -504,7 +504,7 @@ class pdf_rouget extends ModelePdfExpedition $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefSending") ." : ".$object->ref, '', 'R'); - //Date Expedition + // Date Expedition $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); @@ -530,7 +530,7 @@ class pdf_rouget extends ModelePdfExpedition $origin_id = $object->origin_id; // TODO move to external function - if ($conf->$origin->enabled) + if (! empty($conf->$origin->enabled)) { $outputlangs->load('orders'); @@ -616,7 +616,7 @@ class pdf_rouget extends ModelePdfExpedition $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); } - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target'); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails'); // Show recipient $widthrecbox=100;