Commit ff4fb143 authored by Charlotte Bataille's avatar Charlotte Bataille
Browse files

feat/18593 : fix jsonSerialize bug

parent c82e7a28
Pipeline #18541 failed with stages
in 39 seconds
......@@ -1624,11 +1624,15 @@ 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->originators as $originator) {
foreach ($org->originator as $originator) {
$originator->ownerOrgName = $org->displayName;
$originators[] = $originator;
}
......@@ -1672,8 +1676,10 @@ class organization
$archiver = true;
$myOriginatorOrgs = [];
foreach ($allArchivalAgreements as $archivalAgreement) {
if($archivalAgreement->archiverOrgRegNumber == $userOrgUnitOrgRegNumber) {
$myOriginatorOrgs = array_merge($myOriginatorOrgs, $archivalAgreement->originatorOrgIds->jsonSerialize());
if ($archivalAgreement->archiverOrgRegNumber == $userOrgUnitOrgRegNumber) {
if ($archivalAgreement->originatorOrgIds) {
$myOriginatorOrgs = array_merge($myOriginatorOrgs, $archivalAgreement->originatorOrgIds->jsonSerialize());
}
}
}
}
......@@ -1691,16 +1697,14 @@ 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]->originators = [];
$userOrgs[(string)$orgObject->orgId]->{$role} = [];
}
$userOrgs[(string)$orgObject->orgId]->originators[] = $orgUnit;
$userOrgs[(string)$orgObject->orgId]->{$role}[] = $orgUnit;
}
}
}
......
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