application patch 3.7.4

This commit is contained in:
Jephté Clain 2025-03-01 08:40:28 +04:00
parent 03ba8cbb13
commit 4aefd71824
3 changed files with 25 additions and 4 deletions

View File

@ -268,9 +268,13 @@ class CellValueFormatter
$dateObj->modify('+'.$secondsRemainder.'seconds'); $dateObj->modify('+'.$secondsRemainder.'seconds');
if ($this->shouldFormatDates) { if ($this->shouldFormatDates) {
$styleNumberFormatCode = $this->styleManager->getNumberFormatCode($cellStyleId); //$styleNumberFormatCode = $this->styleManager->getNumberFormatCode($cellStyleId);
$phpDateFormat = DateFormatHelper::toPHPDateFormat($styleNumberFormatCode); //$phpDateFormat = DateFormatHelper::toPHPDateFormat($styleNumberFormatCode);
// Toujours utiliser le format français complet
$phpDateFormat = "d/m/Y H:i:s";
$cellValue = $dateObj->format($phpDateFormat); $cellValue = $dateObj->format($phpDateFormat);
// Enlever la composante heure si elle n'existe pas
$cellValue = preg_replace('/ 00:00:00$/', "", $cellValue);
} else { } else {
$cellValue = $dateObj; $cellValue = $dateObj;
} }

View File

@ -29,7 +29,7 @@ class OptionsManager extends OptionsManagerAbstract
protected function setDefaultOptions() protected function setDefaultOptions()
{ {
$this->setOption(Options::TEMP_FOLDER, sys_get_temp_dir()); $this->setOption(Options::TEMP_FOLDER, sys_get_temp_dir());
$this->setOption(Options::SHOULD_FORMAT_DATES, false); $this->setOption(Options::SHOULD_FORMAT_DATES, true);
$this->setOption(Options::SHOULD_PRESERVE_EMPTY_ROWS, false); $this->setOption(Options::SHOULD_PRESERVE_EMPTY_ROWS, false);
$this->setOption(Options::SHOULD_USE_1904_DATES, false); $this->setOption(Options::SHOULD_USE_1904_DATES, false);
} }

View File

@ -22,6 +22,9 @@ abstract class WriterAbstract implements WriterInterface
/** @var resource Pointer to the file/stream we will write to */ /** @var resource Pointer to the file/stream we will write to */
protected $filePointer; protected $filePointer;
/** @var bool faut-il garder ouvert le flux quand close() est appelé? */
protected $dontCloseFilePointer = false;
/** @var bool Indicates whether the writer has been opened or not */ /** @var bool Indicates whether the writer has been opened or not */
protected $isWriterOpened = false; protected $isWriterOpened = false;
@ -57,6 +60,20 @@ abstract class WriterAbstract implements WriterInterface
return $this; return $this;
} }
public function writeToStream($filePointer)
{
$this->outputFilePath = null;
$this->filePointer = $filePointer;
$this->dontCloseFilePointer = true;
$this->throwIfFilePointerIsNotAvailable();
$this->openWriter();
$this->isWriterOpened = true;
return $this;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -177,7 +194,7 @@ abstract class WriterAbstract implements WriterInterface
$this->closeWriter(); $this->closeWriter();
if (\is_resource($this->filePointer)) { if (!$this->dontCloseFilePointer && \is_resource($this->filePointer)) {
$this->globalFunctionsHelper->fclose($this->filePointer); $this->globalFunctionsHelper->fclose($this->filePointer);
} }