Skip to content

Commit

Permalink
fix(Crm Lead Export) fix xls filemanager export
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmhh committed Jun 20, 2024
1 parent df88617 commit 8f7a1f9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tine20/Tinebase/Export/AbstractDeprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ public function getFieldConfig($fieldName)

public function save($target = null)
{
if ($target && $this->_tmpFile) {
if ($target && is_string($this->_tmpFile)) {
stream_copy_to_stream(fopen($this->_tmpFile, 'r'), fopen($target, 'w'));
}
}
Expand Down
2 changes: 1 addition & 1 deletion tine20/Tinebase/Export/FileLocationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getTargetFileLocation($filename = null): Tinebase_Model_Tree_Fil
return $this->_fileLocation;
}

if ($filename === null) {
if (!is_string($filename)) {
if (method_exists($this, 'write')) {
ob_start();
$fh = null;
Expand Down
17 changes: 15 additions & 2 deletions tine20/Tinebase/Export/Spreadsheet/Xls.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,22 @@ public function generate()

$this->_setColumnWidths();

return $this->_tmpFile = $this->getDocument();
return $this->getDocument();
}


public function save($target = null)
{
if ($target && $this->_excelObject instanceof PHPExcel) {
ob_start();
try {
$this->write();
} finally {
$output = ob_get_clean();
}
file_put_contents($target, $output);
}
}

/**
* sets the colunm widths by config column->width
*/
Expand Down

0 comments on commit 8f7a1f9

Please sign in to comment.