Verified Commit 9a5d83c7 authored by Damien's avatar Damien

FEAT #11902 TIME 1:00 Remove print_folder and converted_pdf

parent 77e6bde7
......@@ -675,11 +675,10 @@ if ($mode == 'normal') {
}
if ($tab[$i][$j][$value] == 'count_attachment') {
$excludeAttachmentTypes = ['converted_pdf', 'print_folder'];
$query = "SELECT count(res_id) as total FROM res_attachments
WHERE res_id_master = ?
AND status NOT IN ('DEL', 'OBS') AND attachment_type NOT IN (?) AND (status <> 'TMP' or (typist = ? and status = 'TMP'))";
$arrayPDO = array($tab[$i][0]['res_id'], $excludeAttachmentTypes, $_SESSION['user']['UserId']);
AND status NOT IN ('DEL', 'OBS') AND (status <> 'TMP' or (typist = ? and status = 'TMP'))";
$arrayPDO = array($tab[$i][0]['res_id'], $_SESSION['user']['UserId']);
$stmt2 = $db->query($query, $arrayPDO);
$return_count = $stmt2->fetchObject();
......
......@@ -355,7 +355,7 @@ where lower(translate(folders.label , 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ
array_splice($tmpArray, 0, 1);
$_SESSION['fullTextAttachments']['attachments'] = array_filter($tmpArray);
$db = new Database();
$stmt = $db->query("SELECT DISTINCT res_id_master FROM res_attachments WHERE res_id IN ($Liste_Ids) AND status NOT IN ('DEL','OBS','TMP') AND attachment_type NOT IN ('print_folder')");
$stmt = $db->query("SELECT DISTINCT res_id_master FROM res_attachments WHERE res_id IN ($Liste_Ids) AND status NOT IN ('DEL','OBS','TMP')");
$idMasterDatas = [];
while ($tmp = $stmt->fetchObject()) {
$idMasterDatas[] = $tmp;
......
......@@ -54,12 +54,11 @@ if (isset($_REQUEST['res_id_master'])) {
$db = new Database();
$excludeAttachmentTypes = ['converted_pdf', 'print_folder'];
$query = "SELECT * FROM res_attachments
WHERE res_id_master = ?
AND status NOT IN ('DEL', 'OBS') AND attachment_type NOT IN (?) AND (status <> 'TMP' or (typist = ? and status = 'TMP'))
AND status NOT IN ('DEL', 'OBS') AND (status <> 'TMP' or (typist = ? and status = 'TMP'))
ORDER BY creation_date desc";
$arrayPDO = array($_REQUEST['res_id_master'], $excludeAttachmentTypes, $_SESSION['user']['UserId']);
$arrayPDO = array($_REQUEST['res_id_master'], $_SESSION['user']['UserId']);
$stmt = $db->query($query, $arrayPDO);
while ($return_db = $stmt->fetchObject()) {
......
......@@ -29,22 +29,10 @@
<id>waybill</id>
<label>_WAYBILL</label>
</type> -->
<type show="false" with_chrono="true" icon="FC" sign="false">
<id>routing</id>
<label>_ROUTING</label>
</type>
<type show="true" with_chrono="true" icon="DS" sign="true">
<id>outgoing_mail</id>
<label>_OUTGOING_MAIL</label>
</type>
<type show="false" with_chrono="false" icon="" sign="false">
<id>converted_pdf</id>
<label>_CONVERTED_PDF</label>
</type>
<type show="false" with_chrono="false" icon="" sign="false">
<id>print_folder</id>
<label>_PRINT_FOLDER</label>
</type>
</attachment_types>
<contact_check>
<check_days_before>5</check_days_before> <!-- 0 if you want to disabled -->
......
......@@ -16,6 +16,8 @@ DELETE FROM contacts_groups_lists WHERE contact_id IS NULL;
DELETE FROM resources_folders WHERE res_id NOT IN (SELECT res_id FROM res_letterbox);
DELETE FROM res_attachments WHERE attachment_type in ('converted_pdf', 'print_folder', 'routing');
DROP TABLE IF EXISTS contacts_res;
DROP TABLE IF EXISTS contact_addresses;
DROP TABLE IF EXISTS contact_communication;
......
......@@ -27,12 +27,12 @@ if ($_SESSION['req'] == 'details') {
} else {
$stmt = $db->query("SELECT res_id, creation_date, title, format FROM "
. $_SESSION['tablename']['attach_res_attachments']
. " WHERE res_id_master = ? and coll_id = ? and status <> 'DEL' and attachment_type NOT IN ('response_project','signed_response','outgoing_mail_signed','converted_pdf','outgoing_mail','print_folder','aihp'". $exclude . ") and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
. " WHERE res_id_master = ? and coll_id = ? and status <> 'DEL' and attachment_type NOT IN ('response_project','signed_response','outgoing_mail_signed','outgoing_mail','aihp'". $exclude . ") and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
}
} else {
$stmt = $db->query("SELECT res_id FROM "
. $_SESSION['tablename']['attach_res_attachments']
. " WHERE status <> 'DEL' and attachment_type NOT IN ('converted_pdf', 'print_folder'". $exclude . ") and res_id_master = ? and coll_id = ? and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
. " WHERE status <> 'DEL' and res_id_master = ? and coll_id = ? and (status <> 'TMP' or (typist = ? and status = 'TMP'))", array($res_id, $coll_id, $_SESSION['user']['UserId']));
}
$nbAttach = $stmt->rowCount();
......
......@@ -82,7 +82,7 @@ if ($arrayIsAllowed['status'] == false) {
var eleframe1 = window.parent.top.document.getElementById('list_attach');
eleframe1.location.href = '<?php
echo $_SESSION['config']['businessappurl'];
?>index.php?display=true&module=attachments&page=frame_list_attachments&attach_type_exclude=converted_pdf,print_folder&mode=normal&load';
?>index.php?display=true&module=attachments&page=frame_list_attachments&mode=normal&load';
</script>
<?php
exit();
......
......@@ -465,7 +465,7 @@ for ($i = 0; $i < $tabI; ++$i) {
if ($tab[$i][$j][$value] == 'count_attachment') {
$query = "SELECT count(1) as total FROM res_attachments
WHERE res_id_master = ?
AND status NOT IN ('DEL', 'OBS') AND attachment_type NOT IN ('converted_pdf', 'print_folder') AND (status <> 'TMP' or (typist = ? and status = 'TMP'))";
AND status NOT IN ('DEL', 'OBS') AND (status <> 'TMP' or (typist = ? and status = 'TMP'))";
$arrayPDO = array($tab[$i][0]['res_id'], $_SESSION['user']['UserId']);
$stmt2 = $db->query($query, $arrayPDO);
$return_count = $stmt2->fetchObject();
......
......@@ -61,7 +61,7 @@ if (!empty($_REQUEST['id']) && !empty($_REQUEST['collId'])) {
$stmt = $db->query("select relation, res_id, format, res_id_master, title, identifier, attachment_type from "
. $tableName
. " where (attachment_type NOT IN ('converted_pdf','print_folder')) and res_id = ?", array($objectId));
. " where res_id = ?", array($objectId));
if ($stmt->rowCount() < 1) {
echo '{"status":1, "error" : "'._FILE.' '._UNKNOWN.'"}';
......
......@@ -49,7 +49,7 @@ trait ExternalSignatoryBookTrait
'res_id', 'status'
],
'where' => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP')", "in_signature_book = 'true'"],
'data' => [$args['resId'], ['converted_pdf', 'print_folder', 'signed_response']]
'data' => [$args['resId'], ['signed_response']]
]);
foreach ($attachments as $attachment) {
......
......@@ -445,7 +445,7 @@ class PreProcessActionController
'validation_date', 'relation', 'origin_id'
],
'where' => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP')", "in_signature_book = 'true'"],
'data' => [$resId, ['converted_pdf', 'print_folder', 'signed_response']]
'data' => [$resId, ['signed_response']]
]);
$integratedResource = ResModel::get([
......@@ -532,7 +532,7 @@ class PreProcessActionController
'validation_date', 'relation', 'origin_id'
],
'where' => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP')", "in_signature_book = 'true'"],
'data' => [$resId, ['converted_pdf', 'print_folder', 'signed_response']]
'data' => [$resId, ['signed_response']]
]);
if (empty($attachments)) {
......@@ -714,8 +714,8 @@ class PreProcessActionController
if (!empty($aTemplates)) {
$aAttachments = AttachmentModel::get([
'select' => ['max(relation) as relation', 'res_id_master', 'title', 'res_id', 'identifier as chrono', 'recipient_id', 'recipient_type'],
'where' => ['res_id_master in (?)', 'status not in (?)', 'attachment_type not in (?)', 'in_send_attach = ?'],
'data' => [$data['resources'], ['OBS', 'DEL', 'TMP', 'FRZ'], ['print_folder'], true],
'where' => ['res_id_master in (?)', 'status not in (?)', 'in_send_attach = ?'],
'data' => [$data['resources'], ['OBS', 'DEL', 'TMP', 'FRZ'], true],
'groupBy' => ['res_id_master', 'title', 'res_id', 'chrono', 'recipient_id', 'recipient_type']
]);
......
......@@ -63,7 +63,7 @@ trait ShippingTrait
$attachments = AttachmentModel::get([
'select' => ['res_id', 'title', 'recipient_id', 'recipient_type', 'external_id', 'status'],
'where' => ['res_id_master = ?', 'in_send_attach = ?', 'status not in (?)', 'attachment_type not in (?)'],
'data' => [$args['resId'], true, ['OBS', 'DEL', 'TMP', 'FRZ'], ['print_folder', 'signed_response']]
'data' => [$args['resId'], true, ['OBS', 'DEL', 'TMP', 'FRZ'], ['signed_response']]
]);
if (empty($attachments) && empty($integrations['inShipping'])) {
......
......@@ -101,11 +101,6 @@ class AttachmentController
return $response->withStatus(400)->withJson(['errors' => 'Attachment out of perimeter']);
}
$excludeAttachmentTypes = ['converted_pdf', 'print_folder'];
if (in_array($attachment['type'], $excludeAttachmentTypes)) {
return $response->withStatus(400)->withJson(['errors' => 'Attachment type out of perimeter']);
}
if ($attachment['modificationDate'] == $attachment['creationDate']) {
$attachment['modificationDate'] = null;
}
......@@ -272,7 +267,7 @@ class AttachmentController
return $response->withStatus(403)->withJson(['errors' => 'Query limit is not an integer']);
}
$excludeAttachmentTypes = ['converted_pdf', 'print_folder', 'signed_response'];
$excludeAttachmentTypes = ['signed_response'];
$attachments = AttachmentModel::get([
'select' => [
......
......@@ -169,8 +169,8 @@ class FullTextController
} else {
$resIds = AttachmentModel::get([
'select' => ['res_id'],
'where' => ['attachment_type <> ?', 'status NOT IN (?)', 'fulltext_result = ?'],
'data' => ['print_folder', ['DEL','OBS','TMP'], 'ERROR'],
'where' => ['status NOT IN (?)', 'fulltext_result = ?'],
'data' => [['DEL','OBS','TMP'], 'ERROR'],
'orderBy' => ['res_id DESC'],
]);
}
......
......@@ -118,7 +118,7 @@ class FastParapheurController
'res_id', 'docserver_id', 'path', 'filename', 'format', 'attachment_type'
],
'where' => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP', 'SEND_MASS')", "in_signature_book = 'true'"],
'data' => [$aArgs['resIdMaster'], ['converted_pdf', 'print_folder', 'signed_response']]
'data' => [$aArgs['resIdMaster'], ['signed_response']]
]);
$attachmentTypes = AttachmentModel::getAttachmentsTypesByXML();
......
......@@ -89,7 +89,7 @@ class IParapheurController
$attachments = AttachmentModel::get([
'select' => ['res_id', 'docserver_id', 'path', 'filename', 'format', 'attachment_type'],
'where' => ['res_id_master = ?', 'attachment_type not in (?)', "status NOT IN ('DEL','OBS', 'FRZ', 'TMP', 'SEND_MASS')", "in_signature_book = 'true'"],
'data' => [$aArgs['resIdMaster'], ['converted_pdf', 'print_folder', 'signed_response']]
'data' => [$aArgs['resIdMaster'], ['signed_response']]
]);
$attachmentTypes = AttachmentModel::getAttachmentsTypesByXML();
......
......@@ -189,7 +189,7 @@ class IxbusController
'validation_date', 'relation', 'origin_id'
],
'where' => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP', 'SEND_MASS')", "in_signature_book = 'true'"],
'data' => [$aArgs['resIdMaster'], ['converted_pdf', 'incoming_mail_attachment', 'print_folder', 'signed_response']]
'data' => [$aArgs['resIdMaster'], ['incoming_mail_attachment', 'signed_response']]
]);
$attachmentTypes = AttachmentModel::getAttachmentsTypesByXML();
......
......@@ -199,7 +199,7 @@ class MaarchParapheurController
return ['error' => 'steps is empty'];
}
$excludeAttachmentTypes = ['converted_pdf', 'print_folder', 'signed_response'];
$excludeAttachmentTypes = ['signed_response'];
$attachments = AttachmentModel::get([
'select' => [
......
......@@ -36,7 +36,7 @@ class XParaphController
'select' => [
'res_id', 'title', 'docserver_id', 'path', 'filename'],
'where' => ["res_id_master = ?", "attachment_type not in (?)", "status not in ('DEL', 'OBS', 'FRZ', 'TMP', 'SEND_MASS')", "in_signature_book = 'true'"],
'data' => [$aArgs['resIdMaster'], ['converted_pdf', 'print_folder', 'signed_response']]
'data' => [$aArgs['resIdMaster'], ['signed_response']]
]);
$attachmentToFreeze = [];
......
......@@ -680,11 +680,10 @@ class FolderController
$formattedResources = [];
if (!empty($resIds)) {
$excludeAttachmentTypes = ['converted_pdf', 'print_folder'];
$attachments = AttachmentModel::get([
'select' => ['COUNT(res_id)', 'res_id_master'],
'where' => ['res_id_master in (?)', 'status not in (?)', 'attachment_type not in (?)', '((status = ? AND typist = ?) OR status != ?)'],
'data' => [$resIds, ['DEL', 'OBS'], $excludeAttachmentTypes, 'TMP', $GLOBALS['id'], 'TMP'],
'where' => ['res_id_master in (?)', 'status not in (?)', '((status = ? AND typist = ?) OR status != ?)'],
'data' => [$resIds, ['DEL', 'OBS'], 'TMP', $GLOBALS['id'], 'TMP'],
'groupBy' => ['res_id_master']
]);
......
......@@ -88,7 +88,7 @@ class ResourceListController
$defaultAction = [];
$displayFolderTags = false;
if (!empty($resIds)) {
$excludeAttachmentTypes = ['converted_pdf', 'print_folder', 'signed_response'];
$excludeAttachmentTypes = ['signed_response'];
$attachments = AttachmentModel::get([
'select' => ['COUNT(res_id)', 'res_id_master'],
'where' => ['res_id_master in (?)', 'status not in (?)', 'attachment_type not in (?)', '((status = ? AND typist = ?) OR status != ?)'],
......
......@@ -115,11 +115,10 @@ class UserFollowedResourceController
$formattedResources = [];
if (!empty($resIds)) {
$excludeAttachmentTypes = ['converted_pdf', 'print_folder'];
$attachments = AttachmentModel::get([
'select' => ['COUNT(res_id)', 'res_id_master'],
'where' => ['res_id_master in (?)', 'status not in (?)', 'attachment_type not in (?)', '((status = ? AND typist = ?) OR status != ?)'],
'data' => [$resIds, ['DEL', 'OBS'], $excludeAttachmentTypes, 'TMP', $GLOBALS['id'], 'TMP'],
'where' => ['res_id_master in (?)', 'status not in (?)', '((status = ? AND typist = ?) OR status != ?)'],
'data' => [$resIds, ['DEL', 'OBS'], 'TMP', $GLOBALS['id'], 'TMP'],
'groupBy' => ['res_id_master']
]);
......
......@@ -144,13 +144,9 @@ class SignatureBookController
$incomingMailAttachments = AttachmentModel::get([
'select' => ['res_id', 'title', 'format', 'attachment_type', 'path', 'filename'],
'where' => ['res_id_master = ?', 'attachment_type in (?)', "status not in ('DEL', 'TMP', 'OBS')"],
'data' => [$resId, ['incoming_mail_attachment', 'converted_pdf']]
'data' => [$resId, ['incoming_mail_attachment']]
]);
foreach ($incomingMailAttachments as $value) {
if ($value['attachment_type'] == 'converted_pdf') {
continue;
}
$realId = $value['res_id'];
$convertedAttachment = ConvertPdfController::getConvertedPdfById(['resId' => $realId, 'collId' => 'attachments_coll']);
......@@ -199,14 +195,14 @@ class SignatureBookController
'origin', 'validation_date', 'origin_id'
],
'where' => ['res_id_master = ?', 'attachment_type not in (?)', "status not in ('DEL', 'OBS')", 'in_signature_book = TRUE'],
'data' => [$args['resId'], ['incoming_mail_attachment', 'print_folder']],
'data' => [$args['resId'], ['incoming_mail_attachment']],
'orderBy' => [$orderBy]
]);
$canManageAttachment = PrivilegeController::hasPrivilege(['privilegeId' => 'manage_attachments', 'userId' => $args['userId']]);
foreach ($attachments as $key => $value) {
if ($value['attachment_type'] == 'converted_pdf' || ($value['attachment_type'] == 'signed_response' && !empty($value['origin']))) {
if (($value['attachment_type'] == 'signed_response' && !empty($value['origin']))) {
continue;
}
......@@ -224,7 +220,7 @@ class SignatureBookController
}
foreach ($attachments as $tmpKey => $tmpValue) {
if (strpos($value['format'], 'xl') !== 0 && $value['format'] != 'pptx' && $tmpValue['attachment_type'] == 'converted_pdf' && ($tmpValue['path'] . $tmpValue['filename'] == $pathToFind)) {
if (strpos($value['format'], 'xl') !== 0 && $value['format'] != 'pptx' && ($tmpValue['path'] . $tmpValue['filename'] == $pathToFind)) {
if ($value['status'] != 'SIGN') {
$viewerId = $tmpValue['res_id'];
}
......@@ -289,7 +285,7 @@ class SignatureBookController
$obsAttachments = AttachmentModel::get([
'select' => ['res_id', 'origin_id', 'relation', 'creation_date', 'title'],
'where' => ['res_id_master = ?', 'attachment_type not in (?)', 'status = ?'],
'data' => [$args['resId'], ['incoming_mail_attachment', 'print_folder', 'converted_pdf', 'signed_response'], 'OBS'],
'data' => [$args['resId'], ['incoming_mail_attachment', 'signed_response'], 'OBS'],
'orderBy' => ['relation ASC']
]);
......@@ -303,7 +299,7 @@ class SignatureBookController
}
foreach ($attachments as $key => $value) {
if ($value['attachment_type'] == 'converted_pdf' || $value['attachment_type'] == 'signed_response') {
if ($value['attachment_type'] == 'signed_response') {
unset($attachments[$key]);
continue;
}
......@@ -375,7 +371,7 @@ class SignatureBookController
$attachmentsInResList = AttachmentModel::get([
'select' => ['res_id_master', 'status', 'attachment_type'],
'where' => ['res_id_master in (?)', "attachment_type not in ('incoming_mail_attachment', 'print_folder', 'converted_pdf', 'signed_response')", "status not in ('DEL', 'TMP', 'OBS')"],
'where' => ['res_id_master in (?)', "attachment_type not in ('incoming_mail_attachment', 'signed_response')", "status not in ('DEL', 'TMP', 'OBS')"],
'data' => [$resIds]
]);
......
Markdown is supported
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