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
f62897d4
Commit
f62897d4
authored
Jul 24, 2017
by
Prosper De Laure
Browse files
Accept any profile option
parent
e97e11c2
Changes
10
Hide whitespace changes
Inline
Side-by-side
data/maarchRM/sql/pgsql/migration V1_V2.sql
View file @
f62897d4
ALTER
TABLE
"recordsManagement"
.
"archivalProfile"
ADD
COLUMN
"acceptArchiveWithoutProfile"
boolean
default
true
;
ALTER
TABLE
"recordsManagement"
.
"archivalProfile"
ADD
COLUMN
"acceptAnyProfile"
boolean
default
false
;
CREATE
TABLE
"recordsManagement"
.
"archivalProfileRelationship"
(
...
...
src/bundle/recordsManagement/Controller/archivalProfile.php
View file @
f62897d4
...
...
@@ -287,7 +287,7 @@ class archivalProfile
$this
->
createDetail
(
$archivalProfile
);
// Contents profiles
$this
->
updateContainedProfiles
(
$archivalProfile
->
archivalProfileId
,
$archivalProfile
->
containedProfiles
);
$this
->
updateContainedProfiles
(
$archivalProfile
,
$archivalProfile
->
containedProfiles
);
// Life cycle journal
$eventItems
=
array
(
'archivalProfileReference'
=>
$archivalProfile
->
reference
);
...
...
@@ -331,7 +331,7 @@ class archivalProfile
// archival profile
$this
->
sdoFactory
->
update
(
$archivalProfile
,
"recordsManagement/archivalProfile"
);
// Contents profiles
$this
->
updateContainedProfiles
(
$archivalProfile
->
archivalProfileId
,
$archivalProfile
->
containedProfiles
);
$this
->
updateContainedProfiles
(
$archivalProfile
,
$archivalProfile
->
containedProfiles
);
// Life cycle journal
$eventItems
=
array
(
'archivalProfileReference'
=>
$archivalProfile
->
reference
);
...
...
@@ -354,14 +354,23 @@ class archivalProfile
/**
* Cpdate an archival content profile
* @param
string
$archivalProfile
Id
The parent profile
identifier
* @param
object
$archivalProfile
The parent profile
* @param array $containedProfiles The content profiles identifiers
*
* @return boolean The request of the request
*/
protected
function
updateContainedProfiles
(
$
p
ar
ent
Profile
Id
,
$containedProfiles
)
protected
function
updateContainedProfiles
(
$ar
chival
Profile
,
$containedProfiles
)
{
if
(
$archivalProfile
->
acceptAnyProfile
)
{
$containedProfiles
=
null
;
}
if
(
!
count
(
$containedProfiles
))
{
$oldcontainedProfiles
=
$this
->
sdoFactory
->
find
(
"recordsManagement/archivalProfileRelationship"
,
"parentProfileId = '
$archivalProfile->archivalProfileId
'"
);
if
(
count
(
$oldcontainedProfiles
))
{
$this
->
sdoFactory
->
deleteCollection
(
$oldcontainedProfiles
,
"recordsManagement/archivalProfileRelationship"
);
}
return
;
}
...
...
@@ -374,21 +383,16 @@ class archivalProfile
throw
new
\
core\Exception\NotFoundException
(
"
$profileId
can't be found."
);
}
if
(
!
$this
->
validateContainedProfile
(
$
p
ar
ent
ProfileId
,
$profileId
))
{
if
(
!
$this
->
validateContainedProfile
(
$ar
chivalProfile
->
archival
ProfileId
,
$profileId
))
{
throw
new
\
core\Exception\ForbiddenException
(
"
$profile->reference
can't be content in this archival profile."
);
}
}
$oldcontainedProfiles
=
$this
->
sdoFactory
->
find
(
"recordsManagement/archivalProfileRelationship"
,
"parentProfileId = '
$parentProfileId
'"
);
if
(
count
(
$oldcontainedProfiles
))
{
$this
->
sdoFactory
->
deleteCollection
(
$oldcontainedProfiles
,
"recordsManagement/archivalProfileRelationship"
);
}
$archivalProfileRelationships
=
[];
foreach
(
$containedProfiles
as
$containedProfileId
)
{
$archivalProfileRelationship
=
\
laabs
::
newInstance
(
'recordsManagement/archivalProfileRelationship'
);
$archivalProfileRelationship
->
parentProfileId
=
$
p
ar
ent
ProfileId
;
$archivalProfileRelationship
->
parentProfileId
=
$ar
chivalProfile
->
archival
ProfileId
;
$archivalProfileRelationship
->
containedProfileId
=
$containedProfileId
;
$archivalProfileRelationships
[]
=
$archivalProfileRelationship
;
...
...
@@ -435,7 +439,6 @@ class archivalProfile
{
$archivalProfile
=
$this
->
sdoFactory
->
read
(
'recordsManagement/archivalProfile'
,
$archivalProfileId
);
// containedProfiles
$archivalProfileRelationships
=
$this
->
sdoFactory
->
find
(
"recordsManagement/archivalProfileRelationship"
,
"parentProfileId='
$archivalProfileId
' or containedProfileId='
$archivalProfileId
'"
);
if
(
count
(
$archivalProfileRelationships
))
{
...
...
src/bundle/recordsManagement/Controller/archiveEntryTrait.php
View file @
f62897d4
...
...
@@ -638,8 +638,9 @@ trait archiveEntryTrait
}
for
(
$i
=
0
;
$i
<
$nbArchiveObjects
;
$i
++
)
{
if
((
$archive
->
contents
[
$i
]
->
archivalProfileReference
==
""
&&
!
$this
->
currentArchivalProfile
->
acceptArchiveWithoutProfile
)
||
!
in_array
(
$archive
->
contents
[
$i
]
->
archivalProfileReference
,
$containedProfiles
))
{
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
]);
...
...
@@ -665,6 +666,10 @@ trait archiveEntryTrait
return
;
}
if
(
$archive
->
archivalProfileReference
!=
""
&&
$this
->
currentArchivalProfile
->
acceptAnyProfile
)
{
return
;
}
foreach
(
$this
->
currentArchivalProfile
->
containedProfiles
as
$profile
)
{
if
(
$profile
->
reference
==
$archive
->
archivalProfileReference
)
{
return
;
...
...
src/bundle/recordsManagement/Message/archivalProfile.php
View file @
f62897d4
...
...
@@ -105,6 +105,13 @@ class archivalProfile
*/
public
$acceptArchiveWithoutProfile
;
/**
* The archive accepts sub archive of any profile
*
* @var boolean
*/
public
$acceptAnyProfile
;
/**
* The list of profile description
*
...
...
src/bundle/recordsManagement/Model/archivalProfile.php
View file @
f62897d4
...
...
@@ -107,6 +107,13 @@ class archivalProfile
*/
public
$acceptArchiveWithoutProfile
;
/**
* The archive accepts sub archive of any profile
*
* @var boolean
*/
public
$acceptAnyProfile
;
/**
* The list of profile description
*
...
...
src/bundle/recordsManagement/Resources/sql/schema.pgsql.sql
View file @
f62897d4
...
...
@@ -59,6 +59,7 @@ CREATE TABLE "recordsManagement"."archivalProfile"
"acceptMultipleDocuments"
boolean
default
false
,
"acceptMultipleDocuments"
boolean
default
false
,
"acceptArchiveWithoutProfile"
boolean
default
true
,
"acceptAnyProfile"
boolean
default
false
,
PRIMARY
KEY
(
"archivalProfileId"
),
UNIQUE
(
"reference"
),
FOREIGN
KEY
(
"accessRuleCode"
)
...
...
src/presentation/maarchRM/Presenter/recordsManagement/welcome.php
View file @
f62897d4
...
...
@@ -163,13 +163,25 @@ class welcome
$archive
->
originatorOrgName
=
$originatorOrg
->
displayName
;
$archive
->
depositDate
=
$archive
->
depositDate
->
format
(
'Y-m-d H:i:s'
);
if
(
!
empty
(
$archive
->
archivalProfileReference
))
{
$archivalProfile
=
\
laabs
::
callService
(
'recordsManagement/archivalProfile/readByreference_reference_'
,
$archive
->
archivalProfileReference
);
$archive
->
archivalProfileName
=
$archivalProfile
->
name
;
}
$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
(
"status"
,
$archive
->
status
);
$archive
->
status
=
$this
->
view
->
translator
->
getText
(
$archive
->
status
,
false
,
"recordsManagement/messages"
);
$archive
->
finalDisposition
=
$this
->
view
->
translator
->
getText
(
$archive
->
finalDisposition
,
false
,
"recordsManagement/messages"
);
$depositPrivilege
=
\
laabs
::
callService
(
'auth/userAccount/readHasprivilege'
,
"archiveDeposit/deposit"
);
$this
->
getDescription
(
$archive
);
$this
->
view
->
setSource
(
'retentionRules'
,
$retentionRules
);
...
...
@@ -293,6 +305,7 @@ class welcome
if
(
!
empty
(
$archive
->
descriptionClass
))
{
$presenter
=
\
laabs
::
newPresenter
(
$archive
->
descriptionClass
);
$descriptionHtml
=
$presenter
->
read
(
$archive
->
descriptionObject
);
}
else
{
$descriptionHtml
=
'<table">'
;
...
...
src/presentation/maarchRM/Resources/locale/fr/recordsManagement/archivalProfile.po
View file @
f62897d4
...
...
@@ -238,3 +238,6 @@ msgstr "Voulez vous enregistrer les modifications avant de quitter cet écran ?"
msgid "Go to"
msgstr "Aller vers"
msgid "Accept any profiles"
msgstr "Accepter tout les profiles"
src/presentation/maarchRM/Resources/view/recordsManagement/archivalProfile/archiveStructure.html
View file @
f62897d4
...
...
@@ -2,26 +2,34 @@
<br/>
<form
class=
"form-horizontal"
>
<div
class=
"form-group"
>
<label
class=
"col-md-
4
control-label"
>
Accept archives without profile
</label>
<div
class=
"col-md-
8
"
>
<label
class=
"col-md-
6
control-label"
>
Accept archives without profile
</label>
<div
class=
"col-md-
6
"
>
<input
type=
"checkbox"
id=
"acceptArchiveWithoutProfile"
name=
"acceptArchiveWithoutProfile"
data-toggle=
"toggle"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-md-4 control-label"
>
Accept the profile :
</label>
<div
class=
"col-md-8"
>
<div
class=
"input-group"
>
<select
id=
"profileList"
name=
"profileList"
class=
"form-control"
data-profile-list=
"[?merge profileList ?]"
data-contained-profiles=
"[?merge archivalProfile.containedProfiles ?]"
>
<option
value=
""
data-properties=
""
data-dateproperties=
"[?merge dateFields ?]"
>
Select a profile
</option>
</select>
<span
class=
"input-group-btn"
>
<button
type=
"button"
id=
"addProfile"
class=
"btn btn-success"
><span
class=
"fa fa-plus"
></span></button>
</span>
</div>
</div>
<label
class=
"col-md-6 control-label"
>
Accept any profiles
</label>
<div
class=
"col-md-6"
>
<input
type=
"checkbox"
id=
"acceptAnyProfile"
name=
"acceptAnyProfile"
data-toggle=
"toggle"
>
</div>
</div>
<div
class=
"col-xs-12"
>
<ul
id=
"containedProfileList"
class=
"list-group"
/>
<div
id=
"subProfile"
class=
"[?merge archivalProfile.acceptAnyProfile.bool().then('hide', '') ?]"
>
<div
class=
"form-group"
>
<label
class=
"col-md-4 control-label"
>
Accept the profile :
</label>
<div
class=
"col-md-8"
>
<div
class=
"input-group"
>
<select
id=
"profileList"
name=
"profileList"
class=
"form-control"
data-profile-list=
"[?merge profileList ?]"
data-contained-profiles=
"[?merge archivalProfile.containedProfiles ?]"
>
<option
value=
""
data-properties=
""
data-dateproperties=
"[?merge dateFields ?]"
>
Select a profile
</option>
</select>
<span
class=
"input-group-btn"
>
<button
type=
"button"
id=
"addProfile"
class=
"btn btn-success"
><span
class=
"fa fa-plus"
></span></button>
</span>
</div>
</div>
</div>
<div
class=
"col-xs-12"
>
<ul
id=
"containedProfileList"
class=
"list-group"
/>
</div>
</div>
</form>
</div>
...
...
@@ -86,6 +94,19 @@
this
.
select
.
find
(
'
option[value="
'
+
profileId
+
'
"]
'
).
removeClass
(
'
hide
'
);
},
allowAnyProfile
:
function
()
{
this
.
list
.
find
(
'
li
'
).
each
(
function
()
{
ArchiveStructure
.
removeProfile
(
$
(
this
));
});
$
(
'
#subProfile
'
).
addClass
(
'
hide
'
);
},
limitSubProfile
:
function
()
{
$
(
'
#subProfile
'
).
removeClass
(
'
hide
'
);
},
serialize
:
function
()
{
var
containedProfiles
=
[]
...
...
@@ -140,8 +161,6 @@
$
(
'
#containedProfileList
'
).
on
(
'
click
'
,
'
.showProfile
'
,
function
()
{
var
href
=
this
.
href
;
console
.
log
(
$
(
'
#contain
'
).
data
(
'
not-saved
'
));
if
(
$
(
'
#contain
'
).
data
(
'
not-saved
'
)
==
false
)
{
location
.
href
=
href
;
return
;
...
...
@@ -150,17 +169,24 @@
$
(
'
#saveProfileModal
'
).
modal
();
$
(
'
#saveBeforeChange
'
).
one
(
'
click
'
,
function
()
{
$
(
'
#saveProfileModal
'
).
on
(
'
hide.bs.modal
'
,
function
(){
$
(
'
#saveProfileModal
'
).
on
(
'
hide.bs.modal
'
,
function
()
{
ArchivalProfile
.
save
(
href
);
})
});
$
(
'
#noSaveBeforeChange
'
).
one
(
'
click
'
,
function
(){
$
(
'
#noSaveBeforeChange
'
).
one
(
'
click
'
,
function
()
{
location
.
href
=
href
;
});
return
false
;
});
$
(
'
#acceptAnyProfile
'
).
on
(
'
change
'
,
function
()
{
if
(
$
(
this
).
is
(
'
:checked
'
))
{
ArchiveStructure
.
allowAnyProfile
();
}
else
{
ArchiveStructure
.
limitSubProfile
();
}
})
</script>
src/presentation/maarchRM/Resources/view/recordsManagement/archivalProfile/edit.html
View file @
f62897d4
...
...
@@ -256,7 +256,8 @@ file that was distributed with this source code.
retentionRuleCode
:
$
(
'
#code
'
).
val
(),
acceptUserIndex
:
$
(
'
#allowUserIndexes
'
).
prop
(
"
checked
"
),
archiveDescription
:
[],
acceptArchiveWithoutProfile
:
$
(
'
#acceptArchiveWithoutProfile
'
).
prop
(
"
checked
"
)
acceptArchiveWithoutProfile
:
$
(
'
#acceptArchiveWithoutProfile
'
).
prop
(
"
checked
"
),
acceptAnyProfile
:
$
(
'
#acceptAnyProfile
'
).
prop
(
"
checked
"
)
}
if
(
serializedObject
.
retentionStartDate
==
''
){
...
...
@@ -288,7 +289,6 @@ file that was distributed with this source code.
ArchivalProfile
.
loadAccessCode
();
$
(
'
input, select, textarea
'
).
on
(
'
change
'
,
function
()
{
console
.
log
(
'
ok
'
);
$
(
'
#contain
'
).
data
(
'
not-saved
'
,
true
);
})
...
...
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