diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js index 233e08a8c8b8a3a3502f90bc23ca9bc66ccf14e0..d4726dcb7fa2be453ea26eac5efc5cd80281e466 100755 --- a/apps/maarch_entreprise/js/functions.js +++ b/apps/maarch_entreprise/js/functions.js @@ -2798,7 +2798,7 @@ function showPreviousAttachments(path_manage_script, id) { new Ajax.Request(path_manage_script, { method: 'post', parameters: { - res_id_version: id + res_id: id }, onSuccess: function (answer) { eval("response = " + answer.responseText); diff --git a/modules/attachments/frame_list_attachments.php b/modules/attachments/frame_list_attachments.php index d52216b8f1bd94cb508142e16ee6ec946c128503..77b84f9c08e53f20124df1d50256cb9cc5dc4c6b 100755 --- a/modules/attachments/frame_list_attachments.php +++ b/modules/attachments/frame_list_attachments.php @@ -79,7 +79,7 @@ array_push($template_list, $template_select); $select['res_attachments'] = array(); -// Important de laisser cet ordre : 'res_id', 'res_id_version', 'relation', 'status' +// Important de laisser cet ordre : 'res_id', 'relation', 'status' array_push( $select['res_attachments'], 'res_id', diff --git a/modules/attachments/previous_attachments.php b/modules/attachments/previous_attachments.php index 6f7082eb2aa4e7ba5f79b09c801f210a5be6941e..6c08a2c95465d39e1ad7ed9d6f71b878b6cc8e10 100755 --- a/modules/attachments/previous_attachments.php +++ b/modules/attachments/previous_attachments.php @@ -29,7 +29,7 @@ $users = new class_users(); $return = ''; -if (isset($_REQUEST['res_id_version'])) { +if (isset($_REQUEST['res_id'])) { $status = 0; $return .= '<td colspan="6" style="background-color: #FFF;">'; @@ -59,7 +59,7 @@ if (isset($_REQUEST['res_id_version'])) { $db = new Database(); $query = "SELECT origin_id FROM res_attachments WHERE res_id = ? "; - $stmt = $db->query($query, array($_REQUEST['res_id_version'])); + $stmt = $db->query($query, array($_REQUEST['res_id'])); $attach = $stmt->fetchObject(); $query = "SELECT status, relation, creation_date, title, typist, res_id FROM res_attachments WHERE (res_id = ? or origin_id = ?) AND status = 'OBS' ORDER BY relation desc"; diff --git a/modules/attachments/xml/IVS/validation_rules.xml b/modules/attachments/xml/IVS/validation_rules.xml index 723410e838872f46abc86060fc982fbcbbb91ee2..033fd42e54fb51332a3e331e68a6fb54653eea49 100755 --- a/modules/attachments/xml/IVS/validation_rules.xml +++ b/modules/attachments/xml/IVS/validation_rules.xml @@ -54,7 +54,7 @@ <validationRule name="previous_attachments" extends="standardForm" mode="error"> <parameter name="module" type="identifier" /> - <parameter name="res_id_version" type="integer" /> + <parameter name="res_id" type="integer" /> </validationRule> <validationRule name="del_attachment" extends="standardForm" mode="error"> diff --git a/modules/content_management/retrieve_attachment_from_cm.php b/modules/content_management/retrieve_attachment_from_cm.php index c06c6832fe200fc0cb22908f4ab2f602842c648a..3ddd4922991c830c566a9fb1e83feff9e548f5ef 100755 --- a/modules/content_management/retrieve_attachment_from_cm.php +++ b/modules/content_management/retrieve_attachment_from_cm.php @@ -4,7 +4,7 @@ require_once 'modules/attachments/attachments_tables.php'; $dbAttachment = new Database(); $query = "SELECT relation, docserver_id, path, filename, format FROM res_attachments - WHERE (res_id = ? OR res_id_version = ?) AND res_id_master = ? ORDER BY relation desc"; + WHERE res_id = ? AND res_id_master = ? ORDER BY relation desc"; $stmt = $dbAttachment->query($query, array($objectId, $objectId, $_SESSION['doc_id'])); diff --git a/modules/visa/retrieve_attachment_from_cm.php b/modules/visa/retrieve_attachment_from_cm.php index 47fe6771ea21eb3baafc98c05004283b18bef625..0701e2b20592e681315c741ae9fe2e9b7388b548 100755 --- a/modules/visa/retrieve_attachment_from_cm.php +++ b/modules/visa/retrieve_attachment_from_cm.php @@ -8,17 +8,17 @@ if (!empty($objectResIdMaster)) { $data = [$objectId, $objectId, $_SESSION['doc_id']]; } $stmt = $db->query("SELECT relation, docserver_id, path, filename, format FROM res_attachments - WHERE (res_id = ? OR res_id_version = ?) AND res_id_master = ? ORDER BY relation desc", $data); + WHERE res_id = ? AND res_id_master = ? ORDER BY relation desc", $data); if ($stmt->rowCount() == 0) { $result = array('ERROR' => _THE_DOC . ' ' . _EXISTS_OR_RIGHT); createXML('ERROR', $result); } else { - $line = $stmt->fetchObject(); + $line = $stmt->fetchObject(); $docserver = $line->docserver_id; - $path = $line->path; - $filename = $line->filename; - $format = $line->format; + $path = $line->path; + $filename = $line->filename; + $format = $line->format; $_SESSION['visa']['repSignRel'] = $line->relation; $_SESSION['visa']['repSignId'] = $objectId; @@ -28,11 +28,10 @@ if ($stmt->rowCount() == 0) { , array($docserver)); $func = new functions(); $lineDoc = $stmt2->fetchObject(); - - - $docserver = $lineDoc->path_template; - $fileOnDs = $docserver . $path . str_replace(pathinfo($filename, PATHINFO_EXTENSION), "pdf",$filename);; - $fileOnDs = str_replace('#', DIRECTORY_SEPARATOR, $fileOnDs); + + $docserver = $lineDoc->path_template; + $fileOnDs = $docserver . $path . str_replace(pathinfo($filename, PATHINFO_EXTENSION), "pdf",$filename);; + $fileOnDs = str_replace('#', DIRECTORY_SEPARATOR, $fileOnDs); $fileExtension = $func->extractFileExt($fileOnDs); $fileNameOnTmp = 'tmp_file_' . $_SESSION['user']['UserId'] . '_' . rand() . '.' . $fileExtension; diff --git a/src/app/action/controllers/ShippingTrait.php b/src/app/action/controllers/ShippingTrait.php index 9a00946a2bf77ccad22183e753b1981af50f77f2..0121e87701d4f5a49f9c50b03a55f04172ecf2f4 100644 --- a/src/app/action/controllers/ShippingTrait.php +++ b/src/app/action/controllers/ShippingTrait.php @@ -71,8 +71,7 @@ trait ShippingTrait 'select' => ['docserver_id','path', 'filename', 'fingerprint'], 'resId' => $attachmentId, 'collId' => 'attachments_coll', - 'type' => 'PDF', - 'isVersion' => $isVersion + 'type' => 'PDF' ]); if (empty($convertedDocument)) { return ['errors' => ['No conversion for attachment']]; @@ -113,13 +112,7 @@ trait ShippingTrait $errors = []; foreach ($attachments as $key => $attachment) { $sendingName = CoreConfigModel::uniqueId(); - if (!empty($attachment['res_id'])) { - $isVersion = false; - $attachmentId = $attachment['res_id']; - } else { - $isVersion = true; - $attachmentId = $attachment['res_id_version']; - } + $attachmentId = $attachment['res_id']; $createSending = CurlModel::execSimple([ 'url' => $mailevaConfig['uri'] . '/mail/v1/sendings', @@ -227,7 +220,6 @@ trait ShippingTrait ShippingModel::create([ 'userId' => $currentUser['id'], 'attachmentId' => $attachmentId, - 'isVersion' => $isVersion, 'options' => json_encode($shippingTemplate['options']), 'fee' => $fee, 'recipientEntityId' => $recipientEntity['id'], diff --git a/src/app/resource/controllers/ResController.php b/src/app/resource/controllers/ResController.php index bf6b5484e2137a8dda9f051cc04c89943263a450..34cf117aa994a4c16b80f6c2ab3087e905a455e0 100755 --- a/src/app/resource/controllers/ResController.php +++ b/src/app/resource/controllers/ResController.php @@ -493,7 +493,7 @@ class ResController ConvertThumbnailController::convert([ 'collId' => 'letterbox_coll', 'resId' => $aArgs['resId'], - 'outgoingId' => empty($attachment[0]['res_id']) ? $attachment[0]['res_id_version'] : $attachment[0]['res_id'], + 'outgoingId' => $attachment[0]['res_id'], 'isOutgoingVersion' => empty($attachment[0]['res_id']) ]); } diff --git a/src/app/signatureBook/controllers/SignatureBookController.php b/src/app/signatureBook/controllers/SignatureBookController.php index cab97709bcd72421a7675cd31e77a0653e216894..e2c34a6e15d05e96359dbeeaabc0416737986dcf 100755 --- a/src/app/signatureBook/controllers/SignatureBookController.php +++ b/src/app/signatureBook/controllers/SignatureBookController.php @@ -190,7 +190,7 @@ class SignatureBookController } $realId = 0; - $realId = $value['res_id_version']; + $realId = $value['res_id']; $convertedAttachment = ConvertPdfController::getConvertedPdfById(['select' => ['docserver_id', 'path', 'filename'], 'resId' => $realId, 'collId' => 'attachments_coll']); @@ -275,7 +275,6 @@ class SignatureBookController if ($value['status'] == 'SIGN' && $tmpValue['attachment_type'] == 'signed_response' && !empty($tmpValue['origin'])) { $signDaddy = explode(',', $tmpValue['origin']); if (($signDaddy[0] == $value['res_id'] && $signDaddy[1] == "res_attachments") - || ($signDaddy[0] == $value['res_id_version'] && $signDaddy[1] == "res_version_attachments") ) { $viewerId = $tmpValue['res_id']; unset($attachments[$tmpKey]); @@ -336,7 +335,7 @@ class SignatureBookController if ($value['relation'] == 1) { $obsData[$value['res_id']][] = ['resId' => $value['res_id'], 'title' => $value['title'], 'relation' => $value['relation'], 'creation_date' => $value['creation_date']]; } else { - $obsData[$value['origin_id']][] = ['resId' => $value['res_id_version'], 'title' => $value['title'], 'relation' => $value['relation'], 'creation_date' => $value['creation_date']]; + $obsData[$value['origin_id']][] = ['resId' => $value['res_id'], 'title' => $value['title'], 'relation' => $value['relation'], 'creation_date' => $value['creation_date']]; } } diff --git a/src/frontend/app/actions/send-shipping-action/send-shipping-action.component.html b/src/frontend/app/actions/send-shipping-action/send-shipping-action.component.html index 26fc811034abe34bb26e8494784c0038716375b9..588b52e3184a7137b035408bdbd6e17bb3834a49 100644 --- a/src/frontend/app/actions/send-shipping-action/send-shipping-action.component.html +++ b/src/frontend/app/actions/send-shipping-action/send-shipping-action.component.html @@ -102,7 +102,7 @@ <mat-sidenav mode="side" fixedTopGap="56" position='end' [opened]="attachList.length > 0" style="width: 50%;"> <div class="pjList"> <img *ngFor="let attach of attachList" title="{{attach.identifier}} : {{attach.title}}" - src="../../rest/attachments/{{attach.res_id!=0 ? attach.res_id : attach.res_id_version}}/thumbnail" /> + src="../../rest/attachments/{{attach.res_id}}/thumbnail" /> </div> </mat-sidenav> </mat-sidenav-container> diff --git a/src/frontend/app/attachments/attachments-list.component.ts b/src/frontend/app/attachments/attachments-list.component.ts index 9883d1143f54c3d885b4334f088261864f16515c..1870d18f928312f6b5ce6ee578b4352933720bfe 100644 --- a/src/frontend/app/attachments/attachments-list.component.ts +++ b/src/frontend/app/attachments/attachments-list.component.ts @@ -63,8 +63,7 @@ export class AttachmentsListComponent implements OnInit { } setInSignatureBook(attachment: any) { - const is_version = attachment.res_id_version > 0; - this.http.put("../../rest/attachments/" + attachment.res_id + "/inSignatureBook", { isVersion: is_version }) + this.http.put("../../rest/attachments/" + attachment.res_id + "/inSignatureBook", { }) .subscribe(() => { attachment.in_signature_book = !attachment.in_signature_book; this.notify.success(this.lang.actionDone); @@ -74,8 +73,7 @@ export class AttachmentsListComponent implements OnInit { } setInSendAttachment(attachment: any) { - const is_version = attachment.res_id_version > 0; - this.http.put("../../rest/attachments/" + attachment.res_id + "/inSendAttachment", { isVersion: is_version }) + this.http.put("../../rest/attachments/" + attachment.res_id + "/inSendAttachment", { }) .subscribe(() => { attachment.in_send_attach = !attachment.in_send_attach; this.notify.success(this.lang.actionDone); diff --git a/src/frontend/app/signature-book.component.ts b/src/frontend/app/signature-book.component.ts index 7547df1d4c576cf1e5046a6798af8154964653f5..013ea35c7aa85482d67c6cbba0ecaca646cde4b5 100755 --- a/src/frontend/app/signature-book.component.ts +++ b/src/frontend/app/signature-book.component.ts @@ -346,11 +346,7 @@ export class SignatureBookComponent implements OnInit { editAttachmentIframe(attachment: any) { if (attachment.canModify && attachment.status != "SIGN") { var resId: number; - if (attachment.res_id == 0) { - resId = attachment.res_id_version; - } else if (attachment.res_id_version == 0) { - resId = attachment.res_id; - } + resId = attachment.res_id; modifyAttachmentsForm('index.php?display=true&module=attachments&page=attachments_content&id=' + resId + '&relation=' + attachment.relation + '&docId=' + this.resId, '98%', 'auto'); } @@ -365,11 +361,7 @@ export class SignatureBookComponent implements OnInit { } if (r) { var resId: number; - if (attachment.res_id == 0) { - resId = attachment.res_id_version; - } else if (attachment.res_id_version == 0) { - resId = attachment.res_id; - } + resId = attachment.res_id; this.http.get('index.php?display=true&module=attachments&page=del_attachment&id=' + resId + '&relation=' + attachment.relation + '&docId=' + this.resId + '&rest=true') .subscribe(() => { @@ -398,18 +390,10 @@ export class SignatureBookComponent implements OnInit { this.loadingSign = true; var path = "index.php?display=true&module=visa&page=sign_file&collId=letterbox_coll&resIdMaster=" + this.resId + "&signatureId=" + signature.id; - if (attachment.res_id == 0) { - if (attachment.attachment_type == "outgoing_mail" && this.signatureBook.documents[0].category_id == "outgoing") { - path += "&isVersion&isOutgoing&id=" + attachment.res_id_version; - } else { - path += "&isVersion&id=" + attachment.res_id_version; - } - } else if (attachment.res_id_version == 0) { - if (attachment.attachment_type == "outgoing_mail" && this.signatureBook.documents[0].category_id == "outgoing") { - path += "&isOutgoing&id=" + attachment.res_id; - } else { - path += "&id=" + attachment.res_id; - } + if (attachment.attachment_type == "outgoing_mail" && this.signatureBook.documents[0].category_id == "outgoing") { + path += "&isOutgoing&id=" + attachment.res_id; + } else { + path += "&id=" + attachment.res_id; } this.http.get(path, signature) @@ -448,17 +432,9 @@ export class SignatureBookComponent implements OnInit { unsignFile(attachment: any) { var collId: string; var resId: number; - var isVersion: string; - if (attachment.res_id == 0) { - resId = attachment.res_id_version; - collId = "res_version_attachments"; - isVersion = "true"; - } else if (attachment.res_id_version == 0) { - resId = attachment.res_id; - collId = "res_attachments"; - isVersion = "false"; - } + resId = attachment.res_id; + collId = "res_attachments"; this.http.put(this.coreUrl + 'rest/signatureBook/' + resId + '/unsign', {'table' : collId}) .subscribe(() => {