2
0
forked from Wavyzz/dolibarr

FIX Can use odx templates that does not include lines tags

This commit is contained in:
Laurent Destailleur
2018-02-24 12:32:48 +01:00
parent e68612fa09
commit cbfe241c1b
7 changed files with 287 additions and 198 deletions

View File

@@ -163,7 +163,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
} }
$texte.='<div id="div_'.get_class($this).'">'; $texte.='<div id="div_'.get_class($this).'">';
} }
$texte.= '</td>'; $texte.= '</td>';
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">'; $texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
@@ -368,7 +368,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact); $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
complete_substitutions_array($tmparray, $outputlangs, $object); complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook // Call the ODTSubstitution hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
@@ -392,30 +392,42 @@ class doc_generic_order_odt extends ModelePDFCommandes
// Replace tags of lines // Replace tags of lines
try try
{ {
$listlines = $odfHandler->setSegment('lines'); $foundtagforlines = 1;
foreach ($object->lines as $line) try {
{ $listlines = $odfHandler->setSegment('lines');
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs); }
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); catch(OdfException $e)
// Call the ODTSubstitutionLine hook {
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line); // We may arrive here if tags for lines not present into template
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $foundtagforlines = 0;
foreach($tmparray as $key => $val) dol_syslog($e->getMessage(), LOG_INFO);
{ }
try if ($foundtagforlines)
{ {
$listlines->setVars($key, $val, true, 'UTF-8'); foreach ($object->lines as $line)
} {
catch(OdfException $e) $tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
{ complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
} // Call the ODTSubstitutionLine hook
catch(SegmentException $e) $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
{ $reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
} foreach($tmparray as $key => $val)
} {
$listlines->merge(); try
{
$listlines->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
{
}
catch(SegmentException $e)
{
}
}
$listlines->merge();
}
$odfHandler->mergeSegment($listlines);
} }
$odfHandler->mergeSegment($listlines);
} }
catch(OdfException $e) catch(OdfException $e)
{ {
@@ -468,7 +480,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
$odfHandler=null; // Destroy object $odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);
return 1; // Success return 1; // Success
} }
else else

View File

@@ -290,17 +290,38 @@ class doc_generic_contract_odt extends ModelePDFContract
{ {
$socobject=$object->thirdparty; $socobject=$object->thirdparty;
} }
// Make substitution
$substitutionarray=array( $object->fetch_optionals();
'__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email,
'__TOTAL_TTC__' => $object->total_ttc, // Define substitution array
'__TOTAL_HT__' => $object->total_ht, $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
'__TOTAL_VAT__' => $object->total_vat /* deprecated
); $substitutionarray['__FROM_NAME__'] = $this->emetteur->name;
complete_substitutions_array($substitutionarray, $langs, $object); $substitutionarray['__FROM_EMAIL__'] = $this->emetteur->email;
$substitutionarray['__TOTAL_TTC__'] = $object->total_ttc;
$substitutionarray['__TOTAL_HT__'] = $object->total_ht;
$substitutionarray['__TOTAL_VAT__'] = $object->total_vat;
*/
// Make substitutions into ODT
$array_contract=$this->get_substitutionarray_each_var_object($object, $outputlangs);
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
$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 contract as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
$substitutionarray = array_merge($substitutionarray,$array_contract,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$tmparray = $substitutionarray;
// Call the ODTSubstitution hook // Call the ODTSubstitution hook
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
// Line of free text // Line of free text
@@ -311,6 +332,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
} }
// Open and load template // Open and load template
require_once ODTPHP_PATH.'odf.php'; require_once ODTPHP_PATH.'odf.php';
try { try {
@@ -344,24 +366,6 @@ class doc_generic_contract_odt extends ModelePDFContract
{ {
} }
// Make substitutions into odt
$array_contract=$this->get_substitutionarray_each_var_object($object, $outputlangs);
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
$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 contract as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact)
$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
$tmparray = array_merge($array_contract,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
complete_substitutions_array($tmparray, $outputlangs, $object);
$object->fetch_optionals();
// Call the ODTSubstitution hook
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
foreach($tmparray as $key=>$value) foreach($tmparray as $key=>$value)
{ {
try { try {
@@ -379,33 +383,46 @@ class doc_generic_contract_odt extends ModelePDFContract
{ {
} }
} }
// Replace tags of lines // Replace tags of lines
try try
{ {
$listlines = $odfHandler->setSegment('lines'); $foundtagforlines = 1;
foreach ($object->lines as $line) try {
{ $listlines = $odfHandler->setSegment('lines');
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs); }
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); catch(OdfException $e)
// Call the ODTSubstitutionLine hook {
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line); // We may arrive here if tags for lines not present into template
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $foundtagforlines = 0;
foreach($tmparray as $key => $val) dol_syslog($e->getMessage(), LOG_INFO);
{ }
try if ($foundtagforlines)
{ {
$listlines->setVars($key, $val, true, 'UTF-8'); foreach ($object->lines as $line)
} {
catch(OdfException $e) $tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
{ complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
} // Call the ODTSubstitutionLine hook
catch(SegmentException $e) $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
{ $reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
} foreach($tmparray as $key => $val)
} {
$listlines->merge(); try
{
$listlines->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
{
}
catch(SegmentException $e)
{
}
}
$listlines->merge();
}
$odfHandler->mergeSegment($listlines);
} }
$odfHandler->mergeSegment($listlines);
} }
catch(OdfException $e) catch(OdfException $e)
{ {
@@ -456,7 +473,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$odfHandler=null; // Destroy object $odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);
return 1; // Success return 1; // Success
} }
else else

View File

@@ -437,30 +437,42 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
// Replace tags of lines // Replace tags of lines
try try
{ {
$listlines = $odfHandler->setSegment('lines'); $foundtagforlines = 1;
foreach ($object->lines as $line) try {
{ $listlines = $odfHandler->setSegment('lines');
$tmparray=$this->get_substitutionarray_shipment_lines($line,$outputlangs); }
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); catch(OdfException $e)
// Call the ODTSubstitutionLine hook {
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line); // We may arrive here if tags for lines not present into template
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $foundtagforlines = 0;
foreach($tmparray as $key => $val) dol_syslog($e->getMessage(), LOG_INFO);
{ }
try if ($foundtagforlines)
{ {
$listlines->setVars($key, $val, true, 'UTF-8'); foreach ($object->lines as $line)
} {
catch(OdfException $e) $tmparray=$this->get_substitutionarray_shipment_lines($line,$outputlangs);
{ complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
} // Call the ODTSubstitutionLine hook
catch(SegmentException $e) $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
{ $reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
} foreach($tmparray as $key => $val)
} {
$listlines->merge(); try
{
$listlines->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
{
}
catch(SegmentException $e)
{
}
}
$listlines->merge();
}
$odfHandler->mergeSegment($listlines);
} }
$odfHandler->mergeSegment($listlines);
} }
catch(OdfException $e) catch(OdfException $e)
{ {
@@ -511,7 +523,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
$odfHandler=null; // Destroy object $odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);
return 1; // Success return 1; // Success
} }
else else

View File

@@ -401,30 +401,42 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// Replace tags of lines // Replace tags of lines
try try
{ {
$listlines = $odfHandler->setSegment('lines'); $foundtagforlines = 1;
foreach ($object->lines as $line) try {
{ $listlines = $odfHandler->setSegment('lines');
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs); }
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); catch(OdfException $e)
// Call the ODTSubstitutionLine hook {
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line); // We may arrive here if tags for lines not present into template
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $foundtagforlines = 0;
foreach($tmparray as $key => $val) dol_syslog($e->getMessage(), LOG_INFO);
{ }
try if ($foundtagforlines)
{ {
$listlines->setVars($key, $val, true, 'UTF-8'); foreach ($object->lines as $line)
} {
catch(OdfException $e) $tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
{ complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
} // Call the ODTSubstitutionLine hook
catch(SegmentException $e) $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
{ $reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
} foreach($tmparray as $key => $val)
} {
$listlines->merge(); try
{
$listlines->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
{
}
catch(SegmentException $e)
{
}
}
$listlines->merge();
}
$odfHandler->mergeSegment($listlines);
} }
$odfHandler->mergeSegment($listlines);
} }
catch(OdfException $e) catch(OdfException $e)
{ {
@@ -475,7 +487,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$odfHandler=null; // Destroy object $odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);
return 1; // Success return 1; // Success
} }
else else

View File

@@ -421,30 +421,42 @@ class doc_generic_proposal_odt extends ModelePDFPropales
// Replace tags of lines // Replace tags of lines
try try
{ {
$listlines = $odfHandler->setSegment('lines'); $foundtagforlines = 1;
foreach ($object->lines as $line) try {
{ $listlines = $odfHandler->setSegment('lines');
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs); }
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); catch(OdfException $e)
// Call the ODTSubstitutionLine hook {
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line); // We may arrive here if tags for lines not present into template
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $foundtagforlines = 0;
foreach($tmparray as $key => $val) dol_syslog($e->getMessage(), LOG_INFO);
{ }
try if ($foundtagforlines)
{ {
$listlines->setVars($key, $val, true, 'UTF-8'); foreach ($object->lines as $line)
} {
catch(OdfException $e) $tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
{ complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
} // Call the ODTSubstitutionLine hook
catch(SegmentException $e) $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
{ $reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
} foreach($tmparray as $key => $val)
} {
$listlines->merge(); try
{
$listlines->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
{
}
catch(SegmentException $e)
{
}
}
$listlines->merge();
}
$odfHandler->mergeSegment($listlines);
} }
$odfHandler->mergeSegment($listlines);
} }
catch(OdfException $e) catch(OdfException $e)
{ {
@@ -495,7 +507,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$odfHandler=null; // Destroy object $odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);
return 1; // Success return 1; // Success
} }
else else

View File

@@ -413,30 +413,42 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
// Replace tags of lines // Replace tags of lines
try try
{ {
$listlines = $odfHandler->setSegment('lines'); $foundtagforlines = 1;
foreach ($object->lines as $line) try {
{ $listlines = $odfHandler->setSegment('lines');
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs); }
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); catch(OdfException $e)
// Call the ODTSubstitutionLine hook {
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line); // We may arrive here if tags for lines not present into template
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $foundtagforlines = 0;
foreach($tmparray as $key => $val) dol_syslog($e->getMessage(), LOG_INFO);
{ }
try if ($foundtagforlines)
{ {
$listlines->setVars($key, $val, true, 'UTF-8'); foreach ($object->lines as $line)
} {
catch(OdfException $e) $tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
{ complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
} // Call the ODTSubstitutionLine hook
catch(SegmentException $e) $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
{ $reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
} foreach($tmparray as $key => $val)
} {
$listlines->merge(); try
{
$listlines->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
{
}
catch(SegmentException $e)
{
}
}
$listlines->merge();
}
$odfHandler->mergeSegment($listlines);
} }
$odfHandler->mergeSegment($listlines);
} }
catch(OdfException $e) catch(OdfException $e)
{ {
@@ -487,7 +499,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
$odfHandler=null; // Destroy object $odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);
return 1; // Success return 1; // Success
} }
else else

View File

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