Commit 3b0bedf4 authored by Charlotte Bataille's avatar Charlotte Bataille
Browse files

feat/18079 : compare ownerOrgIds and update originator

parent 39a5466f
Pipeline #14339 failed with stages
in 57 seconds
......@@ -979,13 +979,24 @@ trait archiveModificationTrait
/**
* Update originator service of an array of archives
*
* @param array $archiveIds Array of archive identifiers
* @param string $archiveIds List of archive identifiers
* @param string $orgId Organization identified destined to be new originator of archive
*
*/
public function updateOriginator($archiveIds, $orgId)
{
var_dump('dans le controleur');
exit;
$archive = $this->sdoFactory->read('recordsManagement/archive', $archiveIds);
$currentOwnerOrgId = $archive->originatorOwnerOrgId;
$newOriginatorOrg = $this->sdoFactory->read('organization/organization', $orgId);
if ($currentOwnerOrgId == $newOriginatorOrg->ownerOrgId) {
$archive->originatorOrgRegNumber = $newOriginatorOrg->registrationNumber;
$archive->lastModificationDate = \laabs::newTimestamp();
$this->sdoFactory->update($archive,'recordsManagement/archive');
} else {
throw new \bundle\recordsManagement\Exception\organizationException(
"The new originator organization of the archive must have the same owner organization as the current one."
);
}
}
}
......@@ -22,13 +22,13 @@ namespace bundle\recordsManagement\Model;
* Class model that represents an archive
*
* @package RecordsManagement
* @author Cyril VAZQUEZ (Maarch) <cyril.vazquez@maarch.org>
* @author Charlotte Bataille (Maarch) <charlotte.bataille@maarch.org>
*
* @substitution recordsManagement/archive
*
* @pkey [archiveId]
*/
class archiveStatus
class archiveOriginator
{
/**
* The archive identifier
......@@ -39,12 +39,12 @@ class archiveStatus
public $archiveId;
/**
* The status
* The registration number of the originator organization
*
* @var string
* @enumeration [pending, preserved, frozen, disposable, disposed]
* @notempty
*/
public $status;
public $originatorOrgRegNumber;
/**
* @var timestamp
......
......@@ -263,6 +263,9 @@ msgstr "Une archive gelée ne peut pas être modifiée."
msgid "An archive that does not have the status 'preserved' can't be modified."
msgstr "Une archive n'ayant pas le statut 'Conservée' ne peut pas être modifiée"
msgid "The new originator organization of the archive must have the same owner organization as the current one."
msgstr "Le nouveau service producteur de l'archive doit avoir la même organisation racine que le service producteur actuel."
msgid "An action is already in progress on this archive."
msgstr "Une action est déjà en cours sur cette archive."
......
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