From e996ab257e497c0d56ec00256e81bf048c5a3d9f Mon Sep 17 00:00:00 2001
From: Armand Bahi <armand.bahi@veremes.com>
Date: Wed, 7 Nov 2018 15:46:51 +0100
Subject: [PATCH] =?UTF-8?q?Resolve=20"[Studio]=20suppressions=20des=20diff?=
 =?UTF-8?q?=C3=A9rents=20formulaires"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 web_service/ws/BusinessObjects.class.inc | 28 +++++++++++++++++++-----
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/web_service/ws/BusinessObjects.class.inc b/web_service/ws/BusinessObjects.class.inc
index 413f93e4..fa7ca58d 100755
--- a/web_service/ws/BusinessObjects.class.inc
+++ b/web_service/ws/BusinessObjects.class.inc
@@ -697,10 +697,6 @@ class BusinessObjects extends Vmap {
             $sFileContents .= $aFileContents[$i] . ' ';
         }
 
-//        // Travail sur chacune des requĂȘtes du fichier
-//        $aFileContents = explode(';', $sFileContents);
-//        $aFileContents = $this->cleanDataModelFileArray($aFileContents);
-
         return $sFileContents;
     }
 
@@ -1318,7 +1314,7 @@ class BusinessObjects extends Vmap {
                         fclose($pFile);
                     }
 
-                    if ($this->aValues["Js"] != "") {
+                    if (isset($this->aValues["Js"])) {
                         $pFileJS = fopen($sDirPath . '/forms/ressources/' . $sFormName . '.js', 'w+');
                         if (fwrite($pFileJS, $this->aValues["Js"]) == FALSE) {
                             writeToErrorLog('ERROR: ' . $sFormName . '.js save failed');
@@ -1326,7 +1322,7 @@ class BusinessObjects extends Vmap {
                         fclose($pFileJS);
                     }
 
-                    if ($this->aValues["Css"] != "") {
+                    if (isset($this->aValues["Css"])) {
                         $pFileCSS = fopen($sDirPath . '/forms/ressources/' . $sFormName . '.css', 'w+');
                         if (fwrite($pFileCSS, $this->aValues["Css"]) == FALSE) {
                             writeToErrorLog('ERROR: ' . $sFormName . '.css save failed');
@@ -1370,6 +1366,26 @@ class BusinessObjects extends Vmap {
                     @unlink($sDirPath . "/forms/default.json");
                     $aFields = explode("|", $this->aValues['field']);
                     $this->generateBusinessObjectForm($sBusinessObjectId, $sFormName, $aFields, $this->aValues['label']);
+                    break;
+                case "Published_Delete":
+
+                    if (file_exists($sDirPath . "/forms/published.json")) {
+                        @unlink($sDirPath . "/forms/published.json");
+                    }
+                    if (file_exists($sDirPath . "/forms/ressources/published.js")) {
+                        @unlink($sDirPath . "/forms/ressources/published.js");
+                    }
+                    if (file_exists($sDirPath . "/forms/ressources/published.css")) {
+                        @unlink($sDirPath . "/forms/ressources/published.css");
+                    }
+
+                    break;
+                case "Delete_JS":
+
+                    if (file_exists($sDirPath . "/forms/ressources/" . $sFormName . ".js")) {
+                        @unlink($sDirPath . "/forms/ressources/" . $sFormName . ".js");
+                    }
+
                     break;
             }
         }
-- 
GitLab