application des modifs nulib/spout pour v3.7.4
This commit is contained in:
parent
d416e6799b
commit
bda119cbed
77
patches/v3.7.4.patch
Normal file
77
patches/v3.7.4.patch
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
diff --git a/src/Writer/WriterAbstract.php b/src/Writer/WriterAbstract.php
|
||||||
|
index fd7c472..a2a5e37 100644
|
||||||
|
--- a/src/Writer/WriterAbstract.php
|
||||||
|
+++ b/src/Writer/WriterAbstract.php
|
||||||
|
@@ -22,6 +22,9 @@ abstract class WriterAbstract implements WriterInterface
|
||||||
|
/** @var resource Pointer to the file/stream we will write to */
|
||||||
|
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 */
|
||||||
|
protected $isWriterOpened = false;
|
||||||
|
|
||||||
|
@@ -57,6 +60,20 @@ abstract class WriterAbstract implements WriterInterface
|
||||||
|
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}
|
||||||
|
*/
|
||||||
|
@@ -177,7 +194,7 @@ abstract class WriterAbstract implements WriterInterface
|
||||||
|
|
||||||
|
$this->closeWriter();
|
||||||
|
|
||||||
|
- if (\is_resource($this->filePointer)) {
|
||||||
|
+ if (!$this->dontCloseFilePointer && \is_resource($this->filePointer)) {
|
||||||
|
$this->globalFunctionsHelper->fclose($this->filePointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/Reader/XLSX/Helper/CellValueFormatter.php b/src/Reader/XLSX/Helper/CellValueFormatter.php
|
||||||
|
index 1734fb5..08e5282 100644
|
||||||
|
--- a/src/Reader/XLSX/Helper/CellValueFormatter.php
|
||||||
|
+++ b/src/Reader/XLSX/Helper/CellValueFormatter.php
|
||||||
|
@@ -268,9 +268,13 @@ class CellValueFormatter
|
||||||
|
$dateObj->modify('+'.$secondsRemainder.'seconds');
|
||||||
|
|
||||||
|
if ($this->shouldFormatDates) {
|
||||||
|
- $styleNumberFormatCode = $this->styleManager->getNumberFormatCode($cellStyleId);
|
||||||
|
- $phpDateFormat = DateFormatHelper::toPHPDateFormat($styleNumberFormatCode);
|
||||||
|
+ //$styleNumberFormatCode = $this->styleManager->getNumberFormatCode($cellStyleId);
|
||||||
|
+ //$phpDateFormat = DateFormatHelper::toPHPDateFormat($styleNumberFormatCode);
|
||||||
|
+ // Toujours utiliser le format français complet
|
||||||
|
+ $phpDateFormat = "d/m/Y H:i:s";
|
||||||
|
$cellValue = $dateObj->format($phpDateFormat);
|
||||||
|
+ // Enlever la composante heure si elle n'existe pas
|
||||||
|
+ $cellValue = preg_replace('/ 00:00:00$/', "", $cellValue);
|
||||||
|
} else {
|
||||||
|
$cellValue = $dateObj;
|
||||||
|
}
|
||||||
|
diff --git a/src/Reader/XLSX/Manager/OptionsManager.php b/src/Reader/XLSX/Manager/OptionsManager.php
|
||||||
|
index b04b92c..5749f65 100644
|
||||||
|
--- a/src/Reader/XLSX/Manager/OptionsManager.php
|
||||||
|
+++ b/src/Reader/XLSX/Manager/OptionsManager.php
|
||||||
|
@@ -29,7 +29,7 @@ class OptionsManager extends OptionsManagerAbstract
|
||||||
|
protected function setDefaultOptions()
|
||||||
|
{
|
||||||
|
$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_USE_1904_DATES, false);
|
||||||
|
}
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user