forked from Wavyzz/dolibarr
fix cti (#29812)
* fix cti Dead catch - OdfException is never thrown in the try block. * Update json.lib.php
This commit is contained in:
@@ -297,7 +297,6 @@ function dol_json_decode($json, $assoc = false)
|
|||||||
if ($out != '') {
|
if ($out != '') {
|
||||||
try {
|
try {
|
||||||
// @phan-suppress-next-line PhanPluginUnsafeEval
|
// @phan-suppress-next-line PhanPluginUnsafeEval
|
||||||
//print debug_print_backtrace();
|
|
||||||
eval('$array = '.$out.';'); // not secured but this is no mode used as php json lib is always expected to be loaded now.
|
eval('$array = '.$out.';'); // not secured but this is no mode used as php json lib is always expected to be loaded now.
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$array = array();
|
$array = array();
|
||||||
|
|||||||
@@ -396,44 +396,44 @@ class doc_generic_asset_odt extends ModelePDFAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Replace tags of lines
|
// Replace tags of lines
|
||||||
|
$foundtagforlines = 1;
|
||||||
try {
|
try {
|
||||||
$foundtagforlines = 1;
|
$listlines = $odfHandler->setSegment('lines');
|
||||||
try {
|
} catch (OdfExceptionSegmentNotFound $e) {
|
||||||
$listlines = $odfHandler->setSegment('lines');
|
// We may arrive here if tags for lines not present into template
|
||||||
} catch (OdfExceptionSegmentNotFound $e) {
|
$foundtagforlines = 0;
|
||||||
// We may arrive here if tags for lines not present into template
|
dol_syslog($e->getMessage(), LOG_INFO);
|
||||||
$foundtagforlines = 0;
|
|
||||||
dol_syslog($e->getMessage(), LOG_INFO);
|
|
||||||
} catch (OdfException $e) {
|
|
||||||
$foundtagforlines = 0;
|
|
||||||
dol_syslog($e->getMessage(), LOG_INFO);
|
|
||||||
}
|
|
||||||
if ($foundtagforlines) {
|
|
||||||
$linenumber = 0;
|
|
||||||
foreach ($object->lines as $line) {
|
|
||||||
$linenumber++;
|
|
||||||
$tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber);
|
|
||||||
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) {
|
|
||||||
dol_syslog($e->getMessage(), LOG_INFO);
|
|
||||||
} catch (SegmentException $e) {
|
|
||||||
dol_syslog($e->getMessage(), LOG_INFO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$listlines->merge();
|
|
||||||
}
|
|
||||||
$odfHandler->mergeSegment($listlines);
|
|
||||||
}
|
|
||||||
} catch (OdfException $e) {
|
} catch (OdfException $e) {
|
||||||
$this->error = $e->getMessage();
|
$foundtagforlines = 0;
|
||||||
dol_syslog($this->error, LOG_WARNING);
|
dol_syslog($e->getMessage(), LOG_INFO);
|
||||||
return -1;
|
}
|
||||||
|
if ($foundtagforlines) {
|
||||||
|
$linenumber = 0;
|
||||||
|
foreach ($object->lines as $line) {
|
||||||
|
$linenumber++;
|
||||||
|
$tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber);
|
||||||
|
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) {
|
||||||
|
dol_syslog($e->getMessage(), LOG_INFO);
|
||||||
|
} catch (SegmentException $e) {
|
||||||
|
dol_syslog($e->getMessage(), LOG_INFO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$listlines->merge();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$odfHandler->mergeSegment($listlines);
|
||||||
|
} catch (OdfException $e) {
|
||||||
|
$this->error = $e->getMessage();
|
||||||
|
dol_syslog($this->error, LOG_WARNING);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace labels translated
|
// Replace labels translated
|
||||||
|
|||||||
Reference in New Issue
Block a user