Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
maarchRM
Commits
719aec11
Commit
719aec11
authored
Mar 09, 2022
by
Charlotte Bataille
Browse files
feat/18593 : display other org owner in search form
parent
30b9a80b
Pipeline
#16660
failed with stages
in 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bundle/organization/Controller/organization.php
View file @
719aec11
...
...
@@ -1650,20 +1650,22 @@ class organization
*/
protected
function
getOwnerOrgsByRole
(
$currentService
,
$role
)
{
$organizationController
=
\
laabs
::
newController
(
'organization/organization'
);
$orgUnits
=
$organizationController
->
getOrgsByRole
(
$role
);
$orgUnits
=
$this
->
getOrgsByRole
(
$role
);
$userPositionController
=
\
laabs
::
newController
(
'organization/userPosition'
);
$
org
Controller
=
\
laabs
::
newController
(
'
organization/organization
'
);
$
archivalAgreement
Controller
=
\
laabs
::
newController
(
'
medona/archivalAgreement
'
);
$owner
=
false
;
$archiver
=
false
;
$userOrgUnits
=
[];
$userOrgs
=
[];
$allArchivalAgreements
=
$archivalAgreementController
->
index
();
$originatorOrgIds
=
[];
$userOrgUnitOrgRegNumbers
=
array_merge
(
array
(
$currentService
->
registrationNumber
),
$userPositionController
->
readDescandantService
((
string
)
$currentService
->
orgId
));
foreach
(
$userOrgUnitOrgRegNumbers
as
$userOrgUnitOrgRegNumber
)
{
$userOrgUnit
=
$
orgController
->
getOrgByRegNumber
(
$userOrgUnitOrgRegNumber
);
$userOrgUnit
=
$
this
->
getOrgByRegNumber
(
$userOrgUnitOrgRegNumber
);
$userOrgUnits
[]
=
$userOrgUnit
;
if
(
isset
(
$userOrgUnit
->
orgRoleCodes
))
{
foreach
(
$userOrgUnit
->
orgRoleCodes
as
$orgRoleCode
)
{
...
...
@@ -1672,6 +1674,12 @@ class organization
}
if
(
$orgRoleCode
==
'archiver'
)
{
$archiver
=
true
;
$myOriginatorOrgs
=
[];
foreach
(
$allArchivalAgreements
as
$archivalAgreement
)
{
if
(
$archivalAgreement
->
archiverOrgRegNumber
==
$userOrgUnitOrgRegNumber
)
{
$myOriginatorOrgs
=
array_merge
(
$myOriginatorOrgs
,
$archivalAgreement
->
originatorOrgIds
->
jsonSerialize
());
}
}
}
}
}
...
...
@@ -1681,14 +1689,14 @@ class organization
foreach
(
$orgUnits
as
$orgUnit
)
{
if
(
// Owner = all originators
$owner
// Archiver = all originators fo the same org
||
(
$archiver
&&
$orgUnit
->
ownerOrgId
==
$userOrgUnit
->
ownerOrgId
)
// Archiver = all originators fo
r
the same org
||
(
$archiver
&&
(
$orgUnit
->
ownerOrgId
==
$userOrgUnit
->
ownerOrgId
||
in_array
(
$orgUnit
->
orgId
,
$myOriginatorOrgs
))
)
// Originator = all originators at position and sub-services
||
(
$role
==
'originator'
&&
$orgUnit
->
registrationNumber
==
$userOrgUnit
->
registrationNumber
)
// Depositor = all
||
$role
==
'depositor'
)
{
if
(
!
isset
(
$userOrgs
[(
string
)
$orgUnit
->
ownerOrgId
]))
{
$orgObject
=
$
organizationController
->
read
((
string
)
$orgUnit
->
ownerOrgId
);
$orgObject
=
$
this
->
read
((
string
)
$orgUnit
->
ownerOrgId
);
$userOrgs
[(
string
)
$orgObject
->
orgId
]
=
new
\
stdClass
();
$userOrgs
[(
string
)
$orgObject
->
orgId
]
->
displayName
=
$orgObject
->
displayName
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment