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
a4643e09
Verified
Commit
a4643e09
authored
6 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #9082 All resources for summary sheet
parent
66d9c710
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/resource/controllers/SummarySheetController.php
+36
-21
36 additions, 21 deletions
src/app/resource/controllers/SummarySheetController.php
with
36 additions
and
21 deletions
src/app/resource/controllers/SummarySheetController.php
+
36
−
21
View file @
a4643e09
...
@@ -27,6 +27,7 @@ use Resource\models\ResourceListModel;
...
@@ -27,6 +27,7 @@ use Resource\models\ResourceListModel;
use
setasign\Fpdi\Tcpdf\Fpdi
;
use
setasign\Fpdi\Tcpdf\Fpdi
;
use
Slim\Http\Request
;
use
Slim\Http\Request
;
use
Slim\Http\Response
;
use
Slim\Http\Response
;
use
SrcCore\controllers\PreparedClauseController
;
use
SrcCore\models\CoreConfigModel
;
use
SrcCore\models\CoreConfigModel
;
use
SrcCore\models\TextFormatModel
;
use
SrcCore\models\TextFormatModel
;
use
SrcCore\models\ValidatorModel
;
use
SrcCore\models\ValidatorModel
;
...
@@ -45,27 +46,42 @@ class SummarySheetController
...
@@ -45,27 +46,42 @@ class SummarySheetController
}
}
$queryParamsData
=
$request
->
getQueryParams
();
$queryParamsData
=
$request
->
getQueryParams
();
/*$queryParamsData['units'] = base64_encode(json_encode([
// $queryParamsData['units'] = base64_encode(json_encode([
['label' => 'Informations', 'unit' => 'primaryInformations'],
// ['label' => 'Informations', 'unit' => 'primaryInformations'],
['label' => 'Informations Secondaires', 'unit' => 'secondaryInformations'],
// ['label' => 'Informations Secondaires', 'unit' => 'secondaryInformations'],
['label' => 'Liste de diffusion', 'unit' => 'diffusionList'],
// ['label' => 'Liste de diffusion', 'unit' => 'diffusionList'],
['label' => 'Ptit avis les potos.', 'unit' => 'freeField'],
// ['label' => 'Ptit avis les potos.', 'unit' => 'freeField'],
['label' => 'Annotation(s)', 'unit' => 'notes'],
// ['label' => 'Annotation(s)', 'unit' => 'notes'],
['label' => 'Circuit de visa', 'unit' => 'visaWorkflow'],
// ['label' => 'Circuit de visa', 'unit' => 'visaWorkflow'],
['label' => 'Circuit d\'avis', 'unit' => 'opinionWorkflow'],
// ['label' => 'Circuit d\'avis', 'unit' => 'opinionWorkflow'],
['label' => 'Commentaires', 'unit' => 'freeField'],
// ['label' => 'Commentaires', 'unit' => 'freeField'],
['unit' => 'qrcode'],
// ['unit' => 'qrcode'],
]));*/
// ]));
// $queryParamsData['resources'] = [237, 352];
$units
=
empty
(
$queryParamsData
[
'units'
])
?
[]
:
(
array
)
json_decode
(
base64_decode
(
$queryParamsData
[
'units'
]));
$units
=
empty
(
$queryParamsData
[
'units'
])
?
[]
:
(
array
)
json_decode
(
base64_decode
(
$queryParamsData
[
'units'
]));
$basket
=
BasketModel
::
getById
([
'id'
=>
$aArgs
[
'basketId'
],
'select'
=>
[
'basket_clause'
,
'basket_res_order'
,
'basket_name'
]]);
$basket
=
BasketModel
::
getById
([
'id'
=>
$aArgs
[
'basketId'
],
'select'
=>
[
'basket_clause'
,
'basket_res_order'
,
'basket_name'
]]);
$user
=
UserModel
::
getById
([
'id'
=>
$aArgs
[
'userId'
],
'select'
=>
[
'user_id'
]]);
$user
=
UserModel
::
getById
([
'id'
=>
$aArgs
[
'userId'
],
'select'
=>
[
'user_id'
]]);
$allQueryData
=
ResourceListController
::
getResourcesListQueryData
([
'data'
=>
$queryParamsData
,
'basketClause'
=>
$basket
[
'basket_clause'
],
'login'
=>
$user
[
'user_id'
]]);
$whereClause
=
PreparedClauseController
::
getPreparedClause
([
'clause'
=>
$basket
[
'basket_clause'
],
'login'
=>
$user
[
'user_id'
]]);
if
(
!
empty
(
$allQueryData
[
'order'
]))
{
$rawResourcesInBasket
=
ResModel
::
getOnView
([
$queryParamsData
[
'order'
]
=
$allQueryData
[
'order'
];
'select'
=>
[
'res_id'
],
'where'
=>
[
$whereClause
]
]);
$allResourcesInBasket
=
[];
foreach
(
$rawResourcesInBasket
as
$resource
)
{
$allResourcesInBasket
[]
=
$resource
[
'res_id'
];
}
$order
=
'CASE res_view_letterbox.res_id '
;
foreach
(
$queryParamsData
[
'resources'
]
as
$key
=>
$resId
)
{
if
(
!
in_array
(
$resId
,
$allResourcesInBasket
))
{
return
$response
->
withStatus
(
403
)
->
withJson
([
'errors'
=>
'Resources out of perimeter'
]);
}
$order
.
=
"WHEN
{
$resId
}
THEN
{
$key
}
"
;
}
}
$order
.
=
'END'
;
$select
=
[
'res_id'
,
'subject'
,
'alt_identifier'
];
$select
=
[
'res_id'
,
'subject'
,
'alt_identifier'
];
foreach
(
$units
as
$unit
)
{
foreach
(
$units
as
$unit
)
{
...
@@ -81,13 +97,12 @@ class SummarySheetController
...
@@ -81,13 +97,12 @@ class SummarySheetController
$select
=
array_merge
(
$select
,
$informations
);
$select
=
array_merge
(
$select
,
$informations
);
}
}
}
}
$resources
=
ResourceListModel
::
getOnView
([
$resources
=
ResModel
::
getOnView
([
'select'
=>
$select
,
'select'
=>
$select
,
'table'
=>
$allQueryData
[
'table'
],
'where'
=>
[
'res_view_letterbox.res_id in (?)'
],
'leftJoin'
=>
$allQueryData
[
'leftJoin'
],
'data'
=>
[
$queryParamsData
[
'resources'
]],
'where'
=>
$allQueryData
[
'where'
],
'orderBy'
=>
[
$order
]
'data'
=>
$allQueryData
[
'queryData'
],
'orderBy'
=>
empty
(
$queryParamsData
[
'order'
])
?
[
$basket
[
'basket_res_order'
]]
:
[
$queryParamsData
[
'order'
]]
]);
]);
$pdf
=
new
Fpdi
(
'P'
,
'pt'
);
$pdf
=
new
Fpdi
(
'P'
,
'pt'
);
...
...
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