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