mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
@@ -1046,7 +1046,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
),
|
||||
);
|
||||
|
||||
//Insert reference
|
||||
// Insert list of objects into the project
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('projectrefs');
|
||||
|
||||
@@ -1122,6 +1122,8 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
} catch (OdfExceptionSegmentNotFound $e) {
|
||||
// Do nothing
|
||||
} catch (OdfException $e) {
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
|
||||
@@ -9,6 +9,13 @@ class OdfException extends Exception
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Class of ODT Exception
|
||||
*/
|
||||
class OdfExceptionSegmentNotFound extends Exception
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Templating class for odt file
|
||||
* You need PHP 5.2 at least
|
||||
@@ -662,7 +669,7 @@ IMG;
|
||||
* Extract the segment and store it into $this->segments[]. Return it for next call.
|
||||
*
|
||||
* @param string $segment Segment
|
||||
* @throws OdfException
|
||||
* @throws OdfExceptionSegmentNotFound
|
||||
* @return Segment
|
||||
*/
|
||||
public function setSegment($segment)
|
||||
@@ -674,7 +681,7 @@ IMG;
|
||||
$reg = "#\[!--\sBEGIN\s$segment\s--\](.*)\[!--\sEND\s$segment\s--\]#sm";
|
||||
$m = array();
|
||||
if (preg_match($reg, html_entity_decode($this->contentXml), $m) == 0) {
|
||||
throw new OdfException("'".$segment."' segment not found in the document. The tag [!-- BEGIN xxx --] or [!-- END xxx --] is not present into content file.");
|
||||
throw new OdfExceptionSegmentNotFound("'".$segment."' segment not found in the document. The tag [!-- BEGIN xxx --] or [!-- END xxx --] is not present into content file.");
|
||||
}
|
||||
$this->segments[$segment] = new Segment($segment, $m[1], $this);
|
||||
return $this->segments[$segment];
|
||||
|
||||
Reference in New Issue
Block a user