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
9d116791
Commit
9d116791
authored
Jul 25, 2017
by
Prosper De Laure
Browse files
Bug correction
parent
f62897d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/bundle/recordsManagement/Controller/archivalProfile.php
View file @
9d116791
...
...
@@ -361,45 +361,45 @@ class archivalProfile
*/
protected
function
updateContainedProfiles
(
$archivalProfile
,
$containedProfiles
)
{
if
(
$archivalProfile
->
acceptAnyProfile
)
{
$containedProfiles
=
null
;
$containedProfiles
=
[]
;
}
if
(
!
count
(
$containedProfiles
))
{
$oldcontainedProfiles
=
$this
->
sdoFactory
->
find
(
"recordsManagement/archivalProfileRelationship"
,
"parentProfileId = '
$archivalProfile->archivalProfileId
'"
);
if
(
count
(
$old
containedProfiles
)
)
{
$this
->
sdoFactory
->
deleteCollection
(
$oldcontainedProfiles
,
"recordsManagement/archivalProfileRelationship"
);
}
if
(
count
(
$containedProfiles
))
{
// Validation
foreach
(
$
containedProfiles
as
$profileId
)
{
try
{
$profile
=
$this
->
sdoFactory
->
read
(
"recordsManagement/archivalProfile"
,
$profileId
);
return
;
}
catch
(
\
Exception
$e
)
{
throw
new
\
core\Exception\NotFoundException
(
"
$profileId
can't be found."
);
}
if
(
!
$this
->
validateContainedProfile
(
$archivalProfile
->
archivalProfileId
,
$profileId
))
{
throw
new
\
core\Exception\ForbiddenException
(
"
$profile->reference
can't be content in this archival profile."
);
}
}
}
// Validation
foreach
(
$containedProfiles
as
$profileId
)
{
try
{
$profile
=
$this
->
sdoFactory
->
read
(
"recordsManagement/archivalProfile"
,
$profileId
);
}
catch
(
\
Exception
$e
)
{
throw
new
\
core\Exception\NotFoundException
(
"
$profileId
can't be found."
);
}
if
(
!
$this
->
validateContainedProfile
(
$archivalProfile
->
archivalProfileId
,
$profileId
))
{
throw
new
\
core\Exception\ForbiddenException
(
"
$profile->reference
can't be content in this archival profile."
);
}
$oldcontainedProfiles
=
$this
->
sdoFactory
->
find
(
"recordsManagement/archivalProfileRelationship"
,
"parentProfileId = '
$archivalProfile->archivalProfileId
'"
);
if
(
count
(
$oldcontainedProfiles
))
{
$this
->
sdoFactory
->
deleteCollection
(
$oldcontainedProfiles
,
"recordsManagement/archivalProfileRelationship"
);
}
if
(
count
(
$containedProfiles
))
{
$archivalProfileRelationships
=
[];
foreach
(
$containedProfiles
as
$containedProfileId
)
{
$archivalProfileRelationship
=
\
laabs
::
newInstance
(
'recordsManagement/archivalProfileRelationship'
);
$archivalProfileRelationship
->
parentProfileId
=
$archivalProfile
->
archivalProfileId
;
$archivalProfileRelationship
->
containedProfileId
=
$containedProfileId
;
$archivalProfileRelationships
=
[];
foreach
(
$containedProfiles
as
$containedProfileId
)
{
$archivalProfileRelationship
=
\
laabs
::
newInstance
(
'recordsManagement/archivalProfileRelationship'
);
$archivalProfileRelationship
->
parentProfileId
=
$archivalProfile
->
archivalProfileId
;
$archivalProfileRelationship
->
containedProfileId
=
$containedProfileId
;
$archivalProfileRelationships
[]
=
$archivalProfileRelationship
;
}
$archivalProfileRelationships
[]
=
$
archivalProfileRelationship
;
$this
->
sdoFactory
->
createCollection
(
$archivalProfileRelationships
,
"recordsManagement/
archivalProfileRelationship
"
)
;
}
$this
->
sdoFactory
->
createCollection
(
$archivalProfileRelationships
,
"recordsManagement/archivalProfileRelationship"
);
return
true
;
}
...
...
src/bundle/recordsManagement/Controller/archiveEntryTrait.php
View file @
9d116791
...
...
@@ -354,10 +354,11 @@ trait archiveEntryTrait
public
function
completeArchivalProfileCodes
(
$archive
)
{
if
(
$archive
->
archivalProfileReference
==
""
)
{
$archive
->
archivalProfileReference
=
$this
->
currentArchivalProfile
->
reference
;
return
;
}
$this
->
useArchivalProfile
(
$archive
->
archivalProfileReference
);
if
(
!
empty
(
$this
->
currentArchivalProfile
->
retentionRuleCode
))
{
$archive
->
retentionRuleCode
=
$this
->
currentArchivalProfile
->
retentionRuleCode
;
...
...
@@ -640,11 +641,11 @@ trait archiveEntryTrait
for
(
$i
=
0
;
$i
<
$nbArchiveObjects
;
$i
++
)
{
if
((
$archive
->
contents
[
$i
]
->
archivalProfileReference
==
""
&&
!
$this
->
currentArchivalProfile
->
acceptArchiveWithoutProfile
)
||
(
!
$this
->
currentArchivalProfile
->
acceptAnyProfile
&&
!
in_array
(
$archive
->
contents
[
$i
]
->
archivalProfileReference
,
$containedProfiles
)))
{
throw
new
\
core\Exception\ForbiddenException
(
"Invalid contained archive profile"
);
}
}
$this
->
validateManagementMetadata
(
$archive
->
contents
[
$i
]);
}
}
}
...
...
src/presentation/maarchRM/Presenter/recordsManagement/welcome.php
View file @
9d116791
...
...
@@ -164,19 +164,20 @@ class welcome
$archive
->
depositDate
=
$archive
->
depositDate
->
format
(
'Y-m-d H:i:s'
);
$depositPrivilege
=
\
laabs
::
callService
(
'auth/userAccount/readHasprivilege'
,
"archiveDeposit/deposit"
);
if
(
!
empty
(
$archive
->
archivalProfileReference
))
{
$archivalProfile
=
\
laabs
::
callService
(
'recordsManagement/archivalProfile/readByreference_reference_'
,
$archive
->
archivalProfileReference
);
$archive
->
archivalProfileName
=
$archivalProfile
->
name
;
if
(
!
count
(
$archivalProfile
->
containedProfiles
)
&&
!
$archivalProfile
->
acceptArchiveWithoutProfile
&&
!
$archivalProfile
->
acceptAnyProfile
)
{
$depositPrivilege
=
false
;
}
}
$depositPrivilege
=
\
laabs
::
callService
(
'auth/userAccount/readHasprivilege'
,
"archiveDeposit/deposit"
);
if
(
count
(
$archivalProfile
->
containedProfiles
)
&&
$archivalProfile
->
acceptArchiveWithoutProfile
==
false
)
{
$depositPrivilege
=
false
;
}
$this
->
view
->
translate
();
$this
->
view
->
setSource
(
'containedProfiles'
,
$archivalProfiles
->
containedProfiles
);
//
$this->view->setSource('containedProfiles', $archivalProfiles->containedProfiles);
$this
->
view
->
setSource
(
"status"
,
$archive
->
status
);
$archive
->
status
=
$this
->
view
->
translator
->
getText
(
$archive
->
status
,
false
,
"recordsManagement/messages"
);
...
...
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