Commit 2a9cd920 authored by Arnaud Pauget's avatar Arnaud Pauget
Browse files

feat(18079) : add action on mutliple selected archives to change originator

parent 69382b37
Pipeline #14424 failed with stages
in 1 minute and 2 seconds
...@@ -980,13 +980,22 @@ trait archiveModificationTrait ...@@ -980,13 +980,22 @@ trait archiveModificationTrait
* Get available originators for an archive * Get available originators for an archive
* @param string $archiveId The archive identifier * @param string $archiveId The archive identifier
* *
* @return [type] [description] * @return array $availableOriginatingServices array of organization
*/ */
public function indexAvailableOriginators($archiveId) public function indexAvailableOriginators($archiveIds)
{ {
$archive = $this->sdoFactory->read('recordsManagement/archive', $archiveId); $availableOriginatingServices = null;
$availableOriginatingServices = $this->getDescendantServices($archive->originatorOwnerOrgId, $archive->archivalAgreementReference); foreach($archiveIds as $archiveId) {
$archive = $this->sdoFactory->read('recordsManagement/archive', $archiveId);
if (is_null($availableOriginatingServices)){
$availableOriginatingServices = $this->getDescendantServices($archive->originatorOwnerOrgId, $archive->archivalAgreementReference);
} else {
array_uintersect($availableOriginatingServices, $this->getDescendantServices($archive->originatorOwnerOrgId, $archive->archivalAgreementReference), function($a, $b) {
return strcmp(spl_object_hash($a), spl_object_hash($b));
});
}
}
return $availableOriginatingServices; return $availableOriginatingServices;
} }
......
...@@ -140,7 +140,7 @@ interface archiveInterface ...@@ -140,7 +140,7 @@ interface archiveInterface
* *
* @action recordsManagement/archive/indexAvailableOriginators * @action recordsManagement/archive/indexAvailableOriginators
*/ */
public function read_archiveId_Availableoriginators(); public function readAvailableoriginators($archiveIds);
/** /**
* Read the access rule of archive * Read the access rule of archive
......
...@@ -1349,6 +1349,7 @@ class archive ...@@ -1349,6 +1349,7 @@ class archive
protected function readPrivilegesOnArchives() protected function readPrivilegesOnArchives()
{ {
$hasModificationPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/modify"); $hasModificationPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/modify");
$hasModificationOriginatorPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/adminOriginator");
$hasIntegrityCheckPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/checkIntegrity"); $hasIntegrityCheckPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/checkIntegrity");
$hasDestructionPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "destruction/destructionRequest"); $hasDestructionPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "destruction/destructionRequest");
$hasRestitutionPrivilege = $this->transaction && \laabs::callService('auth/userAccount/readHasprivilege', "restitution/restitutionRequest"); $hasRestitutionPrivilege = $this->transaction && \laabs::callService('auth/userAccount/readHasprivilege', "restitution/restitutionRequest");
...@@ -1357,6 +1358,7 @@ class archive ...@@ -1357,6 +1358,7 @@ class archive
$hasModificationRequestPrivilege = $this->transaction && \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/modificationRequestSend"); $hasModificationRequestPrivilege = $this->transaction && \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/modificationRequestSend");
$this->view->setSource('hasModificationPrivilege', $hasModificationPrivilege); $this->view->setSource('hasModificationPrivilege', $hasModificationPrivilege);
$this->view->setSource('hasModificationOriginatorPrivilege', $hasModificationOriginatorPrivilege);
$this->view->setSource('hasIntegrityCheckPrivilege', $hasIntegrityCheckPrivilege); $this->view->setSource('hasIntegrityCheckPrivilege', $hasIntegrityCheckPrivilege);
$this->view->setSource('hasDestructionPrivilege', $hasDestructionPrivilege); $this->view->setSource('hasDestructionPrivilege', $hasDestructionPrivilege);
$this->view->setSource('hasRestitutionPrivilege', $hasRestitutionPrivilege); $this->view->setSource('hasRestitutionPrivilege', $hasRestitutionPrivilege);
......
...@@ -105,7 +105,8 @@ var ArchivesAction = { ...@@ -105,7 +105,8 @@ var ArchivesAction = {
requestCommunication : ['preserved', 'frozen'], requestCommunication : ['preserved', 'frozen'],
flagForRestitution : ['preserved'], flagForRestitution : ['preserved'],
flagForTransfer : ['preserved'], flagForTransfer : ['preserved'],
addToCollection : ['preserved', 'frozen', 'restituable', 'disposable', 'transferable'] addToCollection : ['preserved', 'frozen', 'restituable', 'disposable', 'transferable'],
editOriginator : ['preserved']
}, },
getSelectedArchives : function(type) { getSelectedArchives : function(type) {
......
<script> <script>
var editOriginator_load = function (archiveId, archiveName, type) { var editOriginator_load = function (archiveId, archiveName, type) {
var url = '/recordsManagement/archive/availableoriginators/' + archiveId var url = '/recordsManagement/archive/availableoriginators';
var type = 'GET'; var type = 'GET';
let parameters = {
archiveIds : [archiveId]
}
$.ajax({ $.ajax({
url : url, url : url,
type : type, type : type,
contentType : 'application/json', data : parameters,
dataType : 'json',
success : function (response) {
displayOrignator(response);
},
error : function(response) {
gritter.show(response.responseJSON.message, response.responseJSON.status, response.responseJSON.errors);
}
});
}
var editOriginator_loadMultiple = function (archiveIds) {
var url = '/recordsManagement/archive/availableoriginators';
var type = 'GET';
let parameters = {
archiveIds : archiveIds
}
$.ajax({
url : url,
type : type,
data : parameters,
dataType : 'json', dataType : 'json',
success : function (response) { success : function (response) {
displayOrignator(response); displayOrignator(response);
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
$('#archiveModificationForm').find('.modificationForm').css('display', 'none'); $('#archiveModificationForm').find('.modificationForm').css('display', 'none');
try { try {
eval(type+"_loadMultiple()"); eval(type+"_loadMultiple(ids)");
$('#archiveModificationForm').css('display', ''); $('#archiveModificationForm').css('display', '');
} }
catch(err) { catch(err) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<li class="editRetentionRule" data-type="retentionRule"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify retention rule</a></li> <li class="editRetentionRule" data-type="retentionRule"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify retention rule</a></li>
<?merge hasModificationPrivilege.bool() ?> <?merge hasModificationPrivilege.bool() ?>
<li class="editAccessRule" data-type="accessRule"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify access rule</a></li> <li class="editAccessRule" data-type="accessRule"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify access rule</a></li>
<?merge hasModificationPrivilege.bool() ?> <?merge hasModificationOriginatorPrivilege.bool() ?>
<li class="editOriginator" data-type="editOriginator"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify originator service</a></li> <li class="editOriginator" data-type="editOriginator"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify originator service</a></li>
<?merge hasModificationPrivilege.bool() ?> <?merge hasModificationPrivilege.bool() ?>
<li class="freeze [?merge .status.ifeq('frozen').then('hide', '') ?]" data-type="freeze"><a href="#"><i class="fa fa-lock">&nbsp;</i>&nbsp;Freeze</a></li> <li class="freeze [?merge .status.ifeq('frozen').then('hide', '') ?]" data-type="freeze"><a href="#"><i class="fa fa-lock">&nbsp;</i>&nbsp;Freeze</a></li>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<li class="editRetentionRule toto" data-type="retentionRule"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify retention rule</a></li> <li class="editRetentionRule toto" data-type="retentionRule"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify retention rule</a></li>
<?merge hasModificationPrivilege.bool() ?> <?merge hasModificationPrivilege.bool() ?>
<li class="editAccessRule" data-type="accessRule"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify access rule</a></li> <li class="editAccessRule" data-type="accessRule"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify access rule</a></li>
<?merge hasOriginatingPrivilege.bool() ?> <?merge hasModificationOriginatorPrivilege.bool() ?>
<li class="editOriginator" data-type="editOriginator"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify originator service</a></li> <li class="editOriginator" data-type="editOriginator"><a href="#"><i class="fa fa-edit">&nbsp;</i>&nbsp;Modify originator service</a></li>
<?merge hasModificationPrivilege.bool() ?> <?merge hasModificationPrivilege.bool() ?>
<li class="freeze" data-type="freeze"><a href="#"><i class="fa fa-lock">&nbsp;</i>&nbsp;Freeze</a></li> <li class="freeze" data-type="freeze"><a href="#"><i class="fa fa-lock">&nbsp;</i>&nbsp;Freeze</a></li>
......
...@@ -32,9 +32,9 @@ interface adminOriginatorInterface ...@@ -32,9 +32,9 @@ interface adminOriginatorInterface
/** /**
* Get available originators for an archive * Get available originators for an archive
* *
* @uses recordsManagement/archive/read_archiveId_Availableoriginators * @uses recordsManagement/archive/readAvailableoriginators
*/ */
public function readRecordsmanagementArchiveAvailableoriginators_archiveId_(); public function readRecordsmanagementArchiveAvailableoriginators($archiveIds);
/** /**
* @uses recordsManagement/archives/updateOriginator * @uses recordsManagement/archives/updateOriginator
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment