From b9c6acdb6dac2de855d2b02ce59bb44e3122dd0b Mon Sep 17 00:00:00 2001
From: Laurent Giovannoni <laurent.giovannoni@maarch.org>
Date: Mon, 3 Nov 2014 17:53:11 +0000
Subject: [PATCH] FEAT add new action

---
 core/trunk/core/class/class_core_tools.php | 11 +++++++++--
 core/trunk/core/xml/actions_pages.xml      | 11 +++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/core/trunk/core/class/class_core_tools.php b/core/trunk/core/class/class_core_tools.php
index 3c9decb6339..60c83f8e394 100644
--- a/core/trunk/core/class/class_core_tools.php
+++ b/core/trunk/core/class/class_core_tools.php
@@ -1419,11 +1419,18 @@ class core_tools extends functions
                 require_once('apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_business_app_tools.php");
                 $app = new business_app_tools();
                 $path = $app->insert_app_page($this->f_page);
-                if((!$path || empty($path)) && !file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.$path) && !file_exists($_SESSION['config']['corepath'].$path)) {
+                if(
+                    (!$path || empty($path)) 
+                    && !file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.$path) 
+                    && !file_exists($path)) {
                     //require($_SESSION["config"]["defaultPage"].".php");
                     $this->loadDefaultPage();
                 } else {
-                    require($path);
+                    if (!file_exists($path)) {
+                        $this->loadDefaultPage();
+                    } else {
+                        require($path);
+                    }
                 }
             }
         }
diff --git a/core/trunk/core/xml/actions_pages.xml b/core/trunk/core/xml/actions_pages.xml
index 8ea22860927..4111cdd9424 100644
--- a/core/trunk/core/xml/actions_pages.xml
+++ b/core/trunk/core/xml/actions_pages.xml
@@ -292,4 +292,15 @@ An action page is described in a ACTIONPAGE tag :
             <COLL_ID>business_coll</COLL_ID>
         </COLLECTIONS>
     </ACTIONPAGE>
+    <ACTIONPAGE>
+        <ID>close_mail_and_index</ID>
+        <LABEL>_CLOSE_MAIL_AND_INDEX</LABEL>
+        <NAME>close_mail_and_index</NAME>
+        <ORIGIN>apps</ORIGIN>
+        <MODULE></MODULE>
+        <FLAG_CREATE>false</FLAG_CREATE>
+        <COLLECTIONS>
+            <COLL_ID>letterbox_coll</COLL_ID>
+        </COLLECTIONS>
+    </ACTIONPAGE>
 </ROOT>
-- 
GitLab