From 735dd7c68fa68fbc3c594d890f36c366782df594 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Mon, 27 Apr 2020 09:15:38 +0100
Subject: [PATCH] FEAT #13126 TIME 0:10 add canConvert to /linkedResources

---
 src/app/resource/controllers/LinkController.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/app/resource/controllers/LinkController.php b/src/app/resource/controllers/LinkController.php
index 3109610a86e..1e41de713f5 100644
--- a/src/app/resource/controllers/LinkController.php
+++ b/src/app/resource/controllers/LinkController.php
@@ -16,6 +16,7 @@ namespace Resource\controllers;
 
 use Contact\controllers\ContactController;
 use Contact\models\ContactModel;
+use Convert\controllers\ConvertPdfController;
 use Entity\models\EntityModel;
 use Entity\models\ListInstanceModel;
 use Group\controllers\PrivilegeController;
@@ -44,7 +45,7 @@ class LinkController
             $linkedResourcesIds = ResController::getAuthorizedResources(['resources' => $linkedResourcesIds, 'userId' => $GLOBALS['id']]);
             if (!empty($linkedResourcesIds)) {
                 $linkedResources = ResModel::get([
-                    'select' => ['res_id as "resId"', 'subject', 'doc_date as "documentDate"', 'status', 'dest_user as "destUser"', 'destination', 'alt_identifier as chrono', 'category_id as "categoryId"', 'filename', 'confidentiality'],
+                    'select' => ['res_id as "resId"', 'subject', 'doc_date as "documentDate"', 'status', 'dest_user as "destUser"', 'destination', 'alt_identifier as chrono', 'category_id as "categoryId"', 'filename', 'format', 'confidentiality'],
                     'where'  => ['res_id in (?)'],
                     'data'   => [$linkedResourcesIds]
                 ]);
@@ -95,6 +96,8 @@ class LinkController
                 foreach ($linkedResources[$key]['visaCircuit'] as $keyCircuit => $valueCircuit) {
                     $linkedResources[$key]['visaCircuit'][$keyCircuit]['userLabel'] = UserModel::getLabelledUserById(['id' => $valueCircuit['item_id']]);
                 }
+
+                $linkedResources[$key]['canConvert'] = ConvertPdfController::canConvert(['extension' => $value['format']]);
             }
         }
 
-- 
GitLab