forked from Wavyzz/dolibarr
FIX Can use odx templates that does not include lines tags
This commit is contained in:
@@ -389,7 +389,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
if (preg_match('/logo$/',$key)) // Image
|
||||
{
|
||||
@@ -408,34 +408,46 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->members as $u)
|
||||
$foundtagforlines = 1;
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_each_var_object($u,$outputlangs);
|
||||
unset($tmparray['object_pass']);
|
||||
unset($tmparray['object_pass_indatabase']);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $user, "completesubstitutionarray_users");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$u);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key => $val)
|
||||
// We may arrive here if tags for lines not present into template
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines)
|
||||
{
|
||||
foreach ($object->members as $u)
|
||||
{
|
||||
try
|
||||
$tmparray=$this->get_substitutionarray_each_var_object($u,$outputlangs);
|
||||
unset($tmparray['object_pass']);
|
||||
unset($tmparray['object_pass_indatabase']);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $user, "completesubstitutionarray_users");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$u);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
if(!is_array($val)) {
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
try
|
||||
{
|
||||
if(!is_array($val)) {
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
$listlines->merge();
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
@@ -443,7 +455,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Replace labels translated
|
||||
$tmparray=$outputlangs->get_translations_for_substitutions();
|
||||
foreach($tmparray as $key=>$value)
|
||||
@@ -486,7 +498,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Success
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user