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
49dfff1b
Commit
49dfff1b
authored
5 years ago
by
Guillaume Heurtier
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #12280 TIME 0:30 folder print notes refactor + fix arrow character in summary sheet
parent
4f75825e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/resource/controllers/ResourceDataExportController.php
+21
-40
21 additions, 40 deletions
...app/resource/controllers/ResourceDataExportController.php
src/app/resource/controllers/SummarySheetController.php
+1
-1
1 addition, 1 deletion
src/app/resource/controllers/SummarySheetController.php
with
22 additions
and
41 deletions
src/app/resource/controllers/ResourceDataExportController.php
+
21
−
40
View file @
49dfff1b
...
@@ -135,24 +135,6 @@ class ResourceDataExportController
...
@@ -135,24 +135,6 @@ class ResourceDataExportController
if
(
!
empty
(
$resource
[
'attachments'
][
'resIds'
]))
{
if
(
!
empty
(
$resource
[
'attachments'
][
'resIds'
]))
{
$attachmentsIds
=
$resource
[
'attachments'
][
'resIds'
];
$attachmentsIds
=
$resource
[
'attachments'
][
'resIds'
];
}
}
if
(
!
empty
(
$resource
[
'attachments'
][
'types'
]))
{
if
(
in_array
(
"ALL"
,
$resource
[
'attachments'
][
'types'
]))
{
// TODO rm types
$attachmentsIds
=
AttachmentModel
::
get
([
'select'
=>
[
'res_id'
],
'where'
=>
[
'res_id_master = ?'
],
'data'
=>
[
$resource
[
'resId'
]]
]);
$attachmentsIds
=
array_column
(
$attachmentsIds
,
'res_id'
);
}
else
{
$ids
=
AttachmentModel
::
get
([
'select'
=>
[
'res_id'
],
'where'
=>
[
'attachment_type in (?)'
,
'res_id_master = ?'
],
'data'
=>
[
$resource
[
'attachments'
][
'types'
],
$resource
[
'resId'
]]
]);
$ids
=
array_column
(
$ids
,
'res_id'
);
$attachmentsIds
=
array_merge
(
$attachmentsIds
,
$ids
);
}
}
if
(
!
empty
(
$attachmentsIds
))
{
if
(
!
empty
(
$attachmentsIds
))
{
$attachments
=
AttachmentModel
::
get
([
$attachments
=
AttachmentModel
::
get
([
...
@@ -200,18 +182,27 @@ class ResourceDataExportController
...
@@ -200,18 +182,27 @@ class ResourceDataExportController
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Note id is not an integer'
]);
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Note id is not an integer'
]);
}
}
}
}
$notesIds
=
$resource
[
'notes'
];
$notes
=
NoteModel
::
get
([
'where'
=>
[
'id in (?)'
],
'data'
=>
[
$resource
[
'notes'
]],
'orderBy'
=>
[
'creation_date desc'
]
]);
if
(
count
(
$notes
)
<
count
(
$resource
[
'notes'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Note(s) not found'
]);
}
}
else
{
}
else
{
$notesIds
=
NoteModel
::
get
([
$notes
=
NoteModel
::
get
([
'select'
=>
[
'id'
],
'select'
=>
[
'id'
,
'identifier'
,
'user_id'
,
'note_text'
,
'creation_date'
],
'where'
=>
[
'identifier = ? '
],
'where'
=>
[
'identifier = ? '
],
'data'
=>
[
$resource
[
'resId'
]]
'data'
=>
[
$resource
[
'resId'
]],
'orderBy'
=>
[
'creation_date desc'
]
]);
]);
$notesIds
=
array_column
(
$notesIds
,
'id'
);
}
}
if
(
!
empty
(
$notes
Ids
))
{
if
(
!
empty
(
$notes
))
{
$noteFilePath
=
ResourceDataExportController
::
getNotesFilePath
([
'notes'
=>
$notes
Ids
,
'resId'
=>
$resource
[
'resId'
]]);
$noteFilePath
=
ResourceDataExportController
::
getNotesFilePath
([
'notes'
=>
$notes
,
'resId'
=>
$resource
[
'resId'
]]);
if
(
!
empty
(
$noteFilePath
[
'errors'
]))
{
if
(
!
empty
(
$noteFilePath
[
'errors'
]))
{
return
$response
->
withStatus
(
$noteFilePath
[
'code'
])
->
withJson
([
'errors'
=>
$noteFilePath
[
'errors'
]]);
return
$response
->
withStatus
(
$noteFilePath
[
'code'
])
->
withJson
([
'errors'
=>
$noteFilePath
[
'errors'
]]);
...
@@ -245,7 +236,7 @@ class ResourceDataExportController
...
@@ -245,7 +236,7 @@ class ResourceDataExportController
if
(
!
empty
(
$acknowledgementReceiptsIds
))
{
if
(
!
empty
(
$acknowledgementReceiptsIds
))
{
$acknowledgementReceipts
=
AcknowledgementReceiptModel
::
getByIds
([
$acknowledgementReceipts
=
AcknowledgementReceiptModel
::
getByIds
([
'select'
=>
[
'id'
,
'res_id'
,
'format'
,
'contact_id'
,
'user_id'
,
'creation_date'
,
'send_date'
,
'docserver_id'
,
'path'
,
'select'
=>
[
'id'
,
'res_id'
,
'format'
,
'contact_id'
,
'user_id'
,
'creation_date'
,
'send_date'
,
'docserver_id'
,
'path'
,
'filen
e
me'
,
'fingerprint'
],
'filen
a
me'
,
'fingerprint'
],
'ids'
=>
$acknowledgementReceiptsIds
'ids'
=>
$acknowledgementReceiptsIds
]);
]);
...
@@ -354,7 +345,7 @@ class ResourceDataExportController
...
@@ -354,7 +345,7 @@ class ResourceDataExportController
$resourceDocument
=
$args
[
'document'
];
$resourceDocument
=
$args
[
'document'
];
if
(
in_array
(
$args
[
'collId'
],
[
'letterbox_coll'
,
'attachments_coll'
]))
{
if
(
!
empty
(
$args
[
'collId'
])
&&
in_array
(
$args
[
'collId'
],
[
'letterbox_coll'
,
'attachments_coll'
]))
{
$document
=
ConvertPdfController
::
getConvertedPdfById
([
'resId'
=>
$resourceDocument
[
'res_id'
],
'collId'
=>
$args
[
'collId'
]]);
$document
=
ConvertPdfController
::
getConvertedPdfById
([
'resId'
=>
$resourceDocument
[
'res_id'
],
'collId'
=>
$args
[
'collId'
]]);
if
(
!
empty
(
$document
[
'errors'
]))
{
if
(
!
empty
(
$document
[
'errors'
]))
{
return
[
'errors'
=>
'Conversion error : '
.
$document
[
'errors'
],
'code'
=>
400
];
return
[
'errors'
=>
'Conversion error : '
.
$document
[
'errors'
],
'code'
=>
400
];
...
@@ -397,17 +388,7 @@ class ResourceDataExportController
...
@@ -397,17 +388,7 @@ class ResourceDataExportController
$notes
=
[];
$notes
=
[];
$notesModel
=
NoteModel
::
get
([
// TODO put this in a param -> query before
foreach
(
$args
[
'notes'
]
as
$note
)
{
'where'
=>
[
'id in (?)'
],
'data'
=>
[
$args
[
'notes'
]],
'orderBy'
=>
[
'creation_date desc'
]
]);
if
(
count
(
$notesModel
)
<
count
(
$args
[
'notes'
]))
{
// TODO useless here ?
return
[
'errors'
=>
'Note(s) not found'
,
'code'
=>
400
];
}
foreach
(
$notesModel
as
$note
)
{
if
(
$note
[
'identifier'
]
!=
$args
[
'resId'
])
{
if
(
$note
[
'identifier'
]
!=
$args
[
'resId'
])
{
return
[
'errors'
=>
'Note not linked to resource'
,
'code'
=>
400
];
return
[
'errors'
=>
'Note not linked to resource'
,
'code'
=>
400
];
}
}
...
@@ -415,7 +396,7 @@ class ResourceDataExportController
...
@@ -415,7 +396,7 @@ class ResourceDataExportController
$user
=
UserModel
::
getById
([
'id'
=>
$note
[
'user_id'
],
'select'
=>
[
'firstname'
,
'lastname'
]]);
$user
=
UserModel
::
getById
([
'id'
=>
$note
[
'user_id'
],
'select'
=>
[
'firstname'
,
'lastname'
]]);
$userName
=
$user
[
'firstname'
]
.
' '
.
$user
[
'lastname'
];
$userName
=
$user
[
'firstname'
]
.
' '
.
$user
[
'lastname'
];
$noteText
=
str_replace
(
'←'
,
'<='
,
$note
[
'note_text'
]);
// TODO might not work (Alex had '?')
$noteText
=
str_replace
(
'←'
,
'<='
,
$note
[
'note_text'
]);
$date
=
explode
(
'-'
,
date
(
'd-m-Y'
,
strtotime
(
$note
[
'creation_date'
])));
$date
=
explode
(
'-'
,
date
(
'd-m-Y'
,
strtotime
(
$note
[
'creation_date'
])));
$date
=
$date
[
0
]
.
'/'
.
$date
[
1
]
.
'/'
.
$date
[
2
]
.
' '
.
date
(
'H:i'
,
strtotime
(
$note
[
'creation_date'
]));
$date
=
$date
[
0
]
.
'/'
.
$date
[
1
]
.
'/'
.
$date
[
2
]
.
' '
.
date
(
'H:i'
,
strtotime
(
$note
[
'creation_date'
]));
...
...
This diff is collapsed.
Click to expand it.
src/app/resource/controllers/SummarySheetController.php
+
1
−
1
View file @
49dfff1b
...
@@ -777,7 +777,7 @@ class SummarySheetController
...
@@ -777,7 +777,7 @@ class SummarySheetController
$notes
[]
=
[
$notes
[]
=
[
'user'
=>
UserModel
::
getLabelledUserById
([
'id'
=>
$rawNote
[
'user_id'
]]),
'user'
=>
UserModel
::
getLabelledUserById
([
'id'
=>
$rawNote
[
'user_id'
]]),
'date'
=>
TextFormatModel
::
formatDate
(
$rawNote
[
'creation_date'
]),
'date'
=>
TextFormatModel
::
formatDate
(
$rawNote
[
'creation_date'
]),
'note'
=>
$rawNote
[
'note_text'
]
'note'
=>
$noteText
=
str_replace
(
'←'
,
'<='
,
$rawNote
[
'note_text'
]
)
];
];
}
}
unset
(
$args
[
'data'
][
'notes'
][
$noteKey
]);
unset
(
$args
[
'data'
][
'notes'
][
$noteKey
]);
...
...
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