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

Merge branch 'fix/19929_less_restrictive_orgRegNumber' into 'develop'

Fix/19929 less restrictive org reg number

See merge request !713
parents 21d7d6ef 8d5bfb1d
Pipeline #17534 failed with stages
in 21 seconds
......@@ -1624,15 +1624,11 @@ class organization
public function getOriginator()
{
$currentService = \laabs::getToken("ORGANIZATION");
if (!$currentService) {
$this->view->addContentFile("recordsManagement/welcome/noWorkingOrg.html");
return $this->view->saveHtml();
}
$ownerOriginatorOrgs = $this->getOwnerOrgsByRole($currentService, 'originator');
$originators = [];
foreach ($ownerOriginatorOrgs as $org) {
foreach ($org->originator as $originator) {
foreach ($org->originators as $originator) {
$originator->ownerOrgName = $org->displayName;
$originators[] = $originator;
}
......@@ -1695,14 +1691,16 @@ class organization
|| ($role == 'originator' && $orgUnit->registrationNumber == $userOrgUnit->registrationNumber)
// Depositor = all
|| $role == 'depositor') {
// $originators = $orgUnit->originators;
if (!isset($userOrgs[(string)$orgUnit->ownerOrgId])) {
$orgObject = $this->read((string)$orgUnit->ownerOrgId);
$userOrgs[(string)$orgObject->orgId] = new \stdClass();
$userOrgs[(string)$orgObject->orgId]->displayName = $orgObject->displayName;
$userOrgs[(string)$orgObject->orgId]->{$role} = [];
$userOrgs[(string)$orgObject->orgId]->originators = [];
}
$userOrgs[(string)$orgObject->orgId]->{$role}[] = $orgUnit;
$userOrgs[(string)$orgObject->orgId]->originators[] = $orgUnit;
}
}
}
......
......@@ -79,7 +79,7 @@ class archive
$emptyRole = false;
// $ownerOriginatorOrgs = $this->getOwnerOriginatorsOrgs($currentService);
$orgController = \laabs::newController('organization/organization');
/* $orgController = \laabs::newController('organization/organization');
$originators = $orgController->getOriginator();
foreach ($originators as $originator) {
if (!isset($ownerOriginatorOrgs[(string) $originator->ownerOrgId])) {
......@@ -90,7 +90,7 @@ class archive
if (!in_array($originator, $ownerOriginatorOrgs[(string) $originator->ownerOrgId]->originators)) {
$ownerOriginatorOrgs[(string)$originator->ownerOrgId]->originators[] = $originator;
}
}
} */
}
$descriptionSchemeNames = \laabs::callService('recordsManagement/descriptionScheme/read_name_Descriptionfields');
......@@ -125,7 +125,7 @@ class archive
$this->view->setSource("retentionRules", $retentionRules);
$this->view->setSource("emptyRole", $emptyRole);
$this->view->setSource("profiles", $profiles);
$this->view->setSource("organizationsOriginator", $ownerOriginatorOrgs);
// $this->view->setSource("organizationsOriginator", $ownerOriginatorOrgs);
$this->view->setSource("deleteDescription", $deleteDescription);
$this->view->setSource("descriptionScheme", $descriptionSchemeNames);
......@@ -242,6 +242,7 @@ class archive
$archive->hasRights = false;
} else {
$archive->hasRights = $archiveController->checkRights($archive);
// $archive->hasRights = true;
}
} catch (\Exception $e) {
$archive->hasRights = false;
......
......@@ -204,8 +204,8 @@ msgstr "Comptes de service"
msgid "Submit"
msgstr "Valider"
msgid "You must use only letters, numbers and the special character '_'"
msgstr "Vous devez utiliser uniquement les lettres, les chiffres et le caractère spécial '_'"
msgid "You must use only letters, numbers and the special characters ('_','-','/' and '.')"
msgstr "Vous devez utiliser uniquement les lettres, les chiffres et les caractères spéciaux ('_','-','/' et '.')"
msgid "The first and last character must be a letter. You must use only letters and the special character '_'"
msgstr "Les premier et dernier caractères doivent être des lettres. Vous devez utiliser uniquement les lettres et le caractère spécial '_'"
......
......@@ -33,7 +33,7 @@
<div class="form-group">
<label>Registration number <span style="color: red">*</span></label>
<input type="text" class="form-control" name="registrationNumber" placeholder="Registration number">
<small class="help-block">You must use only letters, numbers and the special character '_'</small>
<small class="help-block">You must use only letters, numbers and the special characters ('_','-','/' and '.')</small>
</div>
<div class="form-group" id="orgForm_enabled" style="display: none">
<label>Enabled</label>
......@@ -265,7 +265,7 @@
var organization = OrganizationForm.serialize();
var pattern = new RegExp("^[A-Za-z0-9_]*[A-Za-z0-9_]$");
var pattern = new RegExp("^[A-Za-z0-9_/.-]*[A-Za-z0-9_/.-]$");
if(!pattern.test(organization.registrationNumber)) {
return;
......@@ -395,7 +395,7 @@
$("#organization_organizationForm").on("keyup","[name='registrationNumber']", function(){
var input = $(this);
var pattern = new RegExp("^[A-Za-z0-9_]*[A-Za-z0-9]$");
var pattern = new RegExp("^[A-Za-z0-9_/.-]*[A-Za-z0-9/.-]$");
var formGroup = input.closest('.form-group');
if(!input.val()) {
......
......@@ -902,11 +902,10 @@
/* -- EDITION MODAL -- */
var organizations = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('orgName'),
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('displayName'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: {
//url: '/organizations/todisplay?orgUnit=true',
url: '/originator',
url: '/organizations/todisplay?orgUnit=true',
ttl: '0'
},
limit: 100
......
......@@ -41,7 +41,7 @@
<div class="col-sm-8">
<input type="text" class="form-control orgHide" placeholder="Producer" name="originatorOwnerOrgRegNumber"
id="orgTypeahead" />
<select class="form-control hide" name="originatorOwnerOrgId" id="originatorOwnerOrgId">
<!-- <select class="form-control hide" name="originatorOwnerOrgId" id="originatorOwnerOrgId">
<option value="">All</option>
<?merge organizationsOriginator ?>
<div>
......@@ -50,8 +50,10 @@
<?merge .displayName ?>
</option>
</div>
</select>
<select class="form-control hide" name="originatorOrgRegNumber" id="originatorOrgRegNumber">
</select> -->
<input type="hidden" name="originatorOwnerOrgId" id="originatorOwnerOrgId" />
<!-- <select class="form-control hide" name="originatorOrgRegNumber" id="originatorOrgRegNumber">
<option value="">All</option>
<?merge organizationsOriginator ?>
<div>
......@@ -60,7 +62,8 @@
<?merge .displayName ?>
</option>
</div>
</select>
</select> -->
<input type="hidden" name="originatorOrgRegNumber" id="originatorOrgRegNumber" />
</div>
</div>
</div>
......
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