Skip to content
Permalink
Browse files

Added functionality to get project customer contact as contact_xx tags

  • Loading branch information...
apachler committed Mar 24, 2016
1 parent 9b1cfe4 commit 0d308f74be0fafdbaba332d0f448c583c2b2bf2e
Showing with 29 additions and 2 deletions.
  1. +29 −2 htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
@@ -482,7 +482,30 @@ function write_file($object,$outputlangs,$srctemplatepath)
dol_mkdir($conf->projet->dir_temp);
$socobject=$object->thirdparty;
// If PROJECTLEADER contact defined on project, we use it
$usecontact=false;
$arrayidcontact=$object->getIdContact('external','PROJECTLEADER');
if (count($arrayidcontact) > 0)
{
$usecontact=true;
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
{
// 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;
// if we have a PROJECTLEADER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
}
else
{
$socobject=$object->thirdparty;
}
// Make substitution
$substitutionarray=array(
@@ -527,8 +550,12 @@ function write_file($object,$outputlangs,$srctemplatepath)
$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 project 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
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);

0 comments on commit 0d308f7

Please sign in to comment.
You can’t perform that action at this time.