Commit dd4069c0 authored by Arnaud Pauget's avatar Arnaud Pauget
Browse files

Merge branch 'Support/2.8.X' into 'master'

Support/2.8.x

See merge request maarch/archivesPubliques!256
parents 445e9757 40154313
# CHANGELOG # CHANGELOG
## Version 2.8.2
- `Fixed` Erreur lors de la création d'un DIP en ressortie d'une archive.
- `Fixed` Erreur de vérification du niveau de service déclaré dans un bordereau entrant en fonction de celui déclaré dans l'accord de versement.
- `Fixed` Disponibilité des favoris sur l'extension archives publiques.
- `Fixed` Recherche par côte d'archive non fonctionnelle.
## Version 2.8.1
- `Changed` Possibilité de rechercher les archives d'un service producteur appartenant à une autre organisation si la liaison du service d'archive et service producteur existe dans un accord de versement.
- `Changed` Possibilité d'empêcher l'opérateur d'archivage d'accéder à toutes les archives du système. Voir point de configuration "ownerIsSuperUser" dans configuration.ini.default.
## Version 2.8 ## Version 2.8
- `Added` Modification des métadonnées sur archives SEDA 2 - `Added` Modification des métadonnées sur archives SEDA 2
- `Fixed` Modification de la durée de la règle de communicabilité illimitée AR062 en base de données. - `Fixed` Modification de la durée de la règle de communicabilité illimitée AR062 en base de données.
......
...@@ -904,43 +904,45 @@ class content implements \bundle\recordsManagement\Controller\archiveDescription ...@@ -904,43 +904,45 @@ class content implements \bundle\recordsManagement\Controller\archiveDescription
} }
$userServiceOrgRegNumbers = array_merge(array($currentService->registrationNumber), $userPositionController->readDescandantService((string) $currentService->orgId)); $userServiceOrgRegNumbers = array_merge(array($currentService->registrationNumber), $userPositionController->readDescandantService((string) $currentService->orgId));
$owner = false; $ownerIsSuperUser = true;
if (isset(\laabs::configuration("recordsManagement")['ownerIsSuperUser'])) {
$ownerIsSuperUser = (bool) \laabs::configuration("recordsManagement")['ownerIsSuperUser'];
}
// $owner = false;
$userServices = array(); $userServices = array();
$userOrgIds = array(); $userOrgIds = array();
foreach ($userServiceOrgRegNumbers as $userServiceOrgRegNumber) { foreach ($userServiceOrgRegNumbers as $userServiceOrgRegNumber) {
$userService = $orgController->getOrgByRegNumber($userServiceOrgRegNumber); $userService = $orgController->getOrgByRegNumber($userServiceOrgRegNumber);
$userServices[] = $userService; $userServices[] = $userService;
if (isset($userService->orgRoleCodes) && $userService->orgRoleCodes->contains('owner')) { if (isset($userService->orgRoleCodes) && $userService->orgRoleCodes->contains('owner') && $ownerIsSuperUser) {
return '1=1'; return '1=1';
} }
} }
if (!$owner) { $queryUserOrg['originator'] = "originatorOrgRegNumber=['" . implode("', '", $userServiceOrgRegNumbers) . "']";
$queryUserOrg['originator'] = "originatorOrgRegNumber=['" . implode("', '", $userServiceOrgRegNumbers) . "']"; $queryUserOrg['archiver'] = "archiverOrgRegNumber=['" . implode("', '", $userServiceOrgRegNumbers) . "']";
$queryUserOrg['archiver'] = "archiverOrgRegNumber=['" . implode("', '", $userServiceOrgRegNumbers) . "']"; //$queryUserOrg['depositor'] = "depositorOrgRegNumber=['". implode("', '", $userServiceOrgRegNumbers) ."']";
//$queryUserOrg['depositor'] = "depositorOrgRegNumber=['". implode("', '", $userServiceOrgRegNumbers) ."']";
$discoverableProfiles = $this->archivalProfileController->index(null, 'isDiscoverable=true');
$discoverableProfiles = $this->archivalProfileController->index(null, 'isDiscoverable=true'); $discoverableProfilesIdentifiers = array_map(
$discoverableProfilesIdentifiers = array_map( function ($profile) {
function ($profile) { return "'" . $profile->reference . "'";
return "'" . $profile->reference . "'"; },
}, $discoverableProfiles
$discoverableProfiles );
);
$queryUserOrg['accessRule'] = "(
$queryUserOrg['accessRule'] = "( originatorOwnerOrgId = '" . $currentService->ownerOrgId. "' AND (
originatorOwnerOrgId = '" . $currentService->ownerOrgId (
. "' AND ( accessRuleComDate <= '$currentDateString'
( OR accessRuleComDate = NULL
accessRuleComDate <= '$currentDateString'
OR accessRuleComDate = NULL
)
OR (archivalProfileReference = [" . \laabs\implode(", ", $discoverableProfilesIdentifiers) . "])
) )
)"; OR (archivalProfileReference = [" . \laabs\implode(", ", $discoverableProfilesIdentifiers) . "])
)
)";
return "(" . implode(" OR ", $queryUserOrg) . ")"; return "(" . implode(" OR ", $queryUserOrg) . ")";
}
} }
......
...@@ -668,7 +668,6 @@ abstract class abstractMessage ...@@ -668,7 +668,6 @@ abstract class abstractMessage
} }
} }
} elseif (is_string($content->descriptionLanguage)) { } elseif (is_string($content->descriptionLanguage)) {
$archive->descriptionLanguage[] = $content->descriptionLanguage;
if (strlen($content->descriptionLanguage) != 3) { if (strlen($content->descriptionLanguage) != 3) {
$archive->descriptionLanguage[] = $this->translateLanguage(strtolower($content->descriptionLanguage)); $archive->descriptionLanguage[] = $this->translateLanguage(strtolower($content->descriptionLanguage));
} }
...@@ -843,15 +842,21 @@ abstract class abstractMessage ...@@ -843,15 +842,21 @@ abstract class abstractMessage
$keyword = \laabs::newInstance('seda/Keyword'); $keyword = \laabs::newInstance('seda/Keyword');
if (isset($apKeyword->content)) { if (isset($apKeyword->content)) {
$keyword->keywordContent = \laabs::newInstance('seda/KeywordContent', (string) $apKeyword->content); $keyword->keywordContent = \laabs::newInstance('seda/KeywordContent', (string) $apKeyword->content);
$keyword->keywordType = (string) $apKeyword->type;
if (isset($apKeyword->type)) {
$keyword->keywordType = (string) $apKeyword->type;
}
if (isset($apKeyword->reference)) { if (isset($apKeyword->reference)) {
$keyword->keywordReference = \laabs::newInstance('seda/ID', (string) $apKeyword->reference); $keyword->keywordReference = \laabs::newInstance('seda/ID', (string) $apKeyword->reference);
} }
} elseif (isset($apKeyword->keywordContent)) { } elseif (isset($apKeyword->keywordContent)) {
$keyword->keywordContent = \laabs::newInstance('seda/KeywordContent', (string) $apKeyword->keywordContent); $keyword->keywordContent = \laabs::newInstance('seda/KeywordContent', (string) $apKeyword->keywordContent);
$keyword->keywordType = (string) $apKeyword->keywordType;
if (isset($apKeyword->keywordType)) {
$keyword->keywordType = (string) $apKeyword->keywordType;
}
if (isset($apKeyword->keywordReference)) { if (isset($apKeyword->keywordReference)) {
$keyword->keywordReference = \laabs::cast($apKeyword->keywordReference, 'seda/ID'); $keyword->keywordReference = \laabs::cast($apKeyword->keywordReference, 'seda/ID');
} }
......
...@@ -151,24 +151,26 @@ trait ArchiveTransferProcessTrait ...@@ -151,24 +151,26 @@ trait ArchiveTransferProcessTrait
$archive->depositorOrgRegNumber = $message->senderOrgRegNumber; $archive->depositorOrgRegNumber = $message->senderOrgRegNumber;
$archive->archivalAgreementReference = $message->archivalAgreementReference; $archive->archivalAgreementReference = $message->archivalAgreementReference;
$archivalAgreementController = \laabs::newController("medona/archivalAgreement"); if (!empty($archive->archivalAgreementReference)) {
$archivalAgreementController = \laabs::newController("medona/archivalAgreement");
$archivalAgreement = $archivalAgreementController->getByReference($message->archivalAgreementReference);
}
if (!empty($sedaArchive->archiveUnitProfile->value)) { if (!empty($sedaArchive->archiveUnitProfile->value)) {
$archive->archivalProfileReference = $sedaArchive->archiveUnitProfile->value; $archive->archivalProfileReference = $sedaArchive->archiveUnitProfile->value;
} elseif (isset($managementMetadata->archivalProfile)) { } elseif (isset($managementMetadata->archivalProfile)) {
$archive->archivalProfileReference = $managementMetadata->archivalProfile->value; $archive->archivalProfileReference = $managementMetadata->archivalProfile->value;
} elseif (!$parentArchive && !empty($archive->archivalAgreementReference)) { } elseif (!$parentArchive && !empty($archive->archivalAgreementReference)) {
$archivalAgreement = $archivalAgreementController->getByReference($message->archivalAgreementReference);
$archive->archivalProfileReference = $archivalAgreement->archivalProfileReference; $archive->archivalProfileReference = $archivalAgreement->archivalProfileReference;
} }
if ($managementMetadata->serviceLevel) { if ($managementMetadata->serviceLevel) {
$archive->serviceLevelReference = $managementMetadata->serviceLevel->value; $archive->serviceLevelReference = $managementMetadata->serviceLevel->value;
} elseif (!empty($archive->archivalAgreementReference)) {
$archive->serviceLevelReference = $archivalAgreement->serviceLevelReference;
} else { } else {
$serviceLevelController = \laabs::newController('recordsManagement/serviceLevel'); $defaultServiceLevel = $this->serviceLevelController->getDefault();
$defaultServiceLevel = $serviceLevelController->getDefault();
$archive->serviceLevelReference = $defaultServiceLevel->reference; $archive->serviceLevelReference = $defaultServiceLevel->reference;
} }
......
...@@ -52,6 +52,20 @@ trait ArchiveTransferValidationTrait ...@@ -52,6 +52,20 @@ trait ArchiveTransferValidationTrait
|| isset($message->object->dataObjectPackage->managementMetadata->archivalProfile->value)) { || isset($message->object->dataObjectPackage->managementMetadata->archivalProfile->value)) {
$this->validateProfile($this->message, $archivalAgreement); $this->validateProfile($this->message, $archivalAgreement);
} }
if (isset($message->object->dataObjectPackage->managementMetadata->serviceLevel->value)
&& $message->object->dataObjectPackage->managementMetadata->serviceLevel->value != $archivalAgreement->serviceLevelReference) {
$serviceLevelReference = $message->object->dataObjectPackage->managementMetadata->serviceLevel->value;
$this->sendError("203", "Le niveau de service du bordereau $serviceLevelReference ne correspond pas à celui de l'accord de versement");
}
}
if (!empty($message->object->dataObjectPackage->managementMetadata->serviceLevel->value)) {
$serviceLevelRef = $message->object->dataObjectPackage->managementMetadata->serviceLevel->value;
try {
$serviceLevel = $this->serviceLevelController->getByReference($serviceLevelRef);
} catch (\Exception $e) {
$this->sendError("203", "Le niveau de service du bordereau $serviceLevelRef est inconnu du système");
}
} }
// Contrôle des documents attachés // Contrôle des documents attachés
......
...@@ -78,6 +78,7 @@ abstract class abstractMessage ...@@ -78,6 +78,7 @@ abstract class abstractMessage
$this->retentionRuleController = \laabs::newController("recordsManagement/retentionRule"); $this->retentionRuleController = \laabs::newController("recordsManagement/retentionRule");
$this->accessRuleController = \laabs::newController("recordsManagement/accessRule"); $this->accessRuleController = \laabs::newController("recordsManagement/accessRule");
$this->contentController = \laabs::newController("archivesPubliques/content"); $this->contentController = \laabs::newController("archivesPubliques/content");
$this->serviceLevelController = \laabs::newController('recordsManagement/serviceLevel');
} }
/** /**
...@@ -1161,14 +1162,20 @@ abstract class abstractMessage ...@@ -1161,14 +1162,20 @@ abstract class abstractMessage
$keyword = \laabs::newInstance('seda2/Keyword'); $keyword = \laabs::newInstance('seda2/Keyword');
if (isset($apKeyword->content)) { if (isset($apKeyword->content)) {
$keyword->keywordContent = (string) $apKeyword->content; $keyword->keywordContent = (string) $apKeyword->content;
$keyword->keywordType = (string) $apKeyword->type;
if (isset($apKeyword->type)) {
$keyword->keywordType = (string) $apKeyword->type;
}
if (isset($apKeyword->reference)) { if (isset($apKeyword->reference)) {
$keyword->keywordReference = \laabs::newInstance('seda2/ID', (string) $apKeyword->reference); $keyword->keywordReference = \laabs::newInstance('seda2/ID', (string) $apKeyword->reference);
} }
} elseif (isset($apKeyword->keywordContent)) { } elseif (isset($apKeyword->keywordContent)) {
$keyword->keywordContent = (string) $apKeyword->keywordContent; $keyword->keywordContent = (string) $apKeyword->keywordContent;
$keyword->keywordType = (string) $apKeyword->keywordType;
if (isset($apKeyword->keywordType)) {
$keyword->keywordType = (string) $apKeyword->keywordType;
}
if (isset($apKeyword->keywordReference)) { if (isset($apKeyword->keywordReference)) {
$keyword->keywordReference = \laabs::cast($apKeyword->keywordReference, 'seda2/ID'); $keyword->keywordReference = \laabs::cast($apKeyword->keywordReference, 'seda2/ID');
......
...@@ -44,6 +44,10 @@ loginBackground = ".modal-backdrop { ...@@ -44,6 +44,10 @@ loginBackground = ".modal-backdrop {
displayableFormat = "['application/pdf', 'image/*', 'text/*']" displayableFormat = "['application/pdf', 'image/*', 'text/*']"
[recordsManagement] [recordsManagement]
; Allow the owner org to have access to other org units archives
ownerIsSuperUser = false
; Profile directory for rng profile ; Profile directory for rng profile
profilesDirectory = "%laabsDirectory%/data/maarchRM/profiles" profilesDirectory = "%laabsDirectory%/data/maarchRM/profiles"
......
...@@ -17,6 +17,12 @@ ...@@ -17,6 +17,12 @@
'href' : '/medona/list', 'href' : '/medona/list',
'class' : 'fa fa-exchange fa-fw' 'class' : 'fa fa-exchange fa-fw'
}, },
{
'label' : '',
'title' : 'Favoris',
'href' : '/collection',
'class' : 'fa fa-star fa-fw'
},
{ {
'label' : 'Administration', 'label' : 'Administration',
'href' : '#', 'href' : '#',
......
...@@ -67,7 +67,22 @@ class content ...@@ -67,7 +67,22 @@ class content
$this->view->addContentFile("archivesPubliques/contentDescription/search.html"); $this->view->addContentFile("archivesPubliques/contentDescription/search.html");
$ownerOriginatorOrgs = $this->getOwnerOrgs($currentService, 'originator'); // $ownerOriginatorOrgs = $this->getOwnerOrgs($currentService, 'originator');
$orgController = \laabs::newController('organization/organization');
$ownerOriginatorOrgs = [];
$originators = $orgController->getOriginator();
foreach ($originators as $originator) {
if (!isset($ownerOriginatorOrgs[(string) $originator->ownerOrgId])) {
$ownerOriginatorOrgs[(string) $originator->ownerOrgId] = new \stdClass();
$ownerOriginatorOrgs[(string) $originator->ownerOrgId]->displayName = $originator->ownerOrgName;
$ownerOriginatorOrgs[(string) $originator->ownerOrgId]->originators = [];
}
if (!in_array($originator, $ownerOriginatorOrgs[(string) $originator->ownerOrgId]->originators)) {
$ownerOriginatorOrgs[(string)$originator->ownerOrgId]->originators[] = $originator;
}
}
$ownerDepositorOrgs = $this->getOwnerOrgs($currentService, 'depositor'); $ownerDepositorOrgs = $this->getOwnerOrgs($currentService, 'depositor');
...@@ -266,6 +281,8 @@ class content ...@@ -266,6 +281,8 @@ class content
$currentDate = \laabs::newDate(); $currentDate = \laabs::newDate();
$archiveController = \laabs::newController('recordsManagement/archive'); $archiveController = \laabs::newController('recordsManagement/archive');
$collection = \laabs::callService('Collection/Collection/readByUser');
foreach ($archives as $archive) { foreach ($archives as $archive) {
$archive->finalDispositionDesc = $this->view->translator->getText($archive->finalDisposition, false, "recordsManagement/messages"); $archive->finalDispositionDesc = $this->view->translator->getText($archive->finalDisposition, false, "recordsManagement/messages");
$archive->statusDesc = $this->view->translator->getText($archive->status, false, "recordsManagement/messages"); $archive->statusDesc = $this->view->translator->getText($archive->status, false, "recordsManagement/messages");
...@@ -297,6 +314,15 @@ class content ...@@ -297,6 +314,15 @@ class content
} }
} }
$archive->isInUserCollection = false;
if (!is_null($collection->archiveIds) && !empty($collection->archiveIds)) {
foreach ($collection->archiveIds as $collectedArchiveId) {
if ($collectedArchiveId == $archive->archiveId) {
$archive->isInUserCollection = true;
}
}
}
$archive->isCommunicable = '2'; $archive->isCommunicable = '2';
if ($archive->accessRuleComDate) { if ($archive->accessRuleComDate) {
$communicationDelay = $archive->accessRuleComDate->diff(\laabs::newTimestamp()); $communicationDelay = $archive->accessRuleComDate->diff(\laabs::newTimestamp());
...@@ -348,6 +374,7 @@ class content ...@@ -348,6 +374,7 @@ class content
$this->view->setSource('transaction', $transaction); $this->view->setSource('transaction', $transaction);
$packageSchemas = \laabs::configuration("medona")["packageSchemas"]; $packageSchemas = \laabs::configuration("medona")["packageSchemas"];
$this->view->setSource('packageSchemas', $packageSchemas); $this->view->setSource('packageSchemas', $packageSchemas);
$this->view->setSource('collection', $collection);
$this->view->merge(); $this->view->merge();
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<?merge hasReachMaxResults ?> <?merge hasReachMaxResults ?>
<h4><span>Your query returns too much results, only first results are displayed.</span></h4> <h4><span>Your query returns too much results, only first results are displayed.</span></h4>
<input type="hidden" id="transaction" value="[?merge transaction ?]" /> <input type="hidden" id="transaction" value="[?merge transaction ?]" />
<input type="hidden" id="collection" value="[?merge collection.json() ?]" />
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading clearfix"> <div class="panel-heading clearfix">
<div class="pull-left"> <div class="pull-left">
...@@ -11,6 +12,8 @@ ...@@ -11,6 +12,8 @@
<h4><?merge content.count() ?> result(s) on <?merge totalResultsWithoutLimit ?> archive(s)</h4> <h4><?merge content.count() ?> result(s) on <?merge totalResultsWithoutLimit ?> archive(s)</h4>
</div> </div>
<div class="dropdown pull-right" data-translate-catalog="recordsManagement/messages"> <div class="dropdown pull-right" data-translate-catalog="recordsManagement/messages">
<?merge isCollectionView.bool() ?>
<button class="btn btn-warning" type="button" id="deleteCollections">Remove All Collections</button>
<button class="btn btn-warning dropdown-toggle" type="button" id="archiveList_actions" data-toggle="dropdown" aria-expanded="true" title="Actions" disabled="disabled"> <button class="btn btn-warning dropdown-toggle" type="button" id="archiveList_actions" data-toggle="dropdown" aria-expanded="true" title="Actions" disabled="disabled">
<i class="fa fa-navicon">&nbsp;</i>&nbsp;Actions <i class="fa fa-navicon">&nbsp;</i>&nbsp;Actions
<span class="caret"></span> <span class="caret"></span>
...@@ -29,6 +32,7 @@ ...@@ -29,6 +32,7 @@
<th>Date de dépôt</th> <th>Date de dépôt</th>
<th>Dates extr&ecirc;mes</th> <th>Dates extr&ecirc;mes</th>
<th>Statut</th> <th>Statut</th>
<th><span><i class="fa fa-star-half-full" title="Favoris"></i></span></th>
<th style="min-width:150px"></th> <th style="min-width:150px"></th>
</tr> </tr>
</thead> </thead>
...@@ -50,6 +54,7 @@ ...@@ -50,6 +54,7 @@
<td><span class="hidden"><?merge .depositDate.format('Y-m-d H:i:s') ?></span><?merge .depositDate.format('d-m-Y H:i:s') ?></td> <td><span class="hidden"><?merge .depositDate.format('Y-m-d H:i:s') ?></span><?merge .depositDate.format('d-m-Y H:i:s') ?></td>
<td><span class="hidden"><?merge .startDate.format('Ymd') ?></span><?merge .startDate ?> &nbsp; <?merge .endDate ?></td> <td><span class="hidden"><?merge .startDate.format('Ymd') ?></span><?merge .startDate ?> &nbsp; <?merge .endDate ?></td>
<td class="archiveStatus"><?merge .statusDesc ?></td> <td class="archiveStatus"><?merge .statusDesc ?></td>
<td data-isInUserCollection="[?merge .isInUserCollection.bool().then('true', 'false') ?]"><i class="collection fa [?merge .isInUserCollection.bool().then('fa-star orange', 'fa-star-o') ?]"></i></td>
<td> <td>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
......
...@@ -315,7 +315,7 @@ ...@@ -315,7 +315,7 @@
/* ------ FUNCTION ------ */ /* ------ FUNCTION ------ */
serializerReplace = { serializerReplace = {
"archiveIdentifier": "contentId", "archiverArchiveId": "contentId",
"profileReference": "archivalProfileReference", "profileReference": "archivalProfileReference",
"archiveExpired": "isExpired", "archiveExpired": "isExpired",
"text": "term" "text": "term"
......
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