Skip to content

Commit

Permalink
Merge branch 'pu/pm/TbExportWaterMarkOnAllHeaders' into '2024.11'
Browse files Browse the repository at this point in the history
tweak(TB Export) watermark on all headers

See merge request tine20/tine20!4835
  • Loading branch information
paulmhh committed Jan 26, 2024
2 parents f70fa1d + 966b1e8 commit ee7b074
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions tine20/Sales/Export/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ protected function _loadTwig()

// do this after any _createDocument calls! otherwise we lose the watermark
if (!$record->isBooked()) {
$this->_docTemplate->addWaterMark('PROFORMA', 1);
$this->_docTemplate->addWaterMark('PROFORMA', 2);
$this->_docTemplate->addWaterMark('PROFORMA', null);
}

$vats = new Tinebase_Record_RecordSet(Tinebase_Config_KeyFieldRecord::class, []);
Expand Down
8 changes: 7 additions & 1 deletion tine20/Tinebase/Export/Richtext/TemplateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage Export
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
* @author Paul Mehrer <[email protected]>
* @copyright Copyright (c) 2017-2017 Metaways Infosystems GmbH (http://www.metaways.de)
* @copyright Copyright (c) 2017-2024 Metaways Infosystems GmbH (http://www.metaways.de)
*/

/**
Expand Down Expand Up @@ -794,6 +794,12 @@ function ($match) {

public function addWaterMark($text, $headerIndex = 1)
{
if (null === $headerIndex) {
foreach (array_keys($this->tempDocumentHeaders) as $hIdx) {
$this->addWaterMark($text, $hIdx);
}
return;
}
if (!isset($this->tempDocumentHeaders[$headerIndex])) {
throw new Exception('header idnex ' . $headerIndex . ' doesn\'t exist');
/*
Expand Down

0 comments on commit ee7b074

Please sign in to comment.