From 2deeec5655d179e55c8caebb20d0e8b66e9c2685 Mon Sep 17 00:00:00 2001
From: Nestor <npegane@hotmail.com>
Date: Thu, 28 Jun 2018 14:49:31 +0200
Subject: [PATCH] FIX #8001 condition for basket only

---
 apps/maarch_entreprise/smartphone/details.php | 35 ++++++++++---------
 .../smartphone/list_result.php                | 24 +++++++------
 2 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/apps/maarch_entreprise/smartphone/details.php b/apps/maarch_entreprise/smartphone/details.php
index c19dd99e3af..d35af764cb4 100755
--- a/apps/maarch_entreprise/smartphone/details.php
+++ b/apps/maarch_entreprise/smartphone/details.php
@@ -239,25 +239,28 @@ if (isset($_REQUEST['res_id_master'])) {
     <?php
 
     }
-    $action = \Action\models\ActionModel::getById(['id' => $_SESSION['current_basket']['default_action'], 'select' => ['action_page']]);
-    if (!empty($action) && $action['action_page'] == 'visa_mail' && $infos_attach['attachment_type'] != 'signed_response') {
-        ?>
-    <a href="signature_main_panel.php?id=<?php functions::xecho($s_id); ?>&collId=<?php
-                    functions::xecho($_SESSION['collection_id_choice']); ?>&tableName=<?php
-            functions::xecho($_SESSION['res_table']); ?>&res_id_attach=<?php
-            functions::xecho($att_id); ?>">
-        <span class="bubble" style="cursor: pointer;margin-right: 5px;">
-            <i class="fa fa-hand-point-up fa-2x mCdarkGrey" aria-hidden="true"></i>
-        </span>
-    </a>
+    if(!empty($_SESSION['current_basket']['default_action'])){
+        $action = \Action\models\ActionModel::getById(['id' => $_SESSION['current_basket']['default_action'], 'select' => ['action_page']]);
+        if (!empty($action) && $action['action_page'] == 'visa_mail' && $infos_attach['attachment_type'] != 'signed_response') {
+            ?>
+            <a href="signature_main_panel.php?id=<?php functions::xecho($s_id); ?>&collId=<?php
+                            functions::xecho($_SESSION['collection_id_choice']); ?>&tableName=<?php
+                    functions::xecho($_SESSION['res_table']); ?>&res_id_attach=<?php
+                    functions::xecho($att_id); ?>">
+                <span class="bubble" style="cursor: pointer;margin-right: 5px;">
+                    <i class="fa fa-hand-point-up fa-2x mCdarkGrey" aria-hidden="true"></i>
+                </span>
+            </a>
 
-    <span class="bubble" style="cursor: pointer;margin-right: 5px;" onclick="switchFrame('<?php functions::xecho($_SESSION['config']['businessappurl'].'index.php?page=doc_thumb_frame&body_loaded&module=thumbnails'); ?>',<?php functions::xecho($s_id); ?>,<?php functions::xecho($pdf_id); ?>);">
-        <i class="fa fa-retweet fa-2x mCdarkGrey"></i>
-    </span>
-    <input type="hidden" id="type_doc_show" value="attach" />
-    <?php
+            <span class="bubble" style="cursor: pointer;margin-right: 5px;" onclick="switchFrame('<?php functions::xecho($_SESSION['config']['businessappurl'].'index.php?page=doc_thumb_frame&body_loaded&module=thumbnails'); ?>',<?php functions::xecho($s_id); ?>,<?php functions::xecho($pdf_id); ?>);">
+                <i class="fa fa-retweet fa-2x mCdarkGrey"></i>
+            </span>
+            <input type="hidden" id="type_doc_show" value="attach" />
+            <?php
 
+        }        
     }
+    
     ?>
     <br/>
     <br/>
diff --git a/apps/maarch_entreprise/smartphone/list_result.php b/apps/maarch_entreprise/smartphone/list_result.php
index ae4d3b50744..5fa7deb260e 100755
--- a/apps/maarch_entreprise/smartphone/list_result.php
+++ b/apps/maarch_entreprise/smartphone/list_result.php
@@ -63,19 +63,23 @@ if (isset($whereRequest) && !empty($whereRequest)) {
             if ($view == 'view_folders') {
                 $line = '<li>';
             } else {
-                $action = \Action\models\ActionModel::getById(['id' => $_SESSION['current_basket']['default_action'], 'select' => ['action_page']]);
-                if ($i < $nombreDeLignesAffiche) {
-                    if (!empty($action) && $action['action_page'] == 'visa_mail' && $view != 'res_view_attachments') {
-                        $line = '<li id=res_'.$i.' style="display:block;"><a href="view_attachments.php?id=';
+                if(!empty($_REQUEST['baskets'])){
+                    $action = \Action\models\ActionModel::getById(['id' => $_SESSION['current_basket']['default_action'], 'select' => ['action_page']]);
+                    if ($i < $nombreDeLignesAffiche) {
+                        if (!empty($action) && $action['action_page'] == 'visa_mail' && $view != 'res_view_attachments') {
+                            $line = '<li id=res_'.$i.' style="display:block;"><a href="view_attachments.php?id=';
+                        } else {
+                            $line = '<li id=res_'.$i.' style="display:block;"><a href="details.php?id=';
+                        }
                     } else {
-                        $line = '<li id=res_'.$i.' style="display:block;"><a href="details.php?id=';
+                        if (!empty($action) && $action['action_page'] == 'visa_mail' && $view != 'res_view_attachments') {
+                            $line = '<li id=res_'.$i.' style="display:block;"><a href="view_attachments.php?id=';
+                        } else {
+                            $line = '<li id=res_'.$i.' style="display:none;"><a href="details.php?id=';
+                        }
                     }
                 } else {
-                    if (!empty($action) && $action['action_page'] == 'visa_mail' && $view != 'res_view_attachments') {
-                        $line = '<li id=res_'.$i.' style="display:block;"><a href="view_attachments.php?id=';
-                    } else {
-                        $line = '<li id=res_'.$i.' style="display:none;"><a href="details.php?id=';
-                    }
+                    $line = '<li id=res_'.$i.' style="display:block;"><a href="details.php?id=';
                 }
             }
             for ($j = 0; $j < count($tab[$i]); ++$j) {
-- 
GitLab