NEW Add $object in parameter of pdf_build_address so we could include
hook into the function.
This commit is contained in:
parent
0d6546e18e
commit
54034ea852
@ -373,10 +373,11 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
|
||||
* @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 ('source', 'target', 'targetwithdetails')
|
||||
* @param int $mode Address type ('source', 'target', 'targetwithdetails': target but include also phone/fax/email/url)
|
||||
* @param Object $object Object we want to build document for
|
||||
* @return string String with full address
|
||||
*/
|
||||
function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$targetcontact='',$usecontact=0,$mode='source')
|
||||
function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$targetcontact='',$usecontact=0,$mode='source',$object=null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1846,10 +1847,10 @@ function pdf_getLinkedObjects($object,$outputlangs)
|
||||
$linkedobjects=array();
|
||||
|
||||
$object->fetchObjectLinked();
|
||||
|
||||
|
||||
foreach($object->linkedObjects as $objecttype => $objects)
|
||||
{
|
||||
if ($objecttype == 'propal')
|
||||
if ($objecttype == 'propal')
|
||||
{
|
||||
$outputlangs->load('propal');
|
||||
|
||||
@ -1887,28 +1888,26 @@ function pdf_getLinkedObjects($object,$outputlangs)
|
||||
{
|
||||
$outputlangs->load('orders');
|
||||
$outputlangs->load('sendings');
|
||||
foreach($objects as $x => $elementobject)
|
||||
foreach($objects as $elementobject)
|
||||
{
|
||||
$elementobject->fetchObjectLinked();
|
||||
|
||||
|
||||
$order = reset($elementobject->linkedObjects['commande']);
|
||||
|
||||
// We concat this record info into fields xxx_value. title is overwrote.
|
||||
if (! empty($object->linkedObjects['commande']) || $object->element == 'commande') // There is already a link to order or object is the order, so we show only info of shipment
|
||||
if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending");
|
||||
if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'].=' / ';
|
||||
$linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref);
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending");
|
||||
$linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs);
|
||||
}
|
||||
else // We show both info of order and shipment.
|
||||
else // We show both info of order and shipment
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending");
|
||||
if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : '');
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : '');
|
||||
$linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref);
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ($elementobject->date_delivery ? ' / ' . $outputlangs->transnoentities("DateSending") : '');
|
||||
if (empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs);
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs);
|
||||
$linkedobjects[$objecttype]['date_value'].= ($elementobject->date_delivery ? ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs) : '');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1311,7 +1311,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target', $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -626,7 +626,7 @@ class pdf_strato extends ModelePDFContract
|
||||
|
||||
$this->recipient->name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target');
|
||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target', $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -633,7 +633,7 @@ class pdf_merou extends ModelePdfExpedition
|
||||
|
||||
$carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails',$object);
|
||||
|
||||
$blDestX=$blExpX+55;
|
||||
$blW=54;
|
||||
|
||||
@ -932,7 +932,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -1605,7 +1605,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -620,7 +620,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target');
|
||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -854,7 +854,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -1502,7 +1502,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -1111,7 +1111,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,((!empty($object->contact))?$object->contact:null),$usecontact,'target');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,((!empty($object->contact))?$object->contact:null),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -1163,7 +1163,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -1348,7 +1348,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
|
||||
}
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user