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
33acb2ce
Verified
Commit
33acb2ce
authored
5 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #12332 TIME 0:25 Mapping merge
parent
ecaeb93e
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
src/app/contentManagement/controllers/MergeController.php
+39
-19
39 additions, 19 deletions
src/app/contentManagement/controllers/MergeController.php
src/app/resource/controllers/ResController.php
+8
-31
8 additions, 31 deletions
src/app/resource/controllers/ResController.php
with
47 additions
and
50 deletions
src/app/contentManagement/controllers/MergeController.php
+
39
−
19
View file @
33acb2ce
...
@@ -19,6 +19,7 @@ use Contact\models\ContactModel;
...
@@ -19,6 +19,7 @@ use Contact\models\ContactModel;
use
Doctype\models\DoctypeModel
;
use
Doctype\models\DoctypeModel
;
use
Entity\models\EntityModel
;
use
Entity\models\EntityModel
;
use
Entity\models\ListInstanceModel
;
use
Entity\models\ListInstanceModel
;
use
IndexingModel\models\IndexingModelModel
;
use
Note\models\NoteModel
;
use
Note\models\NoteModel
;
use
Resource\models\ResModel
;
use
Resource\models\ResModel
;
use
SrcCore\models\TextFormatModel
;
use
SrcCore\models\TextFormatModel
;
...
@@ -85,36 +86,55 @@ class MergeController
...
@@ -85,36 +86,55 @@ class MergeController
ValidatorModel
::
stringType
(
$args
,
[
'attachmentChrono'
,
'attachmentTitle'
]);
ValidatorModel
::
stringType
(
$args
,
[
'attachmentChrono'
,
'attachmentTitle'
]);
//Resource
//Resource
$resource
=
[];
if
(
!
empty
(
$args
[
'resId'
]))
{
if
(
!
empty
(
$args
[
'resId'
]))
{
$resource
=
ResModel
::
getById
([
'select'
=>
[
'*'
],
'resId'
=>
[
$args
[
'resId'
]]]);
$resource
=
ResModel
::
getById
([
'select'
=>
[
'*'
],
'resId'
=>
[
$args
[
'resId'
]]]);
$allDates
=
[
'doc_date'
,
'departure_date'
,
'admission_date'
,
'process_limit_date'
,
'opinion_limit_date'
,
'closing_date'
,
'creation_date'
];
}
else
{
foreach
(
$allDates
as
$date
)
{
if
(
!
empty
(
$args
[
'modelId'
])
)
{
$
resource
[
$date
]
=
TextFormatModel
::
formatDate
(
$resource
[
$date
],
'd/m/Y'
);
$
indexingModel
=
IndexingModelModel
::
getById
([
'id'
=>
$args
[
'modelId'
],
'select'
=>
[
'category'
]]
);
}
}
$resource
[
'category_id'
]
=
ResModel
::
getCategoryLabel
([
'category_id'
=>
$resource
[
'category_id'
]]);
$resource
=
[
'model_id'
=>
$args
[
'modelId'
]
??
null
,
'category_id'
=>
$indexingModel
[
'category'
]
??
null
,
'type_id'
=>
$args
[
'doctype'
]
??
null
,
'subject'
=>
$args
[
'subject'
]
??
null
,
'destination'
=>
$args
[
'destination'
]
??
null
,
'initiator'
=>
$args
[
'initiator'
]
??
null
,
'doc_date'
=>
$args
[
'documentDate'
]
??
null
,
'admission_date'
=>
$args
[
'arrivalDate'
]
??
null
,
'departure_date'
=>
$args
[
'departureDate'
]
??
null
,
'process_limit_date'
=>
$args
[
'processLimitDate'
]
??
null
,
'barcode'
=>
$args
[
'barcode'
]
??
null
,
'origin'
=>
$args
[
'origin'
]
??
null
];
}
$allDates
=
[
'doc_date'
,
'departure_date'
,
'admission_date'
,
'process_limit_date'
,
'opinion_limit_date'
,
'closing_date'
,
'creation_date'
];
foreach
(
$allDates
as
$date
)
{
$resource
[
$date
]
=
TextFormatModel
::
formatDate
(
$resource
[
$date
],
'd/m/Y'
);
}
$resource
[
'category_id'
]
=
ResModel
::
getCategoryLabel
([
'category_id'
=>
$resource
[
'category_id'
]]);
if
(
!
empty
(
$resource
[
'type_id'
]))
{
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$resource
[
'type_id'
],
'select'
=>
[
'process_delay'
,
'process_mode'
,
'description'
]]);
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$resource
[
'type_id'
],
'select'
=>
[
'process_delay'
,
'process_mode'
,
'description'
]]);
$resource
[
'type_label'
]
=
$doctype
[
'description'
];
$resource
[
'type_label'
]
=
$doctype
[
'description'
];
$resource
[
'process_delay'
]
=
$doctype
[
'process_delay'
];
$resource
[
'process_delay'
]
=
$doctype
[
'process_delay'
];
$resource
[
'process_mode'
]
=
$doctype
[
'process_mode'
];
$resource
[
'process_mode'
]
=
$doctype
[
'process_mode'
];
}
if
(
!
empty
(
$resource
[
'initiator'
]))
{
if
(
!
empty
(
$resource
[
'initiator'
]))
{
$initiator
=
EntityModel
::
getByEntityId
([
'entityId'
=>
$resource
[
'initiator'
],
'select'
=>
[
'*'
]]);
$initiator
=
EntityModel
::
getByEntityId
([
'entityId'
=>
$resource
[
'initiator'
],
'select'
=>
[
'*'
]]);
if
(
!
empty
(
$initiator
))
{
if
(
!
empty
(
$initiator
))
{
foreach
(
$initiator
as
$key
=>
$value
)
{
foreach
(
$initiator
as
$key
=>
$value
)
{
$resource
[
"initiator_
{
$key
}
"
]
=
$value
;
$resource
[
"initiator_
{
$key
}
"
]
=
$value
;
}
}
if
(
!
empty
(
$initiator
[
'parent_entity_id'
]))
{
$parentInitiator
=
EntityModel
::
getByEntityId
([
'entityId'
=>
$initiator
[
'parent_entity_id'
],
'select'
=>
[
'*'
]]);
}
}
}
}
if
(
!
empty
(
$resource
[
'destination'
]))
{
if
(
!
empty
(
$initiator
[
'parent_entity_id'
]))
{
$destination
=
EntityModel
::
getByEntityId
([
'entityId'
=>
$resource
[
'destination'
],
'select'
=>
[
'*'
]]);
$parentInitiator
=
EntityModel
::
getByEntityId
([
'entityId'
=>
$initiator
[
'parent_entity_id'
],
'select'
=>
[
'*'
]]);
if
(
!
empty
(
$destination
[
'parent_entity_id'
]))
{
}
$parentDestination
=
EntityModel
::
getByEntityId
([
'entityId'
=>
$destination
[
'parent_entity_id'
],
'select'
=>
[
'*'
]]);
}
}
if
(
!
empty
(
$resource
[
'destination'
]))
{
$destination
=
EntityModel
::
getByEntityId
([
'entityId'
=>
$resource
[
'destination'
],
'select'
=>
[
'*'
]]);
if
(
!
empty
(
$destination
[
'parent_entity_id'
]))
{
$parentDestination
=
EntityModel
::
getByEntityId
([
'entityId'
=>
$destination
[
'parent_entity_id'
],
'select'
=>
[
'*'
]]);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/resource/controllers/ResController.php
+
8
−
31
View file @
33acb2ce
...
@@ -257,37 +257,14 @@ class ResController
...
@@ -257,37 +257,14 @@ class ResController
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Document has no file'
]);
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Document has no file'
]);
}
}
if
(
$document
[
'category_id'
]
==
'outgoing'
)
{
$convertedDocument
=
ConvertPdfController
::
getConvertedPdfById
([
'resId'
=>
$aArgs
[
'resId'
],
'collId'
=>
'letterbox_coll'
]);
$attachment
=
AttachmentModel
::
get
([
'select'
=>
[
'res_id'
,
'docserver_id'
,
'path'
,
'filename'
],
if
(
empty
(
$convertedDocument
[
'errors'
]))
{
'where'
=>
[
'res_id_master = ?'
,
'attachment_type = ?'
,
'status not in (?)'
],
$documentTodisplay
=
$convertedDocument
;
'data'
=>
[
$aArgs
[
'resId'
],
'outgoing_mail'
,
[
'DEL'
,
'OBS'
]],
$document
[
'docserver_id'
]
=
$documentTodisplay
[
'docserver_id'
];
'limit'
=>
1
$document
[
'path'
]
=
$documentTodisplay
[
'path'
];
]);
$document
[
'filename'
]
=
$documentTodisplay
[
'filename'
];
if
(
!
empty
(
$attachment
[
0
]))
{
$document
[
'fingerprint'
]
=
$documentTodisplay
[
'fingerprint'
];
$attachmentTodisplay
=
$attachment
[
0
];
$id
=
$attachmentTodisplay
[
'res_id'
];
$collId
=
"attachments_coll"
;
$convertedDocument
=
ConvertPdfController
::
getConvertedPdfById
([
'resId'
=>
$id
,
'collId'
=>
$collId
]);
if
(
empty
(
$convertedDocument
[
'errors'
]))
{
$attachmentTodisplay
=
$convertedDocument
;
}
$document
[
'docserver_id'
]
=
$attachmentTodisplay
[
'docserver_id'
];
$document
[
'path'
]
=
$attachmentTodisplay
[
'path'
];
$document
[
'filename'
]
=
$attachmentTodisplay
[
'filename'
];
$document
[
'fingerprint'
]
=
$attachmentTodisplay
[
'fingerprint'
];
}
}
else
{
$convertedDocument
=
ConvertPdfController
::
getConvertedPdfById
([
'resId'
=>
$aArgs
[
'resId'
],
'collId'
=>
'letterbox_coll'
]);
if
(
empty
(
$convertedDocument
[
'errors'
]))
{
$documentTodisplay
=
$convertedDocument
;
$document
[
'docserver_id'
]
=
$documentTodisplay
[
'docserver_id'
];
$document
[
'path'
]
=
$documentTodisplay
[
'path'
];
$document
[
'filename'
]
=
$documentTodisplay
[
'filename'
];
$document
[
'fingerprint'
]
=
$documentTodisplay
[
'fingerprint'
];
}
}
}
$docserver
=
DocserverModel
::
getByDocserverId
([
'docserverId'
=>
$document
[
'docserver_id'
],
'select'
=>
[
'path_template'
,
'docserver_type_id'
]]);
$docserver
=
DocserverModel
::
getByDocserverId
([
'docserverId'
=>
$document
[
'docserver_id'
],
'select'
=>
[
'path_template'
,
'docserver_type_id'
]]);
...
...
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