commit
3d09b05338
@ -275,9 +275,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
|||||||
dol_mkdir($conf->expedition->dir_temp);
|
dol_mkdir($conf->expedition->dir_temp);
|
||||||
|
|
||||||
|
|
||||||
// If BILLING contact defined on invoice, we use it
|
// If SHIPMENT contact defined on invoice, we use it
|
||||||
$usecontact=false;
|
$usecontact=false;
|
||||||
$arrayidcontact=$object->getIdContact('external','BILLING');
|
$arrayidcontact=$object->getIdContact('external','SHIPPING');
|
||||||
if (count($arrayidcontact) > 0)
|
if (count($arrayidcontact) > 0)
|
||||||
{
|
{
|
||||||
$usecontact=true;
|
$usecontact=true;
|
||||||
@ -285,24 +285,27 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Recipient name
|
// Recipient name
|
||||||
if (! empty($usecontact))
|
$contactobject = null;
|
||||||
{
|
if (! empty($usecontact)) {
|
||||||
// On peut utiliser le nom de la societe du contact
|
// On peut utiliser le nom de la societe du contact
|
||||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))
|
||||||
else $socobject = $object->thirdparty;
|
$socobject = $object->contact;
|
||||||
}
|
else {
|
||||||
else
|
$socobject = $object->thirdparty;
|
||||||
{
|
// if we have a SHIIPPING contact and we dont use it as recipient we store the contact object for later use
|
||||||
$socobject=$object->thirdparty;
|
$contactobject = $object->contact;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$socobject = $object->thirdparty;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make substitution
|
// Make substitution
|
||||||
$substitutionarray=array(
|
$substitutionarray=array(
|
||||||
'__FROM_NAME__' => $this->emetteur->name,
|
'__FROM_NAME__' => $this->emetteur->name,
|
||||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||||
'__TOTAL_TTC__' => $object->total_ttc,
|
'__TOTAL_TTC__' => $object->total_ttc,
|
||||||
'__TOTAL_HT__' => $object->total_ht,
|
'__TOTAL_HT__' => $object->total_ht,
|
||||||
'__TOTAL_VAT__' => $object->total_vat
|
'__TOTAL_VAT__' => $object->total_vat
|
||||||
);
|
);
|
||||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||||
// Call the ODTSubstitution hook
|
// Call the ODTSubstitution hook
|
||||||
@ -411,6 +414,28 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($usecontact && is_object($contactobject)) {
|
||||||
|
$tmparray=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||||
|
foreach($tmparray as $key=>$value)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (preg_match('/logo$/',$key)) // Image
|
||||||
|
{
|
||||||
|
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||||
|
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||||
|
}
|
||||||
|
else // Text
|
||||||
|
{
|
||||||
|
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Replace tags of object + external modules
|
// Replace tags of object + external modules
|
||||||
$tmparray=$this->get_substitutionarray_shipment($object,$outputlangs);
|
$tmparray=$this->get_substitutionarray_shipment($object,$outputlangs);
|
||||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||||
|
|||||||
@ -286,20 +286,18 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Recipient name
|
// Recipient name
|
||||||
$contactobject=null;
|
$contactobject = null;
|
||||||
if (! empty($usecontact))
|
if (! empty($usecontact)) {
|
||||||
{
|
|
||||||
// On peut utiliser le nom de la societe du contact
|
// On peut utiliser le nom de la societe du contact
|
||||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))
|
||||||
|
$socobject = $object->contact;
|
||||||
else {
|
else {
|
||||||
$socobject = $object->thirdparty;
|
$socobject = $object->thirdparty;
|
||||||
// if we have a BILLING contact and we dont use it as recipient we store the contact object for later use
|
// if we have a BILLING contact and we dont use it as recipient we store the contact object for later use
|
||||||
$contactobject = $object->contact;
|
$contactobject = $object->contact;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
$socobject = $object->thirdparty;
|
||||||
{
|
|
||||||
$socobject=$object->thirdparty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch info for linked propal
|
// Fetch info for linked propal
|
||||||
|
|||||||
BIN
htdocs/install/doctemplates/shipment/template_shipment.odt
Normal file → Executable file
BIN
htdocs/install/doctemplates/shipment/template_shipment.odt
Normal file → Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user