forked from Wavyzz/dolibarr
FIX Can use odx templates that does not include lines tags
This commit is contained in:
@@ -163,7 +163,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
}
|
||||
$texte.='<div id="div_'.get_class($this).'">';
|
||||
}
|
||||
|
||||
|
||||
$texte.= '</td>';
|
||||
|
||||
$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);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
|
||||
|
||||
$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
|
||||
|
||||
@@ -392,30 +392,42 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
$foundtagforlines = 1;
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
// We may arrive here if tags for lines not present into template
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines)
|
||||
{
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -468,7 +480,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Success
|
||||
}
|
||||
else
|
||||
|
||||
@@ -290,17 +290,38 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
{
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $this->emetteur->name,
|
||||
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||
'__TOTAL_TTC__' => $object->total_ttc,
|
||||
'__TOTAL_HT__' => $object->total_ht,
|
||||
'__TOTAL_VAT__' => $object->total_vat
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
|
||||
$object->fetch_optionals();
|
||||
|
||||
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
/* deprecated
|
||||
$substitutionarray['__FROM_NAME__'] = $this->emetteur->name;
|
||||
$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
|
||||
$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
|
||||
|
||||
// Line of free text
|
||||
@@ -311,6 +332,7 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||
}
|
||||
|
||||
|
||||
// Open and load template
|
||||
require_once ODTPHP_PATH.'odf.php';
|
||||
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)
|
||||
{
|
||||
try {
|
||||
@@ -379,33 +383,46 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
$foundtagforlines = 1;
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
// We may arrive here if tags for lines not present into template
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines)
|
||||
{
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -456,7 +473,7 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Success
|
||||
}
|
||||
else
|
||||
|
||||
@@ -437,30 +437,42 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_shipment_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
$foundtagforlines = 1;
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
// We may arrive here if tags for lines not present into template
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines)
|
||||
{
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_shipment_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -511,7 +523,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Success
|
||||
}
|
||||
else
|
||||
|
||||
@@ -401,30 +401,42 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
$foundtagforlines = 1;
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
// We may arrive here if tags for lines not present into template
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines)
|
||||
{
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -475,7 +487,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Success
|
||||
}
|
||||
else
|
||||
|
||||
@@ -421,30 +421,42 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
$foundtagforlines = 1;
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
// We may arrive here if tags for lines not present into template
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines)
|
||||
{
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -495,7 +507,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Success
|
||||
}
|
||||
else
|
||||
|
||||
@@ -413,30 +413,42 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
|
||||
// Replace tags of lines
|
||||
try
|
||||
{
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
try
|
||||
{
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
catch(SegmentException $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
$foundtagforlines = 1;
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
}
|
||||
catch(OdfException $e)
|
||||
{
|
||||
// We may arrive here if tags for lines not present into template
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines)
|
||||
{
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -487,7 +499,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
|
||||
$odfHandler=null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1; // Success
|
||||
}
|
||||
else
|
||||
|
||||
@@ -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