Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(Tinebase): strike text export function does not work with muti by…
Browse files Browse the repository at this point in the history
…te chars
  • Loading branch information
sstamer committed Mar 21, 2023
1 parent e613c8d commit 56127e7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
7 changes: 1 addition & 6 deletions tine20/Calendar/Export/Doc.php
Expand Up @@ -49,17 +49,12 @@ public function _processRecord(Tinebase_Record_Interface $record)

if ($record->status == 'CANCELED'){
$translation = Tinebase_Translation::getTranslation('Calendar');
$record->summary = $this->_strikeText($record->summary) . ' (' . $translation->_('Canceled') . ')';
$record->summary = $this->strikeText($record->summary) . ' (' . $translation->_('Canceled') . ')';
};

return parent::_processRecord($record);
}

private function _strikeText($text){
$splitText = str_split($text);
return implode(IntlChar::chr(822), $splitText) . IntlChar::chr(822);
}

/**
* @param array $context
* @return array
Expand Down
7 changes: 1 addition & 6 deletions tine20/Calendar/Export/DocV2.php
Expand Up @@ -55,17 +55,12 @@ public function _processRecord(Tinebase_Record_Interface $record)

if ($record->status == 'CANCELED'){
$translation = Tinebase_Translation::getTranslation('Calendar');
$record->summary = $this->_strikeText($record->summary) . ' (' . $translation->_('Canceled') . ')';
$record->summary = $this->strikeText($record->summary) . ' (' . $translation->_('Canceled') . ')';
};

return parent::_processRecord($record);
}

private function _strikeText($text){
$splitText = str_split($text);
return implode(IntlChar::chr(822), $splitText) . IntlChar::chr(822);
}

/**
* @param array $context
* @return array
Expand Down
7 changes: 1 addition & 6 deletions tine20/Calendar/Export/Ods.php
Expand Up @@ -47,14 +47,9 @@ public function processRecord($record, $idx)
$translation = Tinebase_Translation::getTranslation('Calendar');

if ($record->status == 'CANCELED'){
$record->summary = $this->_strikeText($record->summary) . ' (' . $translation->_('Canceled') . ')';
$record->summary = $this->strikeText($record->summary) . ' (' . $translation->_('Canceled') . ')';
};

return parent::processRecord($record, $idx);
}

private function _strikeText($text){
$splitText = str_split($text);
return implode(IntlChar::chr(822), $splitText) . IntlChar::chr(822);
}
}
6 changes: 6 additions & 0 deletions tine20/Tinebase/Export/Abstract.php
Expand Up @@ -1798,4 +1798,10 @@ public static function getPluginOptionsDefinition()
],
];
}

public function strikeText($text){
$splitText = preg_split('//u', $text, null, PREG_SPLIT_NO_EMPTY);
return implode(IntlChar::chr(822), $splitText) . IntlChar::chr(822);
}

}
5 changes: 5 additions & 0 deletions tine20/Tinebase/Export/AbstractDeprecated.php
Expand Up @@ -730,4 +730,9 @@ public function save($target = null)
stream_copy_to_stream(fopen($this->_tmpFile, 'r'), fopen($target, 'w'));
}
}

public function strikeText($text){
$splitText = preg_split('//u', $text, null, PREG_SPLIT_NO_EMPTY);
return implode(IntlChar::chr(822), $splitText) . IntlChar::chr(822);
}
}

0 comments on commit 56127e7

Please sign in to comment.