From 9c19f161c07c5a5e7b02e735390f5e55e66ef5ef Mon Sep 17 00:00:00 2001 From: fednikx <48510145+fednikx@users.noreply.github.com> Date: Thu, 14 Mar 2019 12:31:13 +0100 Subject: [PATCH 1/7] Update RispostaRiceviFatture.php Aggiunta la costante ER00 da restituire quando non si vuole convalidare la ricezione a SDI --- src/RispostaRiceviFatture.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/RispostaRiceviFatture.php b/src/RispostaRiceviFatture.php index d1f3a46..73a2904 100644 --- a/src/RispostaRiceviFatture.php +++ b/src/RispostaRiceviFatture.php @@ -24,6 +24,7 @@ class RispostaRiceviFatture { const ER01 = 'ER01'; + const ER00 = 'ER00'; public $Esito = self::ER01; From fed0682e176c028ee25a88ba55d191e79525ca4f Mon Sep 17 00:00:00 2001 From: fednikx <48510145+fednikx@users.noreply.github.com> Date: Thu, 14 Mar 2019 12:46:57 +0100 Subject: [PATCH 2/7] Update FileSdIBase.php Controlla che il file non abbia estensione p7m. In quel caso removeBOM() non fa nulla. removeBOM() ora rimuove TUTTI i caratteri UTF BOM e non solamente il BOM UTF-8 --- src/FileSdIBase.php | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/FileSdIBase.php b/src/FileSdIBase.php index 92a4283..27dd3a6 100644 --- a/src/FileSdIBase.php +++ b/src/FileSdIBase.php @@ -25,6 +25,22 @@ class FileSdIBase { public $NomeFile = null; public $File = null; + private $BOM = array("\xEF\xBB\xBF", + "\xFE\xFF", + "\xFF\xFE", + "\x00\x00\xFE\xFF", + "\xFF\xFE\x00\x00", + "\x2B\x2F\x76\x38", + "\x2B\x2F\x76\x39", + "\x2B\x2F\x76\x2B", + "\x2B\x2F\x76\x2F", + "\x2B\x2F\x76\x38\x2D", + "\xF7\x64\x4C", + "\xDD\x73\x66\x73", + "\x0E\xFE\xFF", + "\xFB\xEE\x28", + "\x84\x31\x95\x33"); + private $isP7M=FALSE; public function __construct( \StdClass $parametersIn = null ) { @@ -52,7 +68,9 @@ public function import( $file ) if (false === is_readable($file)) { throw new \Exception("'$file' not found or not readable"); } - + $estensione=end(explode($file)); + if(strcmp("p7m",$estensione)===0 || strcmp("P7M",$estensione)===0 || strcmp("p7M",$estensione)===0 || + strcmp("P7m",$estensione)===0) $this->isP7M=TRUE; $this->NomeFile = basename($file); $this->File = file_get_contents($file); $this->removeBOM(); @@ -61,15 +79,17 @@ public function import( $file ) } /** - * Remove UTF-8 BOM + * If is P7M do nothing, else remove ALL UTF BOM charachters * - * Credits: https://forum.italia.it/u/Francesco_Biegi - * See https://forum.italia.it/t/risolto-notifica-di-scarto-content-is-not-allowed-in-prolog/5798/7 */ public function removeBOM() { - $this->File = str_replace("\xEF\xBB\xBF", '', $this->File); - - return $this; + if($this->isP7M){ + return $this; + } + else{ + $this->File = str_replace($this->BOM, '', $this->File); + return $this; + } } } From b92b7beecbd88e52054651437b59ca4732b3b687 Mon Sep 17 00:00:00 2001 From: fednikx <48510145+fednikx@users.noreply.github.com> Date: Thu, 14 Mar 2019 13:00:07 +0100 Subject: [PATCH 3/7] Update FileSdIBase.php --- src/FileSdIBase.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/FileSdIBase.php b/src/FileSdIBase.php index 27dd3a6..77fb711 100644 --- a/src/FileSdIBase.php +++ b/src/FileSdIBase.php @@ -51,7 +51,9 @@ public function __construct( \StdClass $parametersIn = null ) if (!property_exists($parametersIn, 'File')) { throw new \Exception("Cannot find property 'File'"); } - + $estensione=end(explode($this->NomeFile)); + if(strcmp("p7m",$estensione)===0 || strcmp("P7M",$estensione)===0 || strcmp("p7M",$estensione)===0 || + strcmp("P7m",$estensione)===0) $this->isP7M=TRUE; $this->NomeFile = $parametersIn->NomeFile; $this->File = $parametersIn->File; $this->removeBOM(); From aa59b2801248ab242dfbd583a58b59782a442302 Mon Sep 17 00:00:00 2001 From: fednikx <48510145+fednikx@users.noreply.github.com> Date: Fri, 15 Mar 2019 08:41:48 +0100 Subject: [PATCH 4/7] Update FileSdIBase.php Correzione di errori sciocchi --- src/FileSdIBase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FileSdIBase.php b/src/FileSdIBase.php index 77fb711..37e3a25 100644 --- a/src/FileSdIBase.php +++ b/src/FileSdIBase.php @@ -51,7 +51,7 @@ public function __construct( \StdClass $parametersIn = null ) if (!property_exists($parametersIn, 'File')) { throw new \Exception("Cannot find property 'File'"); } - $estensione=end(explode($this->NomeFile)); + $estensione=end(explode($parametersIn->NomeFile)); if(strcmp("p7m",$estensione)===0 || strcmp("P7M",$estensione)===0 || strcmp("p7M",$estensione)===0 || strcmp("P7m",$estensione)===0) $this->isP7M=TRUE; $this->NomeFile = $parametersIn->NomeFile; @@ -81,7 +81,7 @@ public function import( $file ) } /** - * If is P7M do nothing, else remove ALL UTF BOM charachters + * If is P7M do nothing, else remove ALL UTF BOM chars * */ public function removeBOM() From 274a9de984a00ea5eaa432b76a8d26403812ffca Mon Sep 17 00:00:00 2001 From: fednikx <48510145+fednikx@users.noreply.github.com> Date: Fri, 15 Mar 2019 17:28:59 +0100 Subject: [PATCH 5/7] Update FileSdIBase.php --- src/FileSdIBase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FileSdIBase.php b/src/FileSdIBase.php index 37e3a25..33af213 100644 --- a/src/FileSdIBase.php +++ b/src/FileSdIBase.php @@ -51,7 +51,7 @@ public function __construct( \StdClass $parametersIn = null ) if (!property_exists($parametersIn, 'File')) { throw new \Exception("Cannot find property 'File'"); } - $estensione=end(explode($parametersIn->NomeFile)); + $estensione=end(explode(".",$parametersIn->NomeFile)); if(strcmp("p7m",$estensione)===0 || strcmp("P7M",$estensione)===0 || strcmp("p7M",$estensione)===0 || strcmp("P7m",$estensione)===0) $this->isP7M=TRUE; $this->NomeFile = $parametersIn->NomeFile; @@ -70,7 +70,7 @@ public function import( $file ) if (false === is_readable($file)) { throw new \Exception("'$file' not found or not readable"); } - $estensione=end(explode($file)); + $estensione=end(explode(".",$file)); if(strcmp("p7m",$estensione)===0 || strcmp("P7M",$estensione)===0 || strcmp("p7M",$estensione)===0 || strcmp("P7m",$estensione)===0) $this->isP7M=TRUE; $this->NomeFile = basename($file); From 0a768180fa6fa1d76ff0b87fc851390a5fbacb51 Mon Sep 17 00:00:00 2001 From: fednikx <48510145+fednikx@users.noreply.github.com> Date: Sun, 24 Mar 2019 20:07:25 +0100 Subject: [PATCH 6/7] Update FileSdIBase.php --- src/FileSdIBase.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/FileSdIBase.php b/src/FileSdIBase.php index 33af213..b54be7c 100644 --- a/src/FileSdIBase.php +++ b/src/FileSdIBase.php @@ -25,6 +25,7 @@ class FileSdIBase { public $NomeFile = null; public $File = null; + /* Set and array of UTF BOM chars, just in case of need */ private $BOM = array("\xEF\xBB\xBF", "\xFE\xFF", "\xFF\xFE", @@ -40,7 +41,6 @@ class FileSdIBase "\x0E\xFE\xFF", "\xFB\xEE\x28", "\x84\x31\x95\x33"); - private $isP7M=FALSE; public function __construct( \StdClass $parametersIn = null ) { @@ -51,9 +51,7 @@ public function __construct( \StdClass $parametersIn = null ) if (!property_exists($parametersIn, 'File')) { throw new \Exception("Cannot find property 'File'"); } - $estensione=end(explode(".",$parametersIn->NomeFile)); - if(strcmp("p7m",$estensione)===0 || strcmp("P7M",$estensione)===0 || strcmp("p7M",$estensione)===0 || - strcmp("P7m",$estensione)===0) $this->isP7M=TRUE; + $this->NomeFile = $parametersIn->NomeFile; $this->File = $parametersIn->File; $this->removeBOM(); @@ -70,9 +68,6 @@ public function import( $file ) if (false === is_readable($file)) { throw new \Exception("'$file' not found or not readable"); } - $estensione=end(explode(".",$file)); - if(strcmp("p7m",$estensione)===0 || strcmp("P7M",$estensione)===0 || strcmp("p7M",$estensione)===0 || - strcmp("P7m",$estensione)===0) $this->isP7M=TRUE; $this->NomeFile = basename($file); $this->File = file_get_contents($file); $this->removeBOM(); @@ -81,17 +76,10 @@ public function import( $file ) } /** - * If is P7M do nothing, else remove ALL UTF BOM chars - * + * Do nothing */ public function removeBOM() { - if($this->isP7M){ - return $this; - } - else{ - $this->File = str_replace($this->BOM, '', $this->File); - return $this; - } + return $this; } } From 73cd0de5bfd7278112c4bf0aab538154b1272053 Mon Sep 17 00:00:00 2001 From: fednikx <48510145+fednikx@users.noreply.github.com> Date: Thu, 2 May 2019 18:39:20 +0200 Subject: [PATCH 7/7] Update FileSdIBase.php --- src/FileSdIBase.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/FileSdIBase.php b/src/FileSdIBase.php index b54be7c..57650fc 100644 --- a/src/FileSdIBase.php +++ b/src/FileSdIBase.php @@ -25,22 +25,6 @@ class FileSdIBase { public $NomeFile = null; public $File = null; - /* Set and array of UTF BOM chars, just in case of need */ - private $BOM = array("\xEF\xBB\xBF", - "\xFE\xFF", - "\xFF\xFE", - "\x00\x00\xFE\xFF", - "\xFF\xFE\x00\x00", - "\x2B\x2F\x76\x38", - "\x2B\x2F\x76\x39", - "\x2B\x2F\x76\x2B", - "\x2B\x2F\x76\x2F", - "\x2B\x2F\x76\x38\x2D", - "\xF7\x64\x4C", - "\xDD\x73\x66\x73", - "\x0E\xFE\xFF", - "\xFB\xEE\x28", - "\x84\x31\x95\x33"); public function __construct( \StdClass $parametersIn = null ) {