Fix : make ODT substitution for company after contacts

This commit is contained in:
jfefe 2014-04-30 19:18:51 +02:00
parent 00cd616f4c
commit fd45bb16bd
2 changed files with 35 additions and 38 deletions

View File

@ -224,6 +224,7 @@ abstract class CommonDocGenerator
} }
$array_contact = array ( $array_contact = array (
$array_key . '_fullname' => $object->getFullName($outputlangs, 1),
$array_key . '_lastname' => $object->lastname, $array_key . '_lastname' => $object->lastname,
$array_key . '_firstname' => $object->firstname, $array_key . '_firstname' => $object->firstname,
$array_key . '_address' => $object->address, $array_key . '_address' => $object->address,

View File

@ -293,20 +293,15 @@ class doc_generic_odt extends ModeleThirdPartyDoc
// setVars failed, probably because key not found // setVars failed, probably because key not found
} }
} }
// Make substitutions into odt of thirdparty + external modules
$tmparray=$this->get_substitutionarray_thirdparty($object,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Replace tags of lines for contacts // Replace tags of lines for contacts
$contact_arrray=array(); $contact_arrray=array();
$sql = "SELECT p.rowid"; $sql = "SELECT p.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " WHERE p.fk_soc = ".$object->id;
dol_syslog('doc_generic_odt :: sql='.$sql,LOG_DEBUG); dol_syslog('doc_generic_odt :: sql='.$sql,LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
@ -315,7 +310,6 @@ class doc_generic_odt extends ModeleThirdPartyDoc
if ($num) if ($num)
{ {
$i=0; $i=0;
$contactstatic = new Contact($this->db); $contactstatic = new Contact($this->db);
while($i < $num) while($i < $num)
@ -323,9 +317,6 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$contact_arrray[$i] = $obj->rowid; $contact_arrray[$i] = $obj->rowid;
//$contactstatic;
$i++; $i++;
} }
} }
@ -400,6 +391,11 @@ class doc_generic_odt extends ModeleThirdPartyDoc
} }
} }
// Make substitutions into odt of thirdparty + external modules
$tmparray=$this->get_substitutionarray_thirdparty($object,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the beforeODTSave hook // Call the beforeODTSave hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks