Skip to content
Snippets Groups Projects
Commit 72b00c63 authored by Alexandre Morin's avatar Alexandre Morin Committed by Giovannoni Laurent
Browse files

Zip function

parent b75b07ac
No related branches found
No related tags found
No related merge requests found
......@@ -103,6 +103,22 @@ class ArchiveTransfer {
return $xml;
}
public function deleteMessage($listResId)
{
if (!$listResId) {
return false;
}
foreach ($listResId as $resId) {
$unitIdentifiers = $this->getUnitIdentifier($resId);
foreach ($unitIdentifiers as $unitIdentifier) {
$this->deleteSeda($unitIdentifier->message_id);
$this->deleteUnitIdentifier($unitIdentifier->message_id);
}
}
return true;
}
private function sendAttachment($messageObject)
{
$messageId = $messageObject->messageIdentifier->value;
......@@ -356,6 +372,27 @@ class ArchiveTransfer {
return $custodialHistoryItem;
}
///////////////////
/// Requete SQL ///
///////////////////
private function getUnitIdentifier($resId)
{
$queryParams = [];
$queryParams[] = $resId;
$query = "SELECT * FROM unit_identifier WHERE res_id = ?";
$smtp = $this->db->query($query,$queryParams);
$unitIdentifier = [];
while ($res = $smtp->fetchObject()) {
$unitIdentifier[] = $res;
}
return $unitIdentifier;
}
private function getCourrier($resId)
{
......@@ -557,4 +594,36 @@ class ArchiveTransfer {
return true;
}
private function deleteSeda($messageId)
{
$queryParams = [];
$queryParams[] = $messageId;
try {
$query = "DELETE FROM seda WHERE message_id = ?";
$smtp = $this->db->query($query,$queryParams);
} catch (Exception $e) {
return false;
}
return true;
}
private function deleteUnitIdentifier($messageId)
{
$queryParams = [];
$queryParams[] = $messageId;
try {
$query = "DELETE FROM unit_identifier WHERE message_id = ?";
$smtp = $this->db->query($query,$queryParams);
} catch (Exception $e) {
return false;
}
return true;
}
}
\ No newline at end of file
<?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__.'/ArchiveTransferReply.php';
require_once __DIR__.'/ArchiveTransfer.php';
require_once __DIR__.'/Acknowledgement.php';
// Args
//ARCHIVE TRANSFER
//$listResId = ['100','101','102'];
//$archiveTransfer = new ArchiveTransfer();
//$message = $archiveTransfer->receive($listResId);
//$archiveTransfer->sendXml($message);
// ACKNOWLEDGEMENT
//$acknowledgement = new Acknowledgement();
//$acknowledgement->send(__DIR__. DIRECTORY_SEPARATOR ."seda2". DIRECTORY_SEPARATOR . $message->messageIdentifier->value .".xml");
//ARCHIVE TRANSFER REPLY
/*
$archiveTransferReply = new ArchiveTransfertReply();
$archiveTransferReply->receive(__DIR__. DIRECTORY_SEPARATOR ."seda2". DIRECTORY_SEPARATOR . "bblier-20170216-163047_reply.xml");
*/
\ No newline at end of file
......@@ -31,6 +31,9 @@ require_once __DIR__.'/ArchiveTransfer.php';
function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $coll_id, $mode) {
$archiveTransfer = new ArchiveTransfer();
$result = $archiveTransfer->deleteMessage($values);
$result = $archiveTransfer->receive($values);
$db = new Database();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment