diff --git a/modules/export_seda/AdapterMaarchCourrier.php b/modules/export_seda/AdapterMaarchCourrier.php old mode 100755 new mode 100644 index 94820c8b1f3908bf02502f9b9c67f88730dac2ba..2e34a1dbdd130edcb9f6e79202ea71634a9c52ee --- a/modules/export_seda/AdapterMaarchCourrier.php +++ b/modules/export_seda/AdapterMaarchCourrier.php @@ -1,12 +1,58 @@ <?php +require_once __DIR__. DIRECTORY_SEPARATOR. 'RequestSeda.php'; +require_once "core/Models/DocserverModel.php"; +require_once "core/Models/DocserverTypeModel.php"; +require_once "core/Controllers/DocserverToolsController.php"; + class AdapterMaarchCourrier{ + private $db; public function __construct() { - + $this->db = new RequestSeda(); } - public function getInformations($reference) { + public function getInformations($messageId, $type) + { + $res = []; // [0] = url, [1] = header, [2] = cookie, [3] = data + + $message = $this->db->getMessageByIdentifier($messageId); + + $messageObject = json_decode($message->data); + + $docserver = \Core\Models\DocserverModel::getById(['docserver_id' => $message->docserver_id]); + $docserverType = \Core\Models\DocserverTypeModel::getById(['docserver_type_id' => $docserver[0]['docserver_type_id']]); + + $pathDirectory = str_replace('#', DIRECTORY_SEPARATOR, $message->path); + $filePath = $docserver[0]['path_template'] . $pathDirectory . $message->filename; + $fingerprint = \Core\Controllers\DocserverToolsController::doFingerprint([ + 'path' => $filePath, + 'fingerprintMode' => $docserverType[0]['fingerprint_mode'], + ]); + + if($fingerprint['fingerprint'] != $message->fingerprint){ + echo _PB_WITH_FINGERPRINT_OF_DOCUMENT;exit; + } + + $pathParts = pathinfo($filePath); + $res[0] = $messageObject->ArchivalAgency->OrganizationDescriptiveMetadata->Communication[0]->value + . '?extension='. $pathParts['extension'] + . '&size='. filesize($filePath) + . '&type='. $type; + + $res[1] = [ + 'accept:application/json', + 'content-type:application/json' + ]; + + $res[2] = ''; + + $postData = new stdClass(); + $postData->base64 = base64_encode(file_get_contents($filePath)); + + $res[3] = json_encode($postData); + + return $res; } -} \ No newline at end of file +} diff --git a/modules/export_seda/AdapterMaarchRM.php b/modules/export_seda/AdapterMaarchRM.php old mode 100755 new mode 100644 index 7e83e66e3ec5abd7c4afe24b955179f569a5a122..7d263b8c171be59e002d31d8f176186fedf0bcbd --- a/modules/export_seda/AdapterMaarchRM.php +++ b/modules/export_seda/AdapterMaarchRM.php @@ -5,7 +5,29 @@ class AdapterMaarchRM{ public function __construct() { - $this->xml = simplexml_load_file(__DIR__.DIRECTORY_SEPARATOR. 'xml' . DIRECTORY_SEPARATOR . "config.xml"); + $getXml = false; + $path = ''; + if (file_exists( + $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' + )) + { + $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } else if (file_exists($_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml')) { + $path = $_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda' + . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } + + if ($getXml) { + $this->xml = simplexml_load_file($path); + } } public function getInformations($reference) { @@ -22,7 +44,7 @@ class AdapterMaarchRM{ $res[2] = "LAABS-AUTH=".$token; $data = new stdClass(); - $messageDirectory = __DIR__.DIRECTORY_SEPARATOR.'message'.DIRECTORY_SEPARATOR.$reference; + $messageDirectory = (string) $this->xml->CONFIG->directoryMessage.DIRECTORY_SEPARATOR.$reference; $messageFile = $reference.".xml"; $files = scandir($messageDirectory); @@ -46,4 +68,4 @@ class AdapterMaarchRM{ return $res; } -} \ No newline at end of file +} diff --git a/modules/export_seda/Ajax_generate_message.php b/modules/export_seda/Ajax_generate_message.php new file mode 100644 index 0000000000000000000000000000000000000000..ee4ea893ac97828fc6635df60b15ff77f29fe2dc --- /dev/null +++ b/modules/export_seda/Ajax_generate_message.php @@ -0,0 +1,48 @@ +<?php +/* +* Copyright 2008-2017 Maarch +* +* This file is part of Maarch Framework. +* +* Maarch Framework 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. +* +* Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>. +*/ + + require_once __DIR__ . '/RequestSeda.php'; + require_once __DIR__ . '/class/AbstractMessage.php'; + + $status = 0; + $error = $content = ''; + if (!$_REQUEST['messageTitle']) { + $status = 1; + $error = _MESSAGE_TITLE_EMPTY; + } else { + if ($_REQUEST['reference']) { + if (!file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'. DIRECTORY_SEPARATOR.'message'.DIRECTORY_SEPARATOR. $_REQUEST['reference'] .DIRECTORY_SEPARATOR. $_REQUEST['reference'] . '.xml')) { + $abstractMessage = new AbstractMessage(); + $abstractMessage->addTitleToMessage($_REQUEST['reference'],$_REQUEST['messageTitle']); + $abstractMessage->generatePackage($_REQUEST['reference'],'ArchiveTransfer'); + } + + if ($status != 0) { + $error = $res['error']; + } else { + $content = $res['content']; + } + } else { + $status = 1; + } + } + + echo "{status : " . $status . ", content : '" . addslashes($content) . "', error : '" . addslashes($error) . "'}"; + exit (); \ No newline at end of file diff --git a/modules/export_seda/Ajax_seda_zip.php b/modules/export_seda/Ajax_seda_zip.php old mode 100755 new mode 100644 index 5917dd6cc06e83da36d3674098dda1cda01aaf76..b8141d6820f624a57ebbb0ebbc004f95da80812f --- a/modules/export_seda/Ajax_seda_zip.php +++ b/modules/export_seda/Ajax_seda_zip.php @@ -18,49 +18,78 @@ * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. */ - require_once __DIR__.'/Zip.php'; - require_once __DIR__ . '/RequestSeda.php'; +require_once __DIR__.'/Zip.php'; +require_once __DIR__ . '/RequestSeda.php'; - $status = 0; - $error = $content = ''; - if ($_REQUEST['reference']) { - $extract = new Extract(); - $zipfile = $extract->exportZip($_REQUEST['reference']); - $extract->download($zipfile); - } else { - $status = 1; - } +$status = 0; +$error = $content = ''; +if ($_REQUEST['reference']) { + $extract = new Extract(); + $zipfile = $extract->exportZip($_REQUEST['reference']); + $extract->download($zipfile); +} else { + $status = 1; +} - - echo "{status : " . $status . ", content : '" . addslashes($content) . "', error : '" . addslashes($error) . "'}"; - exit (); +echo "{status : " . $status . ", content : '" . addslashes($content) . "', error : '" . addslashes($error) . "'}"; +exit (); class Extract { - protected $zip; + protected $zip; - public function __construct() - { - $this->zip = new Zip(); - } + public function __construct() + { + $this->zip = new Zip(); + + $getXml = false; + $path = ''; + if (file_exists( + $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' + )) { + $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } else if (file_exists($_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml')) { + $path = $_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda' + . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } - public function exportZip($reference) - { - $messageDirectory = __DIR__.DIRECTORY_SEPARATOR.'message'.DIRECTORY_SEPARATOR.$reference; - $zipfile = __DIR__.DIRECTORY_SEPARATOR.'message'.DIRECTORY_SEPARATOR.$reference. ".zip"; + if ($getXml) { + $this->xml = simplexml_load_file($path); + } + } - if (!is_file($zipfile)) { + public function exportZip($reference) + { + $messageDirectory = (string) $this->xml->CONFIG->directoryMessage . DIRECTORY_SEPARATOR . $reference; + $zipDirectory = (string) $this->xml->CONFIG->directoryMessage . DIRECTORY_SEPARATOR . $reference . ".zip"; + + if (!is_file($zipDirectory)) { if (is_dir($messageDirectory)) { - $this->zip->add($zipfile, $messageDirectory.DIRECTORY_SEPARATOR."*"); + $zip = new ZipArchive(); + $zip->open($zipDirectory, ZipArchive::CREATE); + + $listFiles = scandir($messageDirectory.DIRECTORY_SEPARATOR); + foreach ($listFiles as $filename) { + if ($filename != '.' && $filename != '..') { + $zip->addFile($messageDirectory . DIRECTORY_SEPARATOR . $filename, $filename); + } + + } } } - $zipContents = file_get_contents($zipfile); - - return $zipfile; - } + return $zipDirectory; + } - public function download($full_path) + public function download($full_path) { $file_name = basename($full_path); @@ -73,4 +102,4 @@ class Extract readfile($full_path); } -} \ No newline at end of file +} diff --git a/modules/export_seda/Ajax_transfer_SAE.php b/modules/export_seda/Ajax_transfer_SAE.php old mode 100755 new mode 100644 index cc70916b99baa3e567c5d30a326133e50593e7c0..aad691463724b5a75300f090e3b91b08369da3d2 --- a/modules/export_seda/Ajax_transfer_SAE.php +++ b/modules/export_seda/Ajax_transfer_SAE.php @@ -40,7 +40,30 @@ class TransferToSAE public function __construct() { - $this->xml = simplexml_load_file(__DIR__.DIRECTORY_SEPARATOR. 'xml' . DIRECTORY_SEPARATOR . "config.xml"); + $getXml = false; + $path = ''; + if (file_exists( + $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' + )) + { + $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } else if (file_exists($_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml')) { + $path = $_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda' + . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } + + if ($getXml) { + $this->xml = simplexml_load_file($path); + } + } public function send($reference) @@ -60,9 +83,10 @@ class TransferToSAE $abstractMessage->changeStatus($reference, 'SEND_SEDA'); $acknowledgement = new Acknowledgement(); $resIds = explode(',',$_REQUEST['resIds']); - $acknowledgement->send($dataTransfer['content'], $resIds); + $acknowledgementObject = $acknowledgement->receive($dataTransfer['content'], $resIds); $abstractMessage->changeStatus($reference, 'ACK_SEDA'); - $res['content'] .= $reference; + + $res['content'] .= $acknowledgementObject->MessageIdentifier->value; } return $res; diff --git a/modules/export_seda/Ajax_validation.php b/modules/export_seda/Ajax_validation.php old mode 100755 new mode 100644 index 347e7205292c54254acece0892dfcded6b468d07..f0a6e95822083c60ed7bc207c72e9c453ad38f05 --- a/modules/export_seda/Ajax_validation.php +++ b/modules/export_seda/Ajax_validation.php @@ -24,6 +24,7 @@ $error = $content = $res = ''; if ($_REQUEST['reference']) { $resIds = explode(',',$_REQUEST['reference']); + arsort($resIds); if ($_REQUEST['type'] == 'acknowledgement') { require_once __DIR__.'/CheckAcknowledgement.php'; @@ -31,10 +32,9 @@ if ($_REQUEST['reference']) { foreach ($resIds as $id) { $res = $checkAcknowledgement->checkAttachment($id); - if ($res == false) { + if ($res === false) { $status = 1; $error = $_SESSION['error']; - break; } } $content = $res; @@ -45,10 +45,9 @@ if ($_REQUEST['reference']) { foreach ($resIds as $id) { $res = $checkReply->checkAttachment($id); - if ($res == false) { + if ($res === false) { $status = 1; $error = $_SESSION['error']; - break; } } $content = $res; @@ -59,10 +58,9 @@ if ($_REQUEST['reference']) { foreach ($resIds as $id) { $res = $purge->purge($id); - if ($res == false) { + if ($res === false) { $status = 1; $error = $_SESSION['error']; - break; } } $content = $res; @@ -73,10 +71,9 @@ if ($_REQUEST['reference']) { foreach ($resIds as $id) { $res = $reset->reset($id); - if ($res == false) { + if ($res === false) { $status = 1; $error = $_SESSION['error']; - break; } } $content = $res; diff --git a/modules/export_seda/CheckAcknowledgement.php b/modules/export_seda/CheckAcknowledgement.php old mode 100755 new mode 100644 index 92e39c39e2f666148839d852b64bab38378eab69..bd0f87d6d0f39da14019df99d8f54396f7b6b236 --- a/modules/export_seda/CheckAcknowledgement.php +++ b/modules/export_seda/CheckAcknowledgement.php @@ -11,8 +11,8 @@ class CheckAcknowledgement } public function checkAttachment($resId) { - $letter = $this->db->getLetter($resId); - if ($letter->status != "SEND_SEDA") { + $status = $this->db->getStatusLetter($resId); + if ($status != "SEND_SEDA") { $_SESSION['error'] = _ERROR_STATUS_SEDA . $resId; return false; } @@ -54,4 +54,4 @@ class CheckAcknowledgement return $resId; } -} \ No newline at end of file +} diff --git a/modules/export_seda/CheckReply.php b/modules/export_seda/CheckReply.php old mode 100755 new mode 100644 index 08ad02acd717e38f847aa89e0e3474e760c6b3ac..785a3385c844ffa43ab6c82f8480500c0ded3126 --- a/modules/export_seda/CheckReply.php +++ b/modules/export_seda/CheckReply.php @@ -2,19 +2,44 @@ require_once __DIR__ . '/RequestSeda.php'; require_once __DIR__ . '/class/AbstractMessage.php'; +require_once __DIR__ . '/class/ArchiveTransferReply.php'; Class CheckReply { protected $token; protected $SAE; protected $db; + protected $xml; public function __construct() { - $xml = simplexml_load_file(__DIR__.DIRECTORY_SEPARATOR. 'xml' . DIRECTORY_SEPARATOR . "config.xml"); - $this->token = (string) $xml->CONFIG->token; + $getXml = false; + $path = ''; + if (file_exists( + $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' + )) + { + $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } else if (file_exists($_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml')) { + $path = $_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda' + . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } + + if ($getXml) { + $this->xml = simplexml_load_file($path); + } + + $this->token = (string) $this->xml->CONFIG->token; $tokenEncode = urlencode($this->token); $this->token = "LAABS-AUTH=". $tokenEncode; - $this->urlService = (string) $xml->CONFIG->urlSAEService . "/medona/ArchiveTransfer/history"; + $this->urlService = (string) $this->xml->CONFIG->urlSAEService . "/medona/message/reference"; $this->db = new RequestSeda(); } @@ -38,25 +63,19 @@ Class CheckReply { } foreach ($unitIdentifiers as $key => $value) { - $messageReplyIdentifier = $key. '_Reply'; - $messageReply = $this->getReply($messageReplyIdentifier); + $messages = $this->getReply($key); - if (empty($messageReply)) { + if (!isset($messages->replyMessage)) { continue; } //créer message reply & sauvegarder xml - $data = json_decode($messageReply[0]->data); - $this->db->insertMessage($data, "ArchiveTransferReply"); - $abstractMessage->saveXml($data,"ArchiveTransferReply", ".txt"); - - //créer attachment - //changer status courrier - $resIds = explode(',',$value); - foreach ($resIds as $resId) { - $abstractMessage->addAttachment($messageReplyIdentifier,$resId,$messageReplyIdentifier.".txt","txt","Réponse de transfert",2); - $this->db->updateStatusLetterbox($resId,"REPLY_SEDA"); - } + $resIds = explode(',', $value); + $data = json_decode($messages->replyMessage->data); + + $archiveTransferReply = new ArchiveTransferReply(); + $archiveTransferReply->receive($data, $resIds); + $abstractMessage->changeStatus($key, 'REPLY_SEDA'); } return true; @@ -107,14 +126,43 @@ Class CheckReply { 'content-type:application/json' ]; + $refEncode = str_replace('.', '%2E', urlencode($reference)); + $url = $this->urlService .'?reference=' . $refEncode; + try { $curl = curl_init(); - - curl_setopt($curl, CURLOPT_URL, $this->urlService . "?reference=". $reference); + curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($curl, CURLOPT_COOKIE, $this->token); + if (empty($this->xml->CONFIG->certificateSSL)) { + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + } else { + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); + + $certificateSSL = $this->xml->CONFIG->certificateSSL; + if (is_file($certificateSSL)) { + $ext = ['.crt','.pem']; + + $filenameExt = strrchr($certificateSSL, '.'); + if (in_array($filenameExt, $ext)) { + curl_setopt($curl, CURLOPT_CAINFO, $certificateSSL); + } else { + $res['status'] = 1; + $res['content'] = _ERROR_EXTENSION_CERTIFICATE; + return $res; + } + } elseif (is_dir($certificateSSL)) { + curl_setopt($curl, CURLOPT_CAPATH, $certificateSSL); + } else { + $res['status'] = 1; + $res['content'] = _ERROR_UNKNOW_CERTIFICATE; + return $res; + } + } + $data = json_decode(curl_exec($curl)); curl_close($curl); @@ -124,4 +172,4 @@ Class CheckReply { var_dump($e); } } -} \ No newline at end of file +} diff --git a/modules/export_seda/Controllers/AdapterEmail.php b/modules/export_seda/Controllers/AdapterEmail.php new file mode 100644 index 0000000000000000000000000000000000000000..37c13136a9cb4048098e5c08b4706fd032d895cc --- /dev/null +++ b/modules/export_seda/Controllers/AdapterEmail.php @@ -0,0 +1,49 @@ +<?php + +require_once __DIR__. DIRECTORY_SEPARATOR. '..' . DIRECTORY_SEPARATOR. 'RequestSeda.php'; +require_once __DIR__. DIRECTORY_SEPARATOR. '..' . DIRECTORY_SEPARATOR. '..'. DIRECTORY_SEPARATOR. 'sendmail'. DIRECTORY_SEPARATOR. 'Models'. DIRECTORY_SEPARATOR. 'MailModel.php'; + +class AdapterEmail{ + + private $db; + public function __construct() + { + $this->db = new RequestSeda(); + $this->xml = simplexml_load_file(__DIR__. DIRECTORY_SEPARATOR. '..' .DIRECTORY_SEPARATOR. 'xml' . DIRECTORY_SEPARATOR . "config.xml"); + } + + public function send($messageObject, $messageId) + { + $res['status'] = 0; + $res['content'] = ''; + + $gec = strtolower($this->xml->M2M->gec); + + if ($gec == 'maarch_courrier') { + $sendmail = new stdClass(); + $sendmail->coll_id = 'letterbox_coll'; + $sendmail->res_id = $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->Content->OriginatingSystemId; + $sendmail->user_id = $messageObject->TransferringAgency->OrganizationDescriptiveMetadata->UserIdentifier; + $sendmail->to_list = $messageObject->ArchivalAgency->OrganizationDescriptiveMetadata->Communication[0]->value; + $sendmail->cc_list = ''; + $sendmail->cci_list = ''; + $sendmail->email_object = $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->Content->Title[0]; + $sendmail->email_body = $messageObject->Comment[0]->value; + $sendmail->is_res_master_attached = 'N'; + $sendmail->email_status = 'W'; + $sendmail->sender_email = $messageObject->TransferringAgency->OrganizationDescriptiveMetadata->Contact[0]->Communication[1]->value; + + $sendmail->message_exchange_id = $messageId; + + $date = new DateTime; + $sendmail->creation_date = $date->format(DateTime::ATOM); + + $mailModel = new MailModel(); + $mailModel->createMail($sendmail); + + $this->db->updateStatusMessage($messageObject->MessageIdentifier->value,'I'); + } + + return $res; + } +} \ No newline at end of file diff --git a/modules/export_seda/Controllers/AdapterWS.php b/modules/export_seda/Controllers/AdapterWS.php new file mode 100644 index 0000000000000000000000000000000000000000..37c5686cd5684526997b4e17c8ecf318c069357c --- /dev/null +++ b/modules/export_seda/Controllers/AdapterWS.php @@ -0,0 +1,27 @@ +<?php + +require_once __DIR__. DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Transfer.php'; +require_once __DIR__. DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'RequestSeda.php'; + +class AdapterWS{ + + private $db; + public function __construct() + { + $this->db = new RequestSeda(); + } + + public function send($messageObject, $messageId, $type) + { + $transfer = new Transfer(); + + $res = $transfer->transfer('maarchcourrier', $messageId, $type); + + if ($res['status'] == 1) { + $this->db->updateStatusMessage($messageObject->MessageIdentifier->value, 'E'); + return $res; + } + + $this->db->updateStatusMessage($messageObject->MessageIdentifier->value, 'S'); + } +} \ No newline at end of file diff --git a/modules/export_seda/Controllers/ReceiveMessage.php b/modules/export_seda/Controllers/ReceiveMessage.php new file mode 100644 index 0000000000000000000000000000000000000000..ccd539701cd3c0c467c970d6addf51300f217f4b --- /dev/null +++ b/modules/export_seda/Controllers/ReceiveMessage.php @@ -0,0 +1,396 @@ +<?php + +/** + * Copyright Maarch since 2008 under licence GPLv3. + * See LICENCE.txt file at the root folder for more details. + * This file is part of Maarch software. + * + */ + +/** + * @brief Receive Message + * @author dev@maarch.org + * @ingroup export_seda + */ + +require_once __DIR__ . DIRECTORY_SEPARATOR .'../RequestSeda.php'; +require_once __DIR__. DIRECTORY_SEPARATOR .'../Zip.php'; + +class ReceiveMessage +{ + + private $db; + + public function __construct() + { + $this->db = new RequestSeda(); + } + + /** + * @param $messageObject + * @return bool|mixed + */ + public function receive($tmpPath, $tmpName, $type) + { + $res['status'] = 0; + $res['content'] = ''; + + + $zipPathParts = pathinfo($tmpPath. DIRECTORY_SEPARATOR. $tmpName); + $messageDirectory = $tmpPath . $zipPathParts['filename']; + + $zip = new ZipArchive(); + $zip->open($tmpPath. DIRECTORY_SEPARATOR. $tmpName); + $zip->extractTo($messageDirectory); + + $messageFileName = ''; + + foreach (glob($messageDirectory. DIRECTORY_SEPARATOR. '*.xml') as $filename) { + $pathParts = pathinfo($filename); + if (strpos($pathParts['filename'], 'ArchiveTransfer') === false) { + break; + } else { + $messageFileName = $filename; + } + } + + if (!$messageFileName) { + $res['status'] = 1; + $res['content'] = _ERROR_MESSAGE_NOT_PRESENT; + + return $res; + } + + libxml_use_internal_errors(true); + + $xml = new DOMDocument(); + $xml->load($messageFileName); + + // FORMAT MESSAGE XML + /*$xsd = __DIR__ . DIRECTORY_SEPARATOR. '..' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'xsd' . DIRECTORY_SEPARATOR . 'seda-2.0-main.xsd'; + if (!$xml->schemaValidate($xsd)){ + $res['status'] = 1; + $res['content'] = _ERROR_MESSAGE_STRUCTURE_WRONG; + + $this->libxmlDisplayErrors(); + + return $res; + }*/ + + // TEST ATTACHMENT + $listFiles = scandir($messageDirectory); + $dataObject = simplexml_load_file($messageFileName); + if ($dataObject->DataObjectPackage) { + foreach ($dataObject->DataObjectPackage->BinaryDataObject as $binaryDataObject) { + $filename = ''; + // ATTACHMENT FILENAME + $filename = $binaryDataObject->Attachment->attributes(); + if (!array_search($filename, $listFiles)) { + $res['status'] = 1; + $res['content'] = _ERROR_ATTACHMENT_FILE_MISSING . ' : ' . $filename; + + return $res; + } + + // ATTACHMENT BASE 64 + $data = file_get_contents($messageDirectory . DIRECTORY_SEPARATOR . $filename); + $dataBase64 = base64_encode($data); + + if ($dataBase64 != $binaryDataObject->Attachment) { + $res['status'] = 1; + $res['content'] = _ERROR_ATTACHMENT_WRONG_BASE64 . ' : ' . $filename; + + return $res; + } + } + } + + // ARCHIVER AGENCY CONTACT + if ($dataObject->ArchivalAgency) { + if (!$this->db->getEntitiesByBusinessId($dataObject->ArchivalAgency->Identifier)) { + $res['status'] = 1; + $res['content'] = _ERROR_CONTACT_UNKNOW . ' : ' . $dataObject->ArchivalAgency->Identifier; + + return $res; + } + } + + $res['content'] = json_encode($this->getMessageObject($dataObject, $type)); + + return $res; + } + + + private function getMessageObject($dataObject, $type) + { + $messageObject = new stdClass(); + + $listComment= array(); + $messageObject->Comment = new stdClass(); + foreach ($dataObject->Comment as $comment) { + $tmpComment = new stdClass(); + $tmpComment->value = (string) $comment; + + $listComment[] = $tmpComment; + } + $messageObject->Comment = $listComment; + + $messageObject->MessageIdentifier = new stdClass(); + $messageObject->MessageIdentifier->value = (string) $dataObject->MessageIdentifier; + + if ($dataObject->MessageReceivedIdentifier) { + $messageObject->MessageReceivedIdentifier = new stdClass(); + $messageObject->MessageReceivedIdentifier->value = (string) $dataObject->MessageReceivedIdentifier; + } + + if ($dataObject->MessageRequestIdentifier) { + $messageObject->MessageRequestIdentifier = new stdClass(); + $messageObject->MessageRequestIdentifier->value = (string) $dataObject->MessageRequestIdentifier; + } + + $messageObject->Date = (string) $dataObject->Date; + + if ($dataObject->DataObjectPackage) { + $messageObject->DataObjectPackage = $this->getDataObjectPackage($dataObject->DataObjectPackage); + } + + if ($dataObject->ArchivalAgency) { + $messageObject->ArchivalAgency = $this->getOrganization($dataObject->ArchivalAgency); + } + + if ($dataObject->OriginatingAgency) { + $messageObject->OriginatingAgency = $this->getOrganization($dataObject->OriginatingAgency); + } + + if ($dataObject->TransferringAgency) { + $messageObject->TransferringAgency = $this->getOrganization($dataObject->TransferringAgency); + } + + if ($dataObject->Sender) { + $messageObject->Sender = $this->getOrganization($dataObject->Sender); + } + + if ($dataObject->Receiver) { + $messageObject->Receiver = $this->getOrganization($dataObject->Receiver); + } + + if ($dataObject->UnitIdentifier) { + $messageObject->UnitIdentifier = new stdClass(); + $messageObject->UnitIdentifier->value = (string) $dataObject->UnitIdentifier; + } + + if ($type) { + $messageObject->type = $type; + } + + return $messageObject; + } + + private function getDataObjectPackage($dataObject) + { + $dataObjectPackage = new stdClass(); + $dataObjectPackage->BinaryDataObject = new stdClass(); + $dataObjectPackage->BinaryDataObject = $this->getBinaryDataObject($dataObject->BinaryDataObject); + + $dataObjectPackage->DescriptiveMetadata = new stdClass(); + $dataObjectPackage->DescriptiveMetadata->ArchiveUnit = new stdClass(); + $dataObjectPackage->DescriptiveMetadata->ArchiveUnit = $this->getArchiveUnit($dataObject->DescriptiveMetadata->ArchiveUnit); + + return $dataObjectPackage; + } + + private function getBinaryDataObject($dataObject) + { + $listBinaryDataObject = array(); + $i = 0; + foreach ($dataObject as $BinaryDataObject) { + $tmpBinaryDataObject = new stdClass(); + $tmpBinaryDataObject->id = (string) $BinaryDataObject->attributes(); + + $tmpBinaryDataObject->MessageDigest = new stdClass(); + $tmpBinaryDataObject->MessageDigest->value = (string) $BinaryDataObject->MessageDigest; + $tmpBinaryDataObject->MessageDigest->algorithm = (string) $BinaryDataObject->MessageDigest->attributes(); + + $tmpBinaryDataObject->Size = (string) $BinaryDataObject->Size; + + $tmpBinaryDataObject->Attachment = new stdClass(); + $tmpBinaryDataObject->Attachment->value = (string) $BinaryDataObject->Attachment; + foreach ($BinaryDataObject->Attachment->attributes() as $key => $value) { + if ($key == 'filename') { + $tmpBinaryDataObject->Attachment->filename = (string) $value; + } elseif ($key == 'uri') { + $tmpBinaryDataObject->Attachment->uri = (string) $value; + } + } + + $tmpBinaryDataObject->FormatIdentification = new stdClass(); + $tmpBinaryDataObject->FormatIdentification->MimeType = (string) $BinaryDataObject->FormatIdentification->MimeType; + + $listBinaryDataObject[] = $tmpBinaryDataObject; + } + + return $listBinaryDataObject; + } + + private function getArchiveUnit($dataObject) + { + $listArchiveUnit = array(); + foreach ($dataObject as $ArchiveUnit) { + $tmpArchiveUnit = new stdClass(); + $tmpArchiveUnit->id = (string) $ArchiveUnit->attributes(); + $tmpArchiveUnit->Content = new stdClass(); + $tmpArchiveUnit->Content->DescriptionLevel = (string) $ArchiveUnit->Content->DescriptionLevel; + + $tmpArchiveUnit->Content->Title = array(); + foreach ($ArchiveUnit->Content->Title as $title) { + $tmpArchiveUnit->Content->Title[] = (string) $title; + } + + $tmpArchiveUnit->Content->OriginatingSystemId = (string) $ArchiveUnit->Content->OriginatingSystemId; + $tmpArchiveUnit->Content->OriginatingAgencyArchiveUnitIdentifier = (string) $ArchiveUnit->Content->OriginatingAgencyArchiveUnitIdentifier; + $tmpArchiveUnit->Content->DocumentType = (string) $ArchiveUnit->Content->DocumentType; + $tmpArchiveUnit->Content->Status = (string) $ArchiveUnit->Content->Status; + $tmpArchiveUnit->Content->CreatedDate = (string) $ArchiveUnit->Content->CreatedDate; + + if ($ArchiveUnit->Content->Writer) { + $tmpArchiveUnit->Content->Writer = array(); + foreach ($ArchiveUnit->Content->Writer as $Writer) { + $tmpWriter = new stdClass(); + $tmpWriter->FirstName = (string)$Writer->FirstName; + $tmpWriter->BirthName = (string)$Writer->BirthName; + + $tmpArchiveUnit->Content->Writer = $tmpWriter; + } + } + + if ($ArchiveUnit->DataObjectReference) { + $tmpArchiveUnit->DataObjectReference = array(); + foreach ($ArchiveUnit->DataObjectReference as $DataObjectReference) { + $tmpDataObjectReference = new stdClass(); + $tmpDataObjectReference->DataObjectReferenceId = (string) $DataObjectReference->DataObjectReferenceId; + + $tmpArchiveUnit->DataObjectReference[] = $tmpDataObjectReference; + } + } + + if ($ArchiveUnit->ArchiveUnit) { + $tmpArchiveUnit->ArchiveUnit = $this->getArchiveUnit($ArchiveUnit->ArchiveUnit); + } + + $listArchiveUnit[] = $tmpArchiveUnit; + } + return $listArchiveUnit; + } + + private function getOrganization($dataObject) + { + $organization= new stdClass(); + + $organization->Identifier = new stdClass(); + $organization->Identifier->value = (string) $dataObject->Identifier; + + $organization->OrganizationDescriptiveMetadata = new stdClass(); + + if ($dataObject->OrganizationDescriptiveMetadata->LegalClassification) { + $organization->OrganizationDescriptiveMetadata->LegalClassification = (string) $dataObject->OrganizationDescriptiveMetadata->LegalClassification; + } + + if ($dataObject->OrganizationDescriptiveMetadata->Name) { + $organization->OrganizationDescriptiveMetadata->Name = (string) $dataObject->OrganizationDescriptiveMetadata->Name; + } + + if ($dataObject->OrganizationDescriptiveMetadata->Communication) { + $organization->OrganizationDescriptiveMetadata->Communication = $this->getCommunication($dataObject->OrganizationDescriptiveMetadata->Communication); + } + + if ($dataObject->OrganizationDescriptiveMetadata->Contact) { + $organization->OrganizationDescriptiveMetadata->Contact = $this->getContact($dataObject->OrganizationDescriptiveMetadata->Contact); + } + + return $organization; + } + + private function getCommunication($dataObject) + { + $listCommunication = array(); + foreach ($dataObject as $Communication) { + $tmpCommunication = new stdClass(); + $tmpCommunication->Channel = (string) $Communication->Channel; + $tmpCommunication->value = (string) $Communication->CompleteNumber; + + $listCommunication[] = $tmpCommunication; + } + + return $listCommunication; + } + + private function getAddress($dataObject) + { + $listAddress = array(); + foreach ($dataObject as $Address) { + $tmpAddress = new stdClass(); + $tmpAddress->CityName = (string) $Address->CityName; + $tmpAddress->Country = (string) $Address->Country; + $tmpAddress->Postcode = (string) $Address->Postcode; + $tmpAddress->PostOfficeBox = (string) $Address->PostOfficeBox; + $tmpAddress->StreetName = (string) $Address->StreetName; + + $listAddress[] = $tmpAddress; + } + + return $listAddress; + } + + private function getContact($dataObject) + { + $listContact = array(); + foreach ($dataObject as $Contact) { + $tmpContact = new stdClass(); + $tmpContact->DepartmentName = (string) $Contact->DepartmentName; + $tmpContact->PersonName = (string) $Contact->PersonName; + + if ($Contact->Communication) { + $tmpContact->Communication = $this->getCommunication($Contact->Communication); + } + + if ($Contact->Address) { + $tmpContact->Address = $this->getAddress($Contact->Address); + } + $listContact[] = $tmpContact; + } + + return $listContact; + } + + private function libxmlDisplayError($error) + { + $return = "<br/>\n"; + switch ($error->level) { + case LIBXML_ERR_WARNING: + $return .= "<b>Warning $error->code</b>: "; + break; + case LIBXML_ERR_ERROR: + $return .= "<b>Error $error->code</b>: "; + break; + case LIBXML_ERR_FATAL: + $return .= "<b>Fatal Error $error->code</b>: "; + break; + } + $return .= trim($error->message); + if ($error->file) { + $return .= " in <b>$error->file</b>"; + } + $return .= " on line <b>$error->line</b>\n"; + + return $return; + } + + private function libxmlDisplayErrors() + { + $errors = libxml_get_errors(); + foreach ($errors as $error) { + //var_dump($this->libxmlDisplayError($error)); + } + libxmlDisplayErrors(); + } +} \ No newline at end of file diff --git a/modules/export_seda/Controllers/SendMessage.php b/modules/export_seda/Controllers/SendMessage.php new file mode 100644 index 0000000000000000000000000000000000000000..704809aa42a3a5026fc6d72c86e2bc3746f973a4 --- /dev/null +++ b/modules/export_seda/Controllers/SendMessage.php @@ -0,0 +1,89 @@ +<?php + +/** + * Copyright Maarch since 2008 under licence GPLv3. + * See LICENCE.txt file at the root folder for more details. + * This file is part of Maarch software. + * + */ + +/** + * @brief Send Message + * @author dev@maarch.org + * @ingroup export_seda + */ + +require_once __DIR__ . DIRECTORY_SEPARATOR .'../RequestSeda.php'; +require_once __DIR__ . DIRECTORY_SEPARATOR .'../DOMTemplateProcessor.php'; +require_once __DIR__. DIRECTORY_SEPARATOR .'../Zip.php'; +require_once __DIR__. DIRECTORY_SEPARATOR . '/AdapterWS.php'; +require_once __DIR__. DIRECTORY_SEPARATOR . '/AdapterEmail.php'; + +class SendMessage { + + private $db; + + public function __construct() + { + $this->db = new RequestSeda(); + } + + public function send($messageObject, $messageId, $type) + { + $channel = $messageObject->ArchivalAgency->OrganizationDescriptiveMetadata->Communication[0]->Channel; + + $adapter = ''; + if ($channel == 'url') { + $adapter = new AdapterWS(); + } elseif ($channel == 'email') { + $adapter = new AdapterEmail(); + } else { + return false; + } + $res = $adapter->send($messageObject, $messageId, $type); + + return $res; + } + + public function generateMessageFile($messageObject, $type, $tmpPath) + { + $DOMTemplate = new DOMDocument(); + $DOMTemplate->load(__DIR__ .DIRECTORY_SEPARATOR. '..'. DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.$type.'.xml'); + $DOMTemplateProcessor = new DOMTemplateProcessor($DOMTemplate); + $DOMTemplateProcessor->setSource($type, $messageObject); + $DOMTemplateProcessor->merge(); + $DOMTemplateProcessor->removeEmptyNodes(); + + file_put_contents($tmpPath . $messageObject->MessageIdentifier->value . ".xml", $DOMTemplate->saveXML()); + + if ($messageObject->DataObjectPackage) { + foreach ($messageObject->DataObjectPackage->BinaryDataObject as $binaryDataObject) { + $base64_decoded = base64_decode($binaryDataObject->Attachment->value); + $file = fopen($tmpPath . $binaryDataObject->Attachment->filename, 'w'); + fwrite($file, $base64_decoded); + fclose($file); + } + } + $filename = $this->generateZip($messageObject, $tmpPath); + + return $filename; + } + + private function generateZip($messageObject,$tmpPath) + { + $zip = new ZipArchive(); + $filename = $tmpPath.$messageObject->MessageIdentifier->value. ".zip"; + + $zip->open($filename, ZipArchive::CREATE); + + $zip->addFile($tmpPath . $messageObject->MessageIdentifier->value . ".xml", $messageObject->MessageIdentifier->value . ".xml"); + + if ($messageObject->DataObjectPackage) { + foreach ($messageObject->DataObjectPackage->BinaryDataObject as $binaryDataObject) { + $zip->addFile($tmpPath . $binaryDataObject->Attachment->filename, $binaryDataObject->Attachment->filename); + } + } + + return $filename; + } +} \ No newline at end of file diff --git a/modules/export_seda/DOMTemplateProcessor.php b/modules/export_seda/DOMTemplateProcessor.php old mode 100755 new mode 100644 index ecc69be511e3d86ccee4abae9078b4532822b36b..7283ae50eba192b07dfa0607cda0838f19cdfd35 --- a/modules/export_seda/DOMTemplateProcessor.php +++ b/modules/export_seda/DOMTemplateProcessor.php @@ -17,9 +17,10 @@ * You should have received a copy of the GNU Lesser General Public License * along with dependency xml. If not, see <http://www.gnu.org/licenses/>. */ + /** * Process DOM XML Template documents - * + * * @author Cyril Vazquez <cyril.vazquez@maarch.org> */ class DOMTemplateProcessor @@ -69,9 +70,6 @@ class DOMTemplateProcessor { parent::__construct($document); - - $this->xinclude(); - $this->xinclude(); $this->xinclude(); $this->xinclude(); $this->xinclude(); @@ -91,12 +89,12 @@ class DOMTemplateProcessor * Process xinclude processing instructions * @param DOMNode $node The context node. If omitted the method processes the entire document tree. */ - protected function xinclude($node=null) + protected function xinclude($node = null) { if ($pis = $this->query("descendant-or-self::processing-instruction('xinclude')", $node)) { foreach ($pis as $pi) { $includeFragment = $this->document->createDocumentFragment(); - $source = file_get_contents(__DIR__.trim($pi->data)); + $source = file_get_contents(__DIR__ . trim($pi->data)); if (!$source) { throw new \Exception("Error including Xml fragment: fragment '$pi->data' could not be parsed"); } @@ -110,7 +108,7 @@ class DOMTemplateProcessor /** * Bind a variable - * @param string $name The name of the variable + * @param string $name The name of the variable * @param string &$variable The reference of the value */ public function bindVariable($name, &$variable) @@ -120,7 +118,7 @@ class DOMTemplateProcessor /** * Set a source for merge - * @param string $name The name of the data source + * @param string $name The name of the data source * @param string $value The value */ public function setSource($name, $value) @@ -141,7 +139,7 @@ class DOMTemplateProcessor switch($node->nodeType) { case \XML_ELEMENT_NODE: $childNodeList = $node->childNodes; - for ($i=0, $l=$childNodeList->length; $i<$l; $i++) { + for ($i=$childNodeList->length-1; $i>=0; $i--) { $this->removeEmptyNodes($childNodeList->item($i)); } @@ -158,7 +156,7 @@ class DOMTemplateProcessor break; case \XML_TEXT_NODE: - if (ctype_space($node->nodeValue) && $node->previousSibling && $node->previousSibling->nodeType == \XML_TEXT_NODE) { + if (ctype_space($node->nodeValue)) { //&& $node->previousSibling && $node->previousSibling->nodeType == \XML_TEXT_NODE) { $node->nodeValue = trim($node->nodeValue); } break; @@ -170,11 +168,11 @@ class DOMTemplateProcessor ------------------------------------------------------------------------- */ /** * Merges the processing instructions on the given node and its chil nodes. - * - * @param string $node The context node. If omitted the entire document will be processed. + * + * @param string $node The context node. If omitted the entire document will be processed. * @param string $source The data source. If omitted, all merge instruction path must be existing sources */ - public function merge($node=null, $source=null) + public function merge($node = null, $source = null) { // Avoid garbage nodes merge if (!isset($this->mergedNodes)) { @@ -184,7 +182,7 @@ class DOMTemplateProcessor if (!isset($this->mergedForms)) { $this->mergedForms = new \SplObjectStorage(); } - + if ($node && $this->mergedNodes->contains($node)) { return; } @@ -227,7 +225,7 @@ class DOMTemplateProcessor } } - protected function mergePi($pi, $instr, $source=null) + protected function mergePi($pi, $instr, $source = null) { // Get value by reference $value = &$this->getData($instr, $source); @@ -235,7 +233,7 @@ class DOMTemplateProcessor // Use value with selected target if (isset($instr->params['var'])) { $this->addVar($instr->params['var'], $value); - + $pi->parentNode->removeChild($pi); return false; @@ -247,7 +245,7 @@ class DOMTemplateProcessor //if (isset($instr->params['source'])) // var_dump($instr->params['source']); - switch(true) { + switch (true) { // If value is scalar, merge text before Pi case $type == 'string': case $type == 'integer': @@ -283,7 +281,7 @@ class DOMTemplateProcessor // If value is an object but no form : merge string version if possible case method_exists($value, '__toString'): - return $this->mergeText($pi, $instr, (string) $value); + return $this->mergeText($pi, $instr, (string)$value); } } @@ -317,17 +315,17 @@ class DOMTemplateProcessor } } - protected function mergeTextNodes($node=null, $source=null) + protected function mergeTextNodes($node = null, $source = null) { $textNodes = $this->query("descendant-or-self::text()[contains(., '[?merge')] | descendant-or-self::*/@*[contains(., '[?merge')]", $node); - for ($i=0, $l=$textNodes->length; $i<$l; $i++) { + for ($i = 0, $l = $textNodes->length; $i < $l; $i++) { $textNode = $textNodes->item($i); $this->mergeTextNode($textNode, $source); } } - protected function mergeTextNode($textNode, $source=null) + protected function mergeTextNode($textNode, $source = null) { //$nodeXml = $this->saveXml($textNode); $nodeValue = $textNode->nodeValue; @@ -345,7 +343,7 @@ class DOMTemplateProcessor foreach ($instructions as $pi => $instr) { $value = $this->getData($instr, $source); if (is_scalar($value) || is_null($value) || (is_object($value) && method_exists($value, '__toString'))) { - $mergedValue = str_replace($pi, (string) $value, $textNode->nodeValue); + $mergedValue = str_replace($pi, (string)$value, $textNode->nodeValue); $mergedValue = htmlentities($mergedValue); $textNode->nodeValue = str_replace($pi, $value, $mergedValue); } @@ -360,31 +358,31 @@ class DOMTemplateProcessor protected function mergeText($pi, $instr, $value) { $params = $instr->params; - switch(true) { - case isset($params['attr']): - if (!$targetNode = $this->query("following-sibling::*", $pi)->item(0)) { - return true; - } - $targetNode->setAttribute($params['attr'], $value); - break; - - case isset($params['render']): - if (!$params['render']) { - $fragment = $value; - } else { - $fragment = $params['render']; - } - if (!isset($this->fragments[$fragment])) { - return true; - } - $targetNode = $this->fragments[$fragment]->cloneNode(true); - $this->merge($targetNode); - $pi->parentNode->insertBefore($targetNode, $pi); - break; - - default: - $targetNode = $this->document->createTextNode($value); - $pi->parentNode->insertBefore($targetNode, $pi); + switch (true) { + case isset($params['attr']): + if (!$targetNode = $this->query("following-sibling::*", $pi)->item(0)) { + return true; + } + $targetNode->setAttribute($params['attr'], $value); + break; + + case isset($params['render']): + if (!$params['render']) { + $fragment = $value; + } else { + $fragment = $params['render']; + } + if (!isset($this->fragments[$fragment])) { + return true; + } + $targetNode = $this->fragments[$fragment]->cloneNode(true); + $this->merge($targetNode); + $pi->parentNode->insertBefore($targetNode, $pi); + break; + + default: + $targetNode = $this->document->createTextNode($value); + $pi->parentNode->insertBefore($targetNode, $pi); } return true; @@ -396,7 +394,7 @@ class DOMTemplateProcessor if (isset($params['include'])) { $filename = $params['include']; - $source = file_get_contents(__DIR__."/".$filename); + $source = file_get_contents(__DIR__ . "/" . $filename); $targetNode = $this->document->createDocumentFragment(); $targetNode->appendXML($source); @@ -407,9 +405,9 @@ class DOMTemplateProcessor reset($array); if ($count = count($array)) { - $i=0; - while ($i<$count) { - //do { + $i = 0; + while ($i < $count) { + //do { $itemNode = $targetNode->cloneNode(true); $itemData = current($array); if (isset($params['source'])) { @@ -421,9 +419,9 @@ class DOMTemplateProcessor @next($array); $i++; - /*} while ( - @next($array) !== false - );*/ + /*} while ( + @next($array) !== false + );*/ } } // Remove targetNode (row template) @@ -453,7 +451,7 @@ class DOMTemplateProcessor return true; } - protected function mergeObjectProperties($targetNode, $object, $params, $oname=false) + protected function mergeObjectProperties($targetNode, $object, $params, $oname = false) { foreach ($object as $pname => $pvalue) { if ($oname) { @@ -474,12 +472,12 @@ class DOMTemplateProcessor protected function mergeObjectProperty($targetNode, $value, $params, $name) { $elements = $this->query("descendant-or-self::*[@name='$name']", $targetNode); - for ($i=0, $l=$elements->length; $i<$l; $i++) { + for ($i = 0, $l = $elements->length; $i < $l; $i++) { $element = $elements->item($i); switch (strtolower($element->nodeName)) { // Form Input case 'input': - switch($element->getAttribute('type')) { + switch ($element->getAttribute('type')) { case 'checkbox': if (is_bool($value)) { if ($value) { @@ -494,7 +492,7 @@ class DOMTemplateProcessor $element->removeAttribute('checked'); } } - + break; case 'radio': @@ -513,7 +511,7 @@ class DOMTemplateProcessor // Select case 'select': $value = $this->quote($value); - if ($option = $this->query(".//option[@value=".$value."]", $element)->item(0)) { + if ($option = $this->query(".//option[@value=" . $value . "]", $element)->item(0)) { $option->setAttribute('selected', 'true'); if ($optGroup = $this->query("parent::optgroup", $option)->item(0)) { $optGroup->removeAttribute('disabled'); @@ -532,13 +530,13 @@ class DOMTemplateProcessor /** * Merge a boolean * @param DOMNode $pi - * @param string $instr + * @param string $instr * @param boolean $bool - * + * * @return bool */ protected function mergeBool($pi, $instr, $bool) - { + { $params = $instr->params; if (isset($params['include'])) { $res = $params['include']; @@ -574,9 +572,9 @@ class DOMTemplateProcessor /** * Merge a node * @param DOMNode $pi - * @param string $instr + * @param string $instr * @param DOMNode $DOMNode - * + * * @return bool */ public function mergeNode($pi, $instr, $DOMNode) @@ -589,7 +587,7 @@ class DOMTemplateProcessor /* ------------------------------------------------------------------------ Data sources management ------------------------------------------------------------------------ */ - protected function &getData($instr, $source=null) + protected function &getData($instr, $source = null) { //var_dump("getData"); //var_dump($instr); @@ -601,7 +599,7 @@ class DOMTemplateProcessor // First step defines source $type = $steps[0][0]; - switch($type) { + switch ($type) { case 'arg': $value = &$source; break; @@ -630,7 +628,7 @@ class DOMTemplateProcessor break; } - for ($i=1, $l=count($steps); $i<$l; $i++) { + for ($i = 1, $l = count($steps); $i < $l; $i++) { $value = &$this->stepData($steps[$i], $value); } @@ -643,29 +641,29 @@ class DOMTemplateProcessor //var_dump($step); //var_dump("from " . gettype($source)); $value = null; - switch($step[0]) { - case 'func': - $value = &$this->stepFunc($step[1], $step[2], $source); - break; - - case 'offset': - $key = &$this->getParamValue($step[1], $source); - if (is_array($source) && isset($source[$key])) { - $value = &$source[$key]; - } - break; + switch ($step[0]) { + case 'func': + $value = &$this->stepFunc($step[1], $step[2], $source); + break; - case 'prop': - if (isset($source->{$step[1]})) { - $value = &$source->{$step[1]}; - } - break; + case 'offset': + $key = &$this->getParamValue($step[1], $source); + if (is_array($source) && isset($source[$key])) { + $value = &$source[$key]; + } + break; + + case 'prop': + if (isset($source->{$step[1]})) { + $value = &$source->{$step[1]}; + } + break; } - + return $value; } - protected function &stepFunc($name, $params=array(), $source=null) + protected function &stepFunc($name, $params = array(), $source = null) { $value = null; foreach ($params as $i => $param) { @@ -678,7 +676,7 @@ class DOMTemplateProcessor return $value; } //var_dump($params); - switch($name) { + switch ($name) { // Callback functions case 'func': $func = $params[0]; @@ -716,7 +714,7 @@ class DOMTemplateProcessor break; case 'pos': $pos = null; - foreach ((array) $source as $key => $value) { + foreach ((array)$source as $key => $value) { $pos++; if ($key == @key($source)) { break; @@ -727,7 +725,7 @@ class DOMTemplateProcessor } break; case 'islast': - $value = ((@key($source)+1) == @count($source)); + $value = ((@key($source) + 1) == @count($source)); break; case 'slice': $value = @array_slice($source, $params[0], $params[1]); @@ -796,7 +794,7 @@ class DOMTemplateProcessor $value = @strval($source); break; case 'bool': - $value = @(bool) $source; + $value = @(bool)$source; break; case 'array': if (!is_array($source)) { @@ -857,7 +855,7 @@ class DOMTemplateProcessor $value = (strrpos($source, $params[0]) === (strlen($source) - strlen($params[0]) + 1)); break; case 'bit': - $value = ($source & (int) $params[0]) > 0; + $value = ($source & (int)$params[0]) > 0; break; case 'then': @@ -882,7 +880,7 @@ class DOMTemplateProcessor $value = @sprintf($params[0], $source); break; case 'match': - $value = (bool) @preg_match($params[0], $source); + $value = (bool)@preg_match($params[0], $source); break; case 'upper': $value = @strtoupper($source); @@ -989,7 +987,7 @@ class DOMTemplateProcessor return $value; } - protected function &getParamValue($param, $source=null) + protected function &getParamValue($param, $source = null) { if ($param[0] == "'" || $param[0] == '"') { $value = substr($param, 1, -1); @@ -999,14 +997,14 @@ class DOMTemplateProcessor $instr = $this->parse($param); $value = &$this->getData($instr, $source); } - + return $value; } /* ------------------------------------------------------------------------ Merge instructions parser ------------------------------------------------------------------------ */ - protected function parse($instructionString, $sep=" ") + protected function parse($instructionString, $sep = " ") { $args = $this->explode(trim($instructionString), $sep); @@ -1027,17 +1025,17 @@ class DOMTemplateProcessor foreach ($args as $arg) { if (preg_match('#^(?<name>\w+)\s*(=(["\'])(?<value>(?:[^\3\\\\]|\\\\.)*)\3)$#', $arg, $pair)) { $parser->params[$pair['name']] = isset($pair['value']) ? $pair['value'] : null; - } elseif ($arg[0]=="@") { - $parser->params["attr"] = substr($arg, 1); - } elseif ($arg[0]=="$") { - $parser->params["var"] = substr($arg, 1); - } elseif ($arg[0]=="/") { - $parser->params["include"] = substr($arg, 1); + } elseif ($arg[0] == "@") { + $parser->params["attr"] = substr($arg, 1); + } elseif ($arg[0] == "$") { + $parser->params["var"] = substr($arg, 1); + } elseif ($arg[0] == "/") { + $parser->params["include"] = substr($arg, 1); } else { - $parser->params["source"] = $arg; + $parser->params["source"] = $arg; } } - + return $parser; } @@ -1045,9 +1043,9 @@ class DOMTemplateProcessor { $source = array(); $steps = $this->tokenize($data); - for ($i=0, $l=count($steps); $i<$l; $i++) { + for ($i = 0, $l = count($steps); $i < $l; $i++) { $step = $steps[$i]; - switch(true) { + switch (true) { case $step == "" : case $step == false : if ($i == 0) { @@ -1084,14 +1082,14 @@ class DOMTemplateProcessor break; default: - if ($i==0) { + if ($i == 0) { $source[] = array('source', $step); } else { $source[] = array('prop', $step); } } } - + return $source; } @@ -1100,17 +1098,17 @@ class DOMTemplateProcessor $l = strlen($str); $o = 0; $esc = false; - $sq = false; - $dq = false; - $br = 0; + $sq = false; + $dq = false; + $br = 0; $sbr = 0; $tok = array(); - for ($i=0; $i<$l; $i++) { + for ($i = 0; $i < $l; $i++) { // Add token if separator found out of enclosures and brackets if ($str[$i] == $sep && !$dq && !$sq && !$br && !$sbr) { - $tok[] = trim(substr($str, $o, $i-$o)); - $o = $i+1; + $tok[] = trim(substr($str, $o, $i - $o)); + $o = $i + 1; continue; } @@ -1121,33 +1119,33 @@ class DOMTemplateProcessor } // Special characters that affect parsing - switch($str[$i]) { - case "'": - if (!$sq) $sq = true; - else $sq = false; - break; - case '"': - if (!$dq) $dq = true; - else $dq = false; - break; - case '(': - if (!$sq && !$dq) $br++; - break; - case ')': - if (!$sq && !$dq) $br--; - break; - case '[': - if (!$sq && !$dq) $sbr++; - break; - case ']': - if (!$sq && !$dq) $sbr--; - break; - case '\\': - $esc = true; - break; + switch ($str[$i]) { + case "'": + if (!$sq) $sq = true; + else $sq = false; + break; + case '"': + if (!$dq) $dq = true; + else $dq = false; + break; + case '(': + if (!$sq && !$dq) $br++; + break; + case ')': + if (!$sq && !$dq) $br--; + break; + case '[': + if (!$sq && !$dq) $sbr++; + break; + case ']': + if (!$sq && !$dq) $sbr--; + break; + case '\\': + $esc = true; + break; } } - $tail = trim(substr($str, $o, $i-$o)); + $tail = trim(substr($str, $o, $i - $o)); if ($tail !== "") { $tok[] = $tail; } @@ -1164,36 +1162,36 @@ class DOMTemplateProcessor $l = strlen($str); $o = 0; $esc = false; - $sq = false; - $dq = false; - $br = 0; + $sq = false; + $dq = false; + $br = 0; $sbr = false; $steps = array(); $step = false; // Function - for ($i=0; $i<$l; $i++) { + for ($i = 0; $i < $l; $i++) { // Tokenize only of out of enclosures if (!$dq && !$sq && !$br) { // Add token if dot found if ($str[$i] == ".") { - $steps[] = trim(substr($str, $o, $i-$o)); - $o = $i+1; + $steps[] = trim(substr($str, $o, $i - $o)); + $o = $i + 1; continue; } // Add token if opening square bracket if ($str[$i] == "[") { - $steps[] = trim(substr($str, $o, $i-$o)); - $o = $i+1; + $steps[] = trim(substr($str, $o, $i - $o)); + $o = $i + 1; $sbr = true; continue; } // Add token enclosed by square brackets if ($str[$i] == "]" && $sbr) { - $steps[] = trim(substr($str, $o-1, $i-$o+2)); - $o = $i+1; + $steps[] = trim(substr($str, $o - 1, $i - $o + 2)); + $o = $i + 1; $sbr = false; continue; } @@ -1206,27 +1204,27 @@ class DOMTemplateProcessor } // Special characters that affect parsing - switch($str[$i]) { - case "'": - if (!$sq) $sq = true; - else $sq = false; - break; - case '"': - if (!$dq) $dq = true; - else $dq = false; - break; - case '(': - if (!$sq && !$dq) $br++; - break; - case ')': - if (!$sq && !$dq) $br--; - break; - case '\\': - $esc = true; - break; + switch ($str[$i]) { + case "'": + if (!$sq) $sq = true; + else $sq = false; + break; + case '"': + if (!$dq) $dq = true; + else $dq = false; + break; + case '(': + if (!$sq && !$dq) $br++; + break; + case ')': + if (!$sq && !$dq) $br--; + break; + case '\\': + $esc = true; + break; } } - $tail = trim(substr($str, $o, $i-$o)); + $tail = trim(substr($str, $o, $i - $o)); if ($tail !== false) $steps[] = $tail; @@ -1235,4 +1233,4 @@ class DOMTemplateProcessor return $steps; } -} \ No newline at end of file +} diff --git a/modules/export_seda/Purge.php b/modules/export_seda/Purge.php index 3d8748c4471b35bcabeda0ffc35b062206ba6f22..54a1e394b83f3c63ef7ddb4564ec3101225d3dd5 100755 --- a/modules/export_seda/Purge.php +++ b/modules/export_seda/Purge.php @@ -4,21 +4,47 @@ require_once 'vendor/autoload.php'; require_once __DIR__.'/RequestSeda.php'; Class Purge{ + protected $xml; public function __construct() { $this->db = new RequestSeda(); - $xml = simplexml_load_file(__DIR__.DIRECTORY_SEPARATOR. 'xml' . DIRECTORY_SEPARATOR . "config.xml"); - $this->deleteData = (string) $xml->CONFIG->deleteData; + + $getXml = false; + $path = ''; + if (file_exists( + $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' + )) + { + $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } else if (file_exists($_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml')) { + $path = $_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda' + . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } + + if ($getXml) { + $this->xml = simplexml_load_file($path); + } + + $this->deleteData = (string) $this->xml->CONFIG->deleteData; } - public function purge($resId) { + public function purge($resId) + { $reply = $this->db->getReply($resId); if (!$reply) { $_SESSION['error'] = _ERROR_NO_REPLY . $resId; return false; } - $tabDir = explode('#',$reply->path); + $tabDir = explode('#', $reply->path); $dir = ''; for ($i = 0; $i < count($tabDir); $i++) { @@ -29,16 +55,20 @@ Class Purge{ $fileName = $docServer->path_template. DIRECTORY_SEPARATOR . $dir . $reply->filename; $xml = simplexml_load_file($fileName); - if ($xml->ReplyCode != "000") { - $_SESSION['error'] = _LETTER_NO_ARCHIVED. $resId; + if (strpos($xml->ReplyCode, '000') === false) { + $_SESSION['error'] = _ERROR_LETTER_ARCHIVED. $resId; return false; } + $letter = $this->db->getLetter($resId); $message = $this->db->getMessageByReference($xml->MessageRequestIdentifier); $this->db->deleteUnitIdentifier($resId); $this->purgeResource($resId); - $this->purgeContact($letter->contact_id); + + if ($letter->contact_id) { + $this->purgeContact($letter->contact_id); + } $unitIdentifiers = $this->db->getUnitIdentifierByMessageId($message->message_id); if (!$unitIdentifiers) { @@ -74,4 +104,4 @@ Class Purge{ { \Contact\models\ContactModel::purgeContact(['id' => $contactId]); } -} \ No newline at end of file +} diff --git a/modules/export_seda/RequestSeda.php b/modules/export_seda/RequestSeda.php old mode 100755 new mode 100644 index 911725901f7c20619299a17101266b80f3ce2677..052ba7a5ae316dc377eb1198e44bd3ca71f35b7b --- a/modules/export_seda/RequestSeda.php +++ b/modules/export_seda/RequestSeda.php @@ -22,30 +22,94 @@ require_once "core/class/class_request.php"; require_once "core/class/class_resource.php"; require_once "core/class/docservers_controler.php"; +require_once "core/Models/DocserverModel.php"; +require_once "core/Models/DocserverTypeModel.php"; +require_once "core/Controllers/DocserverController.php"; +require_once "core/Controllers/DocserverToolsController.php"; class RequestSeda { - private $db; + private $db; - public function __construct($db = null) - { - if ($db) { - $this->db = $db; + protected $statement; + + public function __construct($db = null) + { + $this->statement = []; + if ($db) { + $this->db = $db; } else { $this->db = new Database(); } - } - public function getMessageByReference($reference) + $query = "SELECT * FROM message_exchange WHERE reference = ?"; + $this->statement['getMessageByReference'] = $this->db->prepare($query); + + $query = "SELECT status FROM res_letterbox WHERE res_id = ?"; + $this->statement['getStatusLetter'] = $this->db->prepare($query); + + $query = "SELECT destination FROM res_letterbox WHERE res_id = ?"; + $this->statement['getDestinationLetter'] = $this->db->prepare($query); + + $query = "SELECT res_id, contact_id, filename, docserver_id, path, creation_date, modification_date, type_id, doc_date, admission_date, creation_date, exp_contact_id, dest_contact_id, destination, nature_id, type_label, alt_identifier, subject, title + FROM res_view_letterbox + WHERE res_id = ?"; + $this->statement['getLetter'] = $this->db->prepare($query); + + $query = "SELECT * FROM entities WHERE entity_id = ?"; + $this->statement['getEntity'] = $this->db->prepare($query); + + $query = "SELECT * FROM notes WHERE identifier = ?"; + $this->statement['getNotes'] = $this->db->prepare($query); + + $query = "SELECT * FROM sendmail WHERE res_id = ?"; + $this->statement['getMails'] = $this->db->prepare($query); + + $query = "SELECT * FROM doctypes WHERE type_id = ?"; + $this->statement['getDocTypes'] = $this->db->prepare($query); + + $query = "SELECT * FROM unit_identifier WHERE res_id = ?"; + $this->statement['getUnitIdentifierByResId'] = $this->db->prepare($query); + + $query = + "SELECT res_parent,res_child + FROM res_linked + WHERE coll_id = 'letterbox_coll' + AND (res_child = ? OR res_parent = ?)"; + $this->statement['getLinks'] = $this->db->prepare($query); + + $query = "SELECT * FROM contacts_v2 WHERE contact_id = ?"; + $this->statement['getContact'] = $this->db->prepare($query); + + $query = "SELECT * FROM docservers WHERE docserver_id = ?"; + $this->statement['getDocServer'] = $this->db->prepare($query); + + $query = "SELECT * FROM res_attachments WHERE res_id_master = ? AND status != 'DEL'"; + $this->statement['getAttachments'] = $this->db->prepare($query); + + $query = "SELECT * FROM history WHERE table_name = ? and record_id = ?"; + $this->statement['getHistory'] = $this->db->prepare($query); + + $query = "INSERT INTO unit_identifier VALUES (?,?,?,?)"; + $this->statement['insertUnitIdentifier'] = $this->db->prepare($query); + + $query = "DELETE FROM message_exchange WHERE message_id = ?"; + $this->statement['deleteMessage'] = $this->db->prepare($query); + + $query = "DELETE FROM unit_identifier WHERE res_id = ?"; + $this->statement['deleteUnitIdentifier'] = $this->db->prepare($query); + } + + public function getMessageByReference($reference) { $queryParams = []; $queryParams[] = $reference; - $query = "SELECT * FROM seda WHERE reference = ?"; + $query = "SELECT * FROM message_exchange WHERE reference = ?"; + + $smtp = $this->db->query($query, $queryParams); - $smtp = $this->db->query($query,$queryParams); - $message = $smtp->fetchObject(); return $message; @@ -57,9 +121,9 @@ class RequestSeda $queryParams[] = $id; - $query = "SELECT * FROM seda WHERE message_id = ?"; + $query = "SELECT * FROM message_exchange WHERE message_id = ?"; - $smtp = $this->db->query($query,$queryParams); + $smtp = $this->db->query($query, $queryParams); $message = $smtp->fetchObject(); @@ -72,9 +136,9 @@ class RequestSeda $queryParams[] = $messageId; - $query = "SELECT res_id FROM unit_identifier WHERE message_id = ?"; + $query = "SELECT * FROM unit_identifier WHERE message_id = ?"; - $smtp = $this->db->query($query,$queryParams); + $smtp = $this->db->query($query, $queryParams); $unitIdentifier = []; while ($res = $smtp->fetchObject()) { @@ -84,20 +148,18 @@ class RequestSeda return $unitIdentifier; } - public function getUnitIdentifierByResId($resId) - { - $queryParams = []; + public function getUnitIdentifierByResId($resId) + { + $queryParams = []; - $queryParams[] = $resId; + $queryParams[] = $resId; - $query = "SELECT * FROM unit_identifier WHERE res_id = ?"; + $this->statement['getUnitIdentifierByResId']->execute($queryParams); - $smtp = $this->db->query($query,$queryParams); - - $unitIdentifier = $res = $smtp->fetchObject(); + $unitIdentifier = $res = $this->statement['getUnitIdentifierByResId']->fetchObject(); - return $unitIdentifier; - } + return $unitIdentifier; + } public function getLetter($resId) { @@ -105,15 +167,59 @@ class RequestSeda $queryParams[] = $resId; - $query = "SELECT * FROM res_view_letterbox WHERE res_id = ?"; - - $smtp = $this->db->query($query,$queryParams); + $this->statement['getLetter']->execute($queryParams); - $letterbox = $smtp->fetchObject(); + $letterbox = $this->statement['getLetter']->fetchObject(); return $letterbox; } + public function getStatusLetter($resId) + { + $queryParams = []; + + $queryParams[] = $resId; + + $this->statement['getStatusLetter']->execute($queryParams); + + $res = $this->statement['getStatusLetter']->fetchObject(); + + return $res->status; + } + + public function getDestinationLetter($resId) + { + $queryParams = []; + + $queryParams[] = $resId; + + $this->statement['getDestinationLetter']->execute($queryParams); + + $res = $this->statement['getDestinationLetter']->fetchObject(); + + return $res->destination; + } + + public function getLinks($resId) + { + $queryParams = []; + + $queryParams[] = $resId; + $queryParams[] = $resId; + + $this->statement['getLinks']->execute($queryParams); + $links = []; + while ($res = $this->statement['getLinks']->fetchObject()) { + if ($resId == $res->res_parent) { + $links[] = $res->res_child; + } else { + $links[] = $res->res_parent; + } + } + + return $links; + } + public function getLettersByStatus($status) { $queryParams = []; @@ -122,7 +228,7 @@ class RequestSeda $query = "SELECT * FROM res_letterbox WHERE status = ?"; - $smtp = $this->db->query($query,$queryParams); + $smtp = $this->db->query($query, $queryParams); $letters = []; while ($res = $smtp->fetchObject()) { @@ -132,167 +238,265 @@ class RequestSeda return $letters; } - public function getDocTypes($typeId) - { - $queryParams = []; + public function getDocTypes($typeId) + { + $queryParams = []; + + $queryParams[] = $typeId; + + $this->statement['getDocTypes']->execute($queryParams); + + $docTypes = $this->statement['getDocTypes']->fetchObject(); + + return $docTypes; + } + + public function getUserInformation($userId) + { + $queryParams = []; - $queryParams[] = $typeId; + $queryParams[] = $userId; - $query = "SELECT * FROM doctypes WHERE type_id = ?"; + $query = "SELECT * FROM users WHERE user_id = ?"; - $smtp = $this->db->query($query,$queryParams); - - $docTypes = $smtp->fetchObject(); + $smtp = $this->db->query($query, $queryParams); - return $docTypes; - } + $user = $smtp->fetchObject(); - public function getUserInformation($userId) - { - $queryParams = []; + return $user; + } - $queryParams[] = $userId; + public function getNotes($letterboxId) + { + $queryParams = []; - $query = "SELECT * FROM users WHERE user_id = ?"; + $queryParams[] = $letterboxId; - $smtp = $this->db->query($query,$queryParams); - - $user = $smtp->fetchObject(); + $this->statement['getNotes']->execute($queryParams); - return $user; - } + $notes = []; + while ($res = $this->statement['getEntity']->fetchObject()) { + $notes[] = $res; + } - public function getNotes($letterboxId) - { - $queryParams = []; + return $notes; + } - $queryParams[] = $letterboxId; + public function getMails($letterboxId) + { + $queryParams = []; - $query = "SELECT * FROM notes WHERE identifier = ?"; + $queryParams[] = $letterboxId; - $smtp = $this->db->query($query,$queryParams); + $this->statement['getMails']->execute($queryParams); - $notes = []; - while ($res = $smtp->fetchObject()) { - $notes[] = $res; - } + $mails = []; + while ($res = $this->statement['getMails']->fetchObject()) { + $mails[] = $res; + } - return $notes; - } + return $mails; + } - public function getEntitie($entityId) - { - $queryParams = []; + public function getEntity($entityId) + { + $queryParams = []; - $queryParams[] = $entityId; + $queryParams[] = $entityId; - $query = "SELECT * FROM entities WHERE entity_id = ?"; + $this->statement['getEntity']->execute($queryParams); - $smtp = $this->db->query($query,$queryParams); - - $entitie = $smtp->fetchObject(); + $entity = $this->statement['getEntity']->fetchObject(); - return $entitie; - } + return $entity; + } - public function getContact($contactId) - { - $queryParams = []; + public function getContact($contactId) + { + $queryParams = []; - $queryParams[] = $contactId; + $queryParams[] = $contactId; - $query = "SELECT * FROM contacts_v2 WHERE contact_id = ?"; + $this->statement['getContact']->execute($queryParams); - $smtp = $this->db->query($query,$queryParams); - - $contact = $smtp->fetchObject(); + $contact = $this->statement['getContact']->fetchObject(); - return $contact; - } + return $contact; + } - public function getDocServer($docServerId) - { - $queryParams = []; + public function getDocServer($docServerId) + { + $queryParams = []; - $queryParams[] = $docServerId; + $queryParams[] = $docServerId; - $query = "SELECT * FROM docservers WHERE docserver_id = ?"; + $this->statement['getDocServer']->execute($queryParams); - $smtp = $this->db->query($query,$queryParams); - - $docServers = $smtp->fetchObject(); + $docServers = $this->statement['getDocServer']->fetchObject(); - return $docServers; - } + return $docServers; + } - public function getAttachments($resIdMaster) - { - $queryParams = []; + public function getAttachments($resIdMaster) + { + $queryParams = []; - $queryParams[] = $resIdMaster; + $queryParams[] = $resIdMaster; - $query = "SELECT * FROM res_attachments WHERE res_id_master = ? AND status != 'DEL'"; + $this->statement['getAttachments']->execute($queryParams); - $smtp = $this->db->query($query,$queryParams); - - while ($res = $smtp->fetchObject()) { - $attachments[] = $res; - } + $attachments = []; + while ($res = $this->statement['getAttachments']->fetchObject()) { + $attachments[] = $res; + } - return $attachments; - } + return $attachments; + } - public function getUseContact($orgIdentifier) - { - $queryParams = []; + public function getUseContact($orgIdentifier) + { + $queryParams = []; - $queryParams[] = $orgIdentifier; - $queryParams[] = $orgIdentifier; + $queryParams[] = $orgIdentifier; + $queryParams[] = $orgIdentifier; - $query = "SELECT COUNT(*) FROM seda WHERE sender_org_identifier = ? OR recipient_org_identifier = ?"; + $query = "SELECT COUNT(*) FROM message_exchange WHERE sender_org_identifier = ? OR recipient_org_identifier = ?"; - $smtp = $this->db->query($query,$queryParams); - - $res = $smtp->fetchObject(); + $smtp = $this->db->query($query, $queryParams); + + $res = $smtp->fetchObject(); - return $res; - } + return $res; + } - public function getAcknowledgement($resIdMaster) { + public function getAcknowledgement($resIdMaster) + { $queryParams = []; $queryParams[] = $resIdMaster; $query = "SELECT * FROM res_attachments WHERE res_id_master = ? and type_id = 1 and status != 'DEL'"; - $smtp = $this->db->query($query,$queryParams); + $smtp = $this->db->query($query, $queryParams); $res = $smtp->fetchObject(); return $res; } - public function getReply($resIdMaster) { + public function getReply($resIdMaster) + { $queryParams = []; $queryParams[] = $resIdMaster; $query = "SELECT * FROM res_attachments WHERE res_id_master = ? and type_id = 2 and status != 'DEL'"; - $smtp = $this->db->query($query,$queryParams); + $smtp = $this->db->query($query, $queryParams); $res = $smtp->fetchObject(); return $res; } - public function insertMessage($messageObject, $type) - { - $queryParams = []; - $messageId = uniqid(); + public function getHistory($tableName, $recordId) + { + $queryParams = []; + + $queryParams[] = $tableName; + $queryParams[] = $recordId; + + $this->statement['getHistory']->execute($queryParams); + + $history = []; + while ($res = $this->statement['getHistory']->fetchObject()) { + $history[] = $res; + } + + return $history; + } + + /*** Generates a local unique identifier + @return string The unique id*/ + public function generateUniqueId() + { + $parts = explode('.', microtime(true)); + $sec = $parts[0]; + if (!isset($parts[1])) { + $msec = 0; + } else { + $msec = $parts[1]; + } + $uniqueId = str_pad(base_convert($sec, 10, 36), 6, '0', STR_PAD_LEFT) . str_pad(base_convert($msec, 10, 16), 4, '0', STR_PAD_LEFT); + $uniqueId .= str_pad(base_convert(mt_rand(), 10, 36), 6, '0', STR_PAD_LEFT); + + return $uniqueId; + } + + + public function insertMessage($messageObject, $type, $aArgs = []) + { + $queryParams = []; + + if (empty($messageObject->messageId)) { + $messageObject->messageId = $this->generateUniqueId(); + } + + if (empty($aArgs['status'])) { + $status = "sent"; + } else { + $status = $aArgs['status']; + } + + if (empty($aArgs['fullMessageObject'])) { + $messageObjectToSave = $messageObject; + } else { + $messageObjectToSave = $aArgs['fullMessageObject']; + } + + if(empty($aArgs['resIdMaster'])){ + $resIdMaster = null; + } else { + $resIdMaster = $aArgs['resIdMaster']; + } + + if (empty($aArgs['filePath'])){ + $filePath = null; + } else { + $filePath = $aArgs['filePath']; + $pathInfo = pathinfo($filePath); + $filesize = filesize($filePath); + + //Store resource on docserver + $aFileInfo = [ + 'collId' => 'archive_transfer_coll', + 'fileInfos' => + [ + 'tmpDir' => $_SESSION['config']['tmppath'], + 'size' => $filesize, + 'format' => $pathInfo['extension'], + 'tmpFileName' => $pathInfo['basename'], + ] + ]; + + $ds = new \Core\Controllers\DocserverController(); + $storeResult = $ds->storeResourceOnDocserver($aFileInfo); + $docserver_id = $storeResult['docserver_id']; + $filepath = $storeResult['destination_dir']; + $filename = $storeResult['file_destination_name']; + + $docserver = \Core\Models\DocserverModel::getById(['docserver_id' => $docserver_id]); + $docserverType = \Core\Models\DocserverTypeModel::getById(['docserver_type_id' => $docserver[0]['docserver_type_id']]); + + $fingerprint = \Core\Controllers\DocserverToolsController::doFingerprint([ + 'path' => $filePath, + 'fingerprintMode' => $docserverType[0]['fingerprint_mode'], + ]); + + } try { - $query = ("INSERT INTO seda ( + $query = ("INSERT INTO message_exchange ( message_id, schema, type, @@ -309,40 +513,53 @@ class RequestSeda size, data, active, - archived) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); - - $queryParams[] = $messageId; // Message Id + archived, + res_id_master, + docserver_id, + path, + filename, + fingerprint, + filesize) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); + + $queryParams[] = $messageObject->messageId; // Message Id $queryParams[] = "2.1"; //Schema $queryParams[] = $type; // Type - $queryParams[] = "sent"; // Status + $queryParams[] = $status; // Status $queryParams[] = $messageObject->date; // Date - $queryParams[] = $messageObject->messageIdentifier->value; // Reference + $queryParams[] = $messageObject->MessageIdentifier->value; // Reference $queryParams[] = $_SESSION['user']['UserId']; // Account Id - $queryParams[] = $messageObject->transferringAgency->identifier->value; // Sender org identifier id - $queryParams[] = ""; //SenderOrgNAme - $queryParams[] = $messageObject->archivalAgency->identifier->value; // Recipient org identifier id - $queryParams[] = ""; //RecipientOrgNAme + $queryParams[] = $messageObject->TransferringAgency->Identifier->value; // Sender org identifier id + $queryParams[] = $aArgs['SenderOrgNAme']; //SenderOrgNAme + $queryParams[] = $messageObject->ArchivalAgency->Identifier->value; // Recipient org identifier id + $queryParams[] = $aArgs['RecipientOrgNAme']; //RecipientOrgNAme $queryParams[] = $messageObject->archivalAgreement->value; // Archival agreement reference $queryParams[] = $messageObject->replyCode->value; //ReplyCode $queryParams[] = 0; // size - $queryParams[] = json_encode($messageObject);//$messageObject; // Data + $queryParams[] = json_encode($messageObjectToSave);//$messageObject; // Data $queryParams[] = 1; // active - $queryParams[] = 0; // archived + $queryParams[] = 0; // archived + $queryParams[] = $resIdMaster; // res_id_master + $queryParams[] = $docserver_id; + $queryParams[] = $filepath; + $queryParams[] = $filename; + $queryParams[] = $fingerprint['fingerprint']; + $queryParams[] = $filesize; - $res = $this->db->query($query,$queryParams); + $res = $this->db->query($query, $queryParams); - } catch (Exception $e) { - return false; - } + } catch (Exception $e) { + return false; + } - return $messageId; - } + return $messageObject->messageId; + } - public function insertAttachment($data,$type) { + public function insertAttachment($data, $type) + { $docserverControler = new docservers_controler(); - $fileInfos = array( + $fileInfos = array( "tmpDir" => $data->tmpDir, "size" => $data->size, "format" => $data->format, @@ -510,33 +727,52 @@ class RequestSeda return true; } - public function insertUnitIdentifier($messageId, $tableName, $resId) - { - try { - $query = ("INSERT INTO unit_identifier VALUES (?,?,?)"); - $queryParams = []; + public function insertUnitIdentifier($messageId, $tableName, $resId, $disposition = "") + { + try { + $queryParams = []; + + $queryParams[] = $messageId; + $queryParams[] = $tableName; + $queryParams[] = $resId; + $queryParams[] = $disposition; + + $this->statement['insertUnitIdentifier']->execute($queryParams); + } catch (Exception $e) { + return false; + } - $queryParams[] = $messageId; - $queryParams[] = $tableName; - $queryParams[] = $resId; + return true; + } - $res = $this->db->query($query,$queryParams); - } catch (Exception $e) { - return false; - } - - return true; - } + public function updateDataMessage($reference, $data) + { - public function updateStatusMessage($reference, $status){ + $queryParams = []; + $queryParams[] = $data; + $queryParams[] = $reference; + + try { + $query = "UPDATE message_exchange SET data = ? WHERE reference = ?"; + + $smtp = $this->db->query($query, $queryParams); + } catch (Exception $e) { + return false; + } + + return true; + } + + public function updateStatusMessage($reference, $status) + { $queryParams = []; $queryParams[] = $status; $queryParams[] = $reference; try { - $query = "UPDATE seda SET status = ? WHERE reference = ?"; + $query = "UPDATE message_exchange SET status = ? WHERE reference = ?"; - $smtp = $this->db->query($query,$queryParams); + $smtp = $this->db->query($query, $queryParams); } catch (Exception $e) { return false; } @@ -544,7 +780,8 @@ class RequestSeda return true; } - public function updateStatusLetterbox($resId,$status) { + public function updateStatusLetterbox($resId, $status) + { $queryParams = []; $queryParams[] = $status; $queryParams[] = $resId; @@ -552,7 +789,7 @@ class RequestSeda try { $query = "UPDATE res_letterbox SET status = ? WHERE res_id = ?"; - $smtp = $this->db->query($query,$queryParams); + $smtp = $this->db->query($query, $queryParams); } catch (Exception $e) { return false; } @@ -560,7 +797,8 @@ class RequestSeda return true; } - public function updateStatusAttachment($resId,$status) { + public function updateStatusAttachment($resId, $status) + { $queryParams = []; $queryParams[] = $status; $queryParams[] = $resId; @@ -568,7 +806,7 @@ class RequestSeda try { $query = "UPDATE res_attachments SET status = ? WHERE res_id_master = ? AND type_id IN (1,2) "; - $smtp = $this->db->query($query,$queryParams); + $smtp = $this->db->query($query, $queryParams); } catch (Exception $e) { return false; } @@ -576,35 +814,115 @@ class RequestSeda return true; } - public function deleteMessage($messageId) - { - $queryParams = []; - $queryParams[] = $messageId; - try { - $query = "DELETE FROM seda WHERE message_id = ?"; + public function deleteMessage($messageId) + { + $queryParams = []; + $queryParams[] = $messageId; + try { + $this->statement['deleteMessage']->execute($queryParams); + } catch (Exception $e) { + return false; + } + + return true; + } + + public function deleteUnitIdentifier($resId) + { + $queryParams = []; + + $queryParams[] = $resId; + try { + $this->statement['deleteUnitIdentifier']->execute($queryParams); + } catch (Exception $e) { + return false; + } + + return true; + } + + public function getMessagesByReference($id) + { + $queryParams = []; + + $queryParams[] = $id; - $smtp = $this->db->query($query,$queryParams); - } catch (Exception $e) { - return false; - } + $query = "SELECT * FROM message_exchange WHERE reference = ?"; - return true; - } + return $this->db->query($query,$queryParams); + } - public function deleteUnitIdentifier($resId) - { - $queryParams = []; + public function getMessagesByReferenceByDate($id) + { + $queryParams = []; - $queryParams[] = $resId; - try { - $query = "DELETE FROM unit_identifier WHERE res_id = ?"; + $queryParams[] = $id; + + $query = "SELECT * FROM message_exchange WHERE reference = ? ORDER BY date asc"; + + return $this->db->query($query,$queryParams); + } + + public function getMessageByIdentifierAndResId($aArgs = []) + { + $queryParams = []; + + $query = "SELECT * FROM message_exchange WHERE message_id = ? and res_id_master = ?"; + $queryParams[] = $aArgs['message_id']; + $queryParams[] = $aArgs['res_id_master']; - $smtp = $this->db->query($query,$queryParams); - } catch (Exception $e) { - return false; - } + $smtp = $this->db->query($query,$queryParams); + + $message = $smtp->fetchObject(); + + return $message; + } + + public function getEntitiesByBusinessId($businessId) { + $queryParams = []; - return true; - } + $queryParams[] = $businessId; + + $query = "SELECT * FROM entities WHERE business_id = ?"; + + $smtp = $this->db->query($query,$queryParams); + + while ($res = $smtp->fetchObject()) { + $entities[] = $res; + } + + return $entities; + } + public function updateOperationDateMessage($aArgs = []){ + $queryParams = []; + $queryParams[] = $aArgs['operation_date']; + $queryParams[] = $aArgs['message_id']; + + try { + $query = "UPDATE message_exchange SET operation_date = ? WHERE message_id = ?"; + + $smtp = $this->db->query($query,$queryParams); + } catch (Exception $e) { + return false; + } + + return true; + } + + public function updateReceptionDateMessage($aArgs = []){ + $queryParams = []; + $queryParams[] = $aArgs['reception_date']; + $queryParams[] = $aArgs['message_id']; + + try { + $query = "UPDATE message_exchange SET reception_date = ? WHERE message_id = ?"; + + $smtp = $this->db->query($query,$queryParams); + } catch (Exception $e) { + return false; + } + + return true; + } -} \ No newline at end of file +} diff --git a/modules/export_seda/Reset.php b/modules/export_seda/Reset.php old mode 100755 new mode 100644 index 6c29e83a66d05c0f029c269ed5272b7fb1556ec0..93b30d832cb20763b9393ac0712ce03528aaa746 --- a/modules/export_seda/Reset.php +++ b/modules/export_seda/Reset.php @@ -20,10 +20,15 @@ Class Reset{ $docServer = $this->db->getDocServer($reply->docserver_id); $fileName = $docServer->path_template. DIRECTORY_SEPARATOR . $dir . $reply->filename; - $xml = simplexml_load_file($fileName); + if (!file_exists($fileName)) { + $_SESSION['error'] = _ERROR_REPLY_NOT_EXIST . $resId; + return; + } + + $xml = simplexml_load_file($fileName); - if ((string) $xml->ReplyCode == "000") { + if (strpos($xml->ReplyCode, '000') !== false) { $_SESSION['error'] = _ERROR_LETTER_ARCHIVED. $resId; return false; } @@ -44,4 +49,4 @@ Class Reset{ return $resId; } -} \ No newline at end of file +} diff --git a/modules/export_seda/Transfer.php b/modules/export_seda/Transfer.php old mode 100755 new mode 100644 index bea51c1199e6a5423d022f9ead1a973d71cdf318..e8a94e52936c5857c90818b00498a9ab02f187d1 --- a/modules/export_seda/Transfer.php +++ b/modules/export_seda/Transfer.php @@ -3,7 +3,30 @@ require_once __DIR__ . '/AdapterMaarchRM.php'; require_once __DIR__ . '/AdapterMaarchCourrier.php'; class Transfer{ - public function __construct(){} + public function __construct(){ + $getXml = false; + $path = ''; + if (file_exists( + $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' + )) { + $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } else if (file_exists($_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml')) { + $path = $_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda' + . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } + + if ($getXml) { + $this->xml = simplexml_load_file($path); + } + } public function transfer($target, $reference, $communicationType = 'url') { $adapter = ''; @@ -12,11 +35,12 @@ class Transfer{ if ($target == 'maarchrm') { $adapter = new AdapterMaarchRM(); - } elseif ($target == 'maarchcourrier' ) { + } elseif ($target == 'maarchcourrier') { $adapter = new AdapterMaarchCourrier(); } else { - $_SESSION['error'] = _UNKNOWN_TARGET; - return false; + $res['status'] = 0; + $res['content'] = _UNKNOWN_TARGET; + return $res; } $param = $adapter->getInformations($reference); // [0] = url, [1] = header, [2] = cookie, [3] = data @@ -30,13 +54,46 @@ class Transfer{ curl_setopt($curl, CURLOPT_HTTPHEADER, $param[1]); curl_setopt($curl, CURLOPT_COOKIE, $param[2]); curl_setopt($curl, CURLOPT_POSTFIELDS, $param[3]); + curl_setopt($curl, CURLOPT_FAILONERROR, true); + + if (empty($this->xml->CONFIG->certificateSSL)) { + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + } else { + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); + + $certificateSSL = $this->xml->CONFIG->certificateSSL; + if (is_file($certificateSSL)) { + $ext = ['.crt','.pem']; + + $filenameExt = strrchr($certificateSSL, '.'); + if (in_array($filenameExt, $ext)) { + curl_setopt($curl, CURLOPT_CAINFO, $certificateSSL); + } else { + $res['status'] = 1; + $res['content'] = _ERROR_EXTENSION_CERTIFICATE; + return $res; + } + } elseif (is_dir($certificateSSL)) { + curl_setopt($curl, CURLOPT_CAPATH, $certificateSSL); + } else { + $res['status'] = 1; + $res['content'] = _ERROR_UNKNOW_CERTIFICATE; + return $res; + } + } $exec = curl_exec($curl); $data = json_decode($exec); if (!$data) { $res['status'] = 1; - $res['content'] = curl_error($curl); + if (curl_error($curl)) { + $res['content'] = curl_error($curl); + } else { + $res['content'] = $exec; + } + } else { $res['content'] = $data; } @@ -48,4 +105,4 @@ class Transfer{ return $res; } -} \ No newline at end of file +} diff --git a/modules/export_seda/batch/BatchPurge.php b/modules/export_seda/batch/BatchPurge.php new file mode 100644 index 0000000000000000000000000000000000000000..29e32434642f2f72913c17eee537448435372939 --- /dev/null +++ b/modules/export_seda/batch/BatchPurge.php @@ -0,0 +1,84 @@ +<?php +$batchPurge = new BatchPurge(); + +require_once __DIR__ . '/../RequestSeda.php'; +require_once __DIR__ . '/../class/AbstractMessage.php'; +require_once __DIR__ . '/../Purge.php'; + +$batchPurge->purge(); + +Class BatchPurge { + protected $db; + + public function __construct() + { + $this->initSession(); + } + + private function initSession() + { + try { + include('Maarch_CLITools/ArgsParser.php');; + } catch (IncludeFileError $e) { + echo 'Maarch_CLITools required ! \n (pear.maarch.org)\n'; + exit(106); + } + + // Defines scripts arguments + $argsparser = new ArgsParser(); + // The config file + $argsparser->add_arg( + 'config', + array( + 'short' => 'c', + 'long' => 'config', + 'mandatory' => true, + 'help' => 'Config file path is mandatory.', + ) + ); + + $options = $argsparser->parse_args($GLOBALS['argv']); + // If option = help then options = false and the script continues ... + if ($options == false) { + exit(0); + } + + $txt = ''; + foreach (array_keys($options) as $key) { + if (isset($options[$key]) && $options[$key] == false) { + $txt .= $key . '=false,'; + } else { + $txt .= $key . '=' . $options[$key] . ','; + } + } + + $xml = simplexml_load_file($options['config']); + + $_SESSION['config']['lang'] = $xml->CONFIG->Lang; + $_SESSION['config']['corepath'] = $xml->CONFIG->MaarchDirectory; + $_SESSION['config']['custom_override_id'] = $xml->CONFIG->CustomId; + $_SESSION['config']['app_id'] = $xml->CONFIG->MaarchApps; + + $_SESSION['config']['databaseserver'] = $xml->CONFIG_BASE->databaseserver; + $_SESSION['config']['databaseserverport'] = $xml->CONFIG_BASE->databaseserverport; + $_SESSION['config']['databaseuser'] = $xml->CONFIG_BASE->databaseuser; + $_SESSION['config']['databasepassword'] = $xml->CONFIG_BASE->databasepassword; + $_SESSION['config']['databasename'] = $xml->CONFIG_BASE->databasename; + $_SESSION['config']['databasetype'] = $xml->CONFIG_BASE->databasetype; + $_SESSION['custom_override_id'] = $xml->CONFIG->CustomId; + $_SESSION['collection_id_choice'] = $xml->COLLECTION->Id; + $_SESSION['tablename']['docservers'] = 'docservers'; + } + + public function purge() + { + $db = new RequestSeda(); + $letters = $db->getLettersByStatus('REPLY_SEDA'); + + + $purge = new Purge(); + foreach ($letters as $letter) { + $purge->purge($letter->res_id); + } + } +} \ No newline at end of file diff --git a/modules/export_seda/batch/CheckAllReply.php b/modules/export_seda/batch/CheckAllReply.php old mode 100755 new mode 100644 index 484bae85e91e23140ce6ada341a8d33ff6c46841..eb56df8a616c627782732a30a9040bc5c1adf5f9 --- a/modules/export_seda/batch/CheckAllReply.php +++ b/modules/export_seda/batch/CheckAllReply.php @@ -1,11 +1,12 @@ <?php +$checkAllReply = new CheckAllReply(); require_once __DIR__ . '/../RequestSeda.php'; require_once __DIR__ . '/../class/AbstractMessage.php'; require_once __DIR__ . '/../CheckReply.php'; -$checkAllReply = new CheckAllReply(); -$checkAllReply->checkAll(); +$CheckReply = new CheckReply(); +$CheckReply->checkAll(); Class CheckAllReply { protected $token; @@ -16,59 +17,59 @@ Class CheckAllReply { public function __construct() { $this->initSession(); - $this->db = new RequestSeda(); - $this->checkReply = new CheckReply(); } private function initSession() { - $xml = simplexml_load_file(__DIR__ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . "config.xml"); - - $_SESSION['config']['databaseserver'] = $xml->CONFIG_BASE->databaseserver; - $_SESSION['config']['databaseserverport'] = $xml->CONFIG_BASE->databaseserverport; - $_SESSION['config']['databaseuser'] = $xml->CONFIG_BASE->databaseuser; - $_SESSION['config']['databasepassword'] = $xml->CONFIG_BASE->databasepassword; - $_SESSION['config']['databasename'] = $xml->CONFIG_BASE->databasename; - $_SESSION['config']['databasetype'] = $xml->CONFIG_BASE->databasetype; - $_SESSION['collection_id_choice'] = $xml->COLLECTION->Id; - $_SESSION['tablename']['docservers'] = 'docservers'; - } - public function checkAll() - { - $abstractMessage = new AbstractMessage(); + try { + include('Maarch_CLITools/ArgsParser.php');; + } catch (IncludeFileError $e) { + echo 'Maarch_CLITools required ! \n (pear.maarch.org)\n'; + exit(106); + } - $letters = $this->db->getLettersByStatus("ACK_SEDA"); + // Defines scripts arguments + $argsparser = new ArgsParser(); + // The config file + $argsparser->add_arg( + 'config', + array( + 'short' => 'c', + 'long' => 'config', + 'mandatory' => true, + 'help' => 'Config file path is mandatory.', + ) + ); - $unitIdentifiers = []; - foreach ($letters as $letter) { - $unitIdentifier = $this->db->getUnitIdentifierByResId($letter->res_id); - $message = $this->db->getMessageByIdentifier($unitIdentifier->message_id); + $options = $argsparser->parse_args($GLOBALS['argv']); + // If option = help then options = false and the script continues ... + if ($options == false) { + exit(0); + } - if(array_key_exists($message->reference, $unitIdentifiers)) { - $unitIdentifiers[$message->reference] .= "," . $unitIdentifier->res_id; + $txt = ''; + foreach (array_keys($options) as $key) { + if (isset($options[$key]) && $options[$key] == false) { + $txt .= $key . '=false,'; } else { - $unitIdentifiers[$message->reference] = $unitIdentifier->res_id; + $txt .= $key . '=' . $options[$key] . ','; } } - foreach ($unitIdentifiers as $key => $value) { - $messageReplyIdentifier = $key. '_Reply'; - $messageReply = $this->checkReply->getReply($messageReplyIdentifier); - - if (empty($messageReply)) { - continue; - } + $xml = simplexml_load_file($options['config']); - $data = json_decode($messageReply[0]->data); - $this->db->insertMessage($data, "ArchiveTransferReply"); - $abstractMessage->saveXml($data,"ArchiveTransferReply", ".txt"); + $_SESSION['config']['lang'] = $xml->CONFIG->Lang; + $_SESSION['config']['corepath'] = $xml->CONFIG->MaarchDirectory; + $_SESSION['config']['custom_override_id'] = $xml->CONFIG->CustomId; + $_SESSION['config']['app_id'] = $xml->CONFIG->MaarchApps; - $resIds = explode(',',$value); - foreach ($resIds as $resId) { - $abstractMessage->addAttachment($messageReplyIdentifier,$resId,$messageReplyIdentifier.".txt","txt","Réponse de transfert",2); - $this->db->updateStatusLetterbox($resId,"REPLY_SEDA"); - } - } - - return true; + $_SESSION['config']['databaseserver'] = $xml->CONFIG_BASE->databaseserver; + $_SESSION['config']['databaseserverport'] = $xml->CONFIG_BASE->databaseserverport; + $_SESSION['config']['databaseuser'] = $xml->CONFIG_BASE->databaseuser; + $_SESSION['config']['databasepassword'] = $xml->CONFIG_BASE->databasepassword; + $_SESSION['config']['databasename'] = $xml->CONFIG_BASE->databasename; + $_SESSION['config']['databasetype'] = $xml->CONFIG_BASE->databasetype; + $_SESSION['custom_override_id'] = $xml->CONFIG->CustomId; + $_SESSION['collection_id_choice'] = $xml->COLLECTION->Id; + $_SESSION['tablename']['docservers'] = 'docservers'; } -} \ No newline at end of file +} diff --git a/modules/export_seda/batch/config/config.xml.default b/modules/export_seda/batch/config/config.xml.default old mode 100755 new mode 100644 index 8a0c2e0dfa6da307db541f402a207d39f3019f6f..dfa529a6c26c7ac247f2020ce3438fda8492a9a6 --- a/modules/export_seda/batch/config/config.xml.default +++ b/modules/export_seda/batch/config/config.xml.default @@ -1,6 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> <ROOT> -<!-- le nom du fichier doit etre config.xml ou config_{custom_id}.xml --> + <CONFIG> + <Lang>fr</Lang> <!-- fr, en--> + <MaarchDirectory>/var/www/MaarchCourrier/</MaarchDirectory> + <MaarchUrl>http://localhost/maarch/</MaarchUrl> + <MaarchApps>maarch_entreprise</MaarchApps> + <CustomId>cs_maarch_courrier</CustomId> + </CONFIG> <COLLECTION> <Id>letterbox_coll</Id> <Table>res_letterbox</Table> @@ -13,8 +19,8 @@ <databaseserver>127.0.0.1</databaseserver> <databaseserverport>5432</databaseserverport> <databasetype>POSTGRESQL</databasetype> - <databasename>maarch</databasename> - <databaseuser>postgres</databaseuser> - <databasepassword>postgres</databasepassword> + <databasename>maarchcourrier</databasename> + <databaseuser>maarch</databaseuser> + <databasepassword>maarch</databasepassword> </CONFIG_BASE> </ROOT> diff --git a/modules/export_seda/class/AbstractMessage.php b/modules/export_seda/class/AbstractMessage.php old mode 100755 new mode 100644 index d538a3839af5f82783edc9e52f57d6397f0cc029..ba4ea1f3db39048fcc27206111a3614c54b854df --- a/modules/export_seda/class/AbstractMessage.php +++ b/modules/export_seda/class/AbstractMessage.php @@ -3,11 +3,82 @@ require_once __DIR__ . DIRECTORY_SEPARATOR .'../RequestSeda.php'; require_once __DIR__ . DIRECTORY_SEPARATOR .'../DOMTemplateProcessor.php'; -Class AbstractMessage{ +if ($_SESSION['config']['app_id']) { + require_once 'apps/maarch_entreprise/class/class_pdf.php'; +} + +class AbstractMessage{ + + private $db; + private $xml; + private $directoryMessage; + public function __construct() + { + $this->db = new RequestSeda(); + + $getXml = false; + $path = ''; + if (file_exists( + $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' + )) { + $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } elseif (file_exists( + $_SESSION['config']['corepath'] . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' + )) { + $path = $_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda' + . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } + + if ($getXml) { + $this->xml = simplexml_load_file($path); + + $this->directoryMessage = (string) $this->xml->CONFIG->directoryMessage; + } + } + + public function generatePackage($reference, $name) + { + $message = $this->db->getMessageByReference($reference); + $messageObject = json_decode($message->data); + + if (!is_dir($this->directoryMessage)) { + umask(0); + mkdir($this->directoryMessage, 0777, true); + } + + if (!is_dir($this->directoryMessage . DIRECTORY_SEPARATOR . $messageObject->MessageIdentifier->value)) { + umask(0); + mkdir($this->directoryMessage . DIRECTORY_SEPARATOR . $messageObject->MessageIdentifier->value, 0777, true); + } + + $this->sendAttachment($messageObject); + + $this->saveXml($messageObject, $name, ".xml"); + } public function saveXml($messageObject, $name, $extension) { + if (isset($messageObject->DataObjectPackage)) { + if ($messageObject->DataObjectPackage->BinaryDataObject) { + foreach ($messageObject->DataObjectPackage->BinaryDataObject as $binaryDataObject) { + unset($binaryDataObject->Attachment->value); + } + } + } + $DOMTemplate = new DOMDocument(); + $DOMTemplate->preserveWhiteSpace = false; + $DOMTemplate->formatOutput = true; $DOMTemplate->load(__DIR__ .DIRECTORY_SEPARATOR. '..'. DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.$name.'.xml'); $DOMTemplateProcessor = new DOMTemplateProcessor($DOMTemplate); $DOMTemplateProcessor->setSource($name, $messageObject); @@ -15,18 +86,18 @@ Class AbstractMessage{ $DOMTemplateProcessor->removeEmptyNodes(); try { - if (!is_dir(__DIR__ . DIRECTORY_SEPARATOR . '..'. DIRECTORY_SEPARATOR.'message')) { + if (!is_dir($this->directoryMessage)) { umask(0); - mkdir(__DIR__ . DIRECTORY_SEPARATOR . '..'. DIRECTORY_SEPARATOR.'message', 0777, true); + mkdir($this->directoryMessage, 0777, true); } - if (!is_dir(__DIR__ . DIRECTORY_SEPARATOR . '..'. DIRECTORY_SEPARATOR.'message' . DIRECTORY_SEPARATOR . $messageObject->messageIdentifier->value)) { + if (!is_dir($this->directoryMessage . DIRECTORY_SEPARATOR . $messageObject->MessageIdentifier->value)) { umask(0); - mkdir(__DIR__ . DIRECTORY_SEPARATOR . '..'. DIRECTORY_SEPARATOR.'message' . DIRECTORY_SEPARATOR . $messageObject->messageIdentifier->value, 0777, true); + mkdir($this->directoryMessage . DIRECTORY_SEPARATOR . $messageObject->MessageIdentifier->value, 0777, true); } - if (!file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'. DIRECTORY_SEPARATOR.'message'.DIRECTORY_SEPARATOR.$messageObject->messageIdentifier->value.DIRECTORY_SEPARATOR. $messageObject->messageIdentifier->value . $extension)) { - file_put_contents(__DIR__.DIRECTORY_SEPARATOR.'..'. DIRECTORY_SEPARATOR.'message'.DIRECTORY_SEPARATOR.$messageObject->messageIdentifier->value.DIRECTORY_SEPARATOR. $messageObject->messageIdentifier->value . $extension, $DOMTemplate->saveXML()); + if (!file_exists($this->directoryMessage . DIRECTORY_SEPARATOR.$messageObject->MessageIdentifier->value.DIRECTORY_SEPARATOR. $messageObject->MessageIdentifier->value . $extension)) { + $DOMTemplate->save($this->directoryMessage . DIRECTORY_SEPARATOR.$messageObject->MessageIdentifier->value.DIRECTORY_SEPARATOR. $messageObject->MessageIdentifier->value . $extension); } } catch (Exception $e) { @@ -37,7 +108,7 @@ Class AbstractMessage{ public function addAttachment($reference, $resIdMaster, $fileName, $extension, $title, $type) { $db = new RequestSeda(); $object = new stdClass(); - $dir = __DIR__.DIRECTORY_SEPARATOR.'..'. DIRECTORY_SEPARATOR.'message'.DIRECTORY_SEPARATOR.$reference.DIRECTORY_SEPARATOR; + $dir = $this->directoryMessage . DIRECTORY_SEPARATOR . $reference . DIRECTORY_SEPARATOR; $object->tmpDir = $dir; $object->size = filesize($dir); @@ -50,15 +121,64 @@ Class AbstractMessage{ return $db->insertAttachment($object, $type); } - public function changeStatus($reference, $status) { - $db = new RequestSeda(); - $message = $db->getMessageByReference($reference); - $listResId = $db->getUnitIdentifierByMessageId($message->message_id); + private function sendAttachment($messageObject) + { + $messageId = $messageObject->MessageIdentifier->value; + + foreach ($messageObject->DataObjectPackage->BinaryDataObject as $binaryDataObject) { + $dest = $this->directoryMessage . DIRECTORY_SEPARATOR . $messageId . DIRECTORY_SEPARATOR . $binaryDataObject->Attachment->filename; + + if (!file_exists($dest)) { + copy($binaryDataObject->Uri, $dest); + + unset($binaryDataObject->Uri); + } + } + + $this->db->updateDataMessage($messageObject->MessageIdentifier->value, json_encode($messageObject)); + } + + public function addTitleToMessage($reference, $title = ' ') + { + $message = $this->db->getMessageByReference($reference); + + $messageObject = json_decode($message->data); + + $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->Content->Title[0] = $title; + + $this->db->updateDataMessage($reference, json_encode($messageObject)); + + return true; + } + + public function changeStatus($reference, $status) + { + $message = $this->db->getMessageByReference($reference); + $listResId = $this->db->getUnitIdentifierByMessageId($message->message_id); for ($i=0; $i < count($listResId); $i++) { - $db->updateStatusLetterbox($listResId[$i]->res_id,$status); + $this->db->updateStatusLetterbox($listResId[$i]->res_id, $status); } return true; } -} \ No newline at end of file + + public function createPDF($name, $body) + { + $pdf = new PDF("p", "pt", "A4"); + $pdf->SetAuthor("MAARCH"); + $pdf->SetTitle($name); + + $pdf->SetFont('times', '', 12); + $pdf->SetTextColor(50, 60, 100); + + $pdf->AddPage('P'); + + $pdf->SetAlpha(1); + + $pdf->MultiCell(0, 10, utf8_decode($body), 0, 'L'); + + $dir = $_SESSION['config']['tmppath'] . $name . '.pdf'; + $pdf->Output($dir, "F"); + } +} diff --git a/modules/export_seda/class/Acknowledgement.php b/modules/export_seda/class/Acknowledgement.php old mode 100755 new mode 100644 index 8c22902d673c5e712231d2733c284a45d05c2ac0..a4546c8bf9d9d3622fc4cba75b64298ecd143af6 --- a/modules/export_seda/class/Acknowledgement.php +++ b/modules/export_seda/class/Acknowledgement.php @@ -28,15 +28,110 @@ class Acknowledgement { { } - public function send($data, $resIds) + public function receive($data, $resIds) { + $messageObject = $this->getMessageObject($data); $abstractMessage = new AbstractMessage(); - $abstractMessage->saveXml($data,"Acknowledgement", ".txt"); + $abstractMessage->saveXml($messageObject,"Acknowledgement", ".xml"); foreach ($resIds as $resId) { - $abstractMessage->addAttachment($data->messageIdentifier->value, $resId, $data->messageIdentifier->value.".txt", "txt", "Accusé de reception",1); + $abstractMessage->addAttachment($messageObject->MessageIdentifier->value, $resId, $messageObject->MessageIdentifier->value.".xml", "xml", "Accusé de réception",1); } + + return $messageObject; } + private function getMessageObject($data) + { + $messageObject = new stdClass(); + + $messageObject->Comment = $data->comment; + $messageObject->Date = $data->date; + $messageObject->MessageIdentifier = $data->messageIdentifier; + $messageObject->MessageReceivedIdentifier = $data->messageReceivedIdentifier; + + $messageObject->Receiver = $this->getOrganisation($data->receiver); + $messageObject->Sender = $this->getOrganisation($data->sender); + + return $messageObject; + } + + private function getOrganisation($data) + { + $organisationObject = new stdClass(); + $organisationObject->Identifier = new stdClass(); + $organisationObject->Identifier->value = $data->id; + + $organisationObject->OrganizationDescriptiveMetadata = new stdClass(); + $organisationObject->OrganizationDescriptiveMetadata->Name = $data->name; + $organisationObject->OrganizationDescriptiveMetadata->LegalClassification = $data->legalClassification; + + if ($data->address) { + $organisationObject->OrganizationDescriptiveMetadata->Address = $this->getAddress($data->address); + } + + if ($data->communication) { + $organisationObject->OrganizationDescriptiveMetadata->Communication = $this->getCommunication($data->communication); + } + + if ($data->contact) { + $organisationObject->OrganizationDescriptiveMetadata->Contact = $this->getContact($data->contact); + } + + return $organisationObject; + } + + private function getContact($data) + { + $listContact = []; + foreach ($data as $contact) { + $tmpContact = new stdClass(); + $tmpContact->DepartmentName = $contact->departmentName; + $tmpContact->PersonName = $contact->personName; + + if ($contact->address){ + $tmpContact->Address = []; + $tmpContact->Address = $this->getAddress($contact->address); + } + + if ($contact->communication) { + $tmpContact->Communication = []; + $tmpContact->Communication = $this->getCommunication($contact->communication); + } + $listContact[] = $tmpContact; + } + return $listContact; + } -} \ No newline at end of file + private function getAddress($data) + { + $listAddress = []; + foreach ($data as $address) { + $tmpAddress = new stdClass(); + $tmpAddress->CityName = $address->cityName; + $tmpAddress->Country = $address->country; + $tmpAddress->PostCode = $address->postCode; + $tmpAddress->StreetName = $address->streetName; + + $listAddress[] = $tmpAddress; + } + return $listAddress; + } + + private function getCommunication($data) + { + $listCommunication = []; + foreach ($data as $communication) { + $tmpCommunication = new stdClass(); + $tmpCommunication->Channel = $communication->channel; + + if ($communication->completeNumber) { + $tmpCommunication->value = $communication->completeNumber; + } else { + $tmpCommunication->value = $communication->URIID; + } + $listCommunication[] = $tmpCommunication; + } + return $listCommunication; + } +} diff --git a/modules/export_seda/class/ArchiveTransfer.php b/modules/export_seda/class/ArchiveTransfer.php old mode 100755 new mode 100644 index c033e85b45b1fea0b85a977b39a90c8aa47ae572..03bd949c5d53966f36048d0c921ff689ec1b04ad --- a/modules/export_seda/class/ArchiveTransfer.php +++ b/modules/export_seda/class/ArchiveTransfer.php @@ -26,11 +26,45 @@ require_once __DIR__ . '/AbstractMessage.php'; class ArchiveTransfer { private $db; + private $abstractMessage; + private $externalLink; + private $xml; + protected $entities; public function __construct() { $this->db = new RequestSeda(); + $this->abstractMessage = new AbstractMessage(); $_SESSION['error'] = ""; + + $getXml = false; + $path = ''; + if (file_exists( + $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' + )) { + $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } elseif (file_exists( + $_SESSION['config']['corepath'] . 'modules' + . DIRECTORY_SEPARATOR . 'export_seda'. DIRECTORY_SEPARATOR . 'xml' + . DIRECTORY_SEPARATOR . 'config.xml' + )) { + $path = $_SESSION['config']['corepath'] . 'modules' . DIRECTORY_SEPARATOR . 'export_seda' + . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml'; + $getXml = true; + } + + if ($getXml) { + $this->xml = simplexml_load_file($path); + } + + $this->entities = []; } public function receive($listResId) @@ -42,8 +76,24 @@ class ArchiveTransfer $messageObject = new stdClass(); $messageObject = $this->initMessage($messageObject); - $result = ''; + if (!empty($_SESSION['error'])) { + return; + } + + $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[] = $this->getArchiveUnit( + "RecordGrp", + null, + null, + 'group_1', + null, + null + ); + + $result = $startDate = $endDate = ''; + $i = 1; foreach ($listResId as $resId) { + $this->externalLink = false; + if (!empty($result)) { $result .= ','; } @@ -51,44 +101,165 @@ class ArchiveTransfer $letterbox = $this->db->getLetter($resId); $attachments = $this->db->getAttachments($letterbox->res_id); + $notes = $this->db->getNotes($letterbox->res_id); + $mails = $this->db->getMails($letterbox->res_id); + $links = $this->db->getLinks($letterbox->res_id); + + $relatedObjectReference = []; + if (is_array($links)) { + foreach ($links as $link) { + if (!array_search($link, $listResId)) { + $relatedObjectReference[$link] = false; + } else { + $relatedObjectReference[$link] = true; + } + } + } else { + if (!array_search($links, $listResId)) { + $relatedObjectReference[$links] = false; + } else { + $relatedObjectReference[$links] = true; + } + } - $archiveUnitId = uniqid(); + $archiveUnitId = 'letterbox_' . $resId; if ($letterbox->filename) { - $messageObject->dataObjectPackage->descriptiveMetadata[] = $this->getArchiveUnit($letterbox, "File", $attachments, $archiveUnitId, $letterbox->res_id, null); - $messageObject->dataObjectPackage->binaryDataObject[] = $this->getBinaryDataObject($letterbox); + $docServers = $this->db->getDocServer($letterbox->docserver_id); + $uri = str_replace("##", DIRECTORY_SEPARATOR, $letterbox->path); + $uri = str_replace("#", DIRECTORY_SEPARATOR, $uri); + $uri .= $letterbox->filename; + $filePath = $docServers->path_template . $uri; + + if (!file_exists($filePath)) { + $_SESSION['error'] = _ERROR_FILE_NOT_EXIST; + return; + } + + $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->ArchiveUnit[] = $this->getArchiveUnit( + "File", + $letterbox, + $attachments, + $archiveUnitId, + $letterbox->res_id, + $relatedObjectReference + ); + + $messageObject->DataObjectPackage->BinaryDataObject[] = $this->getBinaryDataObject( + $filePath, + $_SESSION['collections'][0]['table'] . '_' . $letterbox->res_id + ); } else { - $messageObject->dataObjectPackage->descriptiveMetadata[] = $this->getArchiveUnit($letterbox, "File"); + $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->ArchiveUnit[] = $this->getArchiveUnit( + "File", + $letterbox, + null, + null, + null, + $relatedObjectReference + ); } if ($attachments) { + $j = 1; foreach ($attachments as $attachment) { - //if ($attachment->attachment_type == "simple_attachment" || $attachment->attachment_type == "signed_response") { + $docServers = $this->db->getDocServer($attachment->docserver_id); + + $uri = str_replace("##", DIRECTORY_SEPARATOR, $attachment->path); + $uri = str_replace("#", DIRECTORY_SEPARATOR, $uri); + $uri .= $attachment->filename; + + $filePath = $docServers->path_template . $uri; if ($attachment->attachment_type == "signed_response") { - $messageObject->dataObjectPackage->descriptiveMetadata[] = $this->getArchiveUnit($attachment, "Response", null, null, "response_" . $attachment->res_id, "arch_" . $archiveUnitId); - $messageObject->dataObjectPackage->binaryDataObject[] = $this->getBinaryDataObject($attachment, "response"); + $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->ArchiveUnit[] = $this->getArchiveUnit( + "Response", + $attachment, + null, + 'attachment_'. $i. '_'. $j, + "response_" . $attachment->res_id, + $archiveUnitId + ); + + $messageObject->DataObjectPackage->BinaryDataObject[] = $this->getBinaryDataObject( + $filePath, + $_SESSION['collections'][1]['table'] . '_'. $attachment->res_id + ); + $j++; } else { - $messageObject->dataObjectPackage->binaryDataObject[] = $this->getBinaryDataObject($attachment, "attachment"); + $messageObject->DataObjectPackage->BinaryDataObject[] = $this->getBinaryDataObject( + $filePath, + $_SESSION['collections'][1]['table']. '_'. $attachment->res_id + ); } + } + } + if ($notes) { + foreach ($notes as $note) { + $id = 'note_'.$note->id; + $filePath = $_SESSION['config']['tmppath']. DIRECTORY_SEPARATOR. $id. '.pdf'; - //} + $this->abstractMessage->createPDF($id, $note->note_text); + $messageObject->DataObjectPackage->BinaryDataObject[] = $this->getBinaryDataObject($filePath, $id); } } - } - $messageId = $this->db->insertMessage($messageObject, "ArchiveTransfer"); + if ($mails) { + foreach ($mails as $mail) { + $id = 'email_'.$mail->email_id; + $filePath = $_SESSION['config']['tmppath']. DIRECTORY_SEPARATOR. $id. '.pdf'; + $body = str_replace('###', ';', $mail->email_body); + $data = 'email n°' . $mail->email_id . ' +' .'de ' . $mail->sender_email . ' +' . 'à ' . $mail->to_list . ' +' . 'objet : ' . $mail->email_object . ' +' . 'corps : ' . strip_tags(html_entity_decode($body)); + + $this->abstractMessage->createPDF($id, $data); + $messageObject->DataObjectPackage->BinaryDataObject[] = $this->getBinaryDataObject($filePath, $id); + } + } - foreach ($listResId as $resId) { - $this->db->insertUnitIdentifier($messageId, "res_letterbox", $resId); + $format = 'Y-m-d H:i:s.u'; + $creationDate = DateTime::createFromFormat($format, $letterbox->creation_date); + if ($startDate == '') { + $startDate = $creationDate; + } elseif ( date_diff($startDate, $creationDate) > 0 ) { + $startDate = $creationDate; + } + + $modificationDate = DateTime::createFromFormat($format, $letterbox->modification_date); + if ($endDate == '') { + $endDate = $modificationDate; + } elseif ( date_diff($endDate, $modificationDate) < 0) { + $endDate = $modificationDate; + } + + $i++; } - if ($messageId) { - $abstractMessage = new AbstractMessage(); - $abstractMessage->saveXml($messageObject,"ArchiveTransfer",".xml"); + $originator = ""; + foreach ($messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->ArchiveUnit as $archiveUnit) { + if (!empty($archiveUnit->Content->OriginatingAgency->Identifier->value)) { + $originator = $archiveUnit->Content->OriginatingAgency->Identifier->value; + break; + } + } - $this->sendAttachment($messageObject); + if (!empty($originator)) { + $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->Content->OriginatingAgency = new stdClass(); + $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->Content->OriginatingAgency->Identifier = new stdClass(); + $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->Content->OriginatingAgency->Identifier->value = $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->ArchiveUnit[0]->Content->OriginatingAgency->Identifier->value; } else { - return false; + $_SESSION['error'] = _ERROR_ORIGINATOR_EMPTY; + } + + $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->Content->StartDate = $startDate->format('Y-m-d'); + $messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->Content->EndDate = $endDate->format('Y-m-d'); + + $messageId = $this->saveMessage($messageObject); + + foreach ($listResId as $resId) { + $this->db->insertUnitIdentifier($messageId, "res_letterbox", $resId); } return $result; @@ -117,63 +288,112 @@ class ArchiveTransfer return true; } - private function sendAttachment($messageObject) + private function saveMessage($messageObject) { - $messageId = $messageObject->messageIdentifier->value; + $data = new stdClass(); - foreach ($messageObject->dataObjectPackage->binaryDataObject as $binaryDataObject) { - $basename = basename($binaryDataObject->uri); - $dest = __DIR__ . DIRECTORY_SEPARATOR . '..'. DIRECTORY_SEPARATOR.'message' . DIRECTORY_SEPARATOR . $messageId . DIRECTORY_SEPARATOR . $basename; + $data->messageId = $messageObject->MessageIdentifier->value; + $data->date = $messageObject->Date; - copy($binaryDataObject->uri, $dest); - } + $data->messageIdentifier = new stdClass(); + $data->messageIdentifier->value = $messageObject->MessageIdentifier->value; + + $data->transferringAgency = new stdClass(); + $data->transferringAgency->identifier = new stdClass(); + $data->transferringAgency->identifier->value = $messageObject->TransferringAgency->Identifier->value; + + $data->archivalAgency = new stdClass(); + $data->archivalAgency->identifier = new stdClass(); + $data->archivalAgency->identifier->value = $messageObject->ArchivalAgency->Identifier->value; + + $data->archivalAgreement = new stdClass(); + $data->archivalAgreement->value = $messageObject->ArchivalAgreement->value; + + $data->replyCode = new stdClass(); + $data->replyCode->value = $messageObject->ReplyCode->value; + + $aArgs = []; + $aArgs['fullMessageObject'] = $messageObject; + $aArgs['SenderOrgNAme'] = ""; + $aArgs['RecipientOrgNAme'] = ""; + + $messageId = $this->db->insertMessage($data, "ArchiveTransfer", $aArgs); + + return $messageId; } private function initMessage($messageObject) { + + $this->directoryMessage = (string) $this->xml->CONFIG->directoryMessage; + + if (!$this->directoryMessage || !is_dir($this->directoryMessage)) { + $_SESSION['error'] .= _DIRECTORY_MESSAGE_REQUIRED; + return; + } + $date = new DateTime; - $messageObject->date = $date->format(DateTime::ATOM); - $messageObject->messageIdentifier = new stdClass(); - $messageObject->messageIdentifier->value = $_SESSION['user']['UserId'] . "-" . date('Ymd-His'); + $messageObject->Date = $date->format(DateTime::ATOM); + $messageObject->MessageIdentifier = new stdClass(); + $messageObject->MessageIdentifier->value = $_SESSION['user']['UserId'] . "-" . date('Ymd-His'); + + $messageObject->TransferringAgency = new stdClass(); + $messageObject->TransferringAgency->Identifier = new stdClass(); + + $messageObject->ArchivalAgency = new stdClass(); + $messageObject->ArchivalAgency->Identifier = new stdClass(); - $messageObject->transferringAgency = new stdClass(); - $messageObject->transferringAgency->identifier = new stdClass(); + $messageObject->ArchivalAgreement = new stdClass(); - $messageObject->archivalAgency = new stdClass(); - $messageObject->archivalAgency->identifier = new stdClass(); + foreach ($_SESSION['user']['entities'] as $entity) { + $res = array_key_exists($entity['ENTITY_ID'], $this->entities); + if ($res === false) { + $this->entities[$entity['ENTITY_ID']] = $entity = $this->db->getEntity($entity['ENTITY_ID']); + } else { + $entity = $this->entities[$entity['ENTITY_ID']]; + } - $messageObject->archivalAgreement = new stdClass(); + if ($entity) { + if (!(string) $this->xml->CONFIG->senderOrgRegNumber) { + $_SESSION['error'] .= _TRANSFERRING_AGENCY_SIREN_REQUIRED; + } - foreach ($_SESSION['user']['entities'] as $entitie) { - $entitie = $this->db->getEntitie($entitie['ENTITY_ID']); - if ($entitie) { - $messageObject->transferringAgency->identifier->value = $entitie->business_id; - $messageObject->archivalAgency->identifier->value = $entitie->archival_agency; + if (!$entity->archival_agency) { + $_SESSION['error'] .= _ARCHIVAL_AGENCY_SIREN_REQUIRED; + } - if (!$entitie->business_id) { - $_SESSION['error'] .= _TRANSFERRING_AGENCY_SIREN_COMPULSORY; + if (!$entity->archival_agreement) { + $_SESSION['error'] .= _ARCHIVAL_AGREEMENT_REQUIRED; } - if (!$entitie->archival_agency) { - $_SESSION['error'] .= _ARCHIVAL_AGENCY_SIREN_COMPULSORY; + if (!empty($_SESSION['error'])) { + return; } - $messageObject->archivalAgreement->value = $entitie->archival_agreement; + $messageObject->TransferringAgency->Identifier->value = (string) $this->xml->CONFIG->senderOrgRegNumber; + $messageObject->ArchivalAgency->Identifier->value = $entity->archival_agency; + $messageObject->ArchivalAgreement->value = $entity->archival_agreement; } else { $_SESSION['error'] .= _NO_ENTITIES; } } - $messageObject->dataObjectPackage = new stdClass(); - $messageObject->dataObjectPackage->binaryDataObject = []; - $messageObject->dataObjectPackage->descriptiveMetadata = []; - $messageObject->dataObjectPackage->managementMetadata = new stdClass(); + $messageObject->DataObjectPackage = new stdClass(); + $messageObject->DataObjectPackage->BinaryDataObject = []; + $messageObject->DataObjectPackage->DescriptiveMetadata = new stdClass(); + $messageObject->DataObjectPackage->ManagementMetadata = new stdClass(); return $messageObject; } - private function getArchiveUnit($object, $type, $attachments = null, $archiveUnitId = null, $dataObjectReferenceId = null, $relatedObjectReference = null) - { + private function getArchiveUnit( + $type, + $object = null, + $attachments = null, + $archiveUnitId = null, + $dataObjectReferenceId = null, + $relatedObjectReference = null + ) { $archiveUnit = new stdClass(); if ($archiveUnitId) { @@ -182,171 +402,314 @@ class ArchiveTransfer $archiveUnit->id = uniqid(); } - if ($relatedObjectReference) { - $archiveUnit->content = $this->getContent($object, $type, $relatedObjectReference); + if (isset($object)) { + if ($relatedObjectReference) { + $archiveUnit->Content = $this->getContent($type, $object, $relatedObjectReference); + } else { + $archiveUnit->Content = $this->getContent($type, $object); + } + + $archiveUnit->Management = $this->getManagement($object); } else { - $archiveUnit->content = $this->getContent($object, $type); + $archiveUnit->Content = $this->getContent($type); + $archiveUnit->Management = $this->getManagement(); } - if ($object->type_id != 0) { - $archiveUnit->management = $this->getManagement($object); - } if ($dataObjectReferenceId) { - $archiveUnit->dataObjectReference = new stdClass(); - $archiveUnit->dataObjectReference->dataObjectReferenceId = "doc_" . $dataObjectReferenceId; + $archiveUnit->DataObjectReference = new stdClass(); + if ($type == 'File') { + $archiveUnit->DataObjectReference->DataObjectReferenceId = $_SESSION['collections'][0]['table'] . '_' .$dataObjectReferenceId; + } elseif ($type == 'Note') { + $archiveUnit->DataObjectReference->DataObjectReferenceId = 'note_' .$dataObjectReferenceId; + } elseif ($type == 'Email') { + $archiveUnit->DataObjectReference->DataObjectReferenceId = 'email_' .$dataObjectReferenceId; + } else { + $archiveUnit->DataObjectReference->DataObjectReferenceId = $_SESSION['collections'][1]['table'] . '_' .$dataObjectReferenceId; + } + } + $archiveUnit->ArchiveUnit = []; if ($attachments) { - $archiveUnit->archiveUnit = []; + $i = 1; foreach ($attachments as $attachment) { if ($attachment->res_id_master == $object->res_id) { if ($attachment->attachment_type != "signed_response") { - $archiveUnit->archiveUnit[] = $this->getArchiveUnit($attachment, "Item", null, null, "attachment_" . $attachment->res_id); + $archiveUnit->ArchiveUnit[] = $this->getArchiveUnit( + "Item", + $attachment, + null, + $archiveUnitId. '_attachment_' . $i, + $attachment->res_id + ); } } + $i++; } - if (count($archiveUnit->archiveUnit) == 0) { - unset($archiveUnit->archiveUnit); + } + + if ($object->res_id) { + if ($type != 'Note' && $type != 'Email') { + $notes = $this->db->getNotes($object->res_id); + if ($notes) { + $i = 1; + foreach ($notes as $note) { + $note->title = 'Note n° ' . $note->id; + $archiveUnit->ArchiveUnit[] = $this->getArchiveUnit( + "Note", + $note, + null, + $archiveUnitId . '_note_' . $i, + $note->id + ); + $i++; + } + } } + + if ($type != 'Email' && $type != 'Note') { + $emails = $this->db->getMails($object->res_id); + if ($emails) { + $i = 1; + foreach ($emails as $email) { + $email->title = 'Email n° ' . $email->email_id; + $archiveUnit->ArchiveUnit[] = $this->getArchiveUnit( + "Email", + $email, + null, + $archiveUnitId . '_email_' . $i, + $email->email_id + ); + $i++; + } + } + } + } + if (count($archiveUnit->ArchiveUnit) == 0) { + unset($archiveUnit->ArchiveUnit); } return $archiveUnit; } - private function getContent($object, $type, $relatedObjectReference = null) + private function getContent($type, $object = null, $relatedObjectReference = null) { $content = new stdClass(); - if ($type == "File") { - $content->descriptionLevel = $type; + switch ($type) { + case 'RecordGrp': + $content->DescriptionLevel = $type; + $content->Title = []; + $content->DocumentType = 'Dossier'; + + return $content; + break; + case 'File': + $content->DescriptionLevel = $type; + + $sentDate = new DateTime($object->doc_date); + $receivedDate = new DateTime($object->admission_date); + $acquiredDate = new DateTime($object->creaction_date); + $content->SentDate = $sentDate->format(DateTime::ATOM); + $content->ReceivedDate = $receivedDate->format(DateTime::ATOM); + $content->AcquiredDate = $acquiredDate->format(DateTime::ATOM); + + $content->Addressee = []; + $content->Keyword = []; + + $keyword = $addressee = $entity = ""; + + if ($object->destination) { + $res = array_key_exists($object->destination, $this->entities); + if ($res === false) { + $this->entities[$object->destination] = $entity = $this->db->getEntity($object->destination); + } else { + $entity = $this->entities[$object->destination]; + } + } - $content->receivedDate = $object->admission_date; - $sentDate = new DateTime($object->doc_date); - $receivedDate = new DateTime($object->admission_date); - $acquiredDate = new DateTime(); - $content->sentDate = $sentDate->format(DateTime::ATOM); - $content->receivedDate = $receivedDate->format(DateTime::ATOM); - $content->acquiredDate = $acquiredDate->format(DateTime::ATOM); + if ($object->exp_contact_id) { + $contact = $this->db->getContact($object->exp_contact_id); + $keyword = $this->getKeyword($contact); + $addressee = $this->getAddresse($entity, "entity"); + } elseif ($object->dest_contact_id) { + $contact = $this->db->getContact($object->dest_contact_id); + $addressee = $this->getAddresse($contact); + $keyword = $this->getKeyword($entity, "entity"); + } elseif ($object->exp_user_id) { + $user = $this->db->getUserInformation($object->exp_user_id); + $keyword = $this->getKeyword($user); + $addressee = $this->getAddresse($entity, "entity"); + } - $content->addressee = []; - $content->keyword = []; + if (!empty($keyword)) { + $content->Keyword[] = $keyword; + } - if ($object->exp_contact_id) { + if (!empty($addressee)) { + $content->Addressee[] = $addressee; + } - $contact = $this->db->getContact($object->exp_contact_id); - $entitie = $this->db->getEntitie($object->destination); + $content->Source = $_SESSION['mail_nature'][$object->nature_id]; + + $content->DocumentType = $object->type_label; + $content->OriginatingAgencyArchiveUnitIdentifier = $object->alt_identifier; + $content->OriginatingSystemId = $object->res_id; + + $content->Title = []; + $content->Title[] = $object->subject; + break; + case 'Item': + case 'Attachment': + case 'Response': + case 'Note': + case 'Email': + $content->DescriptionLevel = "Item"; + $content->Title = []; + $content->Title[] = $object->title; + + if ($type == "Item") { + $content->DocumentType = "Pièce jointe"; + $date = new DateTime($object->creation_date); + $content->CreatedDate = $date->format('Y-m-d'); + } elseif ($type == "Note") { + $content->DocumentType = "Note"; + $date = new DateTime($object->date_note); + $content->CreatedDate = $date->format('Y-m-d'); + } elseif ($type == "Email") { + $content->DocumentType = "Courriel"; + $date = new DateTime($object->creation_date); + $content->CreatedDate = $date->format('Y-m-d'); + } elseif ($type == "Response") { + $content->DocumentType = "Réponse"; + $date = new DateTime($object->creation_date); + $content->CreatedDate = $date->format('Y-m-d'); + } - $content->keyword[] = $this->getKeyword($contact); - $content->addressee[] = $this->getAddresse($entitie, "entitie"); - } else if ($object->dest_contact_id) { - $contact = $this->db->getContact($object->dest_contact_id); - $entitie = $this->db->getEntitie($object->destination); + break; + } - $content->addressee[] = $this->getAddresse($contact); - $content->keyword[] = $this->getKeyword($entitie, "entitie"); - } else if ($object->exp_user_id) { - $user = $this->db->getUserInformation($object->exp_user_id); - $entitie = $this->db->getEntitie($object->initiator); - //$entitie = $this->getEntitie($letterbox->destination); + if (isset($relatedObjectReference)) { + $content->RelatedObjectReference = new stdClass(); + $content->RelatedObjectReference->References = []; - $content->keyword[] = $this->getKeyword($user); - $content->addressee[] = $this->getAddresse($entitie, "entitie"); + foreach ($relatedObjectReference as $key => $value) { + $reference = new stdClass(); + if ($value) { + $reference->ArchiveUnitRefId = 'letterbox_' . $key; + $content->RelatedObjectReference->References[] = $reference; + } else { + $destination = $this->db->getDestinationLetter($key); + if (isset($destination)) { + $res = array_key_exists($destination, $this->entities); + if ($res === false) { + $this->entities[$destination] = $entity = $this->db->getEntity($destination); + } else { + $entity = $this->entities[$destination]; + } + + $reference->RepositoryArchiveUnitPID = 'originator:' . $entity->business_id . ':' . $key; + $content->RelatedObjectReference->References[] = $reference; + } + } } - $content->source = $_SESSION['mail_nature'][$object->nature_id]; - - $content->documentType = $object->type_label; - $content->originatingAgencyArchiveUnitIdentifier = $object->alt_identifier; - $content->originatingSystemId = $object->res_id; - - $content->title = []; - $content->title[] = $object->subject; - - } else { - $content->descriptionLevel = "Item"; - $content->title = []; - $content->title[] = $object->title; - $content->originatingSystemId = $object->res_id; - $content->documentType = "Attachment"; - - if ($type == "Response") { - $content->documentType = "Reply"; - + } - $content->relatedObjectReference = new stdClass(); - $content->relatedObjectReference->references = []; + if (isset($object->destination)) { + $content->OriginatingAgency = new stdClass(); + $content->OriginatingAgency->Identifier = new stdClass(); - $reference = new stdClass(); - $reference->archiveUnitRefId = $relatedObjectReference; - $content->relatedObjectReference->references[] = $reference; + $res = array_key_exists($object->destination, $this->entities); + if ($res === false) { + $this->entities[$object->destination] = $entity = $this->db->getEntity($object->destination); + } else { + $entity = $this->entities[$object->destination]; + } + $content->OriginatingAgency->Identifier->value = $entity->business_id; + if (empty($content->OriginatingAgency->Identifier->value)) { + unset($content->OriginatingAgency); } } - if (isset($object->initiator)) { - $content->originatingAgency = new stdClass(); - $content->originatingAgency->identifier = new stdClass(); - $content->originatingAgency->identifier->value = $this->db->getEntitie($object->initiator)->business_id; - } + if (isset($object->res_id)) { + $content->CustodialHistory = new stdClass(); + $content->CustodialHistory->CustodialHistoryItem = []; - /*$notes = $this->getNotes($letterbox->res_id); - $content->custodialHistory = new stdClass(); - $content->custodialHistory->custodialHistoryItem = []; + $histories = $this->db->getHistory($_SESSION['collections'][0]['view'], $object->res_id); + foreach ($histories as $history) { + if ($history->event_type != 'VIEW') { + $content->CustodialHistory->CustodialHistoryItem[] = $this->getCustodialHistoryItem($history); + } + } - foreach ($notes as $note) { - $content->custodialHistory->custodialHistoryItem[] = $this->getCustodialHistoryItem($note); - }*/ + if (count($content->CustodialHistory->CustodialHistoryItem) == 0) { + unset($content->CustodialHistory); + } + } return $content; } - private function getManagement($letterbox) + private function getManagement($letterbox = null) { $management = new stdClass(); - $docTypes = $this->db->getDocTypes($letterbox->type_id); + if ($letterbox && $letterbox->type_id != 0) { + $docTypes = $this->db->getDocTypes($letterbox->type_id); - $management->appraisalRule = new stdClass(); - $management->appraisalRule->rule = new stdClass(); - $management->appraisalRule->rule->value = $docTypes->retention_rule; - if ($docTypes->retention_final_disposition == "preservation") { - $management->appraisalRule->finalAction = "Keep"; - } else { - $management->appraisalRule->finalAction = "Destroy"; + $management->AppraisalRule = new stdClass(); + $management->AppraisalRule->Rule = new stdClass(); + $management->AppraisalRule->Rule->value = $docTypes->retention_rule; + $management->AppraisalRule->StartDate = date("Y-m-d"); + if ($docTypes->retention_final_disposition == "conservation") { + $management->AppraisalRule->FinalAction = "Keep"; + } else { + $management->AppraisalRule->FinalAction = "Destroy"; + } } + if ((string) $this->xml->CONFIG->accessRuleCode) { + $management->AccessRule = new stdClass(); + $management->AccessRule->Rule = new stdClass(); + $management->AccessRule->Rule->value = (string)$this->xml->CONFIG->accessRuleCode; + $management->AccessRule->StartDate = date("Y-m-d"); + } return $management; } - private function getBinaryDataObject($object, $attachment = false) + private function getBinaryDataObject($filePath, $id) { - $docServers = $this->db->getDocServer($object->docserver_id); - $binaryDataObject = new stdClass(); - if ($attachment) { - $binaryDataObject->id = $attachment . "_" . $object->res_id; + $pathInfo = pathinfo($filePath); + + if ($id && $id != $pathInfo['filename']) { + $filename = $pathInfo['filename'] . '_' . $id . '.' . $pathInfo['extension']; } else { - $binaryDataObject->id = $object->res_id; + $filename = $pathInfo['filename'] . '_' . rand() . '.' . $pathInfo['extension']; } - $binaryDataObject->messageDigest = new stdClass(); - $binaryDataObject->messageDigest->value = $object->fingerprint; - $binaryDataObject->messageDigest->algorithm = "sha256"; + $binaryDataObject->id = $id; + $binaryDataObject->Uri = $filePath; + $binaryDataObject->MessageDigest = new stdClass(); + $binaryDataObject->MessageDigest->value = hash_file('sha256', $filePath); + $binaryDataObject->MessageDigest->algorithm = "sha256"; + $binaryDataObject->Size = filesize($filePath); - $binaryDataObject->size = new stdClass(); - $binaryDataObject->size->value = $object->filesize; - $uri = str_replace("##", DIRECTORY_SEPARATOR, $object->path); - $uri = str_replace("#", DIRECTORY_SEPARATOR, $uri); - $uri .= $object->filename; - $binaryDataObject->uri = $docServers->path_template . $uri; + $binaryDataObject->Attachment = new stdClass(); + $binaryDataObject->Attachment->filename = $filename; - $binaryDataObject->fileInfo = new stdClass(); - $binaryDataObject->fileInfo->filename = basename($binaryDataObject->uri); + $binaryDataObject->FileInfo = new stdClass(); + $binaryDataObject->FileInfo->Filename = $filename; + + $binaryDataObject->FormatIdentification = new stdClass(); + $binaryDataObject->FormatIdentification->MimeType = mime_content_type($filePath); return $binaryDataObject; } @@ -354,17 +717,21 @@ class ArchiveTransfer private function getKeyword($informations, $type = null) { $keyword = new stdClass(); - $keyword->keywordContent = new stdClass(); - - if ($type == "entitie") { - $keyword->keywordType = "corpname"; - $keyword->keywordContent->value = $informations->business_id; - } else if ($informations->is_corporate_person == "Y") { - $keyword->keywordType = "corpname"; - $keyword->keywordContent->value = $informations->society; + $keyword->KeywordContent = new stdClass(); + + if ($type == "entity") { + $keyword->KeywordType = "corpname"; + $keyword->KeywordContent->value = $informations->business_id; + } elseif ($informations->is_corporate_person == "Y") { + $keyword->KeywordType = "corpname"; + $keyword->KeywordContent->value = $informations->society; } else { - $keyword->keywordType = "persname"; - $keyword->keywordContent->value = $informations->lastname . " " . $informations->firstname; + $keyword->KeywordType = "persname"; + $keyword->KeywordContent->value = $informations->lastname . " " . $informations->firstname; + } + + if (empty($keyword->KeywordContent->value)) { + return null; } return $keyword; @@ -373,104 +740,138 @@ class ArchiveTransfer private function getAddresse($informations, $type = null) { $addressee = new stdClass(); - if ($type == "entitie") { - $addressee->corpname = $informations->entity_label; - $addressee->identifier = $informations->business_id; - } else if ($informations->is_corporate_person == "Y") { - $addressee->corpname = $informations->society; - $addressee->identifier = $informations->contact_id; + if ($type == "entity") { + $addressee->Corpname = $informations->entity_label; + $addressee->Identifier = $informations->business_id; + } elseif ($informations->is_corporate_person == "Y") { + $addressee->Corpname = $informations->society; + $addressee->Identifier = $informations->contact_id; } else { - $addressee->firstName = $informations->firstname; - $addressee->birthName = $informations->lastname; + $addressee->FirstName = $informations->firstname; + $addressee->BirthName = $informations->lastname; } + if ((empty($addressee->Identifier) || empty($addressee->Corpname)) && (empty($addressee->FirstName) || empty($addressee->BirthName))) { + return null; + } return $addressee; } - private function getCustodialHistoryItem($note) + private function getCustodialHistoryItem($history) { - $custodialHistoryItem = new stdClass(); + $date = new DateTime($history->event_date); - $custodialHistoryItem->value = $note->note_text; - $custodialHistoryItem->when = $note->date_note; + $custodialHistoryItem = new stdClass(); + $custodialHistoryItem->value = $history->info; + $custodialHistoryItem->when = $date->format('Y-m-d'); return $custodialHistoryItem; } - private function getEntitie($entityId, $param) { - $entitie = $this->db->getEntitie($entityId); + private function getEntity($entityId, $param) + { + $res = array_key_exists($entityId, $this->entities); + if ($res === false) { + $this->entities[$entityId] = $entity = $this->db->getEntity($entityId); + } else { + $entity = $this->entities[$entityId]; + } - if (!$entitie) { + if (!$entity) { return false; } - if (!$entitie->business_id) { - $businessId = $this->getEntitieParent($entitie->parent_entity_id,'business_id'); + if (!$entity->business_id) { + $businessId = $this->getEntityParent( + $entity->parent_entity_id, + 'business_id' + ); if (!$businessId) { return false; } - $entitie->business_id = $businessId; + $entity->business_id = $businessId; } - if (!$entitie->archival_agreement) { - $archivalAgreement = $this->getEntitieParent($entitie->parent_entity_id,'archival_agreement'); + if (!$entity->archival_agreement) { + $archivalAgreement = $this->getEntityParent( + $entity->parent_entity_id, + 'archival_agreement' + ); if (!$archivalAgreement) { return false; } - $entitie->archival_agreement = $archivalAgreement; + $entity->archival_agreement = $archivalAgreement; } - if (!$entitie->archival_agency) { - $archivalAgency = $this->getEntitieParent($entitie->parent_entity_id,'archival_agency'); + if (!$entity->archival_agency) { + $archivalAgency = $this->getEntityParent( + $entity->parent_entity_id, + 'archival_agency' + ); if (!$archivalAgency) { return false; } - $entitie->archival_agency = $archivalAgency; + $entity->archival_agency = $archivalAgency; } - return $entitie; + return $entity; } - private function getEntitieParent($parentId,$param) { - $entitie = $this->db->getEntitie($parentId); + private function getEntityParent($parentId, $param) + { + $res = array_key_exists($parentId, $this->entities); + if ($res === false) { + $this->entities[$parentId] = $entity = $this->db->getEntity($parentId); + } else { + $entity = $this->entities[$parentId]; + } - if (!$entitie) { + if (!$entity) { return false; } $res = false; if ($param == 'business_id') { - if (!$entitie->business_id) { - $res = $this->getEntitieParent($entitie->parent_entity_id,'business_id'); + if (!$entity->business_id) { + $res = $this->getEntityParent( + $entity->parent_entity_id, + 'business_id' + ); } else { - $res = $entitie->business_id; + $res = $entity->business_id; } } if ($param == 'archival_agreement') { - if (!$entitie->archival_agreement) { - $res = $this->getEntitieParent($entitie->parent_entity_id,'archival_agreement'); + if (!$entity->archival_agreement) { + $res = $this->getEntityParent( + $entity->parent_entity_id, + 'archival_agreement' + ); } else { - $res = $entitie->archival_agreement; + $res = $entity->archival_agreement; } } if ($param == 'archival_agency') { - if (!$entitie->archival_agency) { - $res = $this->getEntitieParent($entitie->parent_entity_id,'archival_agency'); + if (!$entity->archival_agency) { + $res = $this->getEntityParent( + $entity->parent_entity_id, + 'archival_agency' + ); } else { - $res = $entitie->archival_agency; + $res = $entity->archival_agency; } } return $res; } -} \ No newline at end of file +} diff --git a/modules/export_seda/class/ArchiveTransferReply.php b/modules/export_seda/class/ArchiveTransferReply.php old mode 100755 new mode 100644 index cde8d0fbbed8d2e8996dd9b75f95e2cd9163a310..957c7ec52445f3680909f063cf05029d644a7a0b --- a/modules/export_seda/class/ArchiveTransferReply.php +++ b/modules/export_seda/class/ArchiveTransferReply.php @@ -20,49 +20,124 @@ */ require_once __DIR__ . DIRECTORY_SEPARATOR .'../DOMTemplateProcessor.php'; +require_once __DIR__ . '/AbstractMessage.php'; class ArchiveTransferReply { + private $db; public function __construct() { + $this->db = new RequestSeda(); } - public function send($data, $resIds) + public function receive($data, $resIds) + { + $messageObject = $this->getMessageObject($data); + $abstractMessage = new AbstractMessage(); + //$this->db->insertMessage($data, "ArchiveTransferReply"); + $abstractMessage->saveXml($messageObject,"ArchiveTransferReply", ".xml"); + + foreach ($resIds as $resId) { + $abstractMessage->addAttachment($messageObject->MessageIdentifier->value, $resId, $messageObject->MessageIdentifier->value.".xml", "xml", "Réponse au transfert",2); + } + } + + private function getMessageObject($data) { - //$xml = simplexml_load_file($fileName); $messageObject = new stdClass(); - if ($data->comments) { - $messageObject->comment = []; - if (is_array($data->comments)) { - foreach ($data->comments as $comment) { - $messageObject->comment[] = $comment; - } - } else { - $messageObject->comment[] = $data->comments; - } + $messageObject->Comment = $data->comment; + $messageObject->Date = $data->date; + $messageObject->MessageIdentifier = new stdClass(); + $messageObject->MessageIdentifier->value = $data->messageIdentifier->value; + + $messageObject->MessageRequestIdentifier = new stdClass(); + $messageObject->MessageRequestIdentifier->value = $data->messageRequestIdentifier->value; + + $messageObject->ReplyCode = $data->replyCode->value . ' : ' . $data->replyCode->name; + + $messageObject->ArchivalAgency = $this->getOrganisation($data->archivalAgency); + $messageObject->TransferringAgency = $this->getOrganisation($data->transferringAgency); + + return $messageObject; + } + + private function getOrganisation($data) + { + $organisationObject = new stdClass(); + $organisationObject->Identifier = new stdClass(); + $organisationObject->Identifier->value = $data->id; + + $organisationObject->OrganizationDescriptiveMetadata = new stdClass(); + $organisationObject->OrganizationDescriptiveMetadata->Name = $data->name; + $organisationObject->OrganizationDescriptiveMetadata->LegalClassification = $data->legalClassification; + + if ($data->address) { + $organisationObject->OrganizationDescriptiveMetadata->Address = $this->getAddress($data->address); } - $messageObject->date = $data->date; - $messageObject->messageIdentifier = new stdClass(); - $messageObject->messageIdentifier->value = $data->reference; + if ($data->communication) { + $organisationObject->OrganizationDescriptiveMetadata->Communication = $this->getCommunication($data->communication); + } - $messageObject->messageReceivedIdentifier = new stdClass(); - $messageObject->messageReceivedIdentifier->value = $data->requestReference; + if ($data->contact) { + $organisationObject->OrganizationDescriptiveMetadata->Contact = $this->getContact($data->contact); + } - $messageObject->sender = new stdClass(); - $messageObject->sender->identifier = new stdClass(); - $messageObject->sender->identifier->value = $data->senderOrgRegNumber; + return $organisationObject; + } - $messageObject->receiver = new stdClass(); - $messageObject->receiver->identifier = new stdClass(); - $messageObject->receiver->identifier->value = $data->recipientOrgRegNumber; + private function getContact($data) + { + $listContact = []; + foreach ($data as $contact) { + $tmpContact = new stdClass(); + $tmpContact->DepartmentName = $contact->departmentName; + $tmpContact->PersonName = $contact->personName; - $this->saveXml($messageObject); + if ($contact->address){ + $tmpContact->Address = []; + $tmpContact->Address = $this->getAddress($contact->address); + } - foreach ($resIds as $resId) { - $this->addAttachment($messageObject->messageIdentifier->value, $resId, $messageObject->messageIdentifier->value.".txt", "txt", "Accusé de reception"); + if ($contact->communication) { + $tmpContact->Communication = []; + $tmpContact->Communication = $this->getCommunication($contact->communication); + } + $listContact[] = $tmpContact; } + return $listContact; } -} \ No newline at end of file + private function getAddress($data) + { + $listAddress = []; + foreach ($data as $address) { + $tmpAddress = new stdClass(); + $tmpAddress->CityName = $address->cityName; + $tmpAddress->Country = $address->country; + $tmpAddress->PostCode = $address->postCode; + $tmpAddress->StreetName = $address->streetName; + + $listAddress[] = $tmpAddress; + } + return $listAddress; + } + + private function getCommunication($data) + { + $listCommunication = []; + foreach ($data as $communication) { + $tmpCommunication = new stdClass(); + $tmpCommunication->Channel = $communication->channel; + + if ($communication->completeNumber) { + $tmpCommunication->value = $communication->completeNumber; + } else { + $tmpCommunication->value = $communication->URIID; + } + $listCommunication[] = $tmpCommunication; + } + return $listCommunication; + } +} diff --git a/modules/export_seda/export_seda.php b/modules/export_seda/export_seda.php old mode 100755 new mode 100644 index e252bafa28fa6220bb23ec14937818489a895cc9..668061a9590a6c9a27489ce90bbdc40849220bc4 --- a/modules/export_seda/export_seda.php +++ b/modules/export_seda/export_seda.php @@ -33,18 +33,18 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $archiveTransfer = new ArchiveTransfer(); $db = new RequestSeda(); foreach ($values as $value) { - $letter = $db->getLetter($value); + $status = $db->getStatusLetter($value); - if ($letter->status == 'SEND_SEDA') { + if ($status == 'SEND_SEDA') { $_SESSION['error'] = _ERROR_MESSAGE_ALREADY_SENT . " " . $value; } } - if (!$_SESSION['error']) { - $result = $archiveTransfer->deleteMessage($values); + $result = $archiveTransfer->deleteMessage($values); - $result = $archiveTransfer->receive($values); + $result = $archiveTransfer->receive($values); + if (!$_SESSION['error']) { $db = new Database(); $stmt = $db->query("select message_id from unit_identifier where res_id = ?", array($values[0])); $unitIdentifier = $stmt->fetchObject(); @@ -56,27 +56,29 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $frm_str = '<div id="frm_error_'.$id_action.'" class="error"></div>'; - $frm_str .= '<h2 class="title">'._MESSAGE.' '. $messageObject->messageIdentifier->value; + $frm_str .= '<h2 class="title">'._MESSAGE.' '. $messageObject->MessageIdentifier->value; $frm_str .= '</h2><br/>'; $frm_str .= '<div class="block forms details" >'; // Information Message - $frm_str .= '<h3 class="title">'._INFORMATION_MESSAGE.'</h3>'; + $frm_str .= '<div align="center"><h3>'. _PACKAGE_TITLE.'</h3><br/>'; + $frm_str .= '<input type="text" id="messageTitle" name="messageTitle" placeholder="'._PACKAGE_TITLE.'"></div><br/>'; + $frm_str .= '<h4 class="title">'._INFORMATION_MESSAGE.'</h4>'; $frm_str .= '<table width="100%" cellspacing="2" cellpading="2" border="0"><tbody><tr class="col"><br/>'; $frm_str .='<td><b>'._MESSAGE_IDENTIFIER.':</b></td>'; - $frm_str .= '<td><input type="text" id="messageIdentifier" name="messageIdentifier" value="'.$messageObject->messageIdentifier->value. '" disabled></td>'; + $frm_str .= '<td><input type="text" id="messageIdentifier" name="messageIdentifier" value="'.$messageObject->MessageIdentifier->value. '" disabled></td>'; $frm_str .='<td><b>'._DATE.':</b></td>'; - $frm_str .= '<td><input type="text" id="date" name="date" value="'.$messageObject->date. '" disabled></td></tr><tr class="col">'; + $frm_str .= '<td><input type="text" id="date" name="date" value="'.$messageObject->Date. '" disabled></td></tr><tr class="col">'; $frm_str .='<td><b>'._ARCHIVAL_AGREEMENT.':</b></td>'; - $frm_str .= '<td><input type="text" id="archivalAgreement" name="archivalAgreement" value="'.$messageObject->archivalAgreement->value. '" disabled></td>'; + $frm_str .= '<td><input type="text" id="archivalAgreement" name="archivalAgreement" value="'.$messageObject->ArchivalAgreement->value. '" disabled></td>'; $frm_str .='<td><b>'._ARCHIVAL_AGENCY_SIREN.':</b></td>'; - $frm_str .= '<td><input type="text" id="archivalAgency" name="archivalAgency" value="'.$messageObject->archivalAgency->identifier->value. '" disabled></td></tr><tr class="col">'; + $frm_str .= '<td><input type="text" id="archivalAgency" name="archivalAgency" value="'.$messageObject->ArchivalAgency->Identifier->value. '" disabled></td></tr><tr class="col">'; $frm_str .='<td><b>'._TRANSFERRING_AGENCY_SIREN.':</b></td>'; - $frm_str .= '<td><input type="text" id="transferringAgency" name="transferringAgency" value="'.$messageObject->transferringAgency->identifier->value. '" disabled></td>'; + $frm_str .= '<td><input type="text" id="transferringAgency" name="transferringAgency" value="'.$messageObject->TransferringAgency->Identifier->value. '" disabled></td>'; $frm_str .= '</tr></tbody></table><hr />'; - foreach ($messageObject->dataObjectPackage->descriptiveMetadata as $archiveUnit) { + foreach ($messageObject->DataObjectPackage->DescriptiveMetadata->ArchiveUnit[0]->ArchiveUnit as $archiveUnit) { $frm_str .= viewArchiveUnit($archiveUnit); } @@ -84,13 +86,14 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $frm_str .= '</div>'; $frm_str .='<div align="center">'; - $frm_str .='<input type="button" name="zip" id="zip" class="button" value="'._ZIP.'" onclick="actionSeda(\''.$path_to_script.'&page=Ajax_seda_zip&reference='.$messageObject->messageIdentifier->value.'\',\'zip\');"/>   '; + //$frm_str .='<input type="button" name="generateMessage" id="generateMessage" class="button" value="'._GENERATE_MESSAGE.'" onclick="actionSeda(\''.$path_to_script.'&page=Ajax_generate_message&reference='.$messageObject->MessageIdentifier->value.'\',\'generateMessage\');"/>   '; + $frm_str .='<input type="button" name="zip" id="zip" class="button" value="'._ZIP.'" onclick="actionSeda(\''.$path_to_script.'&page=Ajax_generate_message&reference='.$messageObject->MessageIdentifier->value.'|'.$path_to_script.'&page=Ajax_seda_zip&reference='.$messageObject->MessageIdentifier->value.'\',\'zip\');"/>   '; if (file_exists(__DIR__.DIRECTORY_SEPARATOR. 'xml' . DIRECTORY_SEPARATOR . "config.xml")) { - $frm_str .= '<input type="button" name="sendMessage" id="sendMessage" class="button" value="' . _SEND_MESSAGE . '" onclick="actionSeda(\'' . $path_to_script . '&page=Ajax_transfer_SAE&reference=' . $messageObject->messageIdentifier->value . '&resIds=' . $result . '\',\'sendMessage\');"/>'; + $frm_str .= '<input type="button" name="sendMessage" id="sendMessage" style="disabled: disabled " class="button" value="' . _SEND_MESSAGE . '" onclick="actionSeda(\''.$path_to_script.'&page=Ajax_generate_message&reference='.$messageObject->MessageIdentifier->value.'|'. $path_to_script . '&page=Ajax_transfer_SAE&reference=' . $messageObject->MessageIdentifier->value . '&resIds=' . $result . '\',\'sendMessage\');"/>'; } $frm_str .='</div>'; - $frm_str .='<div align="center" name="validSend" id="validSend" style="display: none "><input type="button" class="button" name="validateMessage" id="validateMessage" value="'._VALIDATE_MANUAL_DELIVERY.'" onclick="actionSeda(\''.$path_to_script.'&page=Ajax_validate_change_status&reference='.$messageObject->messageIdentifier->value.'\',\'validateMessage\');"/></div>'; + $frm_str .='<div align="center" name="validSend" id="validSend" style="display: none "><input type="button" class="button" name="validateMessage" id="validateMessage" value="'._VALIDATE_MANUAL_DELIVERY.'" onclick="actionSeda(\''.$path_to_script.'&page=Ajax_validate_change_status&reference='.$messageObject->MessageIdentifier->value.'\',\'validateMessage\');"/></div>'; } else { $frm_str .='<div align="center" style="color:red">'; $frm_str .= $_SESSION['error']; @@ -108,46 +111,35 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module, return addslashes($frm_str); } -function manage_form($arr_id, $history, $id_action, $label_action, $status) -{ - // récupérer l'entité racine du courrier * - // récupérer archival_agency et archival_agreement * - - // récupérer la retention_final_disposition et retention_rule du type de doc du courrier * - - // appel fonction de transfert et génération bdx * - - - - // historisation du transfert - - // modification statut -> fait automatiquement par mécanique bannette - - // ensuite il y a aura une suppression logique des documents et des contacts (si plus de courriers associés) - - //return array('result' => $result, 'history_msg' => ''); -} - function viewArchiveUnit($archiveUnit, $archiveUnitChildren = false) { $frm_str = ''; + $frm_str .= '<h4 onclick="new Effect.toggle(\''. $archiveUnit->id .'_fields\', \'blind\', {delay:0.2});' + . 'whatIsTheDivStatus(\''. $archiveUnit->id .'_fields\', \'divStatus_'. $archiveUnit->id .'_fields\');" ' + . 'class="categorie" style="width:90%;" onmouseover="this.style.cursor=\'pointer\';">'; + if (!$archiveUnitChildren) { - $frm_str .= '<h3 class="title">'._INFORMATION_ARCHIVE. ' "'. $archiveUnit->content->title[0].'"</h3>'; + $frm_str .= ' <span id="divStatus_'. $archiveUnit->id .'_fields" style="color:#1C99C5;"><i class="fa fa-plus-square-o"></i></span> ' + . _INFORMATION_ARCHIVE. ' "'. $archiveUnit->Content->Title[0]; } else { - $frm_str .= '<h4 class="title">'._INFORMATION_ARCHIVE_CHILDREN. ' "'. $archiveUnit->content->title[0].'"</h4>'; + $frm_str .= ' <span style="margin-left:2%" id="divStatus_'. $archiveUnit->id .'_fields" style="color:#1C99C5;"><i class="fa fa-plus-square-o"></i></span> ' + . _INFORMATION_ARCHIVE_CHILDREN. ' "'. $archiveUnit->Content->Title[0]; } + + $frm_str .= '</h4>'; + $frm_str .= '<div id="'. $archiveUnit->id .'_fields" style="display:none">'; $frm_str .= '<table width="100%" cellspacing="2" cellpading="2" border="0"><tbody><tr class="col"><br/>'; $frm_str .='<td><b>'._ARCHIVE_IDENTIFIER.':</b></td>'; $frm_str .= '<td><input type="text" id="archiveIdentifier" name="archiveIdentifier" value="'.$archiveUnit->id. '" disabled></td></tr>'; - if ($archiveUnit->management) { + if ($archiveUnit->Management) { $frm_str .='<tr class="col"><td><b>'._APPRAISAL_RULE.':</b></td>'; - $frm_str .= '<td><input type="text" id="rule" name="rule" value="'.$archiveUnit->management->appraisalRule->rule->value. '" disabled></td>'; + $frm_str .= '<td><input type="text" id="rule" name="rule" value="'.$archiveUnit->Management->AppraisalRule->Rule->value. '" disabled></td>'; $frm_str .='<td><b>'._APPRAISAL_FINAL_DISPOSITION.':</b></td>'; - if ($archiveUnit->management->appraisalRule->finalAction == 'Destroy') { + if ($archiveUnit->Management->AppraisalRule->FinalAction == 'Destroy') { $frm_str .= '<td><input type="text" id="finalAction" name="finalAction" value="'._DESTROY. '" disabled></td>'; } else { $frm_str .= '<td><input type="text" id="finalAction" name="finalAction" value="'._KEEP. '" disabled></td>'; @@ -157,43 +149,44 @@ function viewArchiveUnit($archiveUnit, $archiveUnitChildren = false) $frm_str .= '<tr class="col"><td><b>'._DESCRIPTION_LEVEL.':</b></td>'; - if ($archiveUnit->content->descriptionLevel == "File") { + if ($archiveUnit->Content->DescriptionLevel == "File") { $frm_str .= '<td><input type="text" id="descriptionLevel" name="descriptionLevel" value="'._FILE. '" disabled></td>'; - }elseif ($archiveUnit->content->descriptionLevel == "Item") { + }elseif ($archiveUnit->Content->DescriptionLevel == "Item") { $frm_str .= '<td><input type="text" id="descriptionLevel" name="descriptionLevel" value="'._ITEM. '" disabled></td>'; }else { - $frm_str .= '<td><input type="text" id="descriptionLevel" name="descriptionLevel" value="'.$archiveUnit->content->descriptionLevel. '" disabled></td>'; + $frm_str .= '<td><input type="text" id="descriptionLevel" name="descriptionLevel" value="'.$archiveUnit->Content->DescriptionLevel. '" disabled></td>'; } $frm_str .= '<td><b>'._DOCUMENT_TYPE.':</b></td>'; - if ($archiveUnit->content->documentType == "Reply") { + if ($archiveUnit->Content->DocumentType == "Reply") { $frm_str .= '<td><input type="text" id="documentType" name="documentType" value="'._REPLY. '" disabled></td></tr>'; - }elseif ($archiveUnit->content->documentType == "Attachment") { + }elseif ($archiveUnit->Content->DocumentType == "Attachment") { $frm_str .= '<td><input type="text" id="documentType" name="documentType" value="'._ATTACHMENT. '" disabled></td></tr>'; } else { - $frm_str .= '<td><input type="text" id="documentType" name="documentType" value="'.$archiveUnit->content->documentType. '" disabled></td></tr>'; + $frm_str .= '<td><input type="text" id="documentType" name="documentType" value="'.$archiveUnit->Content->DocumentType. '" disabled></td></tr>'; } - - - if ($archiveUnit->content->receivedDate) { - $frm_str .= '<tr class="col"><td><b>'._RECEIVED_DATE.':</b></td>'; - $frm_str .= '<td><input type="text" id="receivedDate" name="receivedDate" value="'.$archiveUnit->content->receivedDate. '" disabled></td>'; + if ($archiveUnit->Content->SentDate) { + $frm_str .= '<tr class="col"><td><b>'._SENT_DATE.':</b></td>'; + $frm_str .= '<td><input type="text" id="sentDate" name="sentDate" value="'.$archiveUnit->Content->SentDate. '" disabled></td>'; } - - if ($archiveUnit->content->sentDate) { - $frm_str .= '<td><b>'._SENT_DATE.':</b></td>'; - $frm_str .= '<td><input type="text" id="sentDate" name="sentDate" value="'.$archiveUnit->content->sentDate. '" disabled></td></tr>'; + + if ($archiveUnit->Content->ReceivedDate) { + $frm_str .= '<td><b>'._RECEIVED_DATE.':</b></td>'; + $frm_str .= '<td><input type="text" id="receivedDate" name="receivedDate" value="'.$archiveUnit->Content->ReceivedDate. '" disabled></td></tr>'; } - - $frm_str .= '</tr></tbody></table>'; - if ($archiveUnit->archiveUnit) { - foreach ($archiveUnit->archiveUnit as $archiveUnitChildren) { + $frm_str .= '</tr></tbody></table><br>'; + + if ($archiveUnit->ArchiveUnit) { + foreach ($archiveUnit->ArchiveUnit as $archiveUnitChildren) { $frm_str .= viewArchiveUnit($archiveUnitChildren,true); } } + $frm_str .= '<div>'; + $frm_str .= '</div></div><br>'; + return $frm_str; } diff --git a/modules/export_seda/export_seda_list.php b/modules/export_seda/export_seda_list.php new file mode 100644 index 0000000000000000000000000000000000000000..401de4ff5806752bd74e3f4ceb751709fd3a37cc --- /dev/null +++ b/modules/export_seda/export_seda_list.php @@ -0,0 +1,578 @@ +<?php +/** +* Copyright Maarch since 2008 under licence GPLv3. +* See LICENCE.txt file at the root folder for more details. +* This file is part of Maarch software. + +* @brief documents_list_with_avis +* @author dev <dev@maarch.org> +* @ingroup avis +*/ + +require_once 'core/class/class_request.php'; +require_once 'core/class/class_security.php'; +require_once 'apps/' . $_SESSION['config']['app_id'] . '/class/class_contacts_v2.php'; +require_once 'core/class/class_manage_status.php'; +require_once 'apps/' . $_SESSION['config']['app_id'] . '/class/class_lists.php'; + +$status_obj = new manage_status(); +$security = new security(); +$core_tools = new core_tools(); +$request = new request(); +$contact = new contacts_v2(); +$list = new lists(); + +//Include definition fields +require_once 'apps/' . $_SESSION['config']['app_id'] . '/definition_mail_categories.php'; + +//Order +$order = $order_field = ''; +$order = $list->getOrder(); +$order_field = $list->getOrderField(); +$_SESSION['save_list']['order'] = $order; +$_SESSION['save_list']['order_field'] = $order_field; +//URL extra Parameters +$parameters = ''; +$start = $list->getStart(); +if (!empty($order_field) && !empty($order)) $parameters .= '&order='.$order.'&order_field='.$order_field; +if (!empty($what)) $parameters .= '&what='.$what; +if (!empty($selectedTemplate)) $parameters .= '&template='.$selectedTemplate; +if (!empty($start)) $parameters .= '&start='.$start; +$_SESSION['save_list']['start'] = $start; + + + +//Keep some parameters +$parameters = ''; +if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { + + $parameters .= '&order='.$_REQUEST['order']; + $_SESSION['save_list']['order'] = $_REQUEST['order']; + + if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { + $parameters .= '&order_field='.$_REQUEST['order_field']; + $_SESSION['save_list']['order_field'] = $_REQUEST['order_field']; + } +} +if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) { + $parameters .= '&what='.$_REQUEST['what']; +} +if (isset($_REQUEST['template']) && !empty($_REQUEST['template'])) { + $parameters .= '&template='.$_REQUEST['template']; +} +if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) { + $parameters .= '&start='.$_REQUEST['start']; + $_SESSION['save_list']['start'] = $_REQUEST['start']; +} + +//URL extra parameters +$urlParameters = ''; + +//origin +if ($_REQUEST['origin'] == 'searching') $urlParameters .= '&origin=searching'; + +//Basket information +if (!empty($_SESSION['current_basket']['view'])) { + $table = $_SESSION['current_basket']['view']; +} else { + $table = $_SESSION['current_basket']['table']; +} +$_SESSION['origin'] = 'basket'; +$_SESSION['collection_id_choice'] = $_SESSION['current_basket']['coll_id'];//Collection + +//Table +$select[$table]= array(); + +//Fields +/*array_push( + $select[$table], "res_id", "status", "category_id as category_img", + "contact_firstname", "contact_lastname", "contact_society", "user_lastname", + "user_firstname", "priority", "creation_date", 'modification_date', "admission_date", "date_current_use", "subject", + "process_limit_date", 'recommendation_limit_date', "entity_label", "dest_user", "category_id", "type_label", + "exp_user_id", "count_attachment", "alt_identifier", "is_multicontacts", "locker_user_id", "locker_time", "address_id" +);*/ + +array_push( + $select[$table], "res_id", "status", "category_id as category_img", + "contact_firstname", "contact_lastname", "contact_society", "user_lastname", + "user_firstname", "priority", "creation_date", 'modification_date', "admission_date", "subject", + "process_limit_date", 'recommendation_limit_date', "entity_label", "dest_user", "category_id", "type_label", + "exp_user_id", "count_attachment", "alt_identifier", "is_multicontacts", "locker_user_id", "locker_time", "address_id" +); + +$arrayPDO = array(); +//Where clause +$where_tab = array(); +//From basket +if (!empty($_SESSION['current_basket']['clause'])) $where_tab[] = '('.stripslashes($_SESSION['current_basket']['clause']).')'; //Basket clause +//From filters +$filterClause = $list->getFilters(); +if (!empty($filterClause)) $where_tab[] = $filterClause;//Filter clause +//From search +if ((isset($_REQUEST['origin']) && $_REQUEST['origin'] == 'searching') + && !empty($_SESSION['searching']['where_request']) +) { + $where_tab[] = $_SESSION['searching']['where_request']. '(1=1)'; + $arrayPDO = array_merge($arrayPDO, $_SESSION['searching']['where_request_parameters']); +} +//Build where +$where = implode(' and ', $where_tab); + +//Order +$order = $order_field = ''; +$order = $list->getOrder(); +$order_field = $list->getOrderField(); +if (!empty($order_field) && !empty($order)) { + if ($_REQUEST['order_field'] == 'alt_identifier') { + $orderstr = "order by order_alphanum(alt_identifier)"." ".$order; + } else { + $orderstr = "order by ".$order_field." ".$order; + } + $_SESSION['last_order_basket'] = $orderstr; +} else if (!empty($_SESSION['save_list']['order']) && !empty($_SESSION['save_list']['order_field'])) { + if ($_SESSION['save_list']['order_field'] == 'alt_identifier') { + $orderstr = "order by order_alphanum(alt_identifier)"." ".$_SESSION['save_list']['order']; + } else { + $orderstr = "order by ".$_SESSION['save_list']['order_field']." ".$_SESSION['save_list']['order']; + } + $_SESSION['last_order_basket'] = $orderstr; +} else { + $list->setOrder(); + $list->setOrderField('modification_date'); + $orderstr = "order by modification_date desc"; + $_SESSION['last_order_basket'] = $orderstr; +} + +//Request +$tab=$request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], $_SESSION['config']['databasesearchlimit'], false, "", "", "", false, false, 'distinct'); +// $request->show(); exit; +//Templates +$defaultTemplate = 'documents_list_with_attachments'; +$selectedTemplate = $list->getTemplate(); +if (empty($selectedTemplate)) { + if (!empty($defaultTemplate)) { + $list->setTemplate($defaultTemplate); + $selectedTemplate = $list->getTemplate(); + } +} + + +//For status icon +$extension_icon = ''; +if($selectedTemplate <> 'none') $extension_icon = "_big"; + +$db = new Database(); + +//Result Array + +$tabI = count($tab); +for ($i=0;$i<$tabI;$i++) { + + $tabJ = count($tab[$i]); + for ($j=0;$j<$tabJ;$j++) { + + foreach (array_keys($tab[$i][$j]) as $value) { + + if ($tab[$i][$j][$value]=="res_id") { + + $tab[$i][$j]["res_id"]=$tab[$i][$j]['value']; + $tab[$i][$j]["label"]=_GED_NUM; + $tab[$i][$j]["size"]="4"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='res_id'; + $_SESSION['mlb_search_current_res_id'] = $tab[$i][$j]['value']; + + // notes + $query = "SELECT "; + $query .= "notes.id "; + $query .= "FROM "; + $query .= "notes "; + $query .= "left join "; + $query .= "note_entities "; + $query .= "on "; + $query .= "notes.id = note_entities.note_id "; + $query .= "WHERE "; + $query .= "tablename = 'res_letterbox' "; + $query .= "AND "; + $query .= "coll_id = 'letterbox_coll' "; + $query .= "AND "; + $query .= "identifier = ? "; + $arrayPDOnotes = array($tab[$i][$j]['value']); + $query .= "AND "; + $query .= "( "; + $query .= "( "; + $query .= "item_id IN ("; + + foreach ($_SESSION['user']['entities'] as $entitiestmpnote) { + $query .= "?, "; + $arrayPDOnotes = array_merge($arrayPDOnotes, array($entitiestmpnote['ENTITY_ID'])); + } + $query = substr($query, 0, -2); + + $query .= ") "; + $query .= "OR "; + $query .= "item_id IS NULL "; + $query .= ") "; + $query .= "OR "; + $query .= "user_id = ? "; + $arrayPDOnotes = array_merge($arrayPDOnotes, array($_SESSION['user']['UserId'])); + $query .= ") "; + $stmt = $db->query($query, $arrayPDOnotes); + $tab[$i][$j]['hasNotes'] = $stmt->fetchObject(); + $tab[$i][$j]['res_multi_contacts'] = $_SESSION['mlb_search_current_res_id']; + } + if ($tab[$i][$j][$value]=="creation_date") { + + $tab[$i][$j]["value"]=$core_tools->format_date_db($tab[$i][$j]["value"], false, '', true); + $tab[$i][$j]["label"]=_CREATION_DATE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='creation_date'; + } + if ($tab[$i][$j][$value]=="modification_date") { + + $tab[$i][$j]["value"] = $core_tools->format_date_db($tab[$i][$j]["value"], false, '', true); + $tab[$i][$j]["label"] = _MODIFICATION_DATE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='modification_date'; + } + /*if ($tab[$i][$j][$value]=="date_current_use") { + + $tab[$i][$j]["value"] = $core_tools->format_date_db($tab[$i][$j]["value"], false, '', true); + $tab[$i][$j]["label"] = _DATE_CURRENT_USE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='date_current_use'; + }*/ + if ($tab[$i][$j][$value]=="admission_date") { + + $tab[$i][$j]["value"]=$core_tools->format_date_db($tab[$i][$j]["value"], false); + $tab[$i][$j]["label"]=_ADMISSION_DATE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["order"]='admission_date'; + } + if ($tab[$i][$j][$value]=="process_limit_date") { + + $tab[$i][$j]["value"]=$core_tools->format_date_db($tab[$i][$j]["value"], false); + $compareDate = ""; + if ($tab[$i][$j]["value"] <> "" && ($statusCmp == "NEW" || $statusCmp == "COU" || $statusCmp == "VAL" || $statusCmp == "RET")) { + + $compareDate = $core_tools->compare_date($tab[$i][$j]["value"], date("d-m-Y")); + if ($compareDate == "date2") { + + $tab[$i][$j]["value"] = "<span style='color:red;'><b>".$tab[$i][$j]["value"]."<br><small>(".$core_tools->nbDaysBetween2Dates($tab[$i][$j]["value"], date("d-m-Y"))." "._DAYS.")<small></b></span>"; + + } elseif ($compareDate == "date1") { + + $tab[$i][$j]["value"] = $tab[$i][$j]["value"]."<br><small>(".$core_tools->nbDaysBetween2Dates(date("d-m-Y"), $tab[$i][$j]["value"])." "._DAYS.")<small>"; + + } elseif ($compareDate == "equal") { + + $tab[$i][$j]["value"] = "<span style='color:blue;'><b>".$tab[$i][$j]["value"]."<br><small>("._LAST_DAY.")<small></b></span>"; + } + } + $tab[$i][$j]["label"]=_PROCESS_LIMIT_DATE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='process_limit_date'; + } + if ($tab[$i][$j][$value]=="recommendation_limit_date") { + + $tab[$i][$j]["value"]=$core_tools->format_date_db($tab[$i][$j]["value"], false); + $tab[$i][$j]["label"]=_RECOMMENDATION_LIMIT_DATE; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["order"]='recommendation_limit_date'; + } + if ($tab[$i][$j][$value]=="category_id") { + + $_SESSION['mlb_search_current_category_id'] = $tab[$i][$j]["value"]; + $tab[$i][$j]["value"] = $_SESSION['coll_categories'][$_SESSION['collection_id_choice']][$tab[$i][$j]["value"]]; + $tab[$i][$j]["label"]=_CATEGORY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='category_id'; + } + if ($tab[$i][$j][$value]=="priority") { + + $tab[$i][$j]["value"] = $_SESSION['mail_priorities'][$tab[$i][$j]["value"]]; + $tab[$i][$j]["label"]=_PRIORITY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["order"]='priority'; + } + if ($tab[$i][$j][$value]=="subject") { + + $tab[$i][$j]["value"] = $request->cut_string($request->show_string($tab[$i][$j]["value"], '', '', '', false), 250); + $tab[$i][$j]["label"]=_SUBJECT; + $tab[$i][$j]["size"]="12"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='subject'; + } + if ($tab[$i][$j][$value]=="contact_firstname") { + + $contact_firstname = $tab[$i][$j]["value"]; + $tab[$i][$j]["show"]=false; + } + if ($tab[$i][$j][$value]=="contact_lastname") { + + $contact_lastname = $tab[$i][$j]["value"]; + $tab[$i][$j]["show"]=false; + } + if ($tab[$i][$j][$value]=="contact_society") { + + $contact_society = $tab[$i][$j]["value"]; + $tab[$i][$j]["show"]=false; + } + if ($tab[$i][$j][$value]=="user_firstname") { + + $user_firstname = $tab[$i][$j]["value"]; + $tab[$i][$j]["show"]=false; + } + if ($tab[$i][$j][$value]=="user_lastname") { + + $user_lastname = $tab[$i][$j]["value"]; + $tab[$i][$j]["show"]=false; + } + if ($tab[$i][$j][$value]=="exp_user_id") { + + if (empty($contact_lastname) && empty($contact_firstname) && empty($user_lastname) && empty($user_firstname)) { + $query = "SELECT ca.firstname, ca.lastname FROM contact_addresses ca, res_view_letterbox rvl + WHERE rvl.res_id = ? + AND rvl.address_id = ca.id AND rvl.exp_contact_id = ca.contact_id"; + $arrayPDO = array($tab[$i][0]['res_id']); + $stmt2 = $db->query($query, $arrayPDO); + $return_contact = $stmt2->fetchObject(); + if (!empty($return_contact)) { + $contact_firstname = $return_contact->firstname; + $contact_lastname = $return_contact->lastname; + } + } + + $tab[$i][$j]["label"]=_CONTACT; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["value"] = $contact->get_contact_information_from_view($_SESSION['mlb_search_current_category_id'], $contact_lastname, $contact_firstname, $contact_society, $user_lastname, $user_firstname); + $tab[$i][$j]["order"]=false; + } + if ($tab[$i][$j][$value]=="dest_user") { + + $tab[$i][$j]["label"]="dest_user"; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + if ($tab[$i][15]["value"]=='outgoing') { + $tab[$i][$j]["value"] = "<b>"._TO_CONTACT_C."</b>".$tab[$i][$j]['value']; + } else { + $tab[$i][$j]["value"] = "<b>"._FOR_CONTACT_C."</b>".$tab[$i][$j]['value']; + + } + $tab[$i][$j]["order"]=false; + } + if ($tab[$i][$j][$value]=="is_multicontacts") { + + if ($tab[$i][$j]['value'] == 'Y') { + $tab[$i][$j]["label"]=_CONTACT; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $tab[$i][$j]["value"] = _MULTI_CONTACT; + $tab[$i][$j]["order"]=false; + $tab[$i][$j]["is_multi_contacts"] = 'Y'; + } + } + if ($tab[$i][$j][$value]=="type_label") { + + $tab[$i][$j]["value"] = $request->show_string($tab[$i][$j]["value"]); + $tab[$i][$j]["label"]=_TYPE; + $tab[$i][$j]["size"]="12"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='type_label'; + } + if ($tab[$i][$j][$value]=="status") { + //couleurs des priorités + if ($tab[$i][8]["value"]=='0') { + + $style="style='color:".$_SESSION['mail_priorities_color'][$tab[$i][8]["value"]].";'"; + } else if ($tab[$i][8]["value"]=='1') { + $style="style='color:".$_SESSION['mail_priorities_color'][$tab[$i][8]["value"]].";'"; + } else { + $style="style='color:".$_SESSION['mail_priorities_color'][$tab[$i][8]["value"]].";'"; + } + $res_status = $status_obj->get_status_data($tab[$i][$j]['value'], $extension_icon); + $statusCmp = $tab[$i][$j]['value']; + $img_class = substr($res_status['IMG_SRC'], 0, 2); + if (!isset($res_status['IMG_SRC']) || empty($res_status['IMG_SRC'])) { + $tab[$i][$j]['value'] = "<i ".$style." class = 'fm fm-letter-status-new fm-3x' alt = '".$res_status['LABEL']."' title = '".$res_status['LABEL']."'></i>"; + } else { + $tab[$i][$j]['value'] = "<i ".$style." class = '".$img_class." ".$res_status['IMG_SRC']." ".$img_class."-3x' alt = '".$res_status['LABEL']."' title = '".$res_status['LABEL']."'></i>"; + } + $tab[$i][$j]["label"]=_STATUS; + $tab[$i][$j]["size"]="4"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=true; + $tab[$i][$j]["order"]='status'; + } + if ($tab[$i][$j][$value]=="category_img") { + + $tab[$i][$j]["label"]=_CATEGORY; + $tab[$i][$j]["size"]="10"; + $tab[$i][$j]["label_align"]="right"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; + $my_imgcat = get_img_cat($tab[$i][$j]['value'], $extension_icon); + $tab[$i][$j]['value'] = $my_imgcat; + $tab[$i][$j]["value"] = $tab[$i][$j]['value']; + $tab[$i][$j]["order"]="category_id"; + } + if ($tab[$i][$j][$value]=="count_attachment") { + + $query = "SELECT count(*) as total FROM res_view_attachments + WHERE res_id_master = ? + AND status NOT IN ('DEL', 'OBS') AND attachment_type NOT IN ('converted_pdf', 'print_folder') AND coll_id = ? AND (status <> 'TMP' or (typist = ? and status = 'TMP'))"; + $arrayPDO = array($tab[$i][0]['res_id'], $_SESSION['collection_id_choice'], $_SESSION['user']['UserId']); + $stmt2 = $db->query($query, $arrayPDO); + $return_count = $stmt2->fetchObject(); + + $tab[$i][$j]["label"]=_ATTACHMENTS; + $tab[$i][$j]["size"]="12"; + $tab[$i][$j]["label_align"]="left"; + $tab[$i][$j]["align"]="left"; + $tab[$i][$j]["valign"]="bottom"; + $tab[$i][$j]["show"]=false; + $tab[$i][$j]['value'] = "$return_count->total"; + $tab[$i][$j]["order"]='count_attachment'; + } + } + } +} +//Cle de la liste +$listKey = 'res_id'; + +//Initialiser le tableau de parametres +$paramsTab = array(); +$paramsTab['pageTitle'] = _RESULTS." : ".count($tab).' '._FOUND_DOCS; //Titre de la page +$paramsTab['listCss'] = 'listing largerList spec'; //css +$paramsTab['bool_sortColumn'] = true; //Affichage Tri +$paramsTab['bool_bigPageTitle'] = false; //Affichage du titre en grand +$paramsTab['bool_showIconDocument'] = true; //Affichage de l'icone du document +$paramsTab['bool_showIconDetails'] = true; //Affichage de l'icone de la page de details +$paramsTab['urlParameters'] = 'baskets='.$_SESSION['current_basket']['id'] + .$urlParameters; //Parametres d'url supplementaires +//$paramsTab['filters'] = array('entity', 'entity_subentities', 'category', 'priority', 'identifier','date_current_use'); //Filtres +$paramsTab['filters'] = array('entity', 'entity_subentities', 'category', 'priority', 'identifier'); //Filtres +if (count($template_list) > 0 ) { //Templates + $paramsTab['templates'] = array(); + $paramsTab['templates'] = $template_list; +} +$paramsTab['bool_showTemplateDefaultList'] = true; //Default list (no template) +$paramsTab['defaultTemplate'] = $defaultTemplate; //Default template +$paramsTab['tools'] = array(); //Icones dans la barre d'outils +//Fileplan +if ($core_tools->test_service('fileplan', 'fileplan', false)) { + include_once "modules" . DIRECTORY_SEPARATOR . "fileplan" . DIRECTORY_SEPARATOR + . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; + $fileplan = new fileplan(); + if (count($fileplan->getUserFileplan()) > 0 + || (count($fileplan->getEntitiesFileplan()) > 0 + && $core_tools->test_service('put_doc_in_fileplan', 'fileplan', false)) + ) { + $paramsTab['bool_checkBox'] = true; + $paramsTab['bool_standaloneForm'] = true; + $positions = array( + "script" => "showFileplanList('".$_SESSION['config']['businessappurl'] + . "index.php?display=true&module=fileplan&page=fileplan_ajax_script" + . "&mode=setPosition&origin=basket&coll_id=".$_SESSION['current_basket']['coll_id'] + . $parameters."', 'formList', '600px', '510px', '" + . _CHOOSE_ONE_DOC."')", + "icon" => 'bookmark', + "tooltip" => _FILEPLAN, + "disabledRules" => count($tab)." == 0" + ); + array_push($paramsTab['tools'], $positions); + } +} +if (isset($_REQUEST['origin']) && $_REQUEST['origin'] == 'searching') { + $save = array( + "script" => "createModal(form_txt, 'save_search', '100px', '500px');window.location.href='#top';", + "icon" => 'save', + "tooltip" => _SAVE_QUERY, + "disabledRules" => count($tab)." == 0" + ); + array_push($paramsTab['tools'], $save); +} +$export = array( + "script" => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=export', '_blank');", + "icon" => 'cloud-download', + "tooltip" => _EXPORT_LIST, + "disabledRules" => count($tab)." == 0" + ); +array_push($paramsTab['tools'], $export); +if ($core_tools->test_service('print_doc_details_from_list', 'apps', false)) { + $print = array( + "script" => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=print', '_blank');", + "icon" => 'print', + "tooltip" => _PRINT_LIST, + "disabledRules" => count($tab)." == 0" + ); + array_push($paramsTab['tools'], $print); +} + +//Afficher la liste +$status = 0; +$content = $list->showList($tab, $paramsTab, $listKey, $_SESSION['current_basket']); +// $debug = $list->debug(false); + +$content .= '<script>$j(\'#container\').attr(\'style\', \'width: 90%; min-width: 1000px;\');$j(\'#content\').attr(\'style\', \'width: auto; min-width: 1000px;\');'; +$content .= '$j(\'#inner_content\').attr(\'style\', \'width: auto; min-width: 1000px;\');</script>'; + +echo "{'status' : " . $status . ", 'content' : '" . addslashes($debug.$content) . "', 'error' : '" . addslashes(functions::xssafe($error)) . "'}"; diff --git a/modules/export_seda/js/functions.js b/modules/export_seda/js/functions.js old mode 100755 new mode 100644 index c97b4da5b7e8485588177277b5722da193437051..9021a124b440c322db3231d43c1132cea6346393 --- a/modules/export_seda/js/functions.js +++ b/modules/export_seda/js/functions.js @@ -1,40 +1,67 @@ -function actionSeda($path,$type) { - if ($type == 'zip') { - window.open($path); - $("validSend").style.display = 'block'; - } else { - new Ajax.Request($path, - { - method:'post', - parameters: { url : $path, - }, - onSuccess: function(answer) { - eval("response = "+answer.responseText); - if(response.status == 0){ - if ($type != "validateMessage") { - $("valid").style.display = 'block'; - $("validSend").style.display = 'none'; - $("cancel").style.display = 'none'; - $("sendMessage").style.display = 'none'; +function actionSeda(path,type) { + var resPath = path.split('|'); - alert(response.content); - } else { - $("cancel").click(); - location.reload(); - } + if (type == 'zip' || type == 'sendMessage') { + resPath[0] += '&messageTitle=' + $('messageTitle').value; + } + + new Ajax.Request(resPath[0], + { + method: 'post', + parameters: { + url: resPath[0] + }, + onSuccess: function (answer) { + eval("response = " + answer.responseText); + if (response.status == 0) { + if (type == "validateMessage") { + $("cancel").click(); + location.reload(); } else { - alert(response.error); + $('messageTitle').disabled = true; + + if (type == 'zip') { + window.open(resPath[1]); + + if ($("cancel").style.display != 'none') { + $("validSend").style.display = 'block'; + } + } else if (type == 'sendMessage') { + new Ajax.Request(resPath[1], + { + method:'post', + parameters: { url : resPath[1] + }, + onSuccess: function(answer) { + eval("response = "+answer.responseText); + if(response.status == 0){ + $("valid").style.display = 'block'; + $("validSend").style.display = 'none'; + $("cancel").style.display = 'none'; + $("sendMessage").style.display = 'none'; + + alert(response.content); + } else { + alert(response.error); + } + } + } + ); + } } + } else { + alert(response.error); } - }); - } + } + } + ); } -function actionValidation($path,$type) { - new Ajax.Request($path, +function actionValidation(path,type) { + new Ajax.Request(path, { method:'post', - parameters: { url : $path}, + parameters: { url : path}, onSuccess: function(answer) { eval("response = "+answer.responseText); if(response.status == 0){ @@ -45,4 +72,4 @@ function actionValidation($path,$type) { location.reload(); } }); -} \ No newline at end of file +} diff --git a/modules/export_seda/lang/en.php b/modules/export_seda/lang/en.php old mode 100755 new mode 100644 index df78e68698b39947dc2d3260b6f2017d90f525e1..df0ec8bc98bfb296fb53991cc4fd472d66327957 --- a/modules/export_seda/lang/en.php +++ b/modules/export_seda/lang/en.php @@ -2,6 +2,8 @@ if (!defined("_EXPORT_SEDA_COMMENT")) define("_EXPORT_SEDA_COMMENT", "Export"); +if (!defined("_EXPORT_SEDA_LIST")) + define("_EXPORT_SEDA_LIST", "List of letter to archive"); if (!defined("_EXPORT_SEDA")) define("_EXPORT_SEDA", "Export"); @@ -24,6 +26,15 @@ if (!defined("_INFORMATION_ARCHIVE")) if (!defined("_ARCHIVE_IDENTIFIER")) define("_ARCHIVE_IDENTIFIER", "Archive identifier"); +if (!defined("_PACKAGE_TITLE")) + define("_PACKAGE_TITLE", "Package title"); + +if (!defined("_GENERATE_MESSAGE")) + define("_GENERATE_MESSAGE", "Generate message"); + +if (!defined("_MESSAGE_TITLE_EMPTY")) + define("_MESSAGE_TITLE_EMPTY", "Message title empty"); + if (!defined("_DESCRIPTION_LEVEL")) define("_DESCRIPTION_LEVEL", "Description level"); if (!defined("_ITEM")) @@ -67,14 +78,20 @@ if (!defined("_RECEIVED_MESSAGE")) if (!defined("_ERROR_MESSAGE")) define("_RECEIVED_MESSAGE", "Message non-reçu"); +if (!defined("_DIRECTORY_MESSAGE_REQUIRED")) + define("_DIRECTORY_MESSAGE_REQUIRED", "Directory message not configured"); + if (!defined("_ACKNOWLEDGEMENT_REFERENCE")) define("_ACKNOWLEDGEMENT_REFERENCE", "Acknowledgement reference"); -if (!defined("_TRANSFERRING_AGENCY_SIREN_COMPULSORY")) - define("_TRANSFERRING_AGENCY_SIREN_COMPULSORY", "Transferring agency SIREN compulsory"); +if (!defined("_TRANSFERRING_AGENCY_SIREN_REQUIRED")) + define("_TRANSFERRING_AGENCY_SIREN_REQUIRED", "Transferring agency SIREN required"); -if (!defined("_ARCHIVAL_AGENCY_SIREN_COMPULSORY")) - define("_ARCHIVAL_AGENCY_SIREN_COMPULSORY", "Archive agency SIREN compulsory"); +if (!defined("_ARCHIVAL_AGENCY_SIREN_REQUIRED")) + define("_ARCHIVAL_AGENCY_SIREN_REQUIRED", "Archive agency SIREN required"); + +if (!defined("_ARCHIVAL_AGREEMENT_REQUIRED")) + define("_ARCHIVAL_AGREEMENT_REQUIRED", "Archival agreement required"); if (!defined("_VALIDATE_MANUAL_DELIVERY")) define("_VALIDATE_MANUAL_DELIVERY", "Validate manual delivery"); @@ -88,6 +105,12 @@ if (!defined("_ERROR_STATUS_SEDA")) if (!defined("_ERROR_NO_ACKNOWLEDGEMENT")) define("_ERROR_NO_ACKNOWLEDGEMENT", "No acknowledgement for this letter : "); +if (!defined("_NO_LETTER_PURGE")) + define("_NO_LETTER_PURGE", "No letter to purge"); + +if (!defined("_PURGE")) + define("_PURGE", "letters purge"); + if (!defined("_ERROR_NO_XML_ACKNOWLEDGEMENT")) define("_ERROR_NO_XML_ACKNOWLEDGEMENT", "The acknowledgement is malformed. Letter number : "); @@ -113,4 +136,22 @@ if (!defined("_LETTER_NO_ARCHIVED")) define("_LETTER_NO_ARCHIVED", "The letter not archived. Look the transfer reply. Letter number : "); if (!defined("_ERROR_LETTER_ARCHIVED")) - define("_ERROR_LETTER_ARCHIVED", "You can not reset an archived letter. Letter number : "); \ No newline at end of file + define("_ERROR_LETTER_ARCHIVED", "You can not reset an archived letter. Letter number : "); + +if (!defined("_ERROR_ORIGINATOR_EMPTY")) + define("_ERROR_ORIGINATOR_EMPTY", "At least one originator must be retained"); + +if (!defined("_ERROR_FILE_NOT_EXIST")) + define("_ERROR_FILE_NOT_EXIST", "All the documents must be present in the storage areas"); + +if (!defined("_ERROR_REPLY_NOT_EXIST")) + define("_ERROR_REPLY_NOT_EXIST", "Reply not exist. Letter number : "); + +if (!defined("_ERROR_EXTENSION_CERTIFICATE")) + define("_ERROR_EXTENSION_CERTIFICATE", "Wrong certificate format (.crt or .pem)"); + +if (!defined("_ERROR_UNKNOW_CERTIFICATE")) + define("_ERROR_UNKNOW_CERTIFICATE", "Unknow certificate"); + +if (!defined("_UNKNOWN_TARGET")) + define("_UNKNOWN_TARGET", "Unknown target"); diff --git a/modules/export_seda/lang/fr.php b/modules/export_seda/lang/fr.php old mode 100755 new mode 100644 index efca4350aa308298b163ab8f1f39a1fa2ec361bf..73e3c8d287571f2926a8b2e7bebf32de0b747ddf --- a/modules/export_seda/lang/fr.php +++ b/modules/export_seda/lang/fr.php @@ -1,7 +1,10 @@ <?php -if (!defined("_EXPORTSEDA_COMMENT")) +if (!defined("_EXPORT_SEDA_COMMENT")) define("_EXPORT_SEDA_COMMENT", "Export"); +if (!defined("_EXPORT_SEDA_LIST")) + define("_EXPORT_SEDA_LIST", "Liste des courriers à archiver"); + if (!defined("_EXPORT_SEDA")) define("_EXPORT_SEDA","Transferer vos courriers"); @@ -21,6 +24,15 @@ if (!defined("_EXPORT_SEDA_VIEW")) if (!defined("_INFORMATION_MESSAGE")) define("_INFORMATION_MESSAGE", "Information bordereau"); +if (!defined("_PACKAGE_TITLE")) + define("_PACKAGE_TITLE", "Titre du paquet"); + +if (!defined("_GENERATE_MESSAGE")) + define("_GENERATE_MESSAGE", "Générer bordereau"); + +if (!defined("_MESSAGE_TITLE_EMPTY")) + define("_MESSAGE_TITLE_EMPTY", "Titre du paquet vide"); + if (!defined("_MESSAGE_IDENTIFIER")) define("_MESSAGE_IDENTIFIER", "Identifiant bordereau"); if (!defined("_ARCHIVAL_AGENCY_SIREN")) @@ -80,15 +92,27 @@ if (!defined("_RECEIVED_MESSAGE")) if (!defined("_ERROR_MESSAGE")) define("_ERROR_MESSAGE", "Bordereau non-reçu"); -if (!defined("_TRANSFERRING_AGENCY_SIREN_COMPULSORY")) - define("_TRANSFERRING_AGENCY_SIREN_COMPULSORY", "Numéro SIREN service versant obligatoire"); +if (!defined("_DIRECTORY_MESSAGE_REQUIRED")) + define("_DIRECTORY_MESSAGE_REQUIRED", "Répertoire des messages non configuré"); -if (!defined("_ARCHIVAL_AGENCY_SIREN_COMPULSORY")) - define("_ARCHIVAL_AGENCY_SIREN_COMPULSORY", "Numéro SIREN service d'archive obligatoire"); +if (!defined("_TRANSFERRING_AGENCY_SIREN_REQUIRED")) + define("_TRANSFERRING_AGENCY_SIREN_REQUIRED", "Numéro SIREN service versant obligatoire"); + +if (!defined("_ARCHIVAL_AGENCY_SIREN_REQUIRED")) + define("_ARCHIVAL_AGENCY_SIREN_REQUIRED", "Numéro SIREN service d'archive obligatoire"); + +if (!defined("_ARCHIVAL_AGREEMENT_REQUIRED")) + define("_ARCHIVAL_AGREEMENT_REQUIRED", "Convention d'archivage obligatoire"); if (!defined("_VALIDATE_MANUAL_DELIVERY")) define("_VALIDATE_MANUAL_DELIVERY", "Valider l'envoi manuel du bordereau"); +if (!defined("_NO_LETTER_PURGE")) + define("_NO_LETTER_PURGE", "Aucun document à supprimer"); + +if (!defined("_PURGE")) + define("_PURGE", "document(s) supprimé(s)"); + if (!defined("_ERROR_MESSAGE_ALREADY_SENT")) define("_ERROR_MESSAGE_ALREADY_SENT", "L'archivage d'un courrier sélectionné est déjà en cours, vous ne pouvez pas archiver deux fois le même courrier. Veuillez le désélectionner pour continuer. Numéro de courrier en cours d'archivage : "); @@ -124,3 +148,21 @@ if (!defined("_LETTER_NO_ARCHIVED")) if (!defined("_ERROR_LETTER_ARCHIVED")) define("_ERROR_LETTER_ARCHIVED", "Vous ne pouvez pas remettre à zéro un courrier archivé. Numéro du courrier : "); + +if (!defined("_ERROR_ORIGINATOR_EMPTY")) + define("_ERROR_ORIGINATOR_EMPTY", "Au moins un producteur doit être renseigné"); + +if (!defined("_ERROR_FILE_NOT_EXIST")) + define("_ERROR_FILE_NOT_EXIST", "Tous les documents doivent être présent dans les zones de stockage"); + +if (!defined("_ERROR_REPLY_NOT_EXIST")) + define("_ERROR_REPLY_NOT_EXIST", "La réponse au transfert doit être présente pour effectuer une action. Numéro du courrier : "); + +if (!defined("_ERROR_EXTENSION_CERTIFICATE")) + define("_ERROR_EXTENSION_CERTIFICATE", "Le certificat n'est pas dans le bon format (.crt ou .pem)"); + +if (!defined("_ERROR_UNKNOW_CERTIFICATE")) + define("_ERROR_UNKNOW_CERTIFICATE", "Erreur avec le certificat SSL ou TLS."); + +if (!defined("_UNKNOWN_TARGET")) + define("_UNKNOWN_TARGET", "Cible inconnue"); diff --git a/modules/export_seda/resources/AbstractRule.xml b/modules/export_seda/resources/AbstractRule.xml old mode 100755 new mode 100644 index bea6adcdfddbdd4776f349204dcbe1623a660b70..228090918d19024d6b69cf3406414dde3c03c631 --- a/modules/export_seda/resources/AbstractRule.xml +++ b/modules/export_seda/resources/AbstractRule.xml @@ -1,4 +1,4 @@ -<?merge $abstractRule.rule.bool() ?><Rule><?merge $abstractRule.rule.value ?></Rule> -<?merge $abstractRule.startDate.bool() ?><StartDate><?merge $abstractRule.startDate.value ?></StartDate> -<PreventInheritance><?merge $abstractRule.preventInheritance ?></PreventInheritance> -<RefNonRuleId><?merge $abstractRule.refNonRuleId ?></RefNonRuleId> \ No newline at end of file +<?merge $abstractRule.Rule.bool() ?><Rule><?merge $abstractRule.Rule.value ?></Rule> +<?merge $abstractRule.StartDate.bool() ?><StartDate><?merge $abstractRule.StartDate.value ?></StartDate> +<PreventInheritance><?merge $abstractRule.PreventInheritance ?></PreventInheritance> +<RefNonRuleId><?merge $abstractRule.RefNonRuleId ?></RefNonRuleId> \ No newline at end of file diff --git a/modules/export_seda/resources/Acknowledgement.xml b/modules/export_seda/resources/Acknowledgement.xml old mode 100755 new mode 100644 index 95a0ddd219e9b2a59c96500e765d83cbceda3f82..977b6f0e0868c256a9924e4eea544e8deeae83da --- a/modules/export_seda/resources/Acknowledgement.xml +++ b/modules/export_seda/resources/Acknowledgement.xml @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <Acknowledgement xmlns="fr:gouv:culture:archivesdefrance:seda:v2.0"> - <?merge Acknowledgement.comment ?><Comment><?merge .value ?></Comment> - <Date><?merge Acknowledgement.date ?></Date> - <?merge Acknowledgement.messageIdentifier $messageIdentifier ?><?xinclude /resources/MessageIdentifier.xml ?> - <?merge Acknowledgement.signature.bool() ?> - <Signature><?merge Acknowledgement.signature ?></Signature> - <?merge Acknowledgement.messageReceivedIdentifier $messageReceivedIdentifier ?><?xinclude /resources/MessageReceivedIdentifier.xml ?> + <?merge Acknowledgement.Comment ?><Comment><?merge .value ?></Comment> + <Date><?merge Acknowledgement.Date ?></Date> + <?merge Acknowledgement.MessageIdentifier $messageIdentifier ?><?xinclude /resources/MessageIdentifier.xml ?> + <?merge Acknowledgement.Signature.bool() ?> + <Signature><?merge Acknowledgement.Signature ?></Signature> + <?merge Acknowledgement.MessageReceivedIdentifier $messageReceivedIdentifier ?><?xinclude /resources/MessageReceivedIdentifier.xml ?> <Sender> - <?merge Acknowledgement.sender $organization ?> + <?merge Acknowledgement.Sender $organization ?> <?xinclude /resources/Organization.xml ?> </Sender> <Receiver> - <?merge Acknowledgement.receiver $organization ?> + <?merge Acknowledgement.Receiver $organization ?> <?xinclude /resources/Organization.xml ?> </Receiver> </Acknowledgement> \ No newline at end of file diff --git a/modules/export_seda/resources/Agent.xml b/modules/export_seda/resources/Agent.xml old mode 100755 new mode 100644 index 142f6cc36f3ed56a09f5b712a0e9a726512d60e6..f7907a56bcdcff5678cdd42016ce2ffe71eeed11 --- a/modules/export_seda/resources/Agent.xml +++ b/modules/export_seda/resources/Agent.xml @@ -1,15 +1,15 @@ -<?merge $agent.firstName.bool() ?><FirstName><?merge $agent.firstName ?></FirstName> -<?merge $agent.birthName.bool() ?><BirthName><?merge $agent.birthName ?></BirthName> -<?merge $agent.givenName.bool() ?><GivenName><?merge $agent.givenName ?></GivenName> -<?merge $agent.gender.bool() ?><Gender><?merge $agent.gender ?></Gender> -<?merge $agent.birthDate.bool() ?><BirthDate><?merge $agent.birthDate ?></BirthDate> -<?merge $agent.birthPlace.bool() ?><BirthPlace><?merge $agent.birthPlace ?></BirthPlace> -<?merge $agent.deathDate.bool() ?><DeathDate><?merge $agent.deathDate ?></DeathDate> -<?merge $agent.deathPlace.bool() ?><DeathPlace><?merge $agent.deathPlace ?></DeathPlace> -<?merge $agent.nationality.bool() ?><Nationality><?merge $agent.nationality ?></Nationality> -<?merge $agent.function.bool() ?><Function><?merge $agent.function ?></Function> -<?merge $agent.activity.bool() ?><Activity><?merge $agent.activity ?></Activity> -<?merge $agent.position.bool() ?><Position><?merge $agent.position ?></Position> -<?merge $agent.role.bool() ?><Role><?merge $agent.role ?></Role> -<?merge $agent.corpname.bool() ?><Corpname><?merge $agent.corpname ?></Corpname> -<?merge $agent.identifier.bool() ?><Identifier><?merge $agent.identifier ?></Identifier> \ No newline at end of file +<?merge $agent.FirstName.bool() ?><FirstName><?merge $agent.FirstName ?></FirstName> +<?merge $agent.BirthName.bool() ?><BirthName><?merge $agent.BirthName ?></BirthName> +<?merge $agent.GivenName.bool() ?><GivenName><?merge $agent.GivenName ?></GivenName> +<?merge $agent.Gender.bool() ?><Gender><?merge $agent.Gender ?></Gender> +<?merge $agent.BirthDate.bool() ?><BirthDate><?merge $agent.BirthDate ?></BirthDate> +<?merge $agent.BirthPlace.bool() ?><BirthPlace><?merge $agent.BirthPlace ?></BirthPlace> +<?merge $agent.DeathDate.bool() ?><DeathDate><?merge $agent.DeathDate ?></DeathDate> +<?merge $agent.DeathPlace.bool() ?><DeathPlace><?merge $agent.DeathPlace ?></DeathPlace> +<?merge $agent.Nationality.bool() ?><Nationality><?merge $agent.Nationality ?></Nationality> +<?merge $agent.Function.bool() ?><Function><?merge $agent.Function ?></Function> +<?merge $agent.Activity.bool() ?><Activity><?merge $agent.Activity ?></Activity> +<?merge $agent.Position.bool() ?><Position><?merge $agent.Position ?></Position> +<?merge $agent.Role.bool() ?><Role><?merge $agent.Role ?></Role> +<?merge $agent.Corpname.bool() ?><Corpname><?merge $agent.Corpname ?></Corpname> +<?merge $agent.Identifier.bool() ?><Identifier><?merge $agent.Identifier ?></Identifier> \ No newline at end of file diff --git a/modules/export_seda/resources/ArchiveModificationNotification.xml b/modules/export_seda/resources/ArchiveModificationNotification.xml new file mode 100644 index 0000000000000000000000000000000000000000..dbe515b16c7834fb8f448c43b4fbd9f428bbdebf --- /dev/null +++ b/modules/export_seda/resources/ArchiveModificationNotification.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<ArchiveModificationNotification xmlns="fr:gouv:culture:archivesdefrance:seda:v2.0"> + <?merge ArchiveModificationNotification.Comment ?><Comment><?merge .value ?></Comment> + <Date><?merge ArchiveModificationNotification.Date ?></Date> + <?merge ArchiveModificationNotification.MessageIdentifier $messageIdentifier ?><?xinclude /resources/MessageIdentifier.xml ?> + <?xinclude /resources/CodeListVersions.xml ?> + <UnitIdentifier><?merge ArchiveModificationNotification.UnitIdentifier.value ?></UnitIdentifier> + <ArchivalAgency> + <?merge ArchiveModificationNotification.ArchivalAgency $organization ?> + <?xinclude /resources/Organization.xml ?> + </ArchivalAgency> + <OriginatingAgency> + <?merge ArchiveModificationNotification.OriginatingAgency $organization ?> + <?xinclude /resources/Organization.xml ?> + </OriginatingAgency> +</ArchiveModificationNotification> \ No newline at end of file diff --git a/modules/export_seda/resources/ArchiveTransfer.xml b/modules/export_seda/resources/ArchiveTransfer.xml old mode 100755 new mode 100644 index 64c4639aea6157fd9fc2a626761ffc93193c2d36..051e049ba8622c6466f69059ca9dc3f6b0e41e6b --- a/modules/export_seda/resources/ArchiveTransfer.xml +++ b/modules/export_seda/resources/ArchiveTransfer.xml @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8" ?> <ArchiveTransfer xmlns="fr:gouv:culture:archivesdefrance:seda:v2.0"> - <?merge ArchiveTransfer.comment ?><Comment><?merge .value ?></Comment> - <Date><?merge ArchiveTransfer.date ?></Date> - <?merge ArchiveTransfer.messageIdentifier $messageIdentifier ?><?xinclude /resources/MessageIdentifier.xml ?> - <?merge ArchiveTransfer.archivalAgreement $archivalAgreement ?><?xinclude /resources/ArchivalAgreement.xml ?> + <?merge ArchiveTransfer.Comment ?><Comment><?merge .value ?></Comment> + <Date><?merge ArchiveTransfer.Date ?></Date> + <?merge ArchiveTransfer.MessageIdentifier $messageIdentifier ?><?xinclude /resources/MessageIdentifier.xml ?> + <?merge ArchiveTransfer.ArchivalAgreement $archivalAgreement ?><?xinclude /resources/ArchivalAgreement.xml ?> <?xinclude /resources/CodeListVersions.xml ?> - <?merge ArchiveTransfer.dataObjectPackage $dataObjectPackage ?> + <?merge ArchiveTransfer.DataObjectPackage $dataObjectPackage ?> <?xinclude /resources/DataObjectPackage.xml ?> <ArchivalAgency> - <?merge ArchiveTransfer.archivalAgency $organization ?> + <?merge ArchiveTransfer.ArchivalAgency $organization ?> <?xinclude /resources/Organization.xml ?> </ArchivalAgency> <TransferringAgency> - <?merge ArchiveTransfer.transferringAgency $organization ?> + <?merge ArchiveTransfer.TransferringAgency $organization ?> <?xinclude /resources/Organization.xml ?> </TransferringAgency> </ArchiveTransfer> \ No newline at end of file diff --git a/modules/export_seda/resources/ArchiveTransferReply.xml b/modules/export_seda/resources/ArchiveTransferReply.xml old mode 100755 new mode 100644 index decc409a7efe14dbc05e3e64e6227ac46c463375..d803a3418b914f773490b1eec87a0691caa29546 --- a/modules/export_seda/resources/ArchiveTransferReply.xml +++ b/modules/export_seda/resources/ArchiveTransferReply.xml @@ -1,22 +1,22 @@ <?xml version="1.0" encoding="UTF-8" ?> <ArchiveTransferReply xmlns="fr:gouv:culture:archivesdefrance:seda:v2.0"> - <?merge ArchiveTransferReply.comment ?><Comment><?merge .value ?></Comment> - <Date><?merge ArchiveTransferReply.date ?></Date> - <?merge ArchiveTransferReply.messageIdentifier $messageIdentifier ?><?xinclude /resources/MessageIdentifier.xml ?> - <?merge ArchiveTransferReply.archivalAgreement $archivalAgreement ?><?xinclude /resources/ArchivalAgreement.xml ?> - <ReplyCode><?merge ArchiveTransferReply.replyCode.value ?></ReplyCode> + <?merge ArchiveTransferReply.Comment ?><Comment><?merge .value ?></Comment> + <Date><?merge ArchiveTransferReply.Date ?></Date> + <?merge ArchiveTransferReply.MessageIdentifier $messageIdentifier ?><?xinclude /resources/MessageIdentifier.xml ?> + <?merge ArchiveTransferReply.MessageRequestIdentifier $messageRequestIdentifier ?><?xinclude /resources/MessageRequestIdentifier.xml ?> + <?merge ArchiveTransferReply.ArchivalAgreement $archivalAgreement ?><?xinclude /resources/ArchivalAgreement.xml ?> + <ReplyCode><?merge ArchiveTransferReply.ReplyCode ?></ReplyCode> <?xinclude /resources/CodeListVersions.xml ?> - <?merge ArchiveTransferReply.dataObjectPackage $dataObjectPackage ?> - <?merge ArchiveTransferReply.dataObjectPackage.bool() ?> + <?merge ArchiveTransferReply.DataObjectPackage $dataObjectPackage ?> + <?merge ArchiveTransferReply.DataObjectPackage.bool() ?> <?xinclude /resources/DataObjectPackage.xml ?> - <?merge ArchiveTransferReply.messageRequestIdentifier $messageRequestIdentifier ?><?xinclude /resources/MessageRequestIdentifier.xml ?> - <GrantDate><?merge ArchiveTransferReplyCode.grantDate ?></GrantDate> + <GrantDate><?merge ArchiveTransferReplyCode.GrantDate ?></GrantDate> <ArchivalAgency> - <?merge ArchiveTransferReply.archivalAgency $organization ?> + <?merge ArchiveTransferReply.ArchivalAgency $organization ?> <?xinclude /resources/Organization.xml ?> </ArchivalAgency> <TransferringAgency> - <?merge ArchiveTransferReply.transferringAgency $organization ?> + <?merge ArchiveTransferReply.TransferringAgency $organization ?> <?xinclude /resources/Organization.xml ?> </TransferringAgency> -</ArchiveTransferReply> \ No newline at end of file +</ArchiveTransferReply> diff --git a/modules/export_seda/resources/ArchiveUnit.xml b/modules/export_seda/resources/ArchiveUnit.xml old mode 100755 new mode 100644 index 9f3988eb15a8bdb502c40b1497a245750020c847..09a14872757fadc0df58d0ff7541cb118971e527 --- a/modules/export_seda/resources/ArchiveUnit.xml +++ b/modules/export_seda/resources/ArchiveUnit.xml @@ -1,138 +1,205 @@ <?merge $archiveUnit ?> -<ArchiveUnit id="arch_[?merge .id ?]"> - <ArchiveUnitRefId><?merge .archiveUnitRefId ?></ArchiveUnitRefId> - <ArchiveUnitProfile schemeID="[?merge .archiveUnitProfile.schemeID ?]" schemeName="[?merge .archiveUnitProfile.schemeName ?]" schemeAgencyID="[?merge .archiveUnitProfile.schemeAgencyID ?]" schemeAgencyName="[?merge .archiveUnitProfile.schemeAgencyName ?]" schemeVersionID="[?merge .archiveUnitProfile.schemeVersionID ?]" schemeDataURI="[?merge .archiveUnitProfile.schemeDataURI ?]" schemeURI="[?merge .archiveUnitProfile.schemeURI ?]"><?merge .archiveUnitProfile ?></ArchiveUnitProfile> - <?merge .management.bool() ?> +<ArchiveUnit id="[?merge .id ?]"> + <ArchiveUnitRefId><?merge .ArchiveUnitRefId ?></ArchiveUnitRefId> + <ArchiveUnitProfile schemeID="[?merge .ArchiveUnitProfile.schemeID ?]" schemeName="[?merge .ArchiveUnitProfile.schemeName ?]" schemeAgencyID="[?merge .ArchiveUnitProfile.schemeAgencyID ?]" schemeAgencyName="[?merge .ArchiveUnitProfile.schemeAgencyName ?]" schemeVersionID="[?merge .ArchiveUnitProfile.schemeVersionID ?]" schemeDataURI="[?merge .ArchiveUnitProfile.schemeDataURI ?]" schemeURI="[?merge .ArchiveUnitProfile.schemeURI ?]"><?merge .ArchiveUnitProfile ?></ArchiveUnitProfile> + <?merge .Management.bool() ?> <Management> - <?merge .management.storageRule.bool() ?> + <?merge .Management.ArchivalProfile.bool() ?><ArchivalProfile><?merge .Management.ArchivalProfile.value ?></ArchivalProfile> + <?merge .Management.ServiceLevel.bool() ?><ServiceLevel><?merge .Management.ServiceLevel.value ?></ServiceLevel> + <?merge .Management.StorageRule.bool() ?> <StorageRule> - <?merge .management.storageRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> - <FinalAction><?merge .management.storageRule.finalAction ?></FinalAction> + <?merge .Management.StorageRule.Rule.bool() ?><Rule><?merge .Management.StorageRule.Rule.value ?></Rule> + <?merge .Management.StorageRule.StartDate.bool() ?><StartDate><?merge .Management.StorageRule.StartDate ?></StartDate> + <PreventInheritance><?merge .Management.StorageRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge .Management.StorageRule.RefNonRuleId ?></RefNonRuleId> + <FinalAction><?merge .Management.StorageRule.FinalAction ?></FinalAction> </StorageRule> - <?merge .management.appraisalRule.bool() ?> + <?merge .Management.AppraisalRule.bool() ?> <AppraisalRule> - <?merge .management.appraisalRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> - <FinalAction><?merge .management.appraisalRule.finalAction ?></FinalAction> + <?merge .Management.AppraisalRule.Rule.bool() ?><Rule><?merge .Management.AppraisalRule.Rule.value ?></Rule> + <?merge .Management.AppraisalRule.StartDate.bool() ?><StartDate><?merge .Management.AppraisalRule.StartDate ?></StartDate> + <PreventInheritance><?merge .Management.AppraisalRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge .Management.AppraisalRule.RefNonRuleId ?></RefNonRuleId> + <FinalAction><?merge .Management.AppraisalRule.FinalAction ?></FinalAction> </AppraisalRule> - <?merge .management.accessRule.bool() ?> + <?merge .Management.AccessRule.bool() ?> <AccessRule> - <?merge .management.accessRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> + <?merge .Management.AccessRule.Rule.bool() ?><Rule><?merge .Management.AccessRule.Rule.value ?></Rule> + <?merge .Management.AccessRule.StartDate.bool() ?><StartDate><?merge .Management.AccessRule.StartDate ?></StartDate> + <PreventInheritance><?merge .Management.AccessRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge .Management.AccessRule.RefNonRuleId ?></RefNonRuleId> </AccessRule> - <?merge .management.disseminationRule.bool() ?> + <?merge .Management.DisseminationRule.bool() ?> <DisseminationRule> - <?merge .management.disseminationRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> + <?merge .Management.DisseminationRule.Rule.bool() ?><Rule><?merge .Management.DisseminationRule.Rule.value ?></Rule> + <?merge .Management.DisseminationRule.StartDate.bool() ?><StartDate><?merge .Management.DisseminationRule.StartDate ?></StartDate> + <PreventInheritance><?merge .Management.DisseminationRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge .Management.DisseminationRule.RefNonRuleId ?></RefNonRuleId> </DisseminationRule> - <?merge .management.reuseRule.bool() ?> + <?merge .Management.ReuseRule.bool() ?> <ReuseRule> - <?merge .management.reuseRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> + <?merge .Management.ReuseRule.Rule.bool() ?><Rule><?merge .Management.ReuseRule.Rule.value ?></Rule> + <?merge .Management.ReuseRule.StartDate.bool() ?><StartDate><?merge .Management.ReuseRule.StartDate ?></StartDate> + <PreventInheritance><?merge .Management.ReuseRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge .Management.ReuseRule.RefNonRuleId ?></RefNonRuleId> </ReuseRule> - <?merge .management.classificationRule.bool() ?> + <?merge .Management.ClassificationRule.bool() ?> <ClassificationRule> - <?merge .management.classificationRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> - <ClassificationLevel><?merge .management.classificationRule.classificationLevel ?></ClassificationLevel> - <ClassificationOwner><?merge .management.classificationRule.classificationOwner ?></ClassificationOwner> - <ClassificationReassessingDate><?merge .management.classificationRule.classificationReassessingDate ?></ClassificationReassessingDate> - <NeedReassessingAuthorization><?merge .management.classificationRule.needReassessingAuthorization ?></NeedReassessingAuthorization> + <?merge .Management.ClassificationRule.Rule.bool() ?><Rule><?merge .Management.ClassificationRule.Rule.value ?></Rule> + <?merge .Management.ClassificationRule.StartDate.bool() ?><StartDate><?merge .Management.ClassificationRule.StartDate ?></StartDate> + <PreventInheritance><?merge .Management.ClassificationRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge .Management.ClassificationRule.RefNonRuleId ?></RefNonRuleId> + <ClassificationLevel><?merge .Management.ClassificationRule.ClassificationLevel ?></ClassificationLevel> + <ClassificationOwner><?merge .Management.ClassificationRule.ClassificationOwner ?></ClassificationOwner> + <ClassificationReassessingDate><?merge .Management.ClassificationRule.ClassificationReassessingDate ?></ClassificationReassessingDate> + <NeedReassessingAuthorization><?merge .Management.ClassificationRule.NeedReassessingAuthorization ?></NeedReassessingAuthorization> </ClassificationRule> - <?merge .management.needAuthorization.bool() ?> + <?merge .Management.NeedAuthorization.bool() ?> <NeedAuthorization> - <?merge .management.needAuthorization ?> + <?merge .Management.NeedAuthorization ?> </NeedAuthorization> - <?merge .management.otherManagementAbstract.bool() ?> + <?merge .Management.OtherManagementAbstract.bool() ?> <OtherManagementAbstract> - <?merge .management.otherManagementAbstract ?> + <?merge .Management.OtherManagementAbstract ?> </OtherManagementAbstract> </Management> - <?merge .content.bool() ?> + <?merge .Content.bool() ?> <Content> - <DescriptionLevel listVersionID="[?merge .descriptionLevel ?]"><?merge .content.descriptionLevel ?></DescriptionLevel> - <?merge .content.title ?><Title><?merge . ?></Title> - <?merge .content.filePlanPosition ?><FilePlanPosition schemeID="[?merge .schemeID @schemeID ?]" schemeName="[?merge .schemeName @schemeName ?]" schemeAgencyID="[?merge .schemeAgencyID @schemeAgencyID ?]" schemeAgencyName="[?merge .schemeAgencyName @schemeAgencyName ?]" schemeVersionID="[?merge .schemeVersionID @schemeVersionID ?]" schemeDataURI="[?merge .schemeDataURI @schemeDataURI ?]" schemeURI="[?merge .schemeURI @schemeURI ?]"><?merge .value ?></FilePlanPosition> - <?merge .originatingSystemId ?><OriginatingSystemId><?merge .content.originatingSystemId ?></OriginatingSystemId> - <OriginatingAgencyArchiveUnitIdentifier><?merge .content.originatingAgencyArchiveUnitIdentifier ?></OriginatingAgencyArchiveUnitIdentifier> - <?merge .content.description.bool() ?><Description><?merge .content.description ?></Description> - <?merge .content.custodialHistory.bool() ?> + <DescriptionLevel><?merge .Content.DescriptionLevel ?></DescriptionLevel> + <?merge .Content.Title ?><Title><?merge . ?></Title> + <?merge .Content.FilePlanPosition ?><FilePlanPosition schemeID="[?merge .schemeID @schemeID ?]" schemeName="[?merge .schemeName @schemeName ?]" schemeAgencyID="[?merge .schemeAgencyID @schemeAgencyID ?]" schemeAgencyName="[?merge .schemeAgencyName @schemeAgencyName ?]" schemeVersionID="[?merge .schemeVersionID @schemeVersionID ?]" schemeDataURI="[?merge .schemeDataURI @schemeDataURI ?]" schemeURI="[?merge .schemeURI @schemeURI ?]"><?merge .value ?></FilePlanPosition> + <?merge .Content.OriginatingSystemId.bool() ?><OriginatingSystemId><?merge .Content.OriginatingSystemId ?></OriginatingSystemId> + <OriginatingAgencyArchiveUnitIdentifier><?merge .Content.OriginatingAgencyArchiveUnitIdentifier ?></OriginatingAgencyArchiveUnitIdentifier> + <?merge .Content.Description.bool() ?><Description><?merge .Content.Description ?></Description> + <?merge .Content.CustodialHistory.bool() ?> <CustodialHistory> - <?merge .content.custodialHistory.custodialHistoryItem ?> + <?merge .Content.CustodialHistory.CustodialHistoryItem ?> <CustodialHistoryItem when="[?merge .when ?]"><?merge .value ?></CustodialHistoryItem> </CustodialHistory> - <Type><?merge .content.type ?></Type> - <DocumentType><?merge .content.documentType ?></DocumentType> - <Language><?merge .content.language ?></Language> - <DescriptionLanguage><?merge .content.descriptionLanguage ?></DescriptionLanguage> - <Status><?merge .content.status ?></Status> - <Version><?merge .content.version ?></Version> - <?merge .content.tag ?><Tag><?merge .value ?></Tag> - <?merge .content.keyword.array() ?><Keyword> - <KeywordContent role="[?merge .keywordContent.role @role ?]"><?merge .keywordContent.value ?></KeywordContent> - <KeywordReference schemeID="[?merge .keywordReference.schemeID @schemeID ?]" schemeName="[?merge .keywordReference.schemeName @schemeName ?]" schemeAgencyID="[?merge .keywordReference.schemeAgencyID @schemeAgencyID ?]" schemeAgencyName="[?merge .keywordReference.schemeAgencyName @schemeAgencyName ?]" schemeVersionID="[?merge .keywordReference.schemeVersionID @schemeVersionID ?]" schemeDataURI="[?merge .keywordReference.schemeDataURI @schemeDataURI ?]" schemeURI="[?merge .keywordReference.schemeURI @schemeURI ?]"><?merge .keywordReference.value ?></KeywordReference> - <KeywordType listVersionID="[?merge .keywordType.listVersionID @listVersionID ?]"><?merge .keywordType ?></KeywordType> - </Keyword> - <?merge .content.originatingAgency.bool() ?> + <Type><?merge .Content.Type ?></Type> + <DocumentType><?merge .Content.DocumentType ?></DocumentType> + <Language><?merge .Content.Language ?></Language> + <DescriptionLanguage><?merge .Content.DescriptionLanguage ?></DescriptionLanguage> + <Status><?merge .Content.Status ?></Status> + <Version><?merge .Content.Version ?></Version> + <?merge .Content.Tag ?><Tag><?merge .value ?></Tag> + <?merge .Content.Keyword.array() ?><Keyword> + <KeywordContent role="[?merge .KeywordContent.role @role ?]"><?merge .KeywordContent.value ?></KeywordContent> + <KeywordReference schemeID="[?merge .KeywordReference.schemeID @schemeID ?]" schemeName="[?merge .KeywordReference.schemeName @schemeName ?]" schemeAgencyID="[?merge .KeywordReference.schemeAgencyID @schemeAgencyID ?]" schemeAgencyName="[?merge .KeywordReference.schemeAgencyName @schemeAgencyName ?]" schemeVersionID="[?merge .KeywordReference.schemeVersionID @schemeVersionID ?]" schemeDataURI="[?merge .KeywordReference.schemeDataURI @schemeDataURI ?]" schemeURI="[?merge .KeywordReference.schemeURI @schemeURI ?]"><?merge .KeywordReference.value ?></KeywordReference> + <KeywordType listVersionID="[?merge .KeywordType.listVersionID @listVersionID ?]"><?merge .KeywordType ?></KeywordType> + </Keyword> + <?merge .Content.OriginatingAgency.bool() ?> <OriginatingAgency> - <Identifier><?merge .content.originatingAgency.identifier.value ?></Identifier> + <Identifier><?merge .Content.OriginatingAgency.Identifier.value ?></Identifier> </OriginatingAgency> - <?merge .content.submissionAgency.bool() ?> + <?merge .Content.SubmissionAgency.bool() ?> <SubmissionAgency> - <?merge .content.submissionAgency $organization ?> + <?merge .Content.SubmissionAgency $organization ?> <?xinclude /resources/Organization.xml ?> </SubmissionAgency> - <?merge .content.authorizedAgend.bool() ?> + <?merge .Content.AuthorizedAgend.bool() ?> <AuthorizedAgent> - <?merge .authorizedAgent $agent ?> - <?xinclude /resources/Agent.xml ?> + <FirstName><?merge .Content.AuthorizedAgend.FirstName ?></FirstName> + <BirthName><?merge .Content.AuthorizedAgend.BirthName ?></BirthName> + <GivenName><?merge .Content.AuthorizedAgend.GivenName ?></GivenName> + <Gender><?merge .Content.AuthorizedAgend.Gender ?></Gender> + <BirthDate><?merge .Content.AuthorizedAgend.BirthDate ?></BirthDate> + <BirthPlace><?merge .Content.AuthorizedAgend.BirthPlace ?></BirthPlace> + <DeathDate><?merge .Content.AuthorizedAgend.DeathDate ?></DeathDate> + <DeathPlace><?merge .Content.AuthorizedAgend.DeathPlace ?></DeathPlace> + <Nationality><?merge .Content.AuthorizedAgend.Nationality ?></Nationality> + <Function><?merge .Content.AuthorizedAgend.Function ?></Function> + <Activity><?merge .Content.AuthorizedAgend.Activity ?></Activity> + <Position><?merge .Content.AuthorizedAgend.Position ?></Position> + <Role><?merge .Content.AuthorizedAgend.Role ?></Role> + <Corpname><?merge .Content.AuthorizedAgend.Corpname ?></Corpname> + <Identifier><?merge .Content.AuthorizedAgend.Identifier ?></Identifier> </AuthorizedAgent> - <?merge .content.writter.array() ?> - <Writter> - <?merge . $agent ?> - <?xinclude /resources/Agent.xml ?> - </Writter> - <?merge .content.addressee.array()?> + <?merge .Content.Writer.array() ?> + <Writer> + <FirstName><?merge .FirstName ?></FirstName> + <BirthName><?merge .BirthName ?></BirthName> + <GivenName><?merge .GivenName ?></GivenName> + <Gender><?merge .Gender ?></Gender> + <BirthDate><?merge .BirthDate ?></BirthDate> + <BirthPlace><?merge .BirthPlace ?></BirthPlace> + <DeathDate><?merge .DeathDate ?></DeathDate> + <DeathPlace><?merge .DeathPlace ?></DeathPlace> + <Nationality><?merge .Nationality ?></Nationality> + <Function><?merge .Function ?></Function> + <Activity><?merge .Activity ?></Activity> + <Position><?merge .Position ?></Position> + <Role><?merge .Role ?></Role> + <Corpname><?merge .Corpname ?></Corpname> + <Identifier><?merge .Identifier ?></Identifier> + </Writer> + <?merge .Content.Addressee.array()?> <Addressee> - <?merge . $agent ?> - <?xinclude /resources/Agent.xml ?> + <FirstName><?merge .FirstName ?></FirstName> + <BirthName><?merge .BirthName ?></BirthName> + <GivenName><?merge .GivenName ?></GivenName> + <Gender><?merge .Gender ?></Gender> + <BirthDate><?merge .BirthDate ?></BirthDate> + <BirthPlace><?merge .BirthPlace ?></BirthPlace> + <DeathDate><?merge .DeathDate ?></DeathDate> + <DeathPlace><?merge .DeathPlace ?></DeathPlace> + <Nationality><?merge .Nationality ?></Nationality> + <Function><?merge .Function ?></Function> + <Activity><?merge .Activity ?></Activity> + <Position><?merge .Position ?></Position> + <Role><?merge .Role ?></Role> + <Corpname><?merge .Corpname ?></Corpname> + <Identifier><?merge .Identifier ?></Identifier> </Addressee> - <?merge .content.recipient.array() ?> + <?merge .Content.Recipient.array() ?> <Recipient> - <?merge . $agent ?> - <?xinclude /resources/Agent.xml ?> + <FirstName><?merge .FirstName ?></FirstName> + <BirthName><?merge .BirthName ?></BirthName> + <GivenName><?merge .GivenName ?></GivenName> + <Gender><?merge .Gender ?></Gender> + <BirthDate><?merge .BirthDate ?></BirthDate> + <BirthPlace><?merge .BirthPlace ?></BirthPlace> + <DeathDate><?merge .DeathDate ?></DeathDate> + <DeathPlace><?merge .DeathPlace ?></DeathPlace> + <Nationality><?merge .Nationality ?></Nationality> + <Function><?merge .Function ?></Function> + <Activity><?merge .Activity ?></Activity> + <Position><?merge .Position ?></Position> + <Role><?merge .Role ?></Role> + <Corpname><?merge .Corpname ?></Corpname> + <Identifier><?merge .Identifier ?></Identifier> </Recipient> - <Source><?merge .content.source ?></Source> - <?merge .content.relatedObjectReference.bool() ?> + <Source><?merge .Content.Source ?></Source> + <?merge .Content.RelatedObjectReference.bool() ?> <RelatedObjectReference> - <?merge .content.relatedObjectReference.references ?> + <?merge .Content.RelatedObjectReference.References ?> <References> - <ArchiveUnitRefId><?merge .archiveUnitRefId ?></ArchiveUnitRefId> + <ArchiveUnitRefId><?merge .ArchiveUnitRefId ?></ArchiveUnitRefId> + <RepositoryArchiveUnitPID><?merge .RepositoryArchiveUnitPID ?></RepositoryArchiveUnitPID> </References> </RelatedObjectReference> - <CreatedDate><?merge .content.createdDate ?></CreatedDate> - <TransactedDate><?merge .content.transactedDate ?></TransactedDate> - <AcquiredDate><?merge .content.acquiredDate ?></AcquiredDate> - <SentDate><?merge .content.sentDate ?></SentDate> - <ReceivedDate><?merge .content.receivedDate ?></ReceivedDate> - <RegisteredDate><?merge .content.registeredDate ?></RegisteredDate> - <StartDate><?merge .content.startDate ?></StartDate> - <EndDate><?merge .content.endDate ?></EndDate> - <?merge .content.event.array() ?> + <CreatedDate><?merge .Content.CreatedDate ?></CreatedDate> + <TransactedDate><?merge .Content.TransactedDate ?></TransactedDate> + <AcquiredDate><?merge .Content.AcquiredDate ?></AcquiredDate> + <SentDate><?merge .Content.SentDate ?></SentDate> + <ReceivedDate><?merge .Content.ReceivedDate ?></ReceivedDate> + <RegisteredDate><?merge .Content.RegisteredDate ?></RegisteredDate> + <StartDate><?merge .Content.StartDate ?></StartDate> + <EndDate><?merge .Content.EndDate ?></EndDate> + <?merge .Content.Event.array() ?> <Event> - <EventIdentifier><?merge .eventIdentifier ?></EventIdentifier> - <EventType><?merge .eventType ?></EventType> - <EventDateTime><?merge .eventDateTime ?></EventDateTime> - <EventDetail><?merge .eventDetail ?></EventDetail> - </Event> + <EventIdentifier><?merge .EventIdentifier ?></EventIdentifier> + <EventType><?merge .EventType ?></EventType> + <EventDateTime><?merge .EventDateTime ?></EventDateTime> + <EventDetail><?merge .EventDetail ?></EventDetail> + </Event> </Content> - <?merge .archiveUnit /resources/ArchiveUnit.xml?> - <?merge .dataObjectReference.bool() ?> + <?merge .ArchiveUnit /resources/ArchiveUnit.xml?> + <?merge .DataObjectReference.array() ?> <DataObjectReference> - <?merge .dataObjectReference.dataObjectReferenceId.bool() ?> - <DataObjectReferenceId><?merge .dataObjectReference.dataObjectReferenceId ?></DataObjectReferenceId> - <?merge .dataObjectReference.dataObjectGroupReferenceId.bool() ?> - <DataObjectGroupReferenceId><?merge .dataObjectReference.dataObjectGroupReferenceId ?></DataObjectGroupReferenceId> + <?merge .DataObjectReferenceId.bool() ?> + <DataObjectReferenceId><?merge .DataObjectReferenceId ?></DataObjectReferenceId> + <?merge .DataObjectGroupReferenceId.bool() ?> + <DataObjectGroupReferenceId><?merge .DataObjectGroupReferenceId ?></DataObjectGroupReferenceId> </DataObjectReference> -</ArchiveUnit> \ No newline at end of file +</ArchiveUnit> diff --git a/modules/export_seda/resources/ArchiveUnitChildren.xml b/modules/export_seda/resources/ArchiveUnitChildren.xml old mode 100755 new mode 100644 index 201a6884ea2d84bf90bc72225c7a55b2c8bad705..ad90dcf2a309ae68e4f205f8ade7944f243469b5 --- a/modules/export_seda/resources/ArchiveUnitChildren.xml +++ b/modules/export_seda/resources/ArchiveUnitChildren.xml @@ -1,136 +1,131 @@ <ArchiveUnit id="arch_child_[?merge .id ?]"> - <ArchiveUnitRefId><?merge .archiveUnitRefId ?></ArchiveUnitRefId> - <ArchiveUnitProfile schemeID="[?merge .archiveUnitProfile.schemeID ?]" schemeName="[?merge .archiveUnitProfile.schemeName ?]" schemeAgencyID="[?merge .archiveUnitProfile.schemeAgencyID ?]" schemeAgencyName="[?merge .archiveUnitProfile.schemeAgencyName ?]" schemeVersionID="[?merge .archiveUnitProfile.schemeVersionID ?]" schemeDataURI="[?merge .archiveUnitProfile.schemeDataURI ?]" schemeURI="[?merge .archiveUnitProfile.schemeURI ?]"><?merge .archiveUnitProfile ?></ArchiveUnitProfile> - <?merge .management.bool() ?> + <ArchiveUnitRefId><?merge .ArchiveUnitRefId ?></ArchiveUnitRefId> + <ArchiveUnitProfile schemeID="[?merge .ArchiveUnitProfile.schemeID ?]" schemeName="[?merge .ArchiveUnitProfile.schemeName ?]" schemeAgencyID="[?merge .ArchiveUnitProfile.schemeAgencyID ?]" schemeAgencyName="[?merge .ArchiveUnitProfile.schemeAgencyName ?]" schemeVersionID="[?merge .ArchiveUnitProfile.schemeVersionID ?]" schemeDataURI="[?merge .ArchiveUnitProfile.schemeDataURI ?]" schemeURI="[?merge .ArchiveUnitProfile.schemeURI ?]"><?merge .ArchiveUnitProfile ?></ArchiveUnitProfile> + <?merge .Management.bool() ?> <Management> - <?merge .management.storageRule.bool() ?> + <?merge .Management.StorageRule.bool() ?> <StorageRule> - <?merge .management.storageRule $abstractRule ?> + <?merge .management.StorageRule $abstractRule ?> <?xinclude /resources/AbstractRule.xml ?> - <FinalAction><?merge .management.storageRule.finalAction ?></FinalAction> + <FinalAction><?merge .Management.StorageRule.FinalAction ?></FinalAction> </StorageRule> - <?merge .management.appraisalRule.bool() ?> + <?merge .Management.AppraisalRule.bool() ?> <AppraisalRule> - <?merge .management.appraisalRule $abstractRule ?> + <?merge .Management.AppraisalRule $abstractRule ?> <?xinclude /resources/AbstractRule.xml ?> - <FinalAction><?merge .management.appraisalRule.finalAction ?></FinalAction> + <FinalAction><?merge .Management.AppraisalRule.finalAction ?></FinalAction> </AppraisalRule> - <?merge .management.accessRule.bool() ?> + <?merge .Management.AccessRule.bool() ?> <AccessRule> - <?merge .management.accessRule $abstractRule ?> + <?merge .Management.AccessRule $abstractRule ?> <?xinclude /resources/AbstractRule.xml ?> </AccessRule> - <?merge .management.disseminationRule.bool() ?> + <?merge .Management.DisseminationRule.bool() ?> <DisseminationRule> - <?merge .management.disseminationRule $abstractRule ?> + <?merge .Management.DisseminationRule $abstractRule ?> <?xinclude /resources/AbstractRule.xml ?> </DisseminationRule> - <?merge .management.reuseRule.bool() ?> + <?merge .Management.ReuseRule.bool() ?> <ReuseRule> - <?merge .management.reuseRule $abstractRule ?> + <?merge .Management.ReuseRule $abstractRule ?> <?xinclude /resources/AbstractRule.xml ?> </ReuseRule> - <?merge .management.classificationRule.bool() ?> + <?merge .Management.ClassificationRule.bool() ?> <ClassificationRule> - <?merge .management.classificationRule $abstractRule ?> + <?merge .Management.ClassificationRule $abstractRule ?> <?xinclude /resources/AbstractRule.xml ?> - <ClassificationLevel><?merge .management.classificationRule.classificationLevel ?></ClassificationLevel> - <ClassificationOwner><?merge .management.classificationRule.classificationOwner ?></ClassificationOwner> - <ClassificationReassessingDate><?merge .management.classificationRule.classificationReassessingDate ?></ClassificationReassessingDate> - <NeedReassessingAuthorization><?merge .management.classificationRule.needReassessingAuthorization ?></NeedReassessingAuthorization> + <ClassificationLevel><?merge .Management.ClassificationRule.ClassificationLevel ?></ClassificationLevel> + <ClassificationOwner><?merge .Management.ClassificationRule.ClassificationOwner ?></ClassificationOwner> + <ClassificationReassessingDate><?merge .Management.ClassificationRule.ClassificationReassessingDate ?></ClassificationReassessingDate> + <NeedReassessingAuthorization><?merge .Management.ClassificationRule.NeedReassessingAuthorization ?></NeedReassessingAuthorization> </ClassificationRule> - <?merge .management.needAuthorization.bool() ?> + <?merge .Management.NeedAuthorization.bool() ?> <NeedAuthorization> - <?merge .management.needAuthorization ?> + <?merge .Management.NeedAuthorization ?> </NeedAuthorization> - <?merge .management.otherManagementAbstract.bool() ?> + <?merge .Management.OtherManagementAbstract.bool() ?> <OtherManagementAbstract> - <?merge .management.otherManagementAbstract ?> + <?merge .Management.OtherManagementAbstract ?> </OtherManagementAbstract> </Management> - <?merge .content.bool() ?> + <?merge .Content.bool() ?> <Content> - <DescriptionLevel listVersionID="[?merge .descriptionLevel ?]"><?merge .content.descriptionLevel ?></DescriptionLevel> - <?merge .content.title ?><Title><?merge . ?></Title> - <?merge .content.filePlanPosition ?><FilePlanPosition schemeID="[?merge .schemeID @schemeID ?]" schemeName="[?merge .schemeName @schemeName ?]" schemeAgencyID="[?merge .schemeAgencyID @schemeAgencyID ?]" schemeAgencyName="[?merge .schemeAgencyName @schemeAgencyName ?]" schemeVersionID="[?merge .schemeVersionID @schemeVersionID ?]" schemeDataURI="[?merge .schemeDataURI @schemeDataURI ?]" schemeURI="[?merge .schemeURI @schemeURI ?]"><?merge .value ?></FilePlanPosition> - <?merge .originatingSystemId ?><OriginatingSystemId><?merge .content.originatingSystemId ?></OriginatingSystemId> - <OriginatingAgencyArchiveIdentifier><?merge .content.originatingAgencyArchiveIdentifier ?></OriginatingAgencyArchiveIdentifier> - <?merge .content.description.bool() ?><Description><?merge .content.description ?></Description> - <?merge .content.custodialHistory.bool() ?> + <DescriptionLevel><?merge .Content.DescriptionLevel ?></DescriptionLevel> + <?merge .Content.Title ?><Title><?merge . ?></Title> + <?merge .Content.FilePlanPosition ?><FilePlanPosition schemeID="[?merge .schemeID @schemeID ?]" schemeName="[?merge .schemeName @schemeName ?]" schemeAgencyID="[?merge .schemeAgencyID @schemeAgencyID ?]" schemeAgencyName="[?merge .schemeAgencyName @schemeAgencyName ?]" schemeVersionID="[?merge .schemeVersionID @schemeVersionID ?]" schemeDataURI="[?merge .schemeDataURI @schemeDataURI ?]" schemeURI="[?merge .schemeURI @schemeURI ?]"><?merge .value ?></FilePlanPosition> + <?merge .Content.OriginatingSystemId ?><OriginatingSystemId><?merge .Content.OriginatingSystemId ?></OriginatingSystemId> + <OriginatingAgencyArchiveUnitIdentifier><?merge .Content.OriginatingAgencyArchiveUnitIdentifier ?></OriginatingAgencyArchiveUnitIdentifier> + <?merge .Content.Description.bool() ?><Description><?merge .Content.Description ?></Description> + <?merge .Content.CustodialHistory.bool() ?> <CustodialHistory> - <?merge .content.custodialHistory.custodialHistoryItem ?> + <?merge .Content.CustodialHistory.CustodialHistoryItem ?> <CustodialHistoryItem when="[?merge .when ?]"><?merge .value ?></CustodialHistoryItem> </CustodialHistory> - <Type><?merge .content.type ?></Type> - <DocumentType><?merge .content.documentType ?></DocumentType> - <Language><?merge .content.language ?></Language> - <DescriptionLanguage><?merge .content.descriptionLanguage ?></DescriptionLanguage> - <Status><?merge .content.status ?></Status> - <Version><?merge .content.version ?></Version> - <?merge .content.tag ?><Tag><?merge .value ?></Tag> - <?merge .content.keyword.array() ?><Keyword> - <KeywordContent role="[?merge .keywordContent.role @role ?]"><?merge .keywordContent.value ?></KeywordContent> - <KeywordReference schemeID="[?merge .keywordReference.schemeID @schemeID ?]" schemeName="[?merge .keywordReference.schemeName @schemeName ?]" schemeAgencyID="[?merge .keywordReference.schemeAgencyID @schemeAgencyID ?]" schemeAgencyName="[?merge .keywordReference.schemeAgencyName @schemeAgencyName ?]" schemeVersionID="[?merge .keywordReference.schemeVersionID @schemeVersionID ?]" schemeDataURI="[?merge .keywordReference.schemeDataURI @schemeDataURI ?]" schemeURI="[?merge .keywordReference.schemeURI @schemeURI ?]"><?merge .keywordReference.value ?></KeywordReference> - <KeywordType listVersionID="[?merge .keywordType.listVersionID @listVersionID ?]"><?merge .keywordType ?></KeywordType> + <Type><?merge .Content.Type ?></Type> + <DocumentType><?merge .Content.DocumentType ?></DocumentType> + <Language><?merge .Content.Language ?></Language> + <DescriptionLanguage><?merge .Content.DescriptionLanguage ?></DescriptionLanguage> + <Status><?merge .Content.Status ?></Status> + <Version><?merge .Content.Version ?></Version> + <?merge .Content.Tag ?><Tag><?merge .value ?></Tag> + <?merge .Content.Keyword.array() ?> + <Keyword> + <KeywordContent role="[?merge .KeywordContent.role @role ?]"><?merge .KeywordContent.value ?></KeywordContent> + <KeywordReference schemeID="[?merge .KeywordReference.schemeID @schemeID ?]" schemeName="[?merge .KeywordReference.schemeName @schemeName ?]" schemeAgencyID="[?merge .KeywordReference.schemeAgencyID @schemeAgencyID ?]" schemeAgencyName="[?merge .KeywordReference.schemeAgencyName @schemeAgencyName ?]" schemeVersionID="[?merge .KeywordReference.schemeVersionID @schemeVersionID ?]" schemeDataURI="[?merge .KeywordReference.schemeDataURI @schemeDataURI ?]" schemeURI="[?merge .KeywordReference.schemeURI @schemeURI ?]"><?merge .KeywordReference.value ?></KeywordReference> + <KeywordType listVersionID="[?merge .KeywordType.listVersionID @listVersionID ?]"><?merge .KeywordType ?></KeywordType> </Keyword> - <Coverage> - <SpatialCoverage><?merge .content.spatialCoverage ?></SpatialCoverage> - <TemporalCoverage><?merge .content.temporalCoverage ?></TemporalCoverage> - <JuridicationalCoverage><?merge .content.juridictionalCoverage ?></JuridicationalCoverage> - </Coverage> - <?merge .content.originatingAgency.bool() ?> + <?merge .Content.OriginatingAgency.bool() ?> <OriginatingAgency> - <?merge .content.originatingAgency $organization ?> - <?xinclude /resources/Organization.xml ?> + <Identifier><?merge .Content.OriginatingAgency.Identifier.value ?></Identifier> </OriginatingAgency> - <?merge .content.submissionAgency.bool() ?> + <?merge .Content.SubmissionAgency.bool() ?> <SubmissionAgency> - <?merge .content.submissionAgency $organization ?> + <?merge .Content.SubmissionAgency $organization ?> <?xinclude /resources/Organization.xml ?> </SubmissionAgency> - <?merge .content.authorizedAgend.bool() ?> + <?merge .Content.AuthorizedAgend.bool() ?> <AuthorizedAgent> - <?merge .authorizedAgent $agent ?> + <?merge .AuthorizedAgent $agent ?> <?xinclude /resources/Agent.xml ?> </AuthorizedAgent> - <?merge .content.writter.array() ?> + <?merge .Content.Writter.array() ?> <Writter> <?merge . $agent ?> <?xinclude /resources/Agent.xml ?> </Writter> - <?merge .content.addressee.array()?> + <?merge .Content.Addressee.array()?> <Addressee> <?merge . $agent ?> <?xinclude /resources/Agent.xml ?> </Addressee> - <?merge .content.recipient.array() ?> + <?merge .Content.Recipient.array() ?> <Recipient> <?merge . $agent ?> <?xinclude /resources/Agent.xml ?> </Recipient> - <Source><?merge .content.source ?></Source> - <CreatedDate><?merge .content.createdDate ?></CreatedDate> - <TransactedDate><?merge .content.transactedDate ?></TransactedDate> - <AcquiredDate><?merge .content.acquiredDate ?></AcquiredDate> - <SentDate><?merge .content.sentDate ?></SentDate> - <ReceivedDate><?merge .content.receivedDate ?></ReceivedDate> - <RegisteredDate><?merge .content.registeredDate ?></RegisteredDate> - <StartDate><?merge .content.startDate ?></StartDate> - <EndDate><?merge .content.endDate ?></EndDate> - <?merge .content.event.array() ?> + <Source><?merge .Content.Source ?></Source> + <CreatedDate><?merge .Content.CreatedDate ?></CreatedDate> + <TransactedDate><?merge .Content.TransactedDate ?></TransactedDate> + <AcquiredDate><?merge .Content.AcquiredDate ?></AcquiredDate> + <SentDate><?merge .Content.SentDate ?></SentDate> + <ReceivedDate><?merge .Content.ReceivedDate ?></ReceivedDate> + <RegisteredDate><?merge .Content.RegisteredDate ?></RegisteredDate> + <StartDate><?merge .Content.StartDate ?></StartDate> + <EndDate><?merge .Content.EndDate ?></EndDate> + <?merge .Content.Event.array() ?> <Event> - <EventIdentifier><?merge .eventIdentifier ?></EventIdentifier> - <EventType><?merge .eventType ?></EventType> - <EventDateTime><?merge .eventDateTime ?></EventDateTime> - <EventDetail><?merge .eventDetail ?></EventDetail> - </Event> + <EventIdentifier><?merge .EventIdentifier ?></EventIdentifier> + <EventType><?merge .EventType ?></EventType> + <EventDateTime><?merge .EventDateTime ?></EventDateTime> + <EventDetail><?merge .EventDetail ?></EventDetail> + </Event> </Content> - - <?merge .dataObjectReference.bool() ?> + + <?merge .DataObjectReference.bool() ?> <DataObjectReference> - <?merge .dataObjectReference.dataObjectReferenceId.bool() ?> - <DataObjectReferenceId><?merge .dataObjectReference.dataObjectReferenceId ?></DataObjectReferenceId> - <?merge .dataObjectReference.dataObjectGroupReferenceId.bool() ?> - <DataObjectGroupReferenceId><?merge .dataObjectReference.dataObjectGroupReferenceId ?></DataObjectGroupReferenceId> + <?merge .DataObjectReference.DataObjectReferenceId.bool() ?> + <DataObjectReferenceId><?merge .DataObjectReference.DataObjectReferenceId ?></DataObjectReferenceId> + <?merge .DataObjectReference.DataObjectGroupReferenceId.bool() ?> + <DataObjectGroupReferenceId><?merge .DataObjectReference.DataObjectGroupReferenceId ?></DataObjectGroupReferenceId> </DataObjectReference> </ArchiveUnit> \ No newline at end of file diff --git a/modules/export_seda/resources/DataObjectPackage.xml b/modules/export_seda/resources/DataObjectPackage.xml old mode 100755 new mode 100644 index d4031c27708e9fbab500e2a231dce04b0523936e..497103b15773b51278ab9f3d4c1abccf03fa17f3 --- a/modules/export_seda/resources/DataObjectPackage.xml +++ b/modules/export_seda/resources/DataObjectPackage.xml @@ -1,28 +1,27 @@ <DataObjectPackage> - <?merge $dataObjectPackage.binaryDataObject ?> - <BinaryDataObject id="doc_[?merge .id ?]"> - <Attachment filename="[?merge .attachment.filename ?]"/> - <Uri><?merge .uri ?></Uri> - <MessageDigest algorithm="[?merge .messageDigest.algorithm ?]"><?merge .messageDigest.value ?></MessageDigest> - <Size><?merge .size.value ?></Size> + <?merge $dataObjectPackage.BinaryDataObject ?> + <BinaryDataObject id="[?merge .id ?]"> + <?merge .Attachment.bool() ?><Attachment filename="[?merge .Attachment.filename ?]" uri="[?merge .Attachment.uri ?]"><?merge .Attachment.value ?></Attachment> + <?merge .Uri.bool() ?><Uri><?merge .Uri ?></Uri> + <MessageDigest algorithm="[?merge .MessageDigest.algorithm ?]"><?merge .MessageDigest.value ?></MessageDigest> + <Size><?merge .Size ?></Size> <FormatIdentification> - <MimeType><?merge .formatIdentification.mimeType ?></MimeType> - <FormatId><?merge .formatIdentification.formatId ?></FormatId> + <MimeType><?merge .FormatIdentification.MimeType ?></MimeType> + <FormatId><?merge .FormatIdentification.FormatId ?></FormatId> </FormatIdentification> - <?merge .fileInfo.bool() ?> + <?merge .FileInfo.bool() ?> <FileInfo> - <Filename><?merge .fileInfo.filename ?></Filename> + <Filename><?merge .FileInfo.Filename ?></Filename> </FileInfo> </BinaryDataObject> - <?merge $dataObjectPackage.physicalDataObject.bool() ?> + <?merge $dataObjectPackage.PhysicalDataObject.bool() ?> <PhysicalDataObject> <?merge .bool() ?> - <PhysicalId schemeID="[?merge .physicalId.schemeID ?]" schemeName="[?merge .physicalId.schemeName ?]" schemeAgencyID="[?merge .physicalId.schemeAgencyID ?]" schemeAgencyName="[?merge .physicalId.schemeAgencyName ?]" schemeVersionID="[?merge .physicalId.schemeVersionID ?]" schemeDataURI="[?merge .physicalId.schemeDataURI ?]" schemeURI="[?merge .physicalId.schemeURI ?]"><?merge .physicalId.value ?></PhysicalId> + <PhysicalId schemeID="[?merge .PhysicalId.schemeID ?]" schemeName="[?merge .PhysicalId.schemeName ?]" schemeAgencyID="[?merge .PhysicalId.schemeAgencyID ?]" schemeAgencyName="[?merge .PhysicalId.schemeAgencyName ?]" schemeVersionID="[?merge .PhysicalId.schemeVersionID ?]" schemeDataURI="[?merge .PhysicalId.schemeDataURI ?]" schemeURI="[?merge .PhysicalId.schemeURI ?]"><?merge .PhysicalId.value ?></PhysicalId> </PhysicalDataObject> <DescriptiveMetadata> - <?merge $dataObjectPackage.descriptiveMetadata ?> - <?xinclude /resources/ArchiveUnit.xml ?> + <?merge $dataObjectPackage.DescriptiveMetadata.ArchiveUnit /resources/ArchiveUnit.xml?> </DescriptiveMetadata> - <?merge $dataObjectPackage.managementMetadata $managementMetadata ?> + <?merge $dataObjectPackage.ManagementMetadata $managementMetadata ?> <?xinclude /resources/ManagementMetadata.xml ?> </DataObjectPackage> \ No newline at end of file diff --git a/modules/export_seda/resources/ManagementMetadata.xml b/modules/export_seda/resources/ManagementMetadata.xml old mode 100755 new mode 100644 index 0fd3fc090426c84995263f0e176852048fae38ee..66229a9ab12dfe11d6e1fad40f757ed9fbe908bb --- a/modules/export_seda/resources/ManagementMetadata.xml +++ b/modules/export_seda/resources/ManagementMetadata.xml @@ -1,48 +1,60 @@ <ManagementMetadata> - <?merge $managementMetadata.archivalProfile.bool() ?><ArchivalProfile><?merge $managementMetadata.archivalProfile.value ?></ArchivalProfile> - <?merge $managementMetadata.serviceLevel.bool() ?><ServiceLevel><?merge $managementMetadata.serviceLevel.value ?></ServiceLevel> - <?merge $managementMetadata.storageRule.bool() ?> + <?merge $managementMetadata.ArchivalProfile.bool() ?><ArchivalProfile><?merge $managementMetadata.ArchivalProfile.value ?></ArchivalProfile> + <?merge $managementMetadata.ServiceLevel.bool() ?><ServiceLevel><?merge $managementMetadata.ServiceLevel.value ?></ServiceLevel> + <?merge $managementMetadata.StorageRule.bool() ?> <StorageRule> - <?merge $managementMetadata.storageRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> - <FinalAction><?merge $managementMetadata.storageRule.finalAction ?></FinalAction> + <?merge $managementMetadata.StorageRule.Rule.bool() ?><Rule><?merge $managementMetadata.StorageRule.Rule.value ?></Rule> + <?merge $managementMetadata.StorageRule.StartDate.bool() ?><StartDate><?merge $managementMetadata.StorageRule.StartDate.value ?></StartDate> + <PreventInheritance><?merge $managementMetadata.StorageRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge $managementMetadata.StorageRule.RefNonRuleId ?></RefNonRuleId> + <FinalAction><?merge $managementMetadata.StorageRule.FinalAction ?></FinalAction> </StorageRule> - <?merge $managementMetadata.appraisalRule.bool() ?> + <?merge $managementMetadata.AppraisalRule.bool() ?> <AppraisalRule> - <?merge $managementMetadata.appraisalRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> - <FinalAction><?merge $managementMetadata.appraisalRule.finalAction ?></FinalAction> + <?merge $managementMetadata.AppraisalRule.Rule.bool() ?><Rule><?merge $managementMetadata.AppraisalRule.Rule.value ?></Rule> + <?merge $managementMetadata.AppraisalRule.StartDate.bool() ?><StartDate><?merge $managementMetadata.AppraisalRule.StartDate.value ?></StartDate> + <PreventInheritance><?merge $managementMetadata.AppraisalRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge $managementMetadata.AppraisalRule.RefNonRuleId ?></RefNonRuleId> + <FinalAction><?merge $managementMetadata.AppraisalRule.FinalAction ?></FinalAction> </AppraisalRule> - <?merge $managementMetadata.accessRule.bool() ?> + <?merge $managementMetadata.AccessRule.bool() ?> <AccessRule> - <?merge $managementMetadata.accessRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> + <?merge $managementMetadata.AccessRule.Rule.bool() ?><Rule><?merge $managementMetadata.AccessRule.Rule.value ?></Rule> + <?merge $managementMetadata.AccessRule.StartDate.bool() ?><StartDate><?merge $managementMetadata.AccessRule.StartDate.value ?></StartDate> + <PreventInheritance><?merge $managementMetadata.AccessRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge $managementMetadata.AccessRule.RefNonRuleId ?></RefNonRuleId> </AccessRule> - <?merge $managementMetadata.disseminationRule.bool() ?> + <?merge $managementMetadata.DisseminationRule.bool() ?> <DisseminationRule> - <?merge $managementMetadata.disseminationRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> + <?merge $managementMetadata.DisseminationRule.Rule.bool() ?><Rule><?merge $managementMetadata.DisseminationRule.Rule.value ?></Rule> + <?merge $managementMetadata.DisseminationRule.StartDate.bool() ?><StartDate><?merge $managementMetadata.DisseminationRule.StartDate.value ?></StartDate> + <PreventInheritance><?merge $managementMetadata.DisseminationRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge $managementMetadata.DisseminationRule.RefNonRuleId ?></RefNonRuleId> </DisseminationRule> - <?merge $managementMetadata.reuseRule.bool() ?> + <?merge $managementMetadata.ReuseRule.bool() ?> <ReuseRule> - <?merge $managementMetadata.reuseRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> + <?merge $managementMetadata.ReuseRule.Rule.bool() ?><Rule><?merge $managementMetadata.ReuseRule.Rule.value ?></Rule> + <?merge $managementMetadata.ReuseRule.StartDate.bool() ?><StartDate><?merge $managementMetadata.ReuseRule.StartDate.value ?></StartDate> + <PreventInheritance><?merge $managementMetadata.ReuseRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge $managementMetadata.ReuseRule.RefNonRuleId ?></RefNonRuleId> </ReuseRule> - <?merge $managementMetadata.classificationRule.bool() ?> + <?merge $managementMetadata.ClassificationRule.bool() ?> <ClassificationRule> - <?merge $managementMetadata.classificationRule $abstractRule ?> - <?xinclude /resources/AbstractRule.xml ?> - <ClassificationLevel><?merge $managementMetadata.classificationRule.classificationLevel ?></ClassificationLevel> - <ClassificationOwner><?merge $managementMetadata.classificationRule.classificationOwner ?></ClassificationOwner> - <ClassificationReassessingDate><?merge $managementMetadata.classificationRule.classificationReassessingDate ?></ClassificationReassessingDate> - <NeedReassessingAuthorization><?merge $managementMetadata.classificationRule.needReassessingAuthorization ?></NeedReassessingAuthorization> + <?merge $managementMetadata.ClassificationRule.Rule.bool() ?><Rule><?merge $managementMetadata.ClassificationRule.Rule.value ?></Rule> + <?merge $managementMetadata.ClassificationRule.StartDate.bool() ?><StartDate><?merge $managementMetadata.ClassificationRule.StartDate.value ?></StartDate> + <PreventInheritance><?merge $managementMetadata.ClassificationRule.PreventInheritance ?></PreventInheritance> + <RefNonRuleId><?merge $managementMetadata.ClassificationRule.RefNonRuleId ?></RefNonRuleId> + <ClassificationLevel><?merge $managementMetadata.ClassificationRule.ClassificationLevel ?></ClassificationLevel> + <ClassificationOwner><?merge $managementMetadata.ClassificationRule.ClassificationOwner ?></ClassificationOwner> + <ClassificationReassessingDate><?merge $managementMetadata.ClassificationRule.ClassificationReassessingDate ?></ClassificationReassessingDate> + <NeedReassessingAuthorization><?merge $managementMetadata.ClassificationRule.NeedReassessingAuthorization ?></NeedReassessingAuthorization> </ClassificationRule> - <?merge $managementMetadata.needAuthorization.bool() ?> + <?merge $managementMetadata.NeedAuthorization.bool() ?> <NeedAuthorization> - <?merge $managementMetadata.needAuthorization ?> + <?merge $managementMetadata.NeedAuthorization ?> </NeedAuthorization> - <?merge $managementMetadata.otherManagementAbstract.bool() ?> + <?merge $managementMetadata.OtherManagementAbstract.bool() ?> <OtherManagementAbstract> - <?merge $managementMetadata.otherManagementAbstract ?> + <?merge $managementMetadata.OtherManagementAbstract ?> </OtherManagementAbstract> -</ManagementMetadata> \ No newline at end of file +</ManagementMetadata> diff --git a/modules/export_seda/resources/Organization.xml b/modules/export_seda/resources/Organization.xml old mode 100755 new mode 100644 index 61967de7d4797f01c459e8122cbbf067ac67eb67..f7c20b479b67ebe95e48057e6f0294f964c8f397 --- a/modules/export_seda/resources/Organization.xml +++ b/modules/export_seda/resources/Organization.xml @@ -1,2 +1,41 @@ -<Identifier schemeID="[?merge $organization.identifier.schemeID @schemeID ?]" schemeName="[?merge $organization.identifier.schemeName @schemeName ?]" schemeAgencyID="[?merge $organization.identifier.schemeAgencyID @schemeAgencyID ?]" schemeAgencyName="[?merge $organization.identifier.schemeAgencyName @schemeAgencyName ?]" schemeVersionID="[?merge $organization.identifier.schemeVersionID @schemeVersionID ?]" schemeDataURI="[?merge $organization.identifier.schemeDataURI @schemeDataURI ?]" schemeURI="[?merge $organization.identifier.schemeURI @schemeURI ?]"><?merge $organization.identifier.value ?></Identifier> -<OrganizationDescriptiveMetadata></OrganizationDescriptiveMetadata> \ No newline at end of file +<Identifier schemeID="[?merge $organization.Identifier.schemeID @schemeID ?]" schemeName="[?merge $organization.Identifier.schemeName @schemeName ?]" schemeAgencyID="[?merge $organization.Identifier.schemeAgencyID @schemeAgencyID ?]" schemeAgencyName="[?merge $organization.Identifier.schemeAgencyName @schemeAgencyName ?]" schemeVersionID="[?merge $organization.Identifier.schemeVersionID @schemeVersionID ?]" schemeDataURI="[?merge $organization.Identifier.schemeDataURI @schemeDataURI ?]" schemeURI="[?merge $organization.Identifier.schemeURI @schemeURI ?]"><?merge $organization.Identifier.value ?></Identifier> + <?merge $organization.OrganizationDescriptiveMetadata.bool() ?> +<OrganizationDescriptiveMetadata> + <?merge $organization.OrganizationDescriptiveMetadata.LegalClassification.bool() ?> + <LegalClassification><?merge $organization.OrganizationDescriptiveMetadata.LegalClassification ?></LegalClassification> + <?merge $organization.OrganizationDescriptiveMetadata.Name.bool() ?> + <Name><?merge $organization.OrganizationDescriptiveMetadata.Name ?></Name> + <?merge $organization.OrganizationDescriptiveMetadata.Address.array() ?> + <Address> + <CityName><?merge .CityName ?></CityName> + <Country><?merge .Country ?></Country> + <PostCode><?merge .PostCode ?></PostCode> + <PostOfficeBox><?merge .PostOfficeBox ?></PostOfficeBox> + <StreetName><?merge .StreetName ?></StreetName> + </Address> + <?merge $organization.OrganizationDescriptiveMetadata.Communication.array() ?> + <Communication> + <Channel><?merge .Channel ?></Channel> + <CompleteNumber><?merge .value ?></CompleteNumber> + </Communication> + <?merge $organization.OrganizationDescriptiveMetadata.Contact.array() ?> + <Contact> + <?merge .DepartmentName.bool() ?> + <DepartmentName><?merge .DepartmentName ?></DepartmentName> + <?merge .PersonName.bool() ?> + <PersonName><?merge .PersonName ?></PersonName> + <?merge .Communication ?> + <Communication> + <Channel><?merge .Channel ?></Channel> + <CompleteNumber><?merge .value ?></CompleteNumber> + </Communication> + <?merge .Address ?> + <Address> + <CityName><?merge .CityName ?></CityName> + <Country><?merge .Country ?></Country> + <PostCode><?merge .PostCode ?></PostCode> + <PostOfficeBox><?merge .PostOfficeBox ?></PostOfficeBox> + <StreetName><?merge .StreetName ?></StreetName> + </Address> + </Contact> +</OrganizationDescriptiveMetadata> diff --git a/modules/export_seda/resources/xsd/seda-2.0-descriptive.xsd b/modules/export_seda/resources/xsd/seda-2.0-descriptive.xsd new file mode 100644 index 0000000000000000000000000000000000000000..c31866cb892647a42631436c6489ae76e43ba014 --- /dev/null +++ b/modules/export_seda/resources/xsd/seda-2.0-descriptive.xsd @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="fr:gouv:culture:archivesdefrance:seda:v2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="fr:gouv:culture:archivesdefrance:seda:v2.0" + elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> + <xsd:include schemaLocation="seda-2.0-types.xsd"/> + <xsd:include schemaLocation="seda-2.0-management.xsd"/> + <xsd:include schemaLocation="seda-2.0-ontology.xsd"/> + + <!-- Hierarchy and recursivity --> + <xsd:complexType name="ArchiveUnitType"> + <xsd:annotation> + <xsd:documentation>Unité de base des métadonnées de description contenant la gestion de l'arborescence.</xsd:documentation> + </xsd:annotation> + <xsd:choice> + <xsd:element name="ArchiveUnitRefId" type="ArchiveUnitRefIdType"> + <xsd:annotation> + <xsd:documentation>Permet de faire une référence à d'autres ArchiveUnit dans la même transaction.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:sequence> + <xsd:element name="ArchiveUnitProfile" type="IdentifierType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Référence à une partie d'un profil d’archivage applicable à un ArchiveUnit en particulier. Permet par exemple de faire référence à une typologie documentaire dans un profil d'archivage.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Management" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Métadonnées de gestion applicables à l’ArchiveUnit concernée et à ses héritiers.</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="ManagementGroup"/> + </xsd:complexType> + </xsd:element> + <xsd:element name="Content" type="DescriptiveMetadataContentType" minOccurs="1" maxOccurs="unbounded" > + <xsd:annotation> + <xsd:documentation>Métadonnées de description associées à un ArchiveUnit.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <!-- Hierarchy --> + <xsd:choice> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="ArchiveUnit" type="ArchiveUnitType"> + <xsd:annotation> + <xsd:documentation>Gestion de la récursivité. Un <ArchiveUnit> peut être contenu dans un ature <ArchiveUnit>.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element ref="ArchiveUnitReferenceAbstract"> + <xsd:annotation> + <xsd:documentation>Permet de faire référence à une sous unité d'archives, pouvant être déjà présente dans le système d'archivage provenant d'une transaction précédente.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="DataObjectReference" type="DataObjectRefType"> + <xsd:annotation> + <xsd:documentation>Permet de faire référence à un objet-donnée binaire ou physique déjà présent dans les métadonnées du bordereau.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:choice> + </xsd:sequence> + </xsd:choice> + <xsd:attribute name="id" type="ArchiveUnitIdType" use="required"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'unité d'archives utilisé par exemple dans le cas de multiples héritages, pour savoir quel noeud contient une erreur.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- In ArchiveUnitType from seda-2.0-descriptive.xsd: Descriptive Metadata Content --> + <xsd:complexType name="DescriptiveMetadataContentType"> + <xsd:annotation> + <xsd:documentation>Permet de définir les métadonnées de description. Peut être étendu.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:group ref="ObjectGroup"/> + </xsd:sequence> + <xsd:attribute name="restrictionRuleIdRef" type="xsd:IDREF" use="optional"> + <xsd:annotation> + <xsd:documentation>Permet d'indiquer les restrictions à appliquer sur le noeud. Si rien n'est spécifié, aucune restriction ne s'applique.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="restrictionValue" type="NonEmptyTokenType" use="optional"> + <xsd:annotation> + <xsd:documentation>Valeur de la restriction.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="restrictionEndDate" type="xsd:date" use="optional"> + <xsd:annotation> + <xsd:documentation>Date de la fin de la restriction.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attributeGroup ref="OpenTypeAttributeGroup"/> + </xsd:complexType> + +</xsd:schema> diff --git a/modules/export_seda/resources/xsd/seda-2.0-main.xsd b/modules/export_seda/resources/xsd/seda-2.0-main.xsd new file mode 100644 index 0000000000000000000000000000000000000000..08fd37638339dd5b0442ac2be82358145bb03587 --- /dev/null +++ b/modules/export_seda/resources/xsd/seda-2.0-main.xsd @@ -0,0 +1,816 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="fr:gouv:culture:archivesdefrance:seda:v2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="fr:gouv:culture:archivesdefrance:seda:v2.0" + elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> + + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/> + <xsd:import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink.xsd"/> + + <!-- + ***************************** + *** Types de base + ***************************** + --> + <xsd:include schemaLocation="seda-2.0-types.xsd"/> + <!-- + ***************************** + *** Base technique + ***************************** + --> + <xsd:include schemaLocation="seda-2.0-technical.xsd"/> + <!-- + ***************************** + *** Base de gestion + ***************************** + --> + <xsd:include schemaLocation="seda-2.0-management.xsd"/> + <!-- + ***************************** + *** Base descriptive + ***************************** + --> + <xsd:include schemaLocation="seda-2.0-descriptive.xsd"/> + + <!-- + ***************************** + *** Code List + ***************************** + + --> + <!-- Liste des versions des référentiels issue de MEDONA --> + <xsd:group name="TransportCodeListsGroup"> + <xsd:annotation> + <xsd:documentation>Liste des codes de réponses souhaitée par l'expéditeur.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:group ref="ReplyCodeListGroup"/> + </xsd:sequence> + </xsd:group> + <!-- Reply Code list --> + <xsd:group name="ReplyCodeListGroup"> + <xsd:sequence> + <xsd:element name="ReplyCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Liste des codes de réponses à utiliser.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:simpleType name="ReplyCodeType"> + <xsd:annotation> + <xsd:documentation>Code de réponses spécifié dans la liste de réponses.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="NonEmptyTokenType"/> + </xsd:simpleType> + + + <!-- Liste des versions des référentiels utilisés globalement --> + <xsd:complexType name="CodeListVersionsType"> + <xsd:sequence> + <xsd:group ref="TransportCodeListsGroup"/> + <xsd:group ref="TechnicalCodeListsGroup"/> + <xsd:group ref="ManagementCodeListsGroup"/> + <xsd:element name="AuthorizationReasonCodeListVersion" type="CodeType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Version de la liste de codes d'autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="RelationshipCodeListVersion" type="CodeType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Version de la liste de codes des relations.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element ref="OtherCodeListAbstract" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Permet d'ajouter de nouvelles listes de codes si l'ajout d'autres métadonnées l'impose.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute ref="xml:id" use="optional"/> + </xsd:complexType> + + <!-- + ***************************** + *** Types métier + ***************************** + + --> + + <!-- Paquet d'Objets-données --> + <xsd:complexType name="DataObjectPackageType"> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="BinaryDataObject" type="BinaryDataObjectType"> + <xsd:annotation> + <xsd:documentation>Bloc de métadonnées techniques des objets-données numériques. Le caractère facultatif est requis afin de permettre le transfert d'un plan de classement sans DataObject joint.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="PhysicalDataObject" type="PhysicalDataObjectType"> + <xsd:annotation> + <xsd:documentation>Bloc de métadonnées techniques des objets-données physiques.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + <xsd:element name="DescriptiveMetadata" type="DescriptiveMetadataType"> + <xsd:annotation> + <xsd:documentation>Bloc de métadonnées descriptives des objets-données.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ManagementMetadata" type="ManagementMetadataType"> + <xsd:annotation> + <xsd:documentation>Bloc des métadonnées de gestion par défaut des objets-données.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute ref="xml:id" use="optional"/> + </xsd:complexType> + + <!-- Métadonnées de gestion --> + <xsd:complexType name="ManagementMetadataType"> + <xsd:sequence> + <xsd:element name="ArchivalProfile" type="IdentifierType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Profil d’archivage applicable aux ArchiveUnit.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ServiceLevel" type="IdentifierType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Niveau de service applicable aux unités d’archives.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:group ref="ManagementGroup" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Métadonnées de gestion associées à l'ensemble des unités d'archives.</xsd:documentation> + </xsd:annotation> + </xsd:group> + </xsd:sequence> + <xsd:attribute ref="xml:id" use="optional"/> + </xsd:complexType> + + <!-- Demande d'autorisation --> + <xsd:complexType name="AuthorizationRequestContentType"> + <xsd:sequence> + <xsd:element name="AuthorizationReason" type="xsd:token"> + <xsd:annotation> + <xsd:documentation>Motif de l'autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Comment" type="TextType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Commentaire sur la transaction.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="RequestDate" type="xsd:date"> + <xsd:annotation> + <xsd:documentation>Date de la demande d'autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="UnitIdentifier" type="IdentifierType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'unité documentaire.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Requester" type="OrganizationType"> + <xsd:annotation> + <xsd:documentation>Demandeur de l'autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="AuthorizationRequestReply" + type="BusinessAuthorizationRequestReplyMessageType" minOccurs="0" + maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Réponse à la demande d’autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute ref="xml:id" use="optional"/> + </xsd:complexType> + + <!-- + ***************************** + *** Base de l'arborescence + ***************************** + --> + + <!-- Métadonnées descriptives pour un paquet d'Objets-données --> + <xsd:complexType name="DescriptiveMetadataType"> + <xsd:sequence> + <xsd:element name="ArchiveUnit" type="ArchiveUnitType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Correspond à la notion de composant en ISAD(G). ArchiveUnit permet à la fois de gérer la hiérarchie intellectuelle, + tout en contenant les métadonnées de description et de gestion propres à chaque niveau de description archivistique.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + + <!-- + ***************************** + *** Déclaration des types de message + ***************************** + --> + + <!-- Message --> + <xsd:complexType name="MessageType" abstract="true"> + <xsd:sequence> + <xsd:element name="Comment" type="TextType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Commentaire sur le message.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Date" type="xsd:dateTime"> + <xsd:annotation> + <xsd:documentation>Date du message.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="MessageIdentifier" type="IdentifierType"> + <xsd:annotation> + <xsd:documentation>Identifiant du message.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Signature" type="SignatureType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Signature du message.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute ref="xml:id" use="optional"/> + </xsd:complexType> + + + <!-- Message métier --> + <xsd:complexType name="BusinessMessageType" abstract="true"> + <xsd:complexContent> + <xsd:extension base="MessageType"> + <xsd:sequence> + <xsd:element name="ArchivalAgreement" type="IdentifierType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Accord de service.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="CodeListVersions" type="CodeListVersionsType"> + <xsd:annotation> + <xsd:documentation>Listes de codes de références utilisés dans le message.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="DataObjectPackage" type="DataObjectPackageType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Objets-données échangés dans le message.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- Message de demande --> + <xsd:complexType name="BusinessRequestMessageType" abstract="true"> + <xsd:complexContent> + <xsd:extension base="BusinessMessageType"/> + </xsd:complexContent> + </xsd:complexType> + + <!-- Message de demande d'autorisation --> + <xsd:complexType name="BusinessAuthorizationRequestMessageType" abstract="true"> + <xsd:complexContent> + <xsd:extension base="BusinessRequestMessageType"> + <xsd:sequence> + <xsd:element name="AuthorizationRequestContent" + type="AuthorizationRequestContentType"> + <xsd:annotation> + <xsd:documentation>Demande d’autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- Message de reponse à une demande --> + <xsd:complexType name="BusinessReplyMessageType" abstract="true"> + <xsd:complexContent> + <xsd:extension base="BusinessMessageType"> + <xsd:sequence> + <xsd:element name="ReplyCode" type="NonEmptyTokenType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Code de la réponse.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="MessageRequestIdentifier" type="IdentifierType"> + <xsd:annotation> + <xsd:documentation>Identifiant de la demande.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- Message de demande d'autorisation --> + <xsd:complexType name="BusinessAuthorizationRequestReplyMessageType" abstract="true"> + <xsd:complexContent> + <xsd:extension base="BusinessReplyMessageType"/> + </xsd:complexContent> + </xsd:complexType> + + <!-- Message de notification --> + <xsd:complexType name="BusinessNotificationMessageType" abstract="true"> + <xsd:complexContent> + <xsd:extension base="BusinessMessageType"/> + </xsd:complexContent> + </xsd:complexType> + + <!-- Défintion des organisations avec Id --> + <xsd:complexType name="OrganizationWithIdType"> + <xsd:complexContent> + <xsd:extension base="OrganizationType"> + <xsd:attribute ref="xml:id" use="optional"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + + <!-- + ***************************** + *** Le message d'accusé de réception + ***************************** + --> + <xsd:element name="Acknowledgement" type="AcknowledgementType"> + <xsd:annotation> + <xsd:documentation>Accusé de réception d'un message.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="AcknowledgementType"> + <xsd:complexContent> + <xsd:extension base="MessageType"> + <xsd:sequence> + <xsd:element name="MessageReceivedIdentifier" type="IdentifierType"> + <xsd:annotation> + <xsd:documentation>Identifiant du message reçu.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Sender" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Expéditeur du message.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Receiver" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Destinataire du message.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- + ***************************** + *** Les messages de requete + ***************************** + --> + <!-- Message de demande de communication --> + <xsd:element name="ArchiveDeliveryRequest" type="ArchiveDeliveryRequestType"> + <xsd:annotation> + <xsd:documentation>Demande de communication d'archives.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ArchiveDeliveryRequestType"> + <xsd:complexContent> + <xsd:extension base="BusinessRequestMessageType"> + <xsd:sequence> + <xsd:element name="Derogation" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation>Indique si une procédure de dérogation est nécessaire avant de communiquer l’unité documentaire ArchiveUnit.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="UnitIdentifier" type="IdentifierType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'unité documentaire.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la communication.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Requester" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Demandeur de la communication.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <!-- Message de demande de restitution --> + <xsd:element name="ArchiveRestitutionRequest" type="ArchiveRestitutionRequestType"> + <xsd:annotation> + <xsd:documentation>Demande de restitution d'archives.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ArchiveRestitutionRequestType"> + <xsd:complexContent> + <xsd:extension base="BusinessRequestMessageType"> + <xsd:sequence> + <xsd:element name="UnitIdentifier" type="IdentifierType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'unité documentaire.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la restitution.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="OriginatingAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service producteur demandant la restitution.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <!-- Message de transfert (attention le paquet de données est facultatif)--> + <xsd:element name="ArchiveTransfer" type="ArchiveTransferType"> + <xsd:annotation> + <xsd:documentation>Transfert d'archives.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ArchiveTransferType"> + <xsd:complexContent> + <xsd:extension base="BusinessRequestMessageType"> + <xsd:sequence> + <xsd:element name="RelatedTransferReference" type="IdentifierType" minOccurs="0" + maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Identifiant d’un transfert associé.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="TransferRequestReplyIdentifier" type="IdentifierType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Identifiant de la réponse à une demande de transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable du transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="TransferringAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service versant chargé de réaliser le transport.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <!-- Message de demande de transfert --> + <xsd:element name="ArchiveTransferRequest" type="ArchiveTransferRequestType"> + <xsd:annotation> + <xsd:documentation>Demande de transfert d’archives.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ArchiveTransferRequestType"> + <xsd:complexContent> + <xsd:extension base="BusinessRequestMessageType"> + <xsd:sequence> + <xsd:element name="RelatedTransferReference" type="IdentifierType" minOccurs="0" + maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Référence à un transfert d'archives lié.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="TransferDate" type="xsd:dateTime" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date retenue pour le transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable du transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="TransferringAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service versant responsable du transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- + ***************************** + *** Les messages de demande d'autorisation + ***************************** + --> + <!-- Message de demande d'autorisation au service de contrôle --> + <xsd:element name="AuthorizationControlAuthorityRequest" + type="AuthorizationControlAuthorityRequestType"> + <xsd:annotation> + <xsd:documentation>Demande d'autorisation au service de contrôle.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="AuthorizationControlAuthorityRequestType"> + <xsd:complexContent> + <xsd:extension base="BusinessAuthorizationRequestMessageType"> + <xsd:sequence> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la demande d'autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ControlAuthority" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Autorité de contrôle.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <!-- Message de demande d'autorisation au service producteur --> + <xsd:element name="AuthorizationOriginatingAgencyRequest" + type="AuthorizationOriginatingAgencyRequestType"> + <xsd:annotation> + <xsd:documentation>Demande d'autorisation au service producteur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="AuthorizationOriginatingAgencyRequestType"> + <xsd:complexContent> + <xsd:extension base="BusinessAuthorizationRequestMessageType"> + <xsd:sequence> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la demande d'autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="OriginatingAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service producteur responsable de l’instruction de la demande d’autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- + ***************************** + *** Les messages de reponse à une requete + ***************************** + --> + <!-- Message de réponse à une demande de communication --> + <xsd:element name="ArchiveDeliveryRequestReply" type="ArchiveDeliveryRequestReplyType"> + <xsd:annotation> + <xsd:documentation>Réponse à une demande de communication d'archives.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ArchiveDeliveryRequestReplyType"> + <xsd:complexContent> + <xsd:extension base="BusinessReplyMessageType"> + <xsd:sequence> + <xsd:element name="AuthorizationRequestReplyIdentifier" type="IdentifierType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Identifiant de la réponse à une demande d’autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="UnitIdentifier" type="IdentifierType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'unité documentaire.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la demande de communication.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Requester" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Demandeur de la communication.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <!-- Message de réponse à une demande de restitution --> + <xsd:element name="ArchiveRestitutionRequestReply" type="ArchiveRestitutionRequestReplyType"> + <xsd:annotation> + <xsd:documentation>Réponse à une demande de restitution d'archives.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ArchiveRestitutionRequestReplyType"> + <xsd:complexContent> + <xsd:extension base="BusinessReplyMessageType"> + <xsd:sequence> + <xsd:element name="UnitIdentifier" type="IdentifierType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'unité documentaire.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la demande de restitution.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="OriginatingAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service producteur responsable de la demande de restitution.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <!-- Message de réponse à un transfert --> + <xsd:element name="ArchiveTransferReply" type="ArchiveTransferReplyType"> + <xsd:annotation> + <xsd:documentation>Réponse à un transfert d'archives (acceptation, rejet, anomalie..).</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ArchiveTransferReplyType"> + <xsd:complexContent> + <xsd:extension base="BusinessReplyMessageType"> + <xsd:sequence> + <xsd:element name="GrantDate" type="xsd:dateTime" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de prise en charge effective du transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la réponse à un transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="TransferringAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service versant responsable de la réponse à un transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <!-- Message de réponse à une demande de transfert --> + <xsd:element name="ArchiveTransferRequestReply" type="ArchiveTransferRequestReplyType"> + <xsd:annotation> + <xsd:documentation>Réponse à une demande de transfert d’archives.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ArchiveTransferRequestReplyType"> + <xsd:complexContent> + <xsd:extension base="BusinessReplyMessageType"> + <xsd:sequence> + <xsd:element name="TransferDate" type="xsd:dateTime" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la réponse à une demande de transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="TransferringAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service versant responsable de la réponse à une demande de transfert.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <!-- + ***************************** + *** Les messages de reponse à une demande d'autorisation + ***************************** + --> + <!-- Message de réponse à une demande d'autorisation au service de contrôle --> + <xsd:element name="AuthorizationControlAuthorityRequestReply" + type="AuthorizationControlAuthorityRequestReplyType"> + <xsd:annotation> + <xsd:documentation>Réponse donnée à une demande d'autorisation au service de contrôle.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="AuthorizationControlAuthorityRequestReplyType"> + <xsd:complexContent> + <xsd:extension base="BusinessAuthorizationRequestReplyMessageType"> + <xsd:sequence> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la réponse à une demande d'autorisation à un service de contrôle.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ControlAuthority" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service de contrôle responsable de la réponse à une demande d'autorisation à un service de contrôle.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <!-- Message de réponse à une demande d'autorisation au service producteur --> + <xsd:element name="AuthorizationOriginatingAgencyRequestReply" + type="AuthorizationOriginatingAgencyRequestReplyType"> + <xsd:annotation> + <xsd:documentation>Réponse donnée à une demande d'autorisation au service producteur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="AuthorizationOriginatingAgencyRequestReplyType"> + <xsd:complexContent> + <xsd:extension base="BusinessAuthorizationRequestReplyMessageType"> + <xsd:sequence> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d’archives à l’origine de la demande d’autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="OriginatingAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service producteur responsable de l’instruction de la demande d’autorisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- + ***************************** + *** Les messages de notification + ***************************** + --> + <!-- Message de notification d'élimination --> + <xsd:element name="ArchiveDestructionNotification" type="ArchiveDestructionNotificationType"> + <xsd:annotation> + <xsd:documentation>Notification d'élimination d'archives.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ArchiveDestructionNotificationType"> + <xsd:complexContent> + <xsd:extension base="BusinessNotificationMessageType"> + <xsd:sequence> + <xsd:element name="AuthorizationRequestReplyIdentifier" type="IdentifierType"> + <xsd:annotation> + <xsd:documentation>Identifiant de la réponse à une demande d'autorisation d'élimination.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="UnitIdentifier" type="IdentifierType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'unité documentaire.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la notification d'élimination.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="OriginatingAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service producteur responsable de la notification d'élimination.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- Message de notification de modification --> + <xsd:element name="ArchiveModificationNotification" type="ArchiveModificationNotificationType"> + <xsd:annotation> + <xsd:documentation>Notification de modification d'archives (format ou métadonnées).</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="ArchiveModificationNotificationType"> + <xsd:complexContent> + <xsd:extension base="BusinessNotificationMessageType"> + <xsd:sequence> + <xsd:element name="UnitIdentifier" type="IdentifierType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'unité documentaire.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service d'archives responsable de la notification de modification.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="OriginatingAgency" type="OrganizationWithIdType"> + <xsd:annotation> + <xsd:documentation>Service producteur responsable de la notification de modification.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + +</xsd:schema> diff --git a/modules/export_seda/resources/xsd/seda-2.0-management.xsd b/modules/export_seda/resources/xsd/seda-2.0-management.xsd new file mode 100644 index 0000000000000000000000000000000000000000..2c1a6f4552389fdb7c983ca09e48c678f56a41af --- /dev/null +++ b/modules/export_seda/resources/xsd/seda-2.0-management.xsd @@ -0,0 +1,446 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema + targetNamespace="fr:gouv:culture:archivesdefrance:seda:v2.0" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="fr:gouv:culture:archivesdefrance:seda:v2.0" + elementFormDefault="qualified" + attributeFormDefault="unqualified" + version="1.0"> + <xsd:include schemaLocation="seda-2.0-types.xsd"/> + + <!-- + ***************************** + *** Code List + ***************************** + + --> + <xsd:group name="ManagementCodeListsGroup"> + <xsd:annotation> + <xsd:documentation>Listes de codes nécessaires dans les métadonnées de gestion.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:group ref="StorageRuleCodeListGroup" minOccurs="0"/> + <xsd:group ref="AppraisalRuleCodeListGroup" minOccurs="0"/> + <xsd:group ref="AccessRuleCodeListGroup" minOccurs="0"/> + <xsd:group ref="DisseminationRuleCodeListGroup" minOccurs="0"/> + <xsd:group ref="ReuseRuleCodeListGroup" minOccurs="0"/> + <xsd:group ref="ClassificationRuleCodeListGroup" minOccurs="0"/> + </xsd:sequence> + </xsd:group> + + <!-- Management Lists and Codes --> + <xsd:complexType name="RuleIdType"> + <xsd:annotation> + <xsd:documentation>Identifiant de la règle de gestion.</xsd:documentation> + </xsd:annotation> + <xsd:simpleContent> + <xsd:extension base="NonEmptyTokenType"> + <xsd:attribute name="id" type="xsd:ID" use="optional"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <xsd:group name="AccessRuleCodeListGroup"> + <xsd:sequence> + <xsd:element name="AccessRuleCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Version des listes de codes pour les règles de communicabilité.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <xsd:group name="DisseminationRuleCodeListGroup"> + <xsd:sequence> + <xsd:element name="DisseminationRuleCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Version des listes de codes pour les règles de diffusion.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <xsd:group name="ReuseRuleCodeListGroup"> + <xsd:sequence> + <xsd:element name="ReuseRuleCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Version des listes de codes pour les règles de réutilisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <xsd:group name="ClassificationRuleCodeListGroup"> + <xsd:sequence> + <xsd:element name="ClassificationRuleCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Version des listes de codes pour les règles de classification.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <xsd:group name="AppraisalRuleCodeListGroup"> + <xsd:sequence> + <xsd:element name="AppraisalRuleCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Version des listes de codes pour les règles de durée d'utilité administrative.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <xsd:group name="StorageRuleCodeListGroup"> + <xsd:sequence> + <xsd:element name="StorageRuleCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Version des listes de codes pour les règles de durée d'utilité courante.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Management content --> + <xsd:group name="ManagementGroup"> + <xsd:annotation> + <xsd:documentation>Contient les métadonnées de gestion.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="StorageRule" type="StorageRuleType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Gestion de la durée d’utilité courante.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="AppraisalRule" type="AppraisalRuleType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Gestion de la durée d’utilité administrative.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="AccessRule" type="AccessRuleType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Gestion de la communicabilité.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="DisseminationRule" type="DisseminationRuleType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Gestion de la diffusion.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ReuseRule" type="ReuseRuleType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Gestion de la réutilisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ClassificationRule" type="ClassificationRuleType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Gestion de la classification.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="NeedAuthorization" type="xsd:boolean" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Indique si une autorisation humaine est nécessaire pour vérifier ou valider les opérations de gestion des ArchiveUnit.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element ref="OtherManagementAbstract" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Autres métadonnées de gestion.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Example of codification of one Rule Code oustide SEDA in an external referential --> + <xsd:complexType name="DurationRuleType"> + <xsd:annotation> + <xsd:documentation>Permet d'exprimer pour une règle de gestion quelles informations doivent en découler.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="RuleId" type="RuleIdType"> + <xsd:annotation> + <xsd:documentation>Identifiant de la règle</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Value" type="MeasurementDurationType"/> + <xsd:element name="Description" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="MeasurementDurationUnitsType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="day"/> + <xsd:enumeration value="DAY"/> + <xsd:enumeration value="month"/> + <xsd:enumeration value="MON"/> + <xsd:enumeration value="year"/> + <xsd:enumeration value="ANN"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="MeasurementDurationType"> + <xsd:simpleContent> + <xsd:extension base="xsd:nonNegativeInteger"> + <xsd:attribute name="unit" type="MeasurementDurationUnitsType" use="required"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <!-- Global inheritance control --> + <xsd:group name="PreventInheritanceGroup"> + <xsd:choice> + <xsd:element name="PreventInheritance" type="xsd:boolean" default="false" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Indique si les règles de gestion héritées des ArchiveUnit parents doivent être ignorées pour l’ArchiveUnit concerné.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:group> + + <xsd:complexType name="AccessRuleType"> + <xsd:annotation> + <xsd:documentation>Gestion de la communicabilité.</xsd:documentation> + <xsd:documentation>Chaque règle a une startDate et un Identifiant de règle de référence pour la durée. + Si aucune règle n'est spécifiée et que la date actuelle est dans la StarDate, la réponse de restriction est "Aucune restriction". + Si la date est vide, la réponse de restriction est "Restreint" car il n'y a aucun moyen de calculer la date de fin. + Si une règle et une date sont précisées, alors la date de fin d'application de la règle peut être calculée et comparée avec la date courante..</xsd:documentation> + <xsd:documentation>La liste d'identifiants de règles à appliquer et à ignorer qui doit être appliquée à partir de cet ArchiveUnit.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:sequence minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="Rule" type="RuleIdType"> + <xsd:annotation> + <xsd:documentation>Référence à la règle de communicabilité.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="StartDate" type="xsd:date" nillable="true" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de départ de calcul de la règle de communicabilité.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:choice minOccurs="0"> + <xsd:group ref="PreventInheritanceGroup"/> + <xsd:element name="RefNonRuleId" type="RuleIdType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Identifiant de la règle à désactiver à partir de cette ArchiveUnit.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="DisseminationRuleType"> + <xsd:annotation> + <xsd:documentation>Gestion de la diffusion.</xsd:documentation> + <xsd:documentation>Chaque règle a une startDate et un Identifiant de règle de référence pour la durée. + Si aucune règle n'est spécifiée et que la date actuelle est dans la StarDate, la réponse de restriction est "Aucune restriction". + Si la date est vide, la réponse de restriction est "Restreint" car il n'y a aucun moyen de calculer la date de fin. + Si une règle et une date sont précisées, alors la règle est valable (restriction appliquée).</xsd:documentation> + <xsd:documentation>La liste d'identifiants de règles à appliquer et à ignorer qui doit être appliquée à partir de cet ArchiveUnit.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:sequence minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="Rule" type="RuleIdType"> + <xsd:annotation> + <xsd:documentation>Référence à la règle de diffusion.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="StartDate" type="xsd:date" nillable="true" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de départ de calcul de la règle de diffusion.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:choice minOccurs="0"> + <xsd:group ref="PreventInheritanceGroup"/> + <xsd:element name="RefNonRuleId" type="RuleIdType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>L'identifiant de la règle spécifiée pourra être retirée de l'héritage dans ce noeud.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="ReuseRuleType"> + <xsd:annotation> + <xsd:documentation>Gestion de la réutilisation.</xsd:documentation> + <xsd:documentation>Chaque règle a une startDate et un Identifiant de règle de référence pour la durée. + Si aucune règle n'est spécifiée et que la date actuelle est dans la StarDate, la réponse de restriction est "Aucune restriction". + Si la date est vide, la réponse de restriction est "Restreint" car il n'y a aucun moyen de calculer la date de fin. + Si une règle et une date sont précisées, alors la règle est valable (restriction appliquée).</xsd:documentation> + <xsd:documentation>La liste d'identifiants de règles à appliquer et à ignorer qui doit être appliquée à partir de cet ArchiveUnit.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:sequence minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="Rule" type="RuleIdType"> + <xsd:annotation> + <xsd:documentation>Référence à la règle de réutilisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="StartDate" type="xsd:date" nillable="true" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de départ de calcul de la règle de réutilisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:choice minOccurs="0"> + <xsd:group ref="PreventInheritanceGroup"/> + <xsd:element name="RefNonRuleId" type="RuleIdType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>L'identifiant de la règle spécifiée pourra être retirée de l'héritage dans ce noeud.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="ClassificationRuleType"> + <xsd:annotation> + <xsd:documentation>Gestion de la classification.</xsd:documentation> + <xsd:documentation>Chaque règle a une startDate et un Identifiant de règle de référence pour la durée. + Si aucune règle n'est spécifiée et que la date actuelle est dans la StarDate, la réponse de restriction est "Aucune restriction". + Si la date est vide, la réponse de restriction est "Restreint" car il n'y a aucun moyen de calculer la date de fin. + Si une règle et une date sont précisées, alors la règle est valable (restriction appliquée).</xsd:documentation> + <xsd:documentation>La liste d'identifiants de règles à appliquer et à ignorer qui doit être appliquée à partir de cet ArchiveUnit.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:sequence minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="Rule" type="RuleIdType"> + <xsd:annotation> + <xsd:documentation>Référence à la règle de classification.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="StartDate" type="xsd:date" nillable="true" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de départ de calcul de la règle de classification.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:choice minOccurs="0"> + <xsd:group ref="PreventInheritanceGroup"/> + <xsd:element name="RefNonRuleId" type="RuleIdType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>L'identifiant de la règle spécifiée pourra être retirée de l'héritage dans ce noeud.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + <xsd:element name="ClassificationLevel" type="NonEmptyTokenType"> + <xsd:annotation> + <xsd:documentation>Référence au niveau de classification.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ClassificationOwner" type="NonEmptyTokenType"> + <xsd:annotation> + <xsd:documentation>Propriétaire de la classification. Service émetteur au sens de l’IGI 1300.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ClassificationReassessingDate" type="xsd:date" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de réévaluation de la classification.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="NeedReassessingAuthorization" type="xsd:boolean" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Indique si une autorisation humaine est nécessaire pour réévaluer la classification.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:simpleType name="FinalActionStorageCodeType"> + <xsd:annotation> + <xsd:documentation>Code correspondant à l’action à entreprendre au terme de la durée d’utilité courante.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="NonEmptyTokenType"> + <xsd:enumeration value="RestrictAccess"/> + <xsd:enumeration value="Transfer"/> + <xsd:enumeration value="Copy"/> + </xsd:restriction> + </xsd:simpleType> + + <xsd:complexType name="StorageRuleType"> + <xsd:annotation> + <xsd:documentation>Gestion de la durée d'utilité courante.</xsd:documentation> + <xsd:documentation>Chaque règle a une startDate et un Identifiant de règle de référence pour la durée. + Si aucune règle n'est spécifiée et que la date actuelle est dans la StarDate, la réponse de restriction est "Aucune restriction". + Si la date est vide, la réponse de restriction est "Restreint" car il n'y a aucun moyen de calculer la date de fin. + Si une règle et une date sont précisées, alors la règle est valable (restriction appliquée).</xsd:documentation> + <xsd:documentation>La liste d'identifiants de règles à appliquer et à ignorer qui doit être appliquée à partir de cet ArchiveUnit.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:sequence minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="Rule" type="RuleIdType"> + <xsd:annotation> + <xsd:documentation>Référence à la règle de durée d'utilité courante.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="StartDate" type="xsd:date" nillable="true" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de départ de calcul de la règle d'utilité courante.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:choice minOccurs="0"> + <xsd:group ref="PreventInheritanceGroup"/> + <xsd:element name="RefNonRuleId" type="RuleIdType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>L'identifiant de la règle spécifiée pourra être retirée de l'héritage dans ce noeud.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + <xsd:element name="FinalAction" type="FinalActionStorageCodeType"> + <xsd:annotation> + <xsd:documentation>Action à mettre en Å“uvre au terme de la durée de gestion.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:simpleType name="FinalActionAppraisalCodeType"> + <xsd:annotation> + <xsd:documentation>Code correspondant à l’action à entreprendre au terme de la durée d’utilité administrative.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="NonEmptyTokenType"> + <xsd:enumeration value="Keep"/> + <xsd:enumeration value="Destroy"/> + </xsd:restriction> + </xsd:simpleType> + + <xsd:complexType name="AppraisalRuleType"> + <xsd:annotation> + <xsd:documentation>Gestion de la durée d'utilité administrative.</xsd:documentation> + <xsd:documentation>Chaque règle a une startDate et un Identifiant de règle de référence pour la durée. + Si aucune règle n'est spécifiée et que la date actuelle est dans la StarDate, la réponse de restriction est "Aucune restriction". + Si la date est vide, la réponse de restriction est "Restreint" car il n'y a aucun moyen de calculer la date de fin. + Si une règle et une date sont précisées, alors la règle est valable (restriction appliquée).</xsd:documentation> + <xsd:documentation>La liste d'identifiants de règles à appliquer et à ignorer qui doit être appliquée à partir de cet ArchiveUnit.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:sequence minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="Rule" type="RuleIdType"> + <xsd:annotation> + <xsd:documentation>Référence à la règle de durée d'utilité administrative.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="StartDate" type="xsd:date" nillable="true" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de départ de calcul de durée d'utilité administrative.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:choice minOccurs="0"> + <xsd:group ref="PreventInheritanceGroup"/> + <xsd:element name="RefNonRuleId" type="RuleIdType" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>L'identifiant de la règle spécifiée pourra être retirée de l'héritage dans ce noeud.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + <xsd:element name="FinalAction" type="FinalActionAppraisalCodeType"> + <xsd:annotation> + <xsd:documentation>Action à mettre en Å“uvre au terme de la durée de gestion.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> +</xsd:schema> diff --git a/modules/export_seda/resources/xsd/seda-2.0-ontology.xsd b/modules/export_seda/resources/xsd/seda-2.0-ontology.xsd new file mode 100644 index 0000000000000000000000000000000000000000..5b64db279840671e82d78829f47a0ff56441ad4d --- /dev/null +++ b/modules/export_seda/resources/xsd/seda-2.0-ontology.xsd @@ -0,0 +1,950 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="fr:gouv:culture:archivesdefrance:seda:v2.0" + xmlns:pr="info:lc/xmlns/premis-v2" xmlns="fr:gouv:culture:archivesdefrance:seda:v2.0" elementFormDefault="qualified" + attributeFormDefault="unqualified" version="1.0"> + <xsd:include schemaLocation="seda-2.0-types.xsd"/> + + <xsd:group name="ObjectGroup"> + <xsd:annotation> + <xsd:documentation>Contient les éléments nécessaires à + la description de l'ArchiveUnit et est sensé être la racine du bloc des métadonnées de + description.</xsd:documentation> + <xsd:documentation>Chaque sous-type ou sous-groupe peut aussi être utilisé pour + construire de nouveaux types ou groupes.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:group ref="BaseObjectGroup"/> + <xsd:element ref="ObjectGroupExtenstionAbstract" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:group> + + <xsd:group name="BaseObjectGroup"> + <xsd:sequence> + <xsd:group ref="LevelGroup" minOccurs="1"/> + <xsd:group ref="TitleGroup" minOccurs="1"/> + <xsd:group ref="IdentifierGroup"/> + <xsd:group ref="DescriptionGroup"/> + <xsd:group ref="CustodialHistoryGroup"/> + <xsd:group ref="TypeGroup"/> + <xsd:group ref="DocumentTypeGroup"/> + <xsd:group ref="LanguageGroup"/> + <xsd:group ref="StatusGroup"/> + <xsd:group ref="VersionGroup"/> + <xsd:group ref="KeywordsGroup"/> + <xsd:group ref="CoverageGroup"/> + <xsd:group ref="OriginatingAgencyGroup"/> + <xsd:group ref="SubmissionAgencyGroup"/> + <xsd:group ref="AuthorizedAgentGroup"/> + <xsd:group ref="WritingGroup"/> + <xsd:group ref="AudienceGroup"/> + <xsd:group ref="SourceGroup"/> + <xsd:group ref="RelationGroup"/> + <xsd:group ref="DateGroup"/> + <xsd:group ref="EventGroup"/> + <xsd:group ref="SignatureGroup"/> + <xsd:group ref="GpsGroup"/> + </xsd:sequence> + </xsd:group> + + <!-- Level description --> + <xsd:group name="LevelGroup"> + <xsd:sequence> + <xsd:element name="DescriptionLevel" type="LevelType" minOccurs="1"> + <xsd:annotation> + <xsd:documentation>Niveau de description au sens de la norme ISAD (G). Indique si l’ArchiveUnit correspond à un fonds, + à un sous-fonds, à une classe, à une série organique, à une sous-série organique, à un dossier, à un sous-dossier ou à une pièce.</xsd:documentation> + <xsd:documentation>Référence : seda.DescriptionLevel</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:simpleType name="LevelType"> + <xsd:annotation> + <xsd:documentation>Valeurs de DescriptionLevel.</xsd:documentation> + <xsd:documentation>Références : descriptionlevel_code SEDA 1.0</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Fonds"/> + <xsd:enumeration value="Subfonds"/> + <xsd:enumeration value="Class"/> + <xsd:enumeration value="Collection"/> + <xsd:enumeration value="Series"/> + <xsd:enumeration value="Subseries"/> + <xsd:enumeration value="RecordGrp"/> + <xsd:enumeration value="SubGrp"/> + <xsd:enumeration value="File"/> + <xsd:enumeration value="Item"/> + </xsd:restriction> + </xsd:simpleType> + <!-- Title description --> + <xsd:group name="TitleGroup"> + <xsd:sequence> + <xsd:element name="Title" type="TextType" minOccurs="1" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Intitulé de l'ArchiveUnit.</xsd:documentation> + <xsd:documentation>Références : DC.Title ead.unittitle</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Identification description --> + <xsd:group name="IdentifierGroup"> + <xsd:sequence> + <xsd:element name="FilePlanPosition" type="NonEmptyTokenType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Position de l’ArchiveUnit dans le plan de classement du service producteur.</xsd:documentation> + <xsd:documentation>Références : seda.FilePlanPosition</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SystemId" type="NonEmptyTokenType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Identifiant attribué aux objets. Il est attribué par le SAE et correspond à un identifiant interne.</xsd:documentation> + <xsd:documentation>Références : ARMS</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="OriginatingSystemId" type="NonEmptyTokenType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Identifiant système attribué à l’ArchiveUnit par l’application du service producteur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ArchivalAgencyArchiveUnitIdentifier" type="NonEmptyTokenType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Identifiant métier attribué à l'ArchiveUnit par le service d'archives. Peut être comparé à une cote.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="OriginatingAgencyArchiveUnitIdentifier" type="NonEmptyTokenType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Identifiant métier attribué à l’ArchiveUnit par le service producteur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="TransferringAgencyArchiveUnitIdentifier" type="NonEmptyTokenType" + minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Identifiant attribué à l'ArchiveUnit par le service versant.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- General description --> + <xsd:group name="DescriptionGroup"> + <xsd:sequence> + <xsd:element name="Description" type="TextType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Description détaillée de l’ArchiveUnit. Correspond à la présentation du contenu au sens de la norme ISAD(G).</xsd:documentation> + <xsd:documentation>Références : DC:Documentation</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- CustodialHistory type --> + <xsd:group name="CustodialHistoryGroup"> + <xsd:sequence> + <xsd:element name="CustodialHistory" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Énumère les changements successifs de propriété, de responsabilité et de conservation des ArchiveUnit avant + leur entrée dans le lieu de conservation. On peut notamment y indiquer comment s'est effectué le passage de l'application + d'origine au fichier archivable. Correspond à l'historique de la conservation en ISAD(G).</xsd:documentation> + <xsd:documentation>Références : seda.CustodialHistory</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="CustodialHistoryItem" minOccurs="1" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Description d'une période ou d'un événement précis dans l'historique.</xsd:documentation> + <xsd:documentation>Références : seda.CustodialHistoryItem</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="TextType"> + <xsd:attribute name="when" type="DateType" use="optional"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustodialHistoryFile" type="DataObjectRefType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Référence à un fichier de journalisation externe.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- OAIS type description --> + <xsd:group name="TypeGroup"> + <xsd:sequence> + <xsd:element name="Type" type="TextType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Type d’information au sens de l’OAIS (information de représentation, information de pérennisation, etc.).</xsd:documentation> + <xsd:documentation>Références : seda.DocumentType</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Document type description --> + <xsd:group name="DocumentTypeGroup"> + <xsd:sequence> + <xsd:element name="DocumentType" type="TextType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Type de document au sens diplomatique du terme (ex. compte-rendu de réunion, note, correspondance, etc.). Ne pas confondre avec Type.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Language description --> + <xsd:group name="LanguageGroup"> + <xsd:sequence> + <xsd:element name="Language" type="xsd:language" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Langue du contenu des objets-données.</xsd:documentation> + <xsd:documentation>Références : seda.Language</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="DescriptionLanguage" type="xsd:language" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Langue utilisée pour les informations de représentation et de pérennisation.</xsd:documentation> + <xsd:documentation>Références : seda.DescriptionLanguage</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Status description --> + <xsd:group name="StatusGroup"> + <xsd:sequence> + <xsd:element name="Status" type="NonEmptyTokenType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Etat de l'objet-données (par rapport avec son cycle de vie). Permet par exemple d'indiquer si la signature du fichier a été vérifiée avant le transfert aux archives.</xsd:documentation> + <xsd:documentation>Références : seda.Status</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Version description --> + <xsd:group name="VersionGroup"> + <xsd:sequence> + <xsd:element name="Version" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Permet d'indiquer quelle est la version du document.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Keywords description --> + <xsd:group name="KeywordsGroup"> + <xsd:sequence> + <xsd:element name="Tag" type="NonEmptyTokenType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Mots-clés ou liste de mots-clés génériques. En ce qui concerne l'indexation, on pourra utiliser Tag ou Keyword en fonction de ce que l'on souhaite décrire.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Keyword" type="KeywordsType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Mots-clef avec contexte inspiré du SEDA 1.0. En ce qui concerne l'indexation, on pourra utiliser Tag ou Keyword en fonction de ce que l'on souhaite décrire.</xsd:documentation> + <xsd:documentation>Références : seda.Keyword</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <!-- Repris du SEDA 1.0 --> + <xsd:complexType name="KeywordsType"> + <xsd:annotation> + <xsd:documentation>Mots-clés.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="KeywordContent" type="TextType"> + <xsd:annotation> + <xsd:documentation>Valeur du mot-clé. A utiliser avec Keyword.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="KeywordReference" type="IdentifierType" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Identifiant du mot clé dans un référentiel donné. Par exemple, pour un lieu, il pourrait s'agir de son code officiel géographique selon l'INSEE.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="KeywordType" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Type de mot clé.</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:simpleContent> + <xsd:extension base="CodeKeywordType"> + <xsd:attribute name="listVersionID" type="xsd:token" use="optional" + default="edition 2009"> + </xsd:attribute> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID" use="optional"/> + </xsd:complexType> + <!-- =============================================================== --> + <!-- ===== Code List KeywordType: KeywordType Code ======= --> + <!-- =============================================================== --> + <xsd:simpleType name="CodeKeywordType"> + <xsd:annotation> + <xsd:documentation xml:lang="fr">Table des types de mots-clés.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="corpname"> + <xsd:annotation> + <xsd:documentation xml:lang="fr">Collectivité.</xsd:documentation> + <xsd:documentation>Références : ead.corpname</xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + <xsd:enumeration value="famname"> + <xsd:annotation> + <xsd:documentation xml:lang="fr">Nom de famille.</xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + <xsd:enumeration value="geogname"> + <xsd:annotation> + <xsd:documentation xml:lang="fr">Nom géographique.</xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + <xsd:enumeration value="name"> + <xsd:annotation> + <xsd:documentation xml:lang="fr">Nom.</xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + <xsd:enumeration value="occupation"> + <xsd:annotation> + <xsd:documentation xml:lang="fr">Fonction.</xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + <xsd:enumeration value="persname"> + <xsd:annotation> + <xsd:documentation xml:lang="fr">Nom de personne.</xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + <xsd:enumeration value="subject"> + <xsd:annotation> + <xsd:documentation xml:lang="fr">Mot-matière.</xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + <xsd:enumeration value="genreform"> + <xsd:annotation> + <xsd:documentation xml:lang="fr">Type de document.</xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + <xsd:enumeration value="function"> + <xsd:annotation> + <xsd:documentation xml:lang="fr">Activité.</xsd:documentation> + <xsd:documentation xml:lang="fr">Références : ead.function</xsd:documentation> + </xsd:annotation> + </xsd:enumeration> + </xsd:restriction> + </xsd:simpleType> + + <!-- Coverage description --> + <xsd:group name="CoverageGroup"> + <xsd:sequence> + <xsd:element name="Coverage" type="CoverageType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Couverture spatiale, temporelle ou juridictionnelle de l’ArchiveUnit</xsd:documentation> + <xsd:documentation>Références : DC.Coverage</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:complexType name="CoverageType"> + <xsd:sequence> + <xsd:element name="Spatial" type="TextType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Couverture spatiale ou couverture géographique.</xsd:documentation> + <xsd:documentation>Références: AGKRMS.spatialCoverage</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Temporal" type="TextType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Couverture temporelle.</xsd:documentation> + <xsd:documentation>Références: AGKRMS.temporalCoverage</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Juridictional" type="TextType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Juridiction administrative ou ressort administratif.</xsd:documentation> + <xsd:documentation>Références: AGKRMS.juridictionalCoverage</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + + <!-- OriginatingAgency description --> + <xsd:group name="OriginatingAgencyGroup"> + <xsd:sequence> + <xsd:element name="OriginatingAgency" type="OrganizationType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Service producteur. "Personne physique ou morale, publique ou privée, qui a produit, reçu et conservé des archives dans l'exercice de son activité", Dictionnaire de terminologie archivistique, direction des archives de France, 2002.</xsd:documentation> + <xsd:documentation>Références : seda.OriginatingAgency</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- SubmissionAgency description --> + <xsd:group name="SubmissionAgencyGroup"> + <xsd:sequence> + <xsd:element name="SubmissionAgency" type="OrganizationType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Service versant responsable du transfert des données.</xsd:documentation> + <xsd:documentation>Références : seda.SubmissionAgency</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Proxy description --> + <xsd:group name="AuthorizedAgentGroup"> + <xsd:sequence> + <xsd:element name="AuthorizedAgent" type="AgentType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Titulaire des droits de propriété intellectuelle.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Writing description --> + <xsd:group name="WritingGroup"> + <xsd:sequence> + <xsd:annotation> + <xsd:documentation>Rédacteur de l'objet d'archive.</xsd:documentation> + </xsd:annotation> + <xsd:element name="Writer" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Rédacteur Rédacteur de l’ArchiveUnit.</xsd:documentation> + <xsd:documentation>Références : interpares.Writer</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="WriterGroup"/> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:group name="WriterGroup"> + <xsd:sequence> + <xsd:group ref="PersonGroup"/> + <xsd:group ref="BusinessGroup"/> + </xsd:sequence> + </xsd:group> + + + <!-- Audience description --> + <xsd:group name="AudienceGroup"> + <xsd:sequence> + <xsd:annotation> + <xsd:documentation>Audience du document. Permet de gérer les questions de "diffusion restreinte", de "spécial France" et de "Confidentiel Industrie".</xsd:documentation> + </xsd:annotation> + <xsd:group ref="AddresseeGroup"/> + <xsd:group ref="RecipientGroup"/> + </xsd:sequence> + </xsd:group> + + <!-- Source description --> + <xsd:group name="SourceGroup"> + <xsd:sequence> + <xsd:element name="Source" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>En cas de substitution numérique, permet de faire référence au papier.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Relation description --> + <xsd:group name="RelationGroup"> + <xsd:annotation> + <xsd:documentation>Les valeurs sont des identifiants au choix : - d'un autre objet données (DataObjectRefIdType ou GroupIdType s'ils sont dans le même transfert, ou identifiant dans le SAE sinon) - d'un autre ArchiveUnit (ArchiveUnitRefIdType s'il est dans le même transfert, ou identifiant dans le SAE sinon).</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="RelatedObjectReference" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Référence à un objet faisant ou ne faisant pas partie du présent paquet d'information.</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="IsVersionOf" type="DataObjectOrArchiveUnitReferenceType" + minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Est une version de. Edition, adaptation, traduction. Cette relation permet d'indiquer les modifications dans le contenu.</xsd:documentation> + <xsd:documentation>Références : DC.Relation.isVersionOf</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Replaces" type="DataObjectOrArchiveUnitReferenceType" minOccurs="0" + maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Remplace. Cette relation permet d'indiquer les objets remplacés par le niveau courant de description.</xsd:documentation> + <xsd:documentation>DC.Relation.replaces</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Requires" type="DataObjectOrArchiveUnitReferenceType" minOccurs="0" + maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Requiert. Cette relation permet d'indiquer les objets nécessaire à la compréhension du niveau courant de description.</xsd:documentation> + <xsd:documentation>Références : DC.Relation.requires</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="IsPartOf" type="DataObjectOrArchiveUnitReferenceType" minOccurs="0" + maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Est une partie de. Cette relation permet d'indique qu'un objet est une partie d'un autre.</xsd:documentation> + <xsd:documentation>Références : DC.Relation.isPartOf</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="References" type="DataObjectOrArchiveUnitReferenceType" minOccurs="0" + maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Référence. Cette relation permet d'indiquer qu'un objet en référence un autre.</xsd:documentation> + <xsd:documentation>DC.Relation.references</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:complexType name="DataObjectOrArchiveUnitReferenceType"> + <xsd:choice> + <xsd:element name="ArchiveUnitRefId" type="ArchiveUnitRefIdType"> + <xsd:annotation> + <xsd:documentation>Référence à un ArchiveUnit interne.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="DataObjectReference" type="DataObjectRefType"> + <xsd:annotation> + <xsd:documentation>Référence à un objet-données ou à un groupe d'objets-données interne(s).</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="RepositoryArchiveUnitPID" type="NonEmptyTokenType"> + <xsd:annotation> + <xsd:documentation>Référence à un ArchiveUnit déjà conservé dans un système d'archivage.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="RepositoryObjectPID" type="NonEmptyTokenType"> + <xsd:annotation> + <xsd:documentation>Référence à un un objet-données ou à un groupe d'objets-données déjà conservé(s) dans un système d'archivage.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:complexType> + <!-- Date description --> + <xsd:group name="DateGroup"> + <xsd:sequence> + <xsd:element name="CreatedDate" type="DateType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de création.</xsd:documentation> + <xsd:documentation>Références : ARKMS.DateCreated</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="TransactedDate" type="DateType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de la transaction.</xsd:documentation> + <xsd:documentation>Références : ARKMS.DateTransacted</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="AcquiredDate" type="DateType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de numérisation.</xsd:documentation> + <xsd:documentation>Références : ARKMS.DateAcquired</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SentDate" type="DateType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date d'envoi.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ReceivedDate" type="DateType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de réception.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="RegisteredDate" type="DateType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date d'enregistrement.</xsd:documentation> + <xsd:documentation>Références : ARMS.DateDeclared</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="StartDate" type="DateType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date d'ouverture / date de début.</xsd:documentation> + <xsd:documentation>Références : AGKRMS.StartDate</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="EndDate" type="DateType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de fermeture / Date de fin.</xsd:documentation> + <xsd:documentation>Références : AGKRMS.EndDate</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:simpleType name="DateType"> + <xsd:union memberTypes="xsd:date xsd:dateTime"/> + </xsd:simpleType> + <!-- Event description --> + <xsd:group name="EventGroup"> + <xsd:sequence> + <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Informations décrivant un événement survenu au cours d’une procédure (ex. publication d’un marché, notification d’un marché, recueil d’un avis administratif, etc.).</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:complexType name="EventType"> + <xsd:sequence> + <xsd:element name="EventIdentifier" type="NonEmptyTokenType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'événement.</xsd:documentation> + <xsd:documentation>Références : premis.eventIdentifier</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="EventType" type="NonEmptyTokenType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Type d'événement.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="EventDateTime" type="xsd:dateTime"> + <xsd:annotation> + <xsd:documentation>Date et heure de l'événement.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="EventDetail" type="TextType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Détail sur l'événement.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <!-- Signature description --> + <xsd:group name="SignatureGroup"> + <xsd:sequence> + <xsd:element name="Signature" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Contient toutes les informations relatives à la signature.</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="DateSignature" type="xsd:dateTime"> + <xsd:annotation> + <xsd:documentation>Date de l'objet signature.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Signer"> + <xsd:annotation> + <xsd:documentation>Signataire(s) de la transaction ou de l'objet.</xsd:documentation> + <xsd:documentation>Références : premis.signer</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="SignerGroup"/> + </xsd:complexType> + </xsd:element> + <xsd:element name="Validator"> + <xsd:annotation> + <xsd:documentation>Validateur de la signature.</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="ValidatorGroup"/> + </xsd:complexType> + </xsd:element> + <xsd:element name="Masterdata" type="CodeType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Référentiel des personnes et des organisations au moment de la vérification de la signature et de sa validation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="ReferencedObject" type="ReferencedObjectType"> + <xsd:annotation> + <xsd:documentation>Référence à l'objet signé.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:complexType name="ReferencedObjectType"> + <xsd:annotation> + <xsd:documentation>Contient la référence à l'objet signé (et son empreinte jusqu'à la fin de la phase de versement dans le SAE).</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="SignedObjectId" type="DataObjectRefIdType"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'objet-données signé.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="SignedObjectDigest" type="MessageDigestBinaryObjectType"> + <xsd:annotation> + <xsd:documentation>Empreinte obligatoire jusqu'au processus de versement pour assurer la portabilité de la valeur probante. Le SAE peut ne pas la conserver si l'on considère que l'identifiant de l'objet correspondant suffit. Ce procédé permet de résister au temps lorsque les informations binaires du paquet seront converties au gré des opérations de préservation de la lisibilité des formats. Au cours de ces opérations, l'identifiant ne changera pas, contrairement au format dufichier et donc à son empreinte.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:group name="SignerGroup"> + <xsd:sequence> + <xsd:group ref="PersonOrEntityGroup"/> + <xsd:element name="SigningTime" type="xsd:dateTime"> + <xsd:annotation> + <xsd:documentation>Date de signature.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:group ref="BusinessGroup"/> + </xsd:sequence> + </xsd:group> + <xsd:group name="ValidatorGroup"> + <xsd:sequence> + <xsd:group ref="PersonOrEntityGroup"/> + <xsd:element name="ValidationTime" type="xsd:dateTime"> + <xsd:annotation> + <xsd:documentation>Date de la validation de la signature.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:group ref="BusinessGroup"/> + </xsd:sequence> + </xsd:group> + + <!-- Addressee description --> + <xsd:group name="AddresseeGroup"> + <xsd:sequence> + <xsd:element name="Addressee" minOccurs="0" maxOccurs="unbounded" type="AgentType"> + <xsd:annotation> + <xsd:documentation>Destinataire pour action. Utilisé pour indiquer le nom du destinatire par exemple dans un courrier électronique.</xsd:documentation> + <xsd:documentation>Références : ARMS.Addressee, Interpares.Addressee</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <!-- Recipient description --> + <xsd:group name="RecipientGroup"> + <xsd:sequence> + <xsd:element name="Recipient" minOccurs="0" maxOccurs="unbounded" type="AgentType"> + <xsd:annotation> + <xsd:documentation>Destinataire pour information. Utilisé pour indiquer le nom du destinatire en copie, pour information, par exemple dans un courrier électronique.</xsd:documentation> + <xsd:documentation>Références : Interpares.Recipient</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <!-- Person description --> + <xsd:group name="PersonGroup"> + <xsd:sequence> + <xsd:element name="FirstName" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Prénom d'une personne.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="BirthName" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Nom de naissance d'une personne.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="GivenName" type="xsd:string" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Nom d'usage d'une personne.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Gender" type="NonEmptyTokenType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Sexe de la personne.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="BirthDate" type="xsd:date" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de naissance de la personne.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="BirthPlace" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Lieu de naissance de la personne.</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="LocationGroup"/> + </xsd:complexType> + </xsd:element> + <xsd:element name="DeathDate" type="xsd:date" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de décès d'une personne.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="DeathPlace" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Lieu de décès d'une personne.</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="LocationGroup"/> + </xsd:complexType> + </xsd:element> + <xsd:element name="Nationality" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Nationalité d'une personne.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Identifier" type="NonEmptyTokenType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Dans le PersonGroup, Identifiant de type numéro matricule.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <!-- Entity description --> + <xsd:group name="EntityGroup"> + <xsd:sequence> + <xsd:element name="Corpname" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Nom d'une entité.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Identifier" type="NonEmptyTokenType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'entité.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <!-- Agent description --> + <xsd:complexType name="AgentType"> + <xsd:annotation> + <xsd:documentation>Informations décrivant une personne physique ou morale.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:group ref="PersonOrEntityGroup"/> + </xsd:sequence> + </xsd:complexType> + <xsd:group name="PersonOrEntityGroup"> + <xsd:choice> + <xsd:group ref="PersonGroup"/> + <xsd:group ref="EntityGroup"/> + </xsd:choice> + </xsd:group> + <!-- Business description --> + <xsd:group name="BusinessGroup"> + <xsd:annotation> + <xsd:documentation>Références : AGKRMS.Business</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="Function" type="TextType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>En plus des balises Tag et Keyword, il est possible d'indexer les objets avec des éléments pré-définis : Fonction.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Activity" type="TextType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>En plus des balises Tag et Keyword, il est possible d'indexer les objets avec des éléments pré-définis : Activité.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Position" type="TextType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Intitulé du poste de travail occupé par la personne.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Role" type="TextType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>Droits avec lesquels un utilisateur a réalisé une opération, notamment dans une application.</xsd:documentation> + <xsd:documentation>Références : moreq.role</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <!-- Location description --> + <xsd:group name="LocationGroup"> + <xsd:annotation> + <xsd:documentation>Localisation.</xsd:documentation> + </xsd:annotation> + <xsd:all> + <xsd:element name="Geogname" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>En plus des balises Tag et Keyword, il est possible d'indexer les objets avec des éléments pré-définis : Nom géographique.</xsd:documentation> + <xsd:documentation>Références : ead.geogname</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Address" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>En plus des balises Tag et Keyword, il est possible d'indexer les objets avec des éléments pré-définis : Adresse.</xsd:documentation> + <xsd:documentation>Références : ead.address</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="PostalCode" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>En plus des balises Tag et Keyword, il est possible d'indexer les objets avec des éléments pré-définis : Code postal.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="City" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>En plus des balises Tag et Keyword, il est possible d'indexer les objets avec des éléments pré-définis : Ville.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Region" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>En plus des balises Tag et Keyword, il est possible d'indexer les objets avec des éléments pré-définis : Région.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Country" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>En plus des balises Tag et Keyword, il est possible d'indexer les objets avec des éléments pré-définis : Pays.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:all> + </xsd:group> + <!-- GPS Description: shared with Descriptive and Technical --> + <xsd:group name="GpsGroup"> + <xsd:sequence> + <xsd:element name="Gps" type="GpsType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Coordonnées gps complétées ou vérifiées par un utilisateur. Fait référence à des coordonnées traitées par un utilisateur et non à des coordonnées captées.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:complexType name="GpsType"> + <xsd:sequence> + <xsd:element name="GpsVersionID" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Identifiant de la version du GPS.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="GpsAltitude" type="xsd:integer" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Altitude de la position GPS.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="GpsAltitudeRef" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>0 (niveau de la mer) / 1 (référence au niveau de la mer - valeur négative -).</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="GpsLatitude" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>N (Nord) / S (Sud).</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="GpsLatitudeRef" type="xsd:string" minOccurs="0"/> + <xsd:element name="GpsLongitude" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Latitude de la position GPS.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="GpsLongitudeRef" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>E (Est) / W (Ouest).</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="GpsDateStamp" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Heure et Date de la position GPS.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + +</xsd:schema> diff --git a/modules/export_seda/resources/xsd/seda-2.0-technical.xsd b/modules/export_seda/resources/xsd/seda-2.0-technical.xsd new file mode 100644 index 0000000000000000000000000000000000000000..9e557ee06d1ab537a212df6b0e466d0fef100520 --- /dev/null +++ b/modules/export_seda/resources/xsd/seda-2.0-technical.xsd @@ -0,0 +1,481 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema targetNamespace="fr:gouv:culture:archivesdefrance:seda:v2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="fr:gouv:culture:archivesdefrance:seda:v2.0" + elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> + <xsd:include schemaLocation="seda-2.0-types.xsd"/> + + <!-- + ***************************** + *** Code List + ***************************** + + --> + <xsd:group name="TechnicalCodeListsGroup"> + <xsd:annotation> + <xsd:documentation>Liste de codes à utiliser dans les métadonnées techniques.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:group ref="DigestAlgorithmCodeListGroup"/> + <xsd:group ref="MimeTypeCodeListGroup" minOccurs="0"/> + <xsd:group ref="EncodingCodeListGroup" minOccurs="0"/> + <xsd:group ref="FileFormatCodeListGroup"/> + <xsd:group ref="CompressionAlgorithmCodeListGroup" minOccurs="0"/> + <xsd:group ref="DataObjectVersionCodeListGroup" minOccurs="0"/> + </xsd:sequence> + </xsd:group> + + <!-- Identification of format code --> + <xsd:simpleType name="MimeTypeType"> + <xsd:annotation> + <xsd:documentation>Code de type Mime.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="NonEmptyTokenType"/> + </xsd:simpleType> + <xsd:group name="MimeTypeCodeListGroup"> + <xsd:sequence> + <xsd:element name="MimeTypeCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Version de la liste de code du type Mime.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:simpleType name="EncodingType"> + <xsd:annotation> + <xsd:documentation>Encodage du fichier.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="NonEmptyTokenType"/> + </xsd:simpleType> + <xsd:group name="EncodingCodeListGroup"> + <xsd:sequence> + <xsd:element name="EncodingCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Version de la liste de code d'encodage du fichier.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:simpleType name="FileFormatType"> + <xsd:annotation> + <xsd:documentation>Identification du format de fichier.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="NonEmptyTokenType"/> + </xsd:simpleType> + <xsd:group name="FileFormatCodeListGroup"> + <xsd:sequence> + <xsd:element name="FileFormatCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Version de la liste de code d'identification du format.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:simpleType name="CompressionAlgorithmType"> + <xsd:annotation> + <xsd:documentation>Algorithme de compression utilisée.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="NonEmptyTokenType"/> + </xsd:simpleType> + <xsd:group name="CompressionAlgorithmCodeListGroup"> + <xsd:sequence> + <xsd:element name="CompressionAlgorithmCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Version de la liste de code de l'algorithme de compression.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- Identification d'une version pour un même objet intellectuel --> + <xsd:group name="DataObjectVersionCodeListGroup"> + <xsd:sequence> + <xsd:element name="DataObjectVersionCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Liste de codes correspondant aux diverses versions d'un objet-données au sein d’un groupe d'objets-données (ex. original papier, conservation, diffusion, vignette, txt).</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:simpleType name="VersionIdType"> + <xsd:annotation> + <xsd:documentation>Identifiant utilisé pour référencer les versions (conservation, diffusion, thumbnail/vignette, raw/brut, txt, ...).</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="NonEmptyTokenType"/> + </xsd:simpleType> + + <!-- Paquet d'Objets-données --> + <xsd:group name="DataObjectVersionGroup"> + <xsd:annotation> + <xsd:documentation>Groupe d’objets-données (numériques ou physiques), correspondant aux différentes versions d’un même objet intellectuellement unique. Chaque version peut être par exemple : original papier, version de conservation, version de diffusion, version vignette, version texte ascii… + Lorsqu'un objet-donnée fait partie d'un groupe, le référencement dans les ArchiveUnit ne peut se faire que via ce groupe (DataObjectGroupId).</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:choice> + <xsd:element name="DataObjectGroupReferenceId" type="GroupRefIdType"> + <xsd:annotation> + <xsd:documentation>Référence à un Identifiant du groupe d'objets-données DataObjectVersionGroup.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="DataObjectGroupId" type="GroupIdType"> + <xsd:annotation> + <xsd:documentation>Identifiant du groupe d'objets-données DataObjectVersionGroup (première et unique définition).</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + <xsd:element name="DataObjectVersion" type="VersionIdType"> + <xsd:annotation> + <xsd:documentation>Version d’un objet-données (par exemple : original papier, conservation, diffusion, vignette, txt, …).</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:complexType name="MinimalDataObjectType" abstract="true"> + <xsd:sequence> + <xsd:element name="Relationship" minOccurs="0" maxOccurs="unbounded" + type="RelationshipType"> + <xsd:annotation> + <xsd:documentation>Permet de spécifier un lien technique entre un objet-données et une signature.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:group ref="DataObjectVersionGroup" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="id" type="DataObjectIdType" use="required"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'objet-données associé.</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- Objet de donnees numérique --> + <xsd:complexType name="BinaryDataObjectType"> + <xsd:annotation> + <xsd:documentation>Objet-données numérique.</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:extension base="MinimalDataObjectType"> + <xsd:annotation> + <xsd:documentation>Métadonnées techniques minimales : URI, Digest, Poids.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:choice> + <xsd:element name="Attachment" type="BinaryObjectType"> + <xsd:annotation> + <xsd:documentation>Objet-données (contenu binaire ou fichier joint).</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Uri" type="xsd:anyURI"> + <xsd:annotation> + <xsd:documentation>L'URI spécifie où se trouve l'objet-données numérique. Peut correspondre à un chemin relatif.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + <xsd:element name="MessageDigest" type="MessageDigestBinaryObjectType"> + <xsd:annotation> + <xsd:documentation>Empreinte de l'objet-données.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Size" type="SizeInBytesType"> + <xsd:annotation> + <xsd:documentation>Permet de spécifier la taille de l'objet-données en octet.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Compressed" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Indique si l’objet-données est compressé et doit être décompressé.</xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:simpleContent> + <xsd:extension base="xsd:boolean"> + <xsd:attribute name="algorithm" type="CompressionAlgorithmType" use="required"/> + <xsd:attribute name="uncompressedSize" type="SizeInBytesType" + use="required"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + </xsd:element> + <xsd:group ref="BinaryTechnicalDescriptionGroup"> + <xsd:annotation> + <xsd:documentation>Métadonnées techniques pour les objets-données numériques.</xsd:documentation> + </xsd:annotation> + </xsd:group> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <xsd:group name="BinaryTechnicalDescriptionGroup"> + <xsd:annotation> + <xsd:documentation>Métadonnées techniques pour les objets-données numériques.</xsd:documentation> + <xsd:documentation>Inspiré du schéma FITS.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="FormatIdentification" type="FormatIdentificationType"> + <xsd:annotation> + <xsd:documentation>Identification du format de l'objet-données.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="FileInfo" type="FileInfoType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Propriétés techniques génériques du fichier (nom d’origine, logiciel de création, système d’exploitation de création).</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Metadata" type="CoreMetadataType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Propriétés techniques spécifiques du fichier en fonction de sa nature technique (texte, document, image, audio, vidéo, etc.).</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="OtherMetadata" type="DescriptiveTechnicalMetadataType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Autres métadonnées techniques si celles définies précédemment ne suffisent pas.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + + <!-- FormatIdentification elements --> + <xsd:complexType name="FormatIdentificationType"> + <xsd:sequence> + <xsd:element name="FormatLitteral" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Forme littérale du nom du format.</xsd:documentation> + <xsd:documentation>Exemple : Microsoft Word Document.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="MimeType" type="MimeTypeType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Type Mime associé, potentiellement stable mais pas assez précis.</xsd:documentation> + <xsd:documentation>Exemple : application/msword</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="FormatId" type="FileFormatType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Type spécifique du format tel que défini dans FormatIdCodeList.</xsd:documentation> + <xsd:documentation>Exemple : (Pronom)fmt/40</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Encoding" type="EncodingType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Encodage du fichier tel que défini dans EncodingIdCodeList.</xsd:documentation> + <xsd:documentation>Exemple : Utf-8</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + + <!-- File info elements --> + <xsd:complexType name="FileInfoType"> + <xsd:annotation> + <xsd:documentation>Informations sur le fichier lui-même (d'un point de vue technique).</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="Filename" type="xsd:string"> + <xsd:annotation> + <xsd:documentation>Nom du fichier d'origine.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="CreatingApplicationName" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Nom de l'application utilisée pour créer le fichier.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="CreatingApplicationVersion" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Version de l'application utilisée pour créer le fichier.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="DateCreatedByApplication" type="xsd:dateTime" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de création du fichier.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="CreatingOs" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Système d’exploitation utilisé pour créer le fichier.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="CreatingOsVersion" type="xsd:string" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Version du système d'exploitation utilisé pour créer le fichier.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="LastModified" type="xsd:dateTime" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Date de la dernière modification du fichier.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + + <!-- Objet de donnees physique --> + <xsd:group name="PhysicalTechnicalDescriptionGroup"> + <xsd:annotation> + <xsd:documentation>Objet-données physique.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="PhysicalDimensions" type="DimensionsType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Dimensions d'un objet-données physique.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element ref="OtherDimensionsAbstract" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:group> + <xsd:complexType name="PhysicalDataObjectType"> + <xsd:complexContent> + <xsd:extension base="MinimalDataObjectType"> + <xsd:sequence> + <xsd:element name="PhysicalId" type="IdentifierType"> + <xsd:annotation> + <xsd:documentation>Identifiant physique d’un objet-données physique, externe à celui-ci (ex. code-barres).</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:group ref="PhysicalTechnicalDescriptionGroup"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- Metadata types: inspired from various Library of Congress schema --> + <xsd:complexType name="CoreMetadataType"> + <xsd:annotation> + <xsd:documentation>Métadonnées de base par type d'objet-données.</xsd:documentation> + </xsd:annotation> + <xsd:choice> + <xsd:element name="Text" type="TextTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Métadonnées pour un objet-données de type textuel.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Document" type="DocumentTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Métadonnées pour un objet-données de type document.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Image" type="ImageTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Métadonnées pour un objet-données de type image.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Audio" type="AudioTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Métadonnées pour un objet-données de type audio.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Video" type="VideoTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Métadonnées pour un objet-données de type vidéo.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element ref="OtherCoreTechnicalMetadataAbstract"> + <xsd:annotation> + <xsd:documentation>Métadonnées pour un objet-données d’un autre type (base de données, 3D, programmes, formats propriétaires, etc.).</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:complexType> + + <!-- Physical description: inspired from AudioMD of Library of Congress and UNECE_MeasurementUnitCommonCode --> + <xsd:complexType name="DimensionsType"> + <xsd:annotation> + <xsd:documentation>Permet d'exprimer les mesures de dimensions basiques.</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:extension base="BaseDimensionsType"> + <xsd:sequence> + <xsd:element name="Width" type="MeasurementType" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Métadonnée de dimension physique : largeur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Height" type="MeasurementType" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Métadonnée de dimension physique : hauteur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Depth" type="MeasurementType" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Métadonnée de dimension physique : profondeur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Shape" type="xsd:string" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Métadonnée de dimension physique : forme.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Diameter" type="MeasurementType" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Métadonnée de dimension physique : diamètre.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Length" type="MeasurementType" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Métadonnée de dimension physique : longueur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Thickness" type="MeasurementType" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Métadonnée de dimension physique : épaisseur.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="Weight" type="MeasurementWeightType" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Métadonnée de dimension physique : poids.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="NumberOfPage" type="xsd:int" minOccurs="0" maxOccurs="1"> + <xsd:annotation> + <xsd:documentation>Métadonnée de dimension physique : nombre de pages.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="BaseDimensionsType" abstract="true"/> + <xsd:complexType name="MeasurementType"> + <xsd:simpleContent> + <xsd:extension base="xsd:decimal"> + <xsd:attribute name="unit" type="MeasurementUnitsType" use="required"> + <xsd:annotation> + <xsd:documentation>Références : Voir UNECE_MeasurementUnitCommonCode_8.xsd</xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + <xsd:simpleType name="MeasurementUnitsType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="micrometre"/> + <xsd:enumeration value="4H"/> + <xsd:enumeration value="millimetre"/> + <xsd:enumeration value="MMT"/> + <xsd:enumeration value="centimetre"/> + <xsd:enumeration value="CMT"/> + <xsd:enumeration value="metre"/> + <xsd:enumeration value="inch"/> + <xsd:enumeration value="INH"/> + <xsd:enumeration value="foot"/> + <xsd:enumeration value="FOT"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="MeasurementWeightType"> + <xsd:simpleContent> + <xsd:extension base="xsd:decimal"> + <xsd:attribute name="unit" type="MeasurementWeightUnitsType" use="required"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + <xsd:simpleType name="MeasurementWeightUnitsType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="microgram"/> + <xsd:enumeration value="MC"/> + <xsd:enumeration value="milligram"/> + <xsd:enumeration value="MGM"/> + <xsd:enumeration value="gram"/> + <xsd:enumeration value="GRM"/> + <xsd:enumeration value="kilogram"/> + <xsd:enumeration value="KGM"/> + </xsd:restriction> + </xsd:simpleType> + +</xsd:schema> diff --git a/modules/export_seda/resources/xsd/seda-2.0-types.xsd b/modules/export_seda/resources/xsd/seda-2.0-types.xsd new file mode 100644 index 0000000000000000000000000000000000000000..0e2a36bb77e42db720a775a9f593236418951f92 --- /dev/null +++ b/modules/export_seda/resources/xsd/seda-2.0-types.xsd @@ -0,0 +1,349 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema + targetNamespace="fr:gouv:culture:archivesdefrance:seda:v2.0" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="fr:gouv:culture:archivesdefrance:seda:v2.0" + elementFormDefault="qualified" + attributeFormDefault="unqualified" + version="1.0"> + + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/> + <xsd:import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink.xsd"/> + + <!-- + ***************************** + *** Types de base + ***************************** + --> + <!-- Code --> + <xsd:complexType name="CodeType"> + <xsd:simpleContent> + <xsd:extension base="NonEmptyTokenType"> + <xsd:attribute name="listID" type="xsd:token" use="optional"/> + <xsd:attribute name="listAgencyID" type="xsd:token" use="optional"/> + <xsd:attribute name="listAgencyName" type="xsd:string" use="optional"/> + <xsd:attribute name="listName" type="xsd:string" use="optional"/> + <xsd:attribute name="listVersionID" type="xsd:token" use="optional"/> + <xsd:attribute name="name" type="xsd:string" use="optional"/> + <xsd:attribute name="languageID" type="xsd:language" use="optional"/> + <xsd:attribute name="listURI" type="xsd:anyURI" use="optional"/> + <xsd:attribute name="listSchemeURI" type="xsd:anyURI" use="optional"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <!-- Texte --> + <xsd:complexType name="TextType"> + <xsd:simpleContent> + <xsd:extension base="xsd:string"> + <xsd:attribute ref="xml:lang" use="optional"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <!-- Identifiant --> + <xsd:complexType name="IdentifierType"> + <xsd:simpleContent> + <xsd:extension base="xsd:token"> + <xsd:attribute name="schemeID" type="xsd:token" use="optional"/> + <xsd:attribute name="schemeName" type="xsd:string" use="optional"/> + <xsd:attribute name="schemeAgencyID" type="xsd:token" use="optional"/> + <xsd:attribute name="schemeAgencyName" type="xsd:string" use="optional"/> + <xsd:attribute name="schemeVersionID" type="xsd:token" use="optional"/> + <xsd:attribute name="schemeDataURI" type="xsd:anyURI" use="optional"/> + <xsd:attribute name="schemeURI" type="xsd:anyURI" use="optional"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <!-- Type à spécifier --> + <xsd:attributeGroup name="OpenTypeAttributeGroup"> + <xsd:attribute ref="xml:id" use="optional"/> + <xsd:attribute ref="xlink:href" use="optional"/> + </xsd:attributeGroup> + <xsd:complexType name="OpenType" abstract="true"> + <xsd:sequence> + <xsd:any namespace="##other" processContents="lax" minOccurs="0"/> + </xsd:sequence> + <xsd:attributeGroup ref="OpenTypeAttributeGroup"/> + </xsd:complexType> + + <xsd:simpleType name="NonEmptyTokenType"> + <xsd:annotation> + <xsd:documentation>Elément ne pouvant être vide.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:token"> + <xsd:minLength value="1"/> + </xsd:restriction> + </xsd:simpleType> + <!-- ID --> + <xsd:simpleType name="DataObjectIdType"> + <xsd:annotation> + <xsd:documentation>Identifiant utilisé pour les objets-données.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:ID"/> + </xsd:simpleType> + <xsd:simpleType name="DataObjectRefIdType"> + <xsd:annotation> + <xsd:documentation>Identifiant servant aux relations des objets-données.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:IDREF"/> + </xsd:simpleType> + <xsd:simpleType name="GroupIdType"> + <xsd:annotation> + <xsd:documentation>Identifiant utilisé pour les groupes d'objets-données.</xsd:documentation> + </xsd:annotation> + <xsd:union> + <xsd:simpleType> + <xsd:restriction base="xsd:ID"/> + </xsd:simpleType> + </xsd:union> + </xsd:simpleType> + <xsd:simpleType name="GroupRefIdType"> + <xsd:annotation> + <xsd:documentation>Identifiant utilisé pour référencer les groupes d'objets-données.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:IDREF"/> + </xsd:simpleType> + <xsd:complexType name="DataObjectRefType"> + <xsd:annotation> + <xsd:documentation>Référence à un objet-données ou à un groupe d'objets-données.</xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:choice> + <xsd:element name="DataObjectReferenceId" type="DataObjectRefIdType"> + <xsd:annotation> + <xsd:documentation>Référence à un objet-données listé dans les métadonnées de transport.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="DataObjectGroupReferenceId" type="GroupRefIdType"> + <xsd:annotation> + <xsd:documentation>Référence à un groupe d'objets-données listé dans les métadonnées de transport.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:ID" use="optional"/> + </xsd:complexType> + + <!-- ID of an ArchiveUnit --> + <xsd:simpleType name="ArchiveUnitIdType"> + <xsd:annotation> + <xsd:documentation>Identifiant utilisé pour les unités d'archives.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:ID"/> + </xsd:simpleType> + <xsd:simpleType name="ArchiveUnitRefIdType"> + <xsd:annotation> + <xsd:documentation>Référence aux identifiants utilisés pour les unités d'archives.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:IDREF"/> + </xsd:simpleType> + + <xsd:simpleType name="SizeInBytesType"> + <xsd:annotation> + <xsd:documentation>Poids des objets-données binaires en bytes.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="xsd:positiveInteger"/> + </xsd:simpleType> + + <!-- Binary encoding --> + <xsd:simpleType name="BinaryType"> + <xsd:annotation> + <xsd:documentation>Représentation binaire : utilisation possible de base64 ou d'hexadécimal.</xsd:documentation> + </xsd:annotation> + <xsd:union memberTypes="xsd:base64Binary xsd:hexBinary"/> + </xsd:simpleType> + + <!-- Digest --> + <xsd:group name="DigestAlgorithmCodeListGroup"> + <xsd:sequence> + <xsd:element name="MessageDigestAlgorithmCodeListVersion" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Liste de l'algorithme de hachage utilisé dans le message.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:group> + <xsd:simpleType name="DigestAlgorithmCodeType"> + <xsd:annotation> + <xsd:documentation>Algorithme de hachage spécifié dans DigestAlgorithmCodeList.</xsd:documentation> + </xsd:annotation> + <xsd:restriction base="NonEmptyTokenType"/> + </xsd:simpleType> + <xsd:complexType name="MessageDigestBinaryObjectType"> + <xsd:simpleContent> + <xsd:extension base="BinaryType"> + <xsd:attribute name="algorithm" type="DigestAlgorithmCodeType" use="required"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <!-- + ***************************** + *** Types métier + ***************************** + + --> + + <!-- Contenu de données binaire --> + <xsd:complexType name="BinaryObjectType"> + <xsd:simpleContent> + <xsd:extension base="xsd:base64Binary"> + <xsd:attribute name="filename" type="xsd:string" use="optional"/> + <xsd:attribute name="uri" type="xsd:anyURI" use="optional"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <!-- Données liées --> + <xsd:complexType name="RelationshipType"> + <xsd:attribute name="target" type="xsd:IDREF" use="required"/> + <xsd:attribute name="type" type="NonEmptyTokenType" use="required"/> + </xsd:complexType> + + <!-- Organisation --> + <xsd:complexType name="OrganizationType"> + <xsd:sequence> + <xsd:element name="Identifier" type="IdentifierType"> + <xsd:annotation> + <xsd:documentation>Identifiant de l'organisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="OrganizationDescriptiveMetadata" type="OrganizationDescriptiveMetadataType" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Métadonnées de description de l'organisation.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + + <!-- + ***************************** + *** Objets à redéfinir + ***************************** + La redéfinition permet de fixer le nom de la balise tout en permettant la définition du type ultérieurement + --> + + <!-- Métadonnées descriptives pour une organisation --> + <xsd:complexType name="OrganizationDescriptiveMetadataType"> + <xsd:annotation> + <xsd:documentation>Contient toutes les métadonnées de description des organisations.</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:extension base="OpenType"/> + </xsd:complexContent> + </xsd:complexType> + + <!-- Signature in Main message block --> + <xsd:complexType name="SignatureType"> + <xsd:annotation> + <xsd:documentation>Contient toutes les métadonnées dsur la signature.</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:extension base="OpenType"/> + </xsd:complexContent> + </xsd:complexType> + + <!-- In CoreMetadataType from seda-2.0-technical.xsd: Technical Metadata Content --> + <xsd:complexType name="TextTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Contient toutes les métadonnées techniques de base pour les objets-données de type texte(XML, JSON, CSV, ...).</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:extension base="OpenType"/> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="DocumentTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Contient toutes les métadonnées techniques de base pour les objets-données de type document (Word, PDF, XLS, LibreOffice, ...).</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:extension base="OpenType"/> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="ImageTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Contient toutes les métadonnées techniques de base pour les objets-données de type image.</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:extension base="OpenType"/> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="AudioTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Contient toutes les métadonnées techniques de base pour les objets-données de type audio.</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:extension base="OpenType"/> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="VideoTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Contient toutes les métadonnées techniques de base pour les objets-données de type video.</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:extension base="OpenType"/> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="DescriptiveTechnicalMetadataType"> + <xsd:annotation> + <xsd:documentation>Contient toutes les métadonnées techniques et/ou descriptives définies dans un schéma par un service producteur ou versant mais n'étant pas présentes dans les métadonnées de base.</xsd:documentation> + </xsd:annotation> + <xsd:complexContent> + <xsd:extension base="OpenType"/> + </xsd:complexContent> + </xsd:complexType> + + <!-- + ******************************************* + *** Objets à spécifier par substitution + ******************************************* + La substitution permet de ne pas fixer le nom de la balise, d'en autoriser plusieurs et de laisser l'implémentation choisir en fonction de ses besoins. + --> + <!-- In ObjectGroup from seda-2-0-ontology.xsd: Extra Descriptive Metadata Content --> + <xsd:element name="ObjectGroupExtenstionAbstract" abstract="true"> + <xsd:annotation> + <xsd:documentation>Permet d'étendre ObjectGroup avec d'autres métadonnées descriptives.</xsd:documentation> + </xsd:annotation> + </xsd:element> + + <!-- In PhysicalTechnicalDescriptionGroup from seda-2.0-technical.xsd: extra dimension techncal description for PhysicalDataObject --> + <xsd:element name="OtherDimensionsAbstract" abstract="true"> + <xsd:annotation> + <xsd:documentation>Permet d'étendre <OtherDimensions> avec d'autres métadonnées de description des objets-données physiques.</xsd:documentation> + </xsd:annotation> + </xsd:element> + + <!-- In CoreMetadataType from seda-2.0-technical.xsd: extra Core TechnicalMetadata (Database, 3D, plan, ...) --> + <xsd:element name="OtherCoreTechnicalMetadataAbstract" abstract="true" type="OpenType"> + <xsd:annotation> + <xsd:documentation>Contient toutes les métadonnées techniques de base pour d'autres types.</xsd:documentation> + </xsd:annotation> + </xsd:element> + + <!-- In ArchiveUnitType from seda-2.0-descriptive.xsd: Abstract for ArchiveUnit reference from within EAS --> + <xsd:element name="ArchiveUnitReferenceAbstract" abstract="true"> + <xsd:annotation> + <xsd:documentation>Contient les requêtes nécessaires pour trouver un ArchiveUnit et pointer sur lui dans un prochain ArchiveUnit. + Permet de référencer un noeud déjà existant dans un arbre à partir d'un transfert précédent.</xsd:documentation> + </xsd:annotation> + </xsd:element> + + <!-- In ManagementGroup from seda-2.0-management.xsd: for Management extension --> + <xsd:element name="OtherManagementAbstract" abstract="true"> + <xsd:annotation> + <xsd:documentation>Utilisé par exemple pour manipuler un ArchiveUnit déjà existant dans le système d'archivage électronique.</xsd:documentation> + </xsd:annotation> + </xsd:element> + + <!-- In CodeListVersionsType from seda-2.0-main.xsd: If needed, extra CodeList could be added --> + <xsd:element name="OtherCodeListAbstract" abstract="true" type="CodeType"> + <xsd:annotation> + <xsd:documentation>Permet d'ajouter de nouvelles listes de codes si l'ajout d'autres métadonnées l'impose.</xsd:documentation> + </xsd:annotation> + </xsd:element> + +</xsd:schema> + diff --git a/modules/export_seda/resources/xsd/xlink.xsd b/modules/export_seda/resources/xsd/xlink.xsd new file mode 100644 index 0000000000000000000000000000000000000000..6f4d0a274d80d3e74f7915cafe2d7c0797475764 --- /dev/null +++ b/modules/export_seda/resources/xsd/xlink.xsd @@ -0,0 +1,270 @@ +<?xml version='1.0' encoding='UTF-8'?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"> + + <xs:annotation> + <xs:documentation>This schema document provides attribute declarations and +attribute group, complex type and simple type definitions which can be used in +the construction of user schemas to define the structure of particular linking +constructs, e.g. +<![CDATA[ +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xl="http://www.w3.org/1999/xlink"> + + <xs:import namespace="http://www.w3.org/1999/xlink" + location="http://www.w3.org/1999/xlink.xsd"> + + <xs:element name="mySimple"> + <xs:complexType> + ... + <xs:attributeGroup ref="xl:simpleAttrs"/> + ... + </xs:complexType> + </xs:element> + ... +</xs:schema>]]></xs:documentation> + </xs:annotation> + + <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/> + + <xs:attribute name="type" type="xlink:typeType"/> + + <xs:simpleType name="typeType"> + <xs:restriction base="xs:token"> + <xs:enumeration value="simple"/> + <xs:enumeration value="extended"/> + <xs:enumeration value="title"/> + <xs:enumeration value="resource"/> + <xs:enumeration value="locator"/> + <xs:enumeration value="arc"/> + </xs:restriction> + </xs:simpleType> + + <xs:attribute name="href" type="xlink:hrefType"/> + + <xs:simpleType name="hrefType"> + <xs:restriction base="xs:anyURI"/> + </xs:simpleType> + + <xs:attribute name="role" type="xlink:roleType"/> + + <xs:simpleType name="roleType"> + <xs:restriction base="xs:anyURI"> + <xs:minLength value="1"/> + </xs:restriction> + </xs:simpleType> + + <xs:attribute name="arcrole" type="xlink:arcroleType"/> + + <xs:simpleType name="arcroleType"> + <xs:restriction base="xs:anyURI"> + <xs:minLength value="1"/> + </xs:restriction> + </xs:simpleType> + + <xs:attribute name="title" type="xlink:titleAttrType"/> + + <xs:simpleType name="titleAttrType"> + <xs:restriction base="xs:string"/> + </xs:simpleType> + + <xs:attribute name="show" type="xlink:showType"/> + + <xs:simpleType name="showType"> + <xs:restriction base="xs:token"> + <xs:enumeration value="new"/> + <xs:enumeration value="replace"/> + <xs:enumeration value="embed"/> + <xs:enumeration value="other"/> + <xs:enumeration value="none"/> + </xs:restriction> + </xs:simpleType> + + <xs:attribute name="actuate" type="xlink:actuateType"/> + + <xs:simpleType name="actuateType"> + <xs:restriction base="xs:token"> + <xs:enumeration value="onLoad"/> + <xs:enumeration value="onRequest"/> + <xs:enumeration value="other"/> + <xs:enumeration value="none"/> + </xs:restriction> + </xs:simpleType> + + <xs:attribute name="label" type="xlink:labelType"/> + + <xs:simpleType name="labelType"> + <xs:restriction base="xs:NCName"/> + </xs:simpleType> + + <xs:attribute name="from" type="xlink:fromType"/> + + <xs:simpleType name="fromType"> + <xs:restriction base="xs:NCName"/> + </xs:simpleType> + + <xs:attribute name="to" type="xlink:toType"/> + + <xs:simpleType name="toType"> + <xs:restriction base="xs:NCName"/> + </xs:simpleType> + + <xs:attributeGroup name="simpleAttrs"> + <xs:attribute ref="xlink:type" fixed="simple"/> + <xs:attribute ref="xlink:href"/> + <xs:attribute ref="xlink:role"/> + <xs:attribute ref="xlink:arcrole"/> + <xs:attribute ref="xlink:title"/> + <xs:attribute ref="xlink:show"/> + <xs:attribute ref="xlink:actuate"/> + </xs:attributeGroup> + + <xs:group name="simpleModel"> + <xs:sequence> + <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:group> + + <xs:complexType mixed="true" name="simple"> + <xs:annotation> + <xs:documentation> + Intended for use as the type of user-declared elements to make them + simple links. + </xs:documentation> + </xs:annotation> + <xs:group ref="xlink:simpleModel"/> + <xs:attributeGroup ref="xlink:simpleAttrs"/> + </xs:complexType> + + <xs:attributeGroup name="extendedAttrs"> + <xs:attribute ref="xlink:type" fixed="extended" use="required"/> + <xs:attribute ref="xlink:role"/> + <xs:attribute ref="xlink:title"/> + </xs:attributeGroup> + + <xs:group name="extendedModel"> + <xs:choice> + <xs:element ref="xlink:title"/> + <xs:element ref="xlink:resource"/> + <xs:element ref="xlink:locator"/> + <xs:element ref="xlink:arc"/> + </xs:choice> + </xs:group> + + <xs:complexType name="extended"> + <xs:annotation> + <xs:documentation> + Intended for use as the type of user-declared elements to make them + extended links. + Note that the elements referenced in the content model are all abstract. + The intention is that by simply declaring elements with these as their + substitutionGroup, all the right things will happen. + </xs:documentation> + </xs:annotation> + <xs:group ref="xlink:extendedModel" minOccurs="0" maxOccurs="unbounded"/> + <xs:attributeGroup ref="xlink:extendedAttrs"/> + </xs:complexType> + + <xs:element name="title" type="xlink:titleEltType" abstract="true"/> + + <xs:attributeGroup name="titleAttrs"> + <xs:attribute ref="xlink:type" fixed="title" use="required"/> + <xs:attribute ref="xml:lang"> + <xs:annotation> + <xs:documentation> + xml:lang is not required, but provides much of the + motivation for title elements in addition to attributes, and so + is provided here for convenience. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:attributeGroup> + + <xs:group name="titleModel"> + <xs:sequence> + <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:group> + + <xs:complexType mixed="true" name="titleEltType"> + <xs:group ref="xlink:titleModel"/> + <xs:attributeGroup ref="xlink:titleAttrs"/> + </xs:complexType> + + <xs:element name="resource" type="xlink:resourceType" abstract="true"/> + + <xs:attributeGroup name="resourceAttrs"> + <xs:attribute ref="xlink:type" fixed="resource" use="required"/> + <xs:attribute ref="xlink:role"/> + <xs:attribute ref="xlink:title"/> + <xs:attribute ref="xlink:label"/> + </xs:attributeGroup> + + <xs:group name="resourceModel"> + <xs:sequence> + <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:group> + + <xs:complexType mixed="true" name="resourceType"> + <xs:group ref="xlink:resourceModel"/> + <xs:attributeGroup ref="xlink:resourceAttrs"/> + </xs:complexType> + + <xs:element name="locator" type="xlink:locatorType" abstract="true"/> + + <xs:attributeGroup name="locatorAttrs"> + <xs:attribute ref="xlink:type" fixed="locator" use="required"/> + <xs:attribute ref="xlink:href" use="required"/> + <xs:attribute ref="xlink:role"/> + <xs:attribute ref="xlink:title"/> + <xs:attribute ref="xlink:label"> + <xs:annotation> + <xs:documentation> + label is not required, but locators have no particular + XLink function if they are not labeled. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:attributeGroup> + + <xs:group name="locatorModel"> + <xs:sequence> + <xs:element ref="xlink:title" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:group> + + <xs:complexType name="locatorType"> + <xs:group ref="xlink:locatorModel"/> + <xs:attributeGroup ref="xlink:locatorAttrs"/> + </xs:complexType> + + <xs:element name="arc" type="xlink:arcType" abstract="true"/> + + <xs:attributeGroup name="arcAttrs"> + <xs:attribute ref="xlink:type" fixed="arc" use="required"/> + <xs:attribute ref="xlink:arcrole"/> + <xs:attribute ref="xlink:title"/> + <xs:attribute ref="xlink:show"/> + <xs:attribute ref="xlink:actuate"/> + <xs:attribute ref="xlink:from"/> + <xs:attribute ref="xlink:to"> + <xs:annotation> + <xs:documentation> + from and to have default behavior when values are missing + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:attributeGroup> + + <xs:group name="arcModel"> + <xs:sequence> + <xs:element ref="xlink:title" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:group> + + <xs:complexType name="arcType"> + <xs:group ref="xlink:arcModel"/> + <xs:attributeGroup ref="xlink:arcAttrs"/> + </xs:complexType> + +</xs:schema> diff --git a/modules/export_seda/resources/xsd/xml.xsd b/modules/export_seda/resources/xsd/xml.xsd new file mode 100644 index 0000000000000000000000000000000000000000..85bea7906ab3611cc59a0761154b22d582c419a9 --- /dev/null +++ b/modules/export_seda/resources/xsd/xml.xsd @@ -0,0 +1,287 @@ +<?xml version='1.0'?> +<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?> +<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns ="http://www.w3.org/1999/xhtml" + xml:lang="en"> + + <xs:annotation> + <xs:documentation> + <div> + <h1>About the XML namespace</h1> + + <div class="bodytext"> + <p> + This schema document describes the XML namespace, in a form + suitable for import by other schema documents. + </p> + <p> + See <a href="http://www.w3.org/XML/1998/namespace.html"> + http://www.w3.org/XML/1998/namespace.html</a> and + <a href="http://www.w3.org/TR/REC-xml"> + http://www.w3.org/TR/REC-xml</a> for information + about this namespace. + </p> + <p> + Note that local names in this namespace are intended to be + defined only by the World Wide Web Consortium or its subgroups. + The names currently defined in this namespace are listed below. + They should not be used with conflicting semantics by any Working + Group, specification, or document instance. + </p> + <p> + See further below in this document for more information about <a + href="#usage">how to refer to this schema document from your own + XSD schema documents</a> and about <a href="#nsversioning">the + namespace-versioning policy governing this schema document</a>. + </p> + </div> + </div> + </xs:documentation> + </xs:annotation> + + <xs:attribute name="lang"> + <xs:annotation> + <xs:documentation> + <div> + + <h3>lang (as an attribute name)</h3> + <p> + denotes an attribute whose value + is a language code for the natural language of the content of + any element; its value is inherited. This name is reserved + by virtue of its definition in the XML specification.</p> + + </div> + <div> + <h4>Notes</h4> + <p> + Attempting to install the relevant ISO 2- and 3-letter + codes as the enumerated possible values is probably never + going to be a realistic possibility. + </p> + <p> + See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt"> + http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a> + and the IANA language subtag registry at + <a href="http://www.iana.org/assignments/language-subtag-registry"> + http://www.iana.org/assignments/language-subtag-registry</a> + for further information. + </p> + <p> + The union allows for the 'un-declaration' of xml:lang with + the empty string. + </p> + </div> + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:union memberTypes="xs:language"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value=""/> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + + <xs:attribute name="space"> + <xs:annotation> + <xs:documentation> + <div> + + <h3>space (as an attribute name)</h3> + <p> + denotes an attribute whose + value is a keyword indicating what whitespace processing + discipline is intended for the content of the element; its + value is inherited. This name is reserved by virtue of its + definition in the XML specification.</p> + + </div> + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:NCName"> + <xs:enumeration value="default"/> + <xs:enumeration value="preserve"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + + <xs:attribute name="base" type="xs:anyURI"> <xs:annotation> + <xs:documentation> + <div> + + <h3>base (as an attribute name)</h3> + <p> + denotes an attribute whose value + provides a URI to be used as the base for interpreting any + relative URIs in the scope of the element on which it + appears; its value is inherited. This name is reserved + by virtue of its definition in the XML Base specification.</p> + + <p> + See <a + href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a> + for information about this attribute. + </p> + </div> + </xs:documentation> + </xs:annotation> + </xs:attribute> + + <xs:attribute name="id" type="xs:ID"> + <xs:annotation> + <xs:documentation> + <div> + + <h3>id (as an attribute name)</h3> + <p> + denotes an attribute whose value + should be interpreted as if declared to be of type ID. + This name is reserved by virtue of its definition in the + xml:id specification.</p> + + <p> + See <a + href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a> + for information about this attribute. + </p> + </div> + </xs:documentation> + </xs:annotation> + </xs:attribute> + + <xs:attributeGroup name="specialAttrs"> + <xs:attribute ref="xml:base"/> + <xs:attribute ref="xml:lang"/> + <xs:attribute ref="xml:space"/> + <xs:attribute ref="xml:id"/> + </xs:attributeGroup> + + <xs:annotation> + <xs:documentation> + <div> + + <h3>Father (in any context at all)</h3> + + <div class="bodytext"> + <p> + denotes Jon Bosak, the chair of + the original XML Working Group. This name is reserved by + the following decision of the W3C XML Plenary and + XML Coordination groups: + </p> + <blockquote> + <p> + In appreciation for his vision, leadership and + dedication the W3C XML Plenary on this 10th day of + February, 2000, reserves for Jon Bosak in perpetuity + the XML name "xml:Father". + </p> + </blockquote> + </div> + </div> + </xs:documentation> + </xs:annotation> + + <xs:annotation> + <xs:documentation> + <div xml:id="usage" id="usage"> + <h2><a name="usage">About this schema document</a></h2> + + <div class="bodytext"> + <p> + This schema defines attributes and an attribute group suitable + for use by schemas wishing to allow <code>xml:base</code>, + <code>xml:lang</code>, <code>xml:space</code> or + <code>xml:id</code> attributes on elements they define. + </p> + <p> + To enable this, such a schema must import this schema for + the XML namespace, e.g. as follows: + </p> + <pre> + <schema . . .> + . . . + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + </pre> + <p> + or + </p> + <pre> + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2009/01/xml.xsd"/> + </pre> + <p> + Subsequently, qualified reference to any of the attributes or the + group defined below will have the desired effect, e.g. + </p> + <pre> + <type . . .> + . . . + <attributeGroup ref="xml:specialAttrs"/> + </pre> + <p> + will define a type which will schema-validate an instance element + with any of those attributes. + </p> + </div> + </div> + </xs:documentation> + </xs:annotation> + + <xs:annotation> + <xs:documentation> + <div id="nsversioning" xml:id="nsversioning"> + <h2><a name="nsversioning">Versioning policy for this schema document</a></h2> + <div class="bodytext"> + <p> + In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + <a href="http://www.w3.org/2009/01/xml.xsd"> + http://www.w3.org/2009/01/xml.xsd</a>. + </p> + <p> + At the date of issue it can also be found at + <a href="http://www.w3.org/2001/xml.xsd"> + http://www.w3.org/2001/xml.xsd</a>. + </p> + <p> + The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML + Schema itself, or with the XML namespace itself. In other words, + if the XML Schema or XML namespaces change, the version of this + document at <a href="http://www.w3.org/2001/xml.xsd"> + http://www.w3.org/2001/xml.xsd + </a> + will change accordingly; the version at + <a href="http://www.w3.org/2009/01/xml.xsd"> + http://www.w3.org/2009/01/xml.xsd + </a> + will not change. + </p> + <p> + Previous dated (and unchanging) versions of this schema + document are at: + </p> + <ul> + <li><a href="http://www.w3.org/2009/01/xml.xsd"> + http://www.w3.org/2009/01/xml.xsd</a></li> + <li><a href="http://www.w3.org/2007/08/xml.xsd"> + http://www.w3.org/2007/08/xml.xsd</a></li> + <li><a href="http://www.w3.org/2004/10/xml.xsd"> + http://www.w3.org/2004/10/xml.xsd</a></li> + <li><a href="http://www.w3.org/2001/03/xml.xsd"> + http://www.w3.org/2001/03/xml.xsd</a></li> + </ul> + </div> + </div> + </xs:documentation> + </xs:annotation> + +</xs:schema> + diff --git a/modules/export_seda/script/checkReply.sh b/modules/export_seda/script/checkReply.sh old mode 100755 new mode 100644 index bdf3bad8a95091b70701886c9e693687fb64520e..c9217c3f98ea51b0ca66b784274743a1221ff658 --- a/modules/export_seda/script/checkReply.sh +++ b/modules/export_seda/script/checkReply.sh @@ -1,4 +1,4 @@ #!/bin/sh path='/var/www/html/maarch_courrier' cd $path -php './modules/export_seda/batch/CheckAllReply.php' \ No newline at end of file +php './modules/export_seda/batch/CheckAllReply.php' -c /var/www/html/maarch_courrier/modules/export_seda/batch/config/config.xml diff --git a/modules/export_seda/script/purge.sh b/modules/export_seda/script/purge.sh new file mode 100644 index 0000000000000000000000000000000000000000..ec603cc2ef27739e5430f890269cdb66b6880a0e --- /dev/null +++ b/modules/export_seda/script/purge.sh @@ -0,0 +1,4 @@ +#!/bin/sh +path='/var/www/html/maarch_courrier' +cd $path +php './modules/export_seda/batch/BatchPurge.php' -c /var/www/html/maarch_courrier/modules/export_seda/batch/config/config.xml \ No newline at end of file diff --git a/modules/export_seda/xml/config.xml.default b/modules/export_seda/xml/config.xml.default old mode 100755 new mode 100644 index 23af5be2b8c6d9b8f584fd2048644980758df2e3..ddb10efdd0d90a7d504c44b1cfce2e4cace49b6d --- a/modules/export_seda/xml/config.xml.default +++ b/modules/export_seda/xml/config.xml.default @@ -9,7 +9,11 @@ <token></token> <urlSAEService>http://srv-maarchrm-ap</urlSAEService> <urlSAE>http://maarchrm/transfer/sent</urlSAE> + <directoryMessage></directoryMessage> + <senderOrgRegNumber></senderOrgRegNumber> + <accessRuleCode></accessRuleCode> <deleteData>true</deleteData> + <certificateSSL></certificateSSL> </CONFIG> <TABLENAME/> <HISTORY> @@ -17,4 +21,7 @@ <sedaadd>true</sedaadd> <sedadel>true</sedadel> </HISTORY> -</root> \ No newline at end of file + <M2M> + <gec>maarch_courrier</gec> + </M2M> +</root> diff --git a/modules/life_cycle/batch/scripts/purge_document.sh.default b/modules/life_cycle/batch/scripts/purge_document.sh.default new file mode 100644 index 0000000000000000000000000000000000000000..5507fa1b42a22938827ae6c5aab3722287e3dc09 --- /dev/null +++ b/modules/life_cycle/batch/scripts/purge_document.sh.default @@ -0,0 +1,5 @@ +#!/bin/sh + +path='/var/www/html/maarch_courrier/modules/life_cycle/batch' +cd $path +php 'process_purge.php' -c /var/www/html/maarch_courrier/modules/life_cycle/batch/config/config_purge.xml -coll "letterbox_coll" \ No newline at end of file