Commit e110ba64 authored by Alexandre Morin's avatar Alexandre Morin
Browse files

Fix status restitution destruction

parent a6437c76
......@@ -366,7 +366,7 @@ class ArchiveRestitution extends abstractMessage
*/
public function process($messageId)
{
$this->changeStatus($messageId, "processing");
$this->changeStatus($messageId, "validating");
$message = $this->sdoFactory->read('medona/message', array("messageId" => $messageId));
$message->active = false;
......@@ -380,7 +380,7 @@ class ArchiveRestitution extends abstractMessage
$this->archiveController->setStatus($unitIdentifier->objectId, 'disposed');
}
$this->changeStatus($messageId, "processed");
$this->changeStatus($messageId, "validated");
$uri = $this->messageDirectory."/".(string) $message->messageId;
if (is_dir($uri)) {
......
......@@ -159,7 +159,6 @@ class ArchiveRestitutionRequest extends abstractMessage
if ($message->schema != 'medona') {
$archiveRestitutionRequestController = \laabs::newController($message->schema.'/ArchiveRestitutionRequest');
$archiveRestitutionRequestController->send($message);
} else {
$archiveRestitutionRequest = $this->sendMessage($message);
$message->object = $archiveRestitutionRequest;
......@@ -365,7 +364,7 @@ class ArchiveRestitutionRequest extends abstractMessage
$operationResult
);
$message->status = "validated";
$message->status = "processed";
$this->sdoFactory->update($message);
return true;
......@@ -380,9 +379,10 @@ class ArchiveRestitutionRequest extends abstractMessage
{
$results = array();
$restitutionIds = $this->sdoFactory->index('medona/message', array('messageId'), 'type = "ArchiveRestitution" AND status = "accepted"');
$restitutionIds = $this->sdoFactory->index('medona/message', array('messageId'), 'type = "ArchiveRestitution" AND status = "validated"');
foreach ($restitutionIds as $restitutionId) {
$this->changeStatus($restitutionId, "processing");
$results[(string) $restitutionId] = $this->destruct($restitutionId);
$this->changeStatus($restitutionId, "processed");
}
......@@ -407,7 +407,7 @@ class ArchiveRestitutionRequest extends abstractMessage
foreach ($restitutionRequest->unitIdentifier as $unitIdentifier) {
$archive = $this->archiveController->destruct($unitIdentifier->objectId);
$removedArchiveIds[] = $archive->archiveId;
$removedArchiveIds[] = (string) $archive["success"][0]->archiveId;
}
return $removedArchiveIds;
......
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