forked from Wavyzz/dolibarr
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.
This commit is contained in:
@@ -290,11 +290,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;
|
||||
|
||||
@@ -325,7 +324,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'target')
|
||||
if ($mode == 'target' || $mode == 'targetwithdetails')
|
||||
{
|
||||
if ($usecontact)
|
||||
{
|
||||
@@ -344,11 +343,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
|
||||
@@ -363,10 +364,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
|
||||
@@ -409,16 +413,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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user