Unverified Commit 82dcfc57 authored by Jerome Boucher's avatar Jerome Boucher
Browse files

feat/13448 : discovering archives

parent 3a2b7620
Pipeline #13834 failed with stages
in 1 minute and 3 seconds
...@@ -28,3 +28,4 @@ WITH ( ...@@ -28,3 +28,4 @@ WITH (
); );
ALTER TABLE "recordsManagement"."archivalProfile" ADD COLUMN "isRetentionLastDeposit" boolean default false; ALTER TABLE "recordsManagement"."archivalProfile" ADD COLUMN "isRetentionLastDeposit" boolean default false;
ALTER TABLE "recordsManagement"."archivalProfile" ADD COLUMN "isDiscoverable" boolean default false;
...@@ -680,7 +680,7 @@ class userAccount ...@@ -680,7 +680,7 @@ class userAccount
*/ */
public function readUserPositions($accountId) public function readUserPositions($accountId)
{ {
$users = $this->sdoFactory->find("organization/userPosition", "accountId = '$accountId'"); $users = $this->sdoFactory->find("organization/userPosition", "userAccountId = '$accountId'");
$users = \laabs::castMessageCollection($users, 'organization/userPositionTree'); $users = \laabs::castMessageCollection($users, 'organization/userPositionTree');
foreach ($users as $user) { foreach ($users as $user) {
......
...@@ -55,6 +55,7 @@ trait archiveAccessTrait ...@@ -55,6 +55,7 @@ trait archiveAccessTrait
* @param string $processingStatus * @param string $processingStatus
* @param bool $checkAccess * @param bool $checkAccess
* @param integer $maxResults * @param integer $maxResults
* @param boolean $isDiscoverable
* *
* @return recordsManagement/archive[] Array of recordsManagement/archive object * @return recordsManagement/archive[] Array of recordsManagement/archive object
*/ */
...@@ -83,7 +84,8 @@ trait archiveAccessTrait ...@@ -83,7 +84,8 @@ trait archiveAccessTrait
$archiverArchiveId = null, $archiverArchiveId = null,
$processingStatus = null, $processingStatus = null,
$checkAccess = true, $checkAccess = true,
$maxResults = null $maxResults = null,
$isDiscoverable = false
) { ) {
$accountController = \laabs::newController('auth/userAccount'); $accountController = \laabs::newController('auth/userAccount');
$accountController->isAuthorized('user'); $accountController->isAuthorized('user');
...@@ -111,7 +113,8 @@ trait archiveAccessTrait ...@@ -111,7 +113,8 @@ trait archiveAccessTrait
$originatingStartDate, $originatingStartDate,
$originatingEndDate, $originatingEndDate,
$archiverArchiveId, $archiverArchiveId,
$processingStatus $processingStatus,
$isDiscoverable
); );
foreach ($searchClasses as $descriptionClass => $descriptionController) { foreach ($searchClasses as $descriptionClass => $descriptionController) {
...@@ -149,6 +152,7 @@ trait archiveAccessTrait ...@@ -149,6 +152,7 @@ trait archiveAccessTrait
* @param string $processingStatus * @param string $processingStatus
* @param bool $checkAccess * @param bool $checkAccess
* @param integer $maxResults * @param integer $maxResults
* @param boolean $isDiscoverable
* *
* @return integer $count Count of archives from search * @return integer $count Count of archives from search
*/ */
...@@ -177,7 +181,8 @@ trait archiveAccessTrait ...@@ -177,7 +181,8 @@ trait archiveAccessTrait
$archiverArchiveId = null, $archiverArchiveId = null,
$processingStatus = null, $processingStatus = null,
$checkAccess = true, $checkAccess = true,
$maxResults = null $maxResults = null,
$isDiscoverable = false
) { ) {
$accountController = \laabs::newController('auth/userAccount'); $accountController = \laabs::newController('auth/userAccount');
$accountController->isAuthorized('user'); $accountController->isAuthorized('user');
...@@ -205,7 +210,8 @@ trait archiveAccessTrait ...@@ -205,7 +210,8 @@ trait archiveAccessTrait
$originatingStartDate, $originatingStartDate,
$originatingEndDate, $originatingEndDate,
$archiverArchiveId, $archiverArchiveId,
$processingStatus $processingStatus,
$isDiscoverable
); );
$count = 0; $count = 0;
...@@ -237,29 +243,31 @@ trait archiveAccessTrait ...@@ -237,29 +243,31 @@ trait archiveAccessTrait
$originatingStartDate = null, $originatingStartDate = null,
$originatingEndDate = null, $originatingEndDate = null,
$archiverArchiveId = null, $archiverArchiveId = null,
$processingStatus = null $processingStatus = null,
$isDiscoverable = false
) { ) {
$archiveArgs = [ $archiveArgs = [
'archiveId' => $archiveId, 'archiveId' => $archiveId,
'profileReference' => $profileReference, 'profileReference' => $profileReference,
'status' => $status, 'status' => $status,
'archiveName' => $archiveName, 'archiveName' => $archiveName,
'agreementReference' => $agreementReference, 'agreementReference' => $agreementReference,
'archiveExpired' => $archiveExpired, 'archiveExpired' => $archiveExpired,
'finalDisposition' => $finalDisposition, 'finalDisposition' => $finalDisposition,
'originatorOrgRegNumber' => $originatorOrgRegNumber, 'originatorOrgRegNumber' => $originatorOrgRegNumber,
'originatorOwnerOrgId' => $originatorOwnerOrgId, 'originatorOwnerOrgId' => $originatorOwnerOrgId,
'originatorArchiveId' => $originatorArchiveId, 'originatorArchiveId' => $originatorArchiveId,
'originatingDate' => $originatingDate, 'originatingDate' => $originatingDate,
'filePlanPosition' => $filePlanPosition, 'filePlanPosition' => $filePlanPosition,
'hasParent' => $hasParent, 'hasParent' => $hasParent,
'partialRetentionRule' => $partialRetentionRule, 'partialRetentionRule' => $partialRetentionRule,
'retentionRuleCode' => $retentionRuleCode, 'retentionRuleCode' => $retentionRuleCode,
'depositStartDate' => $depositStartDate, 'depositStartDate' => $depositStartDate,
'depositEndDate' => $depositEndDate, 'depositEndDate' => $depositEndDate,
'originatingDate' => [$originatingStartDate, $originatingEndDate], // [0] startDate, [1] endDate 'originatingDate' => [$originatingStartDate, $originatingEndDate], // [0] startDate, [1] endDate
'archiverArchiveId' => $archiverArchiveId, 'archiverArchiveId' => $archiverArchiveId,
'processingStatus' => $processingStatus 'processingStatus' => $processingStatus,
'isDiscoverable' => $isDiscoverable
]; ];
if (!$filePlanPosition) { if (!$filePlanPosition) {
...@@ -977,11 +985,11 @@ trait archiveAccessTrait ...@@ -977,11 +985,11 @@ trait archiveAccessTrait
$queryParts = []; $queryParts = [];
if (!empty($args['archiveName'])) { if (!empty($args['archiveName'])) {
$queryParts[] = "archiveName='*".$args['archiveName']."*'"; $queryParts[] = "archiveName='*" . $args['archiveName'] . "*'";
} }
if (!empty($args['profileReference'])) { if (!empty($args['profileReference'])) {
$queryParts['archivalProfileReference'] = "archivalProfileReference = :archivalProfileReference"; $queryParts['archivalProfileReference'] = "archivalProfileReference = :archivalProfileReference";
$queryParams['archivalProfileReference']=$args['profileReference']; $queryParams['archivalProfileReference'] = $args['profileReference'];
} }
if (!empty($args['agreementReference'])) { if (!empty($args['agreementReference'])) {
$queryParts['archivalAgreementReference'] = "archivalAgreementReference=:archivalAgreementReference"; $queryParts['archivalAgreementReference'] = "archivalAgreementReference=:archivalAgreementReference";
...@@ -1016,7 +1024,7 @@ trait archiveAccessTrait ...@@ -1016,7 +1024,7 @@ trait archiveAccessTrait
} }
if (!empty($args['finalDisposition'])) { if (!empty($args['finalDisposition'])) {
$queryParts['finalDisposition'] = "finalDisposition= :finalDisposition"; $queryParts['finalDisposition'] = "finalDisposition= :finalDisposition";
$queryParams['finalDisposition'] =$args['finalDisposition']; $queryParams['finalDisposition'] = $args['finalDisposition'];
} }
if (!empty($args['originatorOrgRegNumber'])) { if (!empty($args['originatorOrgRegNumber'])) {
$queryParts[] = "originatorOrgRegNumber= :originatorOrgRegNumber"; $queryParts[] = "originatorOrgRegNumber= :originatorOrgRegNumber";
...@@ -1100,6 +1108,12 @@ trait archiveAccessTrait ...@@ -1100,6 +1108,12 @@ trait archiveAccessTrait
} }
} }
if (isset($args['isDiscoverable'])) {
if ($args['isDiscoverable']) {
$queryParts['isDiscoverable'] = "isDiscoverable=true";
}
}
if ($checkAccess) { if ($checkAccess) {
$accessRuleAssert = $this->getAccessRuleAssert($currentDateString); $accessRuleAssert = $this->getAccessRuleAssert($currentDateString);
......
...@@ -140,4 +140,11 @@ class archivalProfile ...@@ -140,4 +140,11 @@ class archivalProfile
* @var json * @var json
*/ */
public $processingStatuses; public $processingStatuses;
/**
* Is property discoverable by services outside of owner service
*
* @var boolean
*/
public $isDiscoverable;
} }
...@@ -158,6 +158,13 @@ class archivalProfile ...@@ -158,6 +158,13 @@ class archivalProfile
*/ */
public $processingStatuses; public $processingStatuses;
/**
* Is property discoverable by services outside of owner service
*
* @var boolean
*/
public $isDiscoverable;
/** /**
* Get the properties * Get the properties
* @return array * @return array
...@@ -176,4 +183,4 @@ class archivalProfile ...@@ -176,4 +183,4 @@ class archivalProfile
return $this->name; return $this->name;
} }
} }
\ No newline at end of file
...@@ -121,6 +121,11 @@ class archive ...@@ -121,6 +121,11 @@ class archive
*/ */
public $archivalAgreementReference; public $archivalAgreementReference;
/**
* @var bool
*/
public $isDiscoverable;
/* ************************************************************************ /* ************************************************************************
* Management Data * Management Data
*********************************************************************** */ *********************************************************************** */
......
...@@ -60,6 +60,7 @@ CREATE TABLE "recordsManagement"."archivalProfile" ...@@ -60,6 +60,7 @@ CREATE TABLE "recordsManagement"."archivalProfile"
"fileplanLevel" text, "fileplanLevel" text,
"processingStatuses" jsonb, "processingStatuses" jsonb,
"isRetentionLastDeposit" boolean default false, "isRetentionLastDeposit" boolean default false,
"isDiscoverable" boolean default false,
PRIMARY KEY ("archivalProfileId"), PRIMARY KEY ("archivalProfileId"),
UNIQUE ("reference"), UNIQUE ("reference"),
FOREIGN KEY ("accessRuleCode") FOREIGN KEY ("accessRuleCode")
......
...@@ -56,6 +56,7 @@ interface archivesInterface ...@@ -56,6 +56,7 @@ interface archivesInterface
* @param string $originatingEndDate * @param string $originatingEndDate
* @param string $archiverArchiveId * @param string $archiverArchiveId
* @param integer $maxResults * @param integer $maxResults
* @param boolean $isDiscoverable
* *
* @action recordsManagement/archive/search * @action recordsManagement/archive/search
* *
...@@ -83,7 +84,8 @@ interface archivesInterface ...@@ -83,7 +84,8 @@ interface archivesInterface
$originatingStartDate = null, $originatingStartDate = null,
$originatingEndDate = null, $originatingEndDate = null,
$archiverArchiveId = null, $archiverArchiveId = null,
$maxResults = null $maxResults = null,
$isDiscoverable = false
); );
/** /**
...@@ -112,6 +114,7 @@ interface archivesInterface ...@@ -112,6 +114,7 @@ interface archivesInterface
* @param string $originatingEndDate * @param string $originatingEndDate
* @param string $archiverArchiveId * @param string $archiverArchiveId
* @param integer $maxResults * @param integer $maxResults
* @param boolean $isDiscoverable
* *
* @action recordsManagement/archive/count * @action recordsManagement/archive/count
* *
...@@ -139,7 +142,8 @@ interface archivesInterface ...@@ -139,7 +142,8 @@ interface archivesInterface
$originatingStartDate = null, $originatingStartDate = null,
$originatingEndDate = null, $originatingEndDate = null,
$archiverArchiveId = null, $archiverArchiveId = null,
$maxResults = null $maxResults = null,
$isDiscoverable = false
); );
/** /**
......
...@@ -279,4 +279,7 @@ msgid "cannot be recursively called" ...@@ -279,4 +279,7 @@ msgid "cannot be recursively called"
msgstr "ne peut pas être appelé récursivement" msgstr "ne peut pas être appelé récursivement"
msgid "Update when a file is added" msgid "Update when a file is added"
msgstr "Mettre à jour au versement d'une pièce" msgstr "Mettre à jour au versement d'une pièce"
\ No newline at end of file
msgid "Discoverable"
msgstr "Décelable"
...@@ -1337,3 +1337,6 @@ msgstr "Veuillez choisir le type de critère supplémentaire à ajouter" ...@@ -1337,3 +1337,6 @@ msgstr "Veuillez choisir le type de critère supplémentaire à ajouter"
msgid "Add filter" msgid "Add filter"
msgstr "Ajouter le filtre" msgstr "Ajouter le filtre"
msgid "Search in other services"
msgstr "Rechercher dans d'autres services"
...@@ -56,6 +56,13 @@ file that was distributed with this source code. ...@@ -56,6 +56,13 @@ file that was distributed with this source code.
<input type="checkbox" id="fileplanLevelToggle"> <input type="checkbox" id="fileplanLevelToggle">
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-md-3 control-label">Discoverable</label>
<div class="col-md-9">
<input type='hidden' id="isDiscoverable" name="isDiscoverable">
<input type="checkbox" id="isDiscoverableToggle">
</div>
</div>
</div> </div>
<?hinclude recordsManagement/archivalProfile/tabs.html ?> <?hinclude recordsManagement/archivalProfile/tabs.html ?>
...@@ -200,6 +207,7 @@ file that was distributed with this source code. ...@@ -200,6 +207,7 @@ file that was distributed with this source code.
reference: $('#reference').val(), reference: $('#reference').val(),
name: $('#name').val(), name: $('#name').val(),
fileplanLevel: $("#fileplanLevel").val(), fileplanLevel: $("#fileplanLevel").val(),
isDiscoverable : $("#isDiscoverableToggle").prop("checked"),
descriptionClass: $('#descriptionClass').val(), descriptionClass: $('#descriptionClass').val(),
retentionStartDate: $('#startDate option:selected').val(), retentionStartDate: $('#startDate option:selected').val(),
description: $('#description').val(), description: $('#description').val(),
...@@ -234,7 +242,6 @@ file that was distributed with this source code. ...@@ -234,7 +242,6 @@ file that was distributed with this source code.
} }
serializedObject.archiveDescription = PropertiesList.serialize(); serializedObject.archiveDescription = PropertiesList.serialize();
if ($("#fileplanLevel").val() != 'item') { if ($("#fileplanLevel").val() != 'item') {
serializedObject.acceptArchiveWithoutProfile = $('#acceptArchiveWithoutProfile').prop("checked"); serializedObject.acceptArchiveWithoutProfile = $('#acceptArchiveWithoutProfile').prop("checked");
serializedObject.containedProfiles = ArchiveStructure.serialize(); serializedObject.containedProfiles = ArchiveStructure.serialize();
...@@ -262,6 +269,11 @@ file that was distributed with this source code. ...@@ -262,6 +269,11 @@ file that was distributed with this source code.
$("#contentsTabBtn").addClass('hide'); $("#contentsTabBtn").addClass('hide');
} }
$('#isDiscoverableToggle').bootstrapToggle();
if ($('#isDiscoverable').val() == '1') {
$('#isDiscoverableToggle').bootstrapToggle('on');
}
$("#archivalProfileNavControl").find('a').first().click(); $("#archivalProfileNavControl").find('a').first().click();
ArchivalProfile.loadRetentionRule(); ArchivalProfile.loadRetentionRule();
...@@ -344,4 +356,8 @@ file that was distributed with this source code. ...@@ -344,4 +356,8 @@ file that was distributed with this source code.
$('#updateRetentionRuleOnDeposit').removeClass('hide'); $('#updateRetentionRuleOnDeposit').removeClass('hide');
} }
}); });
$('#isDiscoverableToggle').on('change', function (e) {
$("#isDiscoverable").val($(this).prop('checked'));
});
</script> </script>
...@@ -181,11 +181,26 @@ ...@@ -181,11 +181,26 @@
</div> </div>
<!-- PARTIAL RETENTION RULE --> <!-- PARTIAL RETENTION RULE -->
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="row">
<label class="col-sm-4 control-label">Partial retention rule</label> <div class="form-group">
<div class="col-sm-8 checkbox" id="partialRetentionRule"> <div class="col-md-6">
<input type="checkbox" name="partialRetentionRule" data-toggle="toggle" data-on="Oui" data-off="Non"> <div class="row">
<label class="col-sm-8 control-label">Partial retention rule</label>
<div class="col-sm4 checkbox" id="partialRetentionRule">
<input type="checkbox" name="partialRetentionRule" id="partialRetentionRuleToggle">
</div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<label class="col-sm-8 control-label">Search in other services</label>
<div class="col-sm4 checkbox" id="isDiscoverable">
<input type="checkbox" name="isDiscoverable" id="isDiscoverableToggle">
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<!-- DEPOSITOR --> <!-- DEPOSITOR -->
...@@ -247,3 +262,15 @@ ...@@ -247,3 +262,15 @@
</div> </div>
<span class="hide" id="required_fields">You must fill all required fields (*)</span> <span class="hide" id="required_fields">You must fill all required fields (*)</span>
</div> </div>
<script>
$('#partialRetentionRuleToggle').bootstrapToggle({
on: 'Oui',
off: 'Non'
});
$('#isDiscoverableToggle').bootstrapToggle({
on: 'Oui',
off: 'Non'
});
</script>
...@@ -70,6 +70,7 @@ interface retrieveInterface ...@@ -70,6 +70,7 @@ interface retrieveInterface
* @param string $text * @param string $text
* @param string $archiverArchiveId * @param string $archiverArchiveId
* @param integer $maxResults * @param integer $maxResults
* @param boolean $isDiscoverable
* *
* @uses recordsManagement/archives/read * @uses recordsManagement/archives/read
* @uses recordsManagement/archives/readCount * @uses recordsManagement/archives/readCount
...@@ -88,7 +89,8 @@ interface retrieveInterface ...@@ -88,7 +89,8 @@ interface retrieveInterface
$description = null, $description = null,
$text = null, $text = null,
$archiverArchiveId = null, $archiverArchiveId = null,
$maxResults = null $maxResults = null,
$isDiscoverable = false
); );
/** /**
......
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