Verified Commit 0ecf9022 authored by Cyril Vazquez's avatar Cyril Vazquez
Browse files

WIP

parent 762467d3
......@@ -105,15 +105,13 @@ translationLogType = "{
;The path of the stopword file for fullTextIndexing
stopWordsFilePath = "%laabsDirectory%/data/stopwords/stopwords_fr.txt"
;descriptionSchemes = "{
; 'seda2/Content' : {
; 'label' : 'SEDA 2',
; 'type' : 'php',
; 'uri' : 'seda2/Content',
; 'controller' : '',
; 'presenter' : ''
; }
;}"
packageSchemas = "{
'mades' : {
'label' : 'Format d\'échange Maarch RM',
'phpNamespace' : 'mades',
'presenter' : 'mades/message'
}
}"
[audit]
; Send notifications on audit event
......
......@@ -27,7 +27,7 @@ namespace bundle\mades\Controller;
* @author Alexis Ragot <alexis.ragot@maarch.org>
*/
class ArchiveTransfer extends Message implements \bundle\medona\Controller\ArchiveTransferInterface
{
{
public $errors = [];
public $infos = [];
public $replyCode;
......@@ -65,7 +65,7 @@ class ArchiveTransfer extends Message implements \bundle\medona\Controller\Archi
}
$message->date = $message->object->date;
$message->senderOrgRegNumber = $message->object->transferringAgency->identifier->value;
$this->receiveTransferringAgency($message);
$message->recipientOrgRegNumber = $message->object->archivalAgency->identifier->value;
$message->reference = $message->object->messageIdentifier->value;
......@@ -83,11 +83,22 @@ class ArchiveTransfer extends Message implements \bundle\medona\Controller\Archi
}
if (isset($message->object->dataObjectPackage->physicalDataObject)) {
$message->dataObjectCount += count($message->object->dataObjectPackage->physicalDataObject);
}
}
return $message;
}
protected function receiveTransferringAgency($message)
{
// Organization object OR Identifier object OR string
// Identifier is object OR string
if (is_object($message->object->transferringAgency)) {
if (isset($message->object->transferringAgency->identifier)) {
$message->senderOrgRegNumber = $message->object->transferringAgency->identifier->value;
}
protected function receiveAttachments($message)
{
$this->validateReference($message->object->dataObjectPackage->descriptiveMetadata, $message->object->dataObjectPackage->binaryDataObject);
......
<?php
/*
* Copyright (C) Maarch
*
* This file is part of bundle Mades
*
* Bundle Mades is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bundle Mades is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with bundle Mades. If not, see <http://www.gnu.org/licenses/>.
*/
namespace bundle\mades\Controller;
/**
* Class for archive transfer
*
* @package Mades
* @author Alexis Ragot <alexis.ragot@maarch.org>
*/
abstract class Message
{
/**
* Load a message
* @param medona\message $message The message object
*/
public function loadMessage($message)
{
$data = file_get_contents($message->path);
$message->object = json_decode($data);
$message->object->binaryDataObject = get_object_vars($message->object->dataObjectPackage->binaryDataObject);
$message->object->descriptiveMetadata = get_object_vars($message->object->dataObjectPackage->descriptiveMetadata);
}
protected function sendError($code, $message = false)
{
if ($message) {
array_push($this->errors, new \core\Error($message, null, $code));
} else {
array_push($this->errors, new \core\Error($this->getReplyMessage($code), null, $code));
}
if ($this->replyCode == null) {
$this->replyCode = $code;
}
}
}
\ No newline at end of file
......@@ -45,7 +45,7 @@ class ArchiveModificationNotification extends ArchiveNotification
$message->messageId = \laabs::newId();
$message->type = "ArchiveModificationNotification";
$schema = "";
$schema = "mades";
if (\laabs::hasBundle('seda')) {
$schema = "seda";
}
......@@ -80,7 +80,6 @@ class ArchiveModificationNotification extends ArchiveNotification
try {
if ($message->schema) {
$archiveModificationNotificationController = \laabs::newController($message->schema.'/ArchiveModificationNotification');
$archiveModificationNotificationController->send($message);
}
......
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