NEW Add hook pdf_build_address
NEW Add option MAIN_PUBLIC_NOTE_IN_ADDRESS
This commit is contained in:
parent
54034ea852
commit
4b4de22a54
@ -143,6 +143,7 @@ class HookManager
|
||||
'formattachOptions',
|
||||
'formBuilddocLineOptions',
|
||||
'moveUploadedFile',
|
||||
'pdf_build_address',
|
||||
'pdf_writelinedesc',
|
||||
'pdf_getlinenum',
|
||||
'pdf_getlineref',
|
||||
|
||||
@ -366,7 +366,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
|
||||
|
||||
|
||||
/**
|
||||
* Return a string with full address formated
|
||||
* Return a string with full address formated for output on documents
|
||||
*
|
||||
* @param Translate $outputlangs Output langs object
|
||||
* @param Societe $sourcecompany Source company object
|
||||
@ -379,126 +379,150 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
|
||||
*/
|
||||
function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$targetcontact='',$usecontact=0,$mode='source',$object=null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$stringaddress = '';
|
||||
global $conf, $hookmanager;
|
||||
|
||||
if ($mode == 'source' && ! is_object($sourcecompany)) return -1;
|
||||
if ($mode == 'target' && ! is_object($targetcompany)) return -1;
|
||||
|
||||
if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO: Deprecated
|
||||
if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id);
|
||||
if (! empty($targetcompany->state_id) && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->state_id);
|
||||
if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO deprecated
|
||||
if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id);
|
||||
if (! empty($targetcompany->state_id) && empty($targetcompany->departement)) $targetcompany->departement=getState($targetcompany->state_id); //TODO deprecated
|
||||
if (! empty($targetcompany->state_id) && empty($targetcompany->state)) $targetcompany->state=getState($targetcompany->state_id);
|
||||
|
||||
if ($mode == 'source')
|
||||
$reshook=0;
|
||||
$stringaddress = '';
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$withCountry = 0;
|
||||
if (!empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) $withCountry = 1;
|
||||
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n";
|
||||
|
||||
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
|
||||
{
|
||||
// Phone
|
||||
if ($sourcecompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("PhoneShort").": ".$outputlangs->convToOutputCharset($sourcecompany->phone);
|
||||
// Fax
|
||||
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? ($sourcecompany->phone ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
|
||||
// EMail
|
||||
if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email);
|
||||
// Web
|
||||
if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url);
|
||||
}
|
||||
$parameters = array('sourcecompany'=>&$sourcecompany,'targetcompany'=>&$targetcompany,'targetcontact'=>$targetcontact,'outputlangs'=>$outputlangs,'mode'=>$mode,'usecontact'=>$usecontact);
|
||||
$action='';
|
||||
$reshook = $hookmanager->executeHooks('pdf_build_address',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$stringaddress.=$hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if ($mode == 'target' || $mode == 'targetwithdetails')
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($usecontact)
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1));
|
||||
if ($mode == 'source')
|
||||
{
|
||||
$withCountry = 0;
|
||||
if (!empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) $withCountry = 1;
|
||||
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n";
|
||||
|
||||
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
|
||||
{
|
||||
// Phone
|
||||
if ($sourcecompany->phone) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("PhoneShort").": ".$outputlangs->convToOutputCharset($sourcecompany->phone);
|
||||
// Fax
|
||||
if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? ($sourcecompany->phone ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
|
||||
// EMail
|
||||
if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email);
|
||||
// Web
|
||||
if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url);
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'target' || $mode == 'targetwithdetails')
|
||||
{
|
||||
if ($usecontact)
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1));
|
||||
|
||||
if (!empty($targetcontact->address)) {
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n";
|
||||
}else {
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
}
|
||||
// Country
|
||||
if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
|
||||
$stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code))."\n";
|
||||
}
|
||||
else if (empty($targetcontact->country_code) && !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) || $mode == 'targetwithdetails')
|
||||
{
|
||||
// Phone
|
||||
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
|
||||
if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
|
||||
// Web
|
||||
if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
// 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) || $mode == 'targetwithdetails')
|
||||
{
|
||||
// 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
|
||||
if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
|
||||
// Web
|
||||
if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
|
||||
}
|
||||
}
|
||||
|
||||
// Intra VAT
|
||||
if (empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))
|
||||
{
|
||||
if ($targetcompany->tva_intra) $stringaddress.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
|
||||
}
|
||||
|
||||
// Professionnal Ids
|
||||
if (! empty($conf->global->MAIN_PROFID1_IN_ADDRESS) && ! empty($targetcompany->idprof1))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId1",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID2_IN_ADDRESS) && ! empty($targetcompany->idprof2))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId2",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID3_IN_ADDRESS) && ! empty($targetcompany->idprof3))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId3",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID4_IN_ADDRESS) && ! empty($targetcompany->idprof4))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId4",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
|
||||
}
|
||||
|
||||
if (!empty($targetcontact->address)) {
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n";
|
||||
}else {
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
}
|
||||
// Country
|
||||
if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
|
||||
$stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code))."\n";
|
||||
}
|
||||
else if (empty($targetcontact->country_code) && !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) || $mode == 'targetwithdetails')
|
||||
{
|
||||
// Phone
|
||||
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
|
||||
if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
|
||||
// Web
|
||||
if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
// 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) || $mode == 'targetwithdetails')
|
||||
{
|
||||
// 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
|
||||
if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
|
||||
// Web
|
||||
if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
|
||||
}
|
||||
}
|
||||
|
||||
// Intra VAT
|
||||
if (empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))
|
||||
{
|
||||
if ($targetcompany->tva_intra) $stringaddress.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
|
||||
}
|
||||
|
||||
// Professionnal Ids
|
||||
if (! empty($conf->global->MAIN_PROFID1_IN_ADDRESS) && ! empty($targetcompany->idprof1))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId1",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID2_IN_ADDRESS) && ! empty($targetcompany->idprof2))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId2",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID3_IN_ADDRESS) && ! empty($targetcompany->idprof3))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId3",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID4_IN_ADDRESS) && ! empty($targetcompany->idprof4))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId4",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
|
||||
}
|
||||
// Public note
|
||||
if (! empty($conf->global->MAIN_PUBLIC_NOTE_IN_ADDRESS))
|
||||
{
|
||||
if ($mode == 'source' && ! empty($sourcecompany->note_public))
|
||||
{
|
||||
$stringaddress.="\n".$sourcecompany->note_public;
|
||||
}
|
||||
if (($mode == 'target' || $mode == 'targetwithdetails') && ! empty($targetcompany->note_public))
|
||||
{
|
||||
$stringaddress.="\n".$targetcompany->note_public;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $stringaddress;
|
||||
}
|
||||
|
||||
@ -1046,6 +1070,7 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide
|
||||
global $db, $conf, $langs, $hookmanager;
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
@ -1055,16 +1080,16 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide
|
||||
$action='';
|
||||
$reshook=$hookmanager->executeHooks('pdf_writelinedesc',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
|
||||
if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
$labelproductservice=pdf_getlinedesc($object,$i,$outputlangs,$hideref,$hidedesc,$issupplierline);
|
||||
// Description
|
||||
$pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1, false, true, 'J',true);
|
||||
return $labelproductservice;
|
||||
$result.=$labelproductservice;
|
||||
}
|
||||
return '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1763,6 +1788,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||
global $hookmanager;
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
if (is_object($hookmanager)) // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run
|
||||
{
|
||||
@ -1778,9 +1804,9 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||
{
|
||||
if ($object->lines[$i]->special_code == 3)
|
||||
{
|
||||
return $outputlangs->transnoentities("Option");
|
||||
$result.=$outputlangs->transnoentities("Option");
|
||||
}
|
||||
if (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
||||
elseif (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -1833,8 +1859,8 @@ function pdf_getTotalQty($object,$type,$outputlangs)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return linked objects
|
||||
* FIXME This function returns only one link per link type instead of all links. If we fix this, we must also fix function pdf_writeLinkedObjects
|
||||
* Return linked objects to use for document generation.
|
||||
* Warning: To save space, this function returns only one link per link type (all links are concated on same record string). This function is used by pdf_writeLinkedObjects
|
||||
*
|
||||
* @param object $object Object
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -1850,7 +1876,11 @@ function pdf_getLinkedObjects($object,$outputlangs)
|
||||
|
||||
foreach($object->linkedObjects as $objecttype => $objects)
|
||||
{
|
||||
if ($objecttype == 'propal')
|
||||
if ($objecttype == 'facture')
|
||||
{
|
||||
// For invoice, we don't want to have a reference line on document. Image we are using recuring invoice, we will have a line longer than document width.
|
||||
}
|
||||
elseif ($objecttype == 'propal' || $objecttype == 'supplier_proposal')
|
||||
{
|
||||
$outputlangs->load('propal');
|
||||
|
||||
@ -1862,13 +1892,13 @@ function pdf_getLinkedObjects($object,$outputlangs)
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
else if ($objecttype == 'commande')
|
||||
else if ($objecttype == 'commande' || $objecttype == 'supplier_order')
|
||||
{
|
||||
$outputlangs->load('orders');
|
||||
foreach($objects as $elementobject)
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder");
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '');
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '') . ($elementobject->ref_supplier ? ' ('.$elementobject->ref_supplier.')' : '');
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate");
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs);
|
||||
}
|
||||
@ -1892,7 +1922,7 @@ function pdf_getLinkedObjects($object,$outputlangs)
|
||||
{
|
||||
$elementobject->fetchObjectLinked();
|
||||
|
||||
$order = reset($elementobject->linkedObjects['commande']);
|
||||
$order = reset($elementobject->linkedObjects['commande']); // Get first order
|
||||
|
||||
if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user