Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pastell Connecteur SAE Maarch RM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
Pastell Connecteur SAE Maarch RM
Commits
07012218
Commit
07012218
authored
4 years ago
by
Arnaud Pauget
Browse files
Options
Downloads
Patches
Plain Diff
fix() : amélioration analyse datas reçu lors de l'export d'un bordereau + error debug
parent
7435fbc6
No related branches found
Branches containing commit
Tags
<3.1.5
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MaarchREST.class.php
+16
-3
16 additions, 3 deletions
MaarchREST.class.php
with
16 additions
and
3 deletions
MaarchREST.class.php
+
16
−
3
View file @
07012218
...
...
@@ -161,22 +161,35 @@ class MaarchREST extends SAEConnecteur {
public
function
getXmlFromZipMessage
(
$zipMessage
,
$messageId
)
{
$tmpFile
=
new
TmpFile
();
$zipTempFile
=
$tmpFile
->
create
();
file_put_contents
(
$zipTempFile
,
$zipMessage
);
$writer
=
file_put_contents
(
$zipTempFile
,
$zipMessage
);
if
(
$writer
==
0
)
{
throw
new
UnrecoverableException
(
"ERREUR : L'application n'a pas pu écrire le contenu du bordereau ou son contenu est vide."
);
}
// get the absolute path to $file
$path
=
pathinfo
(
realpath
(
$zipTempFile
),
PATHINFO_DIRNAME
);
if
(
is_null
(
$zipMessage
)
||
empty
(
$zipMessage
))
{
throw
new
UnrecoverableException
(
"Le paquet a correctement été récupéré mais semble vide. Vérifiez l'identifiant
$messageId
dans maarch RM."
);
}
try
{
shell_exec
(
"7z x
$zipTempFile
-o
$path
*.xml"
);
}
catch
(
Exception
$e
)
{
error_log
(
"ERREUR LECTURE ZIP"
,
0
);
error_log
(
"Chemin ZIP : "
.
$zipTempFile
,
0
);
error_log
(
"Extraction vers : "
.
$path
,
0
);
throw
new
UnrecoverableException
(
$e
);
}
$fullFilePath
=
$path
.
"/"
.
$messageId
.
".xml"
;
if
(
!
file_exists
(
$fullFilePath
))
{
error_log
(
"ERREUR LECTURE FICHIER : "
.
$fullFilePath
,
0
);
throw
new
UnrecoverableException
(
"Problème lors de la lecture du fichier
$fullFilePath
."
);
}
$xmlContent
=
file_get_contents
(
$fullFilePath
);
unlink
(
$zipTempFile
);
...
...
@@ -200,10 +213,10 @@ class MaarchREST extends SAEConnecteur {
"application/zip"
);
if
(
$zipMessage
)
{
if
(
$zipMessage
&&
$zipMessage
!=
"false"
)
{
return
$zipMessage
;
}
else
{
throw
new
UnrecoverableException
(
"Le paquet du bordereau identifié par "
.
$messageId
.
" n'a pas pu être récup
e
ré."
);
throw
new
UnrecoverableException
(
"Le paquet du bordereau identifié par "
.
$messageId
.
" n'a pas pu être récup
é
ré
dans Maarch RM
."
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment