Verified Commit 0eb11201 authored by Alexis Ragot's avatar Alexis Ragot
Browse files

fixed modification of message reference

parent 8ff3e6e6
<?php
/*
* Copyright (C) 2015 Maarch
*
* This file is part of bundle seda.
*
* Bundle seda is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bundle seda is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with bundle seda. If not, see <http://www.gnu.org/licenses/>.
*/
namespace ext\demorm_publique\bundle\seda\Controller;
class ArchiveTransferComposition extends \ext\archivesPubliques\bundle\seda\Controller\ArchiveTransferComposition
{
/**
* Receive message with all contents embedded
* @param object $messageObject The message
* @param bool $isTemplate True if the message is a template
*
* @return string The new message identifier
*/
public function create($messageObject, $isTemplate=false)
{
$message = $this->composeMessage($messageObject);
$message->messageId = \laabs::newId();
if ($isTemplate) {
$message->status = 'template';
}
$message->reference = $message->reference . "_" . \laabs::newTimestamp()->getTimestamp()
if ($this->sdoFactory->exists('medona/message', array('type'=>$message->type, 'senderOrgRegNumber'=>$message->senderOrgRegNumber, 'reference'=>$message->reference))) {
throw \laabs::newException("seda/invalidMessageException", "L'identifiant du message existe déjà.");
}
$messageDir = $this->messageDirectory.DIRECTORY_SEPARATOR.(string) $message->messageId;
if (!is_dir($messageDir)) {
mkdir($messageDir, 0777, true);
}
$this->sdoFactory->create($message, 'medona/message');
return $message->messageId;
}
}
\ No newline at end of file
<?php
/*
* Copyright (C) 2015 Maarch
*
* This file is part of bundle seda.
*
* Bundle seda is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bundle seda is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with bundle seda. If not, see <http://www.gnu.org/licenses/>.
*/
namespace ext\demorm_publique\bundle\seda\Controller;
class ArchiveTransferComposition extends \ext\archivesPubliques\bundle\seda2\Controller\ArchiveTransferComposition
{
/**
* Receive message with all contents embedded
* @param object $messageObject The message
* @param bool $isTemplate True if the message is a template
*
* @return string The new message identifier
*/
public function create($messageObject, $isTemplate=false)
{
$message = $this->composeMessage($messageObject);
$message->messageId = \laabs::newId();
if ($isTemplate) {
$message->status = 'template';
}
$message->reference = $message->reference . "_" . \laabs::newTimestamp()->getTimestamp()
if ($this->sdoFactory->exists('medona/message', array('type'=>$message->type, 'senderOrgRegNumber'=>$message->senderOrgRegNumber, 'reference'=>$message->reference))) {
throw \laabs::newException("seda/invalidMessageException", "L'identifiant du message existe déjà.");
}
$messageDir = $this->messageDirectory.DIRECTORY_SEPARATOR.(string) $message->messageId;
if (!is_dir($messageDir)) {
mkdir($messageDir, 0777, true);
}
$this->sdoFactory->create($message, 'medona/message');
return $message->messageId;
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment