Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
7628eea0
Verified
Commit
7628eea0
authored
4 years ago
by
Florian Azizian
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #15047 TIME 1:20 Begin initSeda
parent
b6c9505f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
rest/index.php
+3
-0
3 additions, 0 deletions
rest/index.php
src/app/external/exportSeda/controllers/SedaController.php
+104
-0
104 additions, 0 deletions
src/app/external/exportSeda/controllers/SedaController.php
with
107 additions
and
0 deletions
rest/index.php
+
3
−
0
View file @
7628eea0
...
@@ -623,6 +623,9 @@ $app->post('/collaboraOnline/file', \ContentManagement\controllers\CollaboraOnli
...
@@ -623,6 +623,9 @@ $app->post('/collaboraOnline/file', \ContentManagement\controllers\CollaboraOnli
$app
->
delete
(
'/collaboraOnline/file'
,
\ContentManagement\controllers\CollaboraOnlineController
::
class
.
':deleteTmpFile'
);
$app
->
delete
(
'/collaboraOnline/file'
,
\ContentManagement\controllers\CollaboraOnlineController
::
class
.
':deleteTmpFile'
);
$app
->
post
(
'/collaboraOnline/encodedFile'
,
\ContentManagement\controllers\CollaboraOnlineController
::
class
.
':saveTmpEncodedDocument'
);
$app
->
post
(
'/collaboraOnline/encodedFile'
,
\ContentManagement\controllers\CollaboraOnlineController
::
class
.
':saveTmpEncodedDocument'
);
// Archival
$app
->
get
(
'/resources/{resId}/initSeda'
,
\ExportSeda\controllers\SedaController
::
class
.
':initSeda'
);
// Registered mail
// Registered mail
$app
->
get
(
'/registeredMail/sites'
,
\RegisteredMail\controllers\IssuingSiteController
::
class
.
':get'
);
$app
->
get
(
'/registeredMail/sites'
,
\RegisteredMail\controllers\IssuingSiteController
::
class
.
':get'
);
$app
->
get
(
'/registeredMail/sites/{id}'
,
\RegisteredMail\controllers\IssuingSiteController
::
class
.
':getById'
);
$app
->
get
(
'/registeredMail/sites/{id}'
,
\RegisteredMail\controllers\IssuingSiteController
::
class
.
':getById'
);
...
...
This diff is collapsed.
Click to expand it.
src/app/external/exportSeda/controllers/SedaController.php
0 → 100755
+
104
−
0
View file @
7628eea0
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
*
*/
/**
* @brief Seda Controller
* @author dev@maarch.org
*/
namespace
ExportSeda\controllers
;
use
Attachment\models\AttachmentModel
;
use
Doctype\models\DoctypeModel
;
use
Email\models\EmailModel
;
use
Entity\models\EntityModel
;
use
Note\models\NoteModel
;
use
Resource\models\ResModel
;
use
Respect\Validation\Validator
;
use
Slim\Http\Request
;
use
Slim\Http\Response
;
use
SrcCore\models\CoreConfigModel
;
class
SedaController
{
public
function
initSeda
(
Request
$request
,
Response
$response
,
array
$aArgs
)
{
if
(
!
Validator
::
intVal
()
->
validate
(
$aArgs
[
'resId'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Route resId is not an integer'
]);
}
$resource
=
ResModel
::
getById
([
'resId'
=>
$aArgs
[
'resId'
],
'select'
=>
[
'destination'
,
'type_id'
,
'subject'
]]);
if
(
empty
(
$resource
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'resource does not exists'
]);
}
elseif
(
empty
(
$resource
[
'destination'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'resource has no destination'
,
'lang'
=>
'noDestination'
]);
}
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$resource
[
'type_id'
],
'select'
=>
[
'description'
,
'retention_rule'
,
'retention_final_disposition'
]]);
if
(
empty
(
$doctype
[
'retention_rule'
])
||
empty
(
$doctype
[
'retention_final_disposition'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'retention_rule or retention_final_disposition is empty for doctype'
,
'lang'
=>
'noRetentionInfo'
]);
}
$entity
=
EntityModel
::
getByEntityId
([
'entityId'
=>
$resource
[
'destination'
],
'select'
=>
[
'producer_service'
,
'entity_label'
,
'business_id'
]]);
if
(
empty
(
$entity
[
'producer_service'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'producer_service is empty for this entity'
,
'lang'
=>
'noProducerService'
]);
}
$sedaXml
=
CoreConfigModel
::
getXmlLoaded
([
'path'
=>
'modules/export_seda/xml/config.xml'
]);
if
(
empty
(
$sedaXml
->
CONFIG
->
senderOrgRegNumber
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'No senderOrgRegNumber found in config.xml (export_seda)'
]);
}
$return
=
[
'data'
=>
[
'entity'
=>
[
'label'
=>
$entity
[
'entity_label'
],
'siren'
=>
$entity
[
'business_id'
],
'archiveEntitySiren'
=>
$sedaXml
->
CONFIG
->
senderOrgRegNumber
],
'doctype'
=>
[
'label'
=>
$doctype
[
'description'
],
'retentionRule'
=>
$doctype
[
'retention_rule'
],
'retentionFinalDisposition'
=>
$doctype
[
'retention_final_disposition'
]
]
],
'archiveUnit'
=>
[
[
'id'
=>
'letterbox_'
.
$aArgs
[
'resId'
],
'label'
=>
$resource
[
'subject'
],
'type'
=>
'mainDocument'
]
]
];
$notes
=
NoteModel
::
get
([
'select'
=>
[
'note_text'
,
'id'
],
'where'
=>
[
'identifier = ?'
],
'data'
=>
[
$aArgs
[
'resId'
]]]);
foreach
(
$notes
as
$note
)
{
$return
[
'archiveUnit'
][]
=
[
'id'
=>
'note_'
.
$note
[
'id'
],
'label'
=>
$note
[
'note_text'
],
'type'
=>
'note'
];
}
$emails
=
EmailModel
::
get
([
'select'
=>
[
'object'
,
'id'
],
'where'
=>
[
'document->>\'id\' = ?'
,
'status = ?'
],
'data'
=>
[
$aArgs
[
'resId'
],
'SENT'
],
'orderBy'
=>
[
'send_date desc'
]
]);
foreach
(
$emails
as
$email
)
{
$return
[
'archiveUnit'
][]
=
[
'id'
=>
'note_'
.
$email
[
'id'
],
'label'
=>
$email
[
'object'
],
'type'
=>
'email'
];
}
return
$response
->
withJson
(
$return
);
}
}
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