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