Skip to content

Commit

Permalink
Added functionality to get order customer contact as contact_xx tags
Browse files Browse the repository at this point in the history
  • Loading branch information
apachler committed Jul 10, 2017
1 parent 6b4cecd commit 0932ebd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
Expand Up @@ -275,9 +275,9 @@ function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidede
dol_mkdir($conf->commande->dir_temp);


// If BILLING contact defined on invoice, we use it
// If CUSTOMER contact defined on order, we use it
$usecontact=false;
$arrayidcontact=$object->getIdContact('external','BILLING');
$arrayidcontact=$object->getIdContact('external','CUSTOMER');
if (count($arrayidcontact) > 0)
{
$usecontact=true;
Expand All @@ -289,7 +289,11 @@ function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidede
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
else $socobject = $object->thirdparty;
else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
}
else
{
Expand Down Expand Up @@ -356,8 +360,12 @@ function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidede
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
$array_other=$this->get_substitutionarray_other($outputlangs);
// retrieve contact information for use in order as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact)
$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');

$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other);
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook

Expand Down

0 comments on commit 0932ebd

Please sign in to comment.