From 880d8788bd1a45d01edd9c4dbfced96263b91451 Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Wed, 1 Aug 2018 11:53:12 +0200
Subject: [PATCH] External SB controller

---
 .../actions/sendToExternalSignatureBook.php   | 28 +++++++++++++++++--
 modules/visa/class/IxbusController.php        | 27 ++++++++++++++++++
 2 files changed, 53 insertions(+), 2 deletions(-)
 create mode 100644 modules/visa/class/IxbusController.php

diff --git a/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php b/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php
index 67117822649..4eeed8d5d3a 100644
--- a/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php
+++ b/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php
@@ -2,13 +2,37 @@
 
 $confirm = true;
 
-$etapes = ['send'];
+$etapes = ['form'];
+
+function get_form_txt($values, $path_manage_action,  $id_action, $table, $module, $coll_id, $mode)
+{
+    if (file_exists("custom/{$_SESSION['custom_override_id']}/modules/visa/xml/remoteSignatoryBooks.xml")) {
+        $path = "custom/{$_SESSION['custom_override_id']}/modules/visa/xml/remoteSignatoryBooks.xml";
+    } else {
+        $path = 'modules/visa/xml/remoteSignatoryBooks.xml';
+    }
+
+    $config = [];
+    if (file_exists($path)) {
+        $loadedXml = simplexml_load_file($path);
+        if ($loadedXml) {
+            $config['id'] = (string)$loadedXml->signatoryBookEnabled;
+        }
+    }
+
+    if ($config['id'] == 'ixbus') {
+        include_once 'modules/visa/class/IxbusController.php';
+
+        $html = IxbusController::getModal();
+    }
+
+    return addslashes($html);
+}
 
 function manage_send($aId)
 {
     $result = '';
 
-
     $xmlPostString = '<?xml version="1.0" encoding="utf-8"?>
                         <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                             <soap:Body>
diff --git a/modules/visa/class/IxbusController.php b/modules/visa/class/IxbusController.php
new file mode 100644
index 00000000000..8fdba096596
--- /dev/null
+++ b/modules/visa/class/IxbusController.php
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * Copyright Maarch since 2008 under licence GPLv3.
+ * See LICENCE.txt file at the root folder for more details.
+ * This file is part of Maarch software.
+ *
+ */
+
+/**
+ * @brief Ixbus Controller
+ * @author dev@maarch.org
+ */
+
+
+class IxbusController
+{
+    public static function getModal()
+    {
+        $html ='<div align="center">';
+        $html .='<input type="button" name="cancel" id="cancel" class="button" value="valider"/>';
+        $html .='<input type="button" name="cancel" id="cancel" class="button" value="annuler"/>';
+        $html .='</div>';
+
+        return $html;
+    }
+}
-- 
GitLab