Verified Commit c4ae45c5 authored by Arnaud Pauget's avatar Arnaud Pauget
Browse files

Added function to control the transition to a new status (checkStatus

parent 56eea994
......@@ -77,4 +77,28 @@ class archive extends \bundle\recordsManagement\Controller\archive
return $res;
* Check if the new status of an archive is possible depending on current status
* @param string $archiveId Identifier of the archives to check
* @param string $status New status to check
* @return boolean if the new status is possible on this archive (depends on the current status of the archive)
public function checkStatus($archiveId, $status)
$statusList = [];
$statusList['restituable'] = array('preserved', 'restituted', 'disposed');
if (!isset($statusList[$status])) {
return false;
$archive = $this->sdoFactory->read('recordsManagement/archiveStatus', $archiveId);
if (!in_array($archive->status, $statusList[$status])) {
return false;
return true;
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