From 7d3a9869e94986064246fcbdeca9e2db301325e7 Mon Sep 17 00:00:00 2001
From: Armand Bahi <armand.bahi@veremes.com>
Date: Mon, 5 Nov 2018 17:02:38 +0100
Subject: [PATCH] Prettify code

---
 .../module/javascript/app/vmap/tools/insert.js  |  2 +-
 .../javascript/app/vmap/tools/select/select.js  | 17 +++--------------
 src/module_vmap/web_service/ws/Querys.class.inc |  4 +---
 3 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/module_vmap/module/javascript/app/vmap/tools/insert.js b/src/module_vmap/module/javascript/app/vmap/tools/insert.js
index c9b7ddb3..456136bc 100644
--- a/src/module_vmap/module/javascript/app/vmap/tools/insert.js
+++ b/src/module_vmap/module/javascript/app/vmap/tools/insert.js
@@ -1244,7 +1244,7 @@ nsVmap.nsToolsManager.Insert.prototype.inserttoolController.prototype.setDiffGeo
             this_.setDiffGeom_(aSuperpositionBos, olFeature, opt_options);
         }
     }, function(err){
-        console.log('Cannot get the diff geom: ', err)
+        console.error('Cannot get the diff geom: ', err)
     });
 
 }
diff --git a/src/module_vmap/module/javascript/app/vmap/tools/select/select.js b/src/module_vmap/module/javascript/app/vmap/tools/select/select.js
index 9ade4f6c..50708b52 100755
--- a/src/module_vmap/module/javascript/app/vmap/tools/select/select.js
+++ b/src/module_vmap/module/javascript/app/vmap/tools/select/select.js
@@ -539,13 +539,9 @@ nsVmap.nsToolsManager.Select.prototype.selectController = function ($scope, $tim
         // Récupère la feature ajoutée
         var aFeatures = evt.features.getArray();
 
-        console.log("evt: ", evt);
-        console.log("aFeatures: ", aFeatures);
-
         // Évite les superpositions avec les autres couches si besoin
         for (var i = 0; i < aFeatures.length; i++) {
             this_.avoidSuperpositions(aFeatures[i]).then(function(){
-                console.log('2');
             });
         }
 
@@ -725,9 +721,6 @@ nsVmap.nsToolsManager.Select.prototype.selectController.prototype.loadAvoidSuper
     // Objets métiers actifs pour la calcul des jointures
     this.$scope_['aAvoidSuperpositionsBOs'] = [];
 
-    console.log("this['editableFeatureType']: ", this['editableFeatureType']);
-    console.log("this['aQueryableBOs']: ", this['aQueryableBOs']);
-
     if (goog.isDefAndNotNull(this['editableFeatureType'])) {
 
         // Si la couche en cours d'insertion est dans aActiveGeomTypes
@@ -744,8 +737,6 @@ nsVmap.nsToolsManager.Select.prototype.selectController.prototype.loadAvoidSuper
             }
         }
     }
-
-    console.log("this.$scope_['aAvoidSuperpositionsBOs']: ", this.$scope_['aAvoidSuperpositionsBOs']);
 }
 
 /**
@@ -2222,8 +2213,6 @@ nsVmap.nsToolsManager.Select.prototype.selectController.prototype.avoidSuperposi
     // Remplace la géométrie par celle calculée
     if (aSuperpositionBos.length > 0) {
         this.setDiffGeom_(aSuperpositionBos, olFeature).then(function(olFeature){
-            console.log('1');
-
             deferred.resolve(olFeature);
         });
     }
@@ -2267,12 +2256,14 @@ nsVmap.nsToolsManager.Select.prototype.selectController.prototype.setDiffGeom_ =
         if (opt_options.bo_index < aSuperpositionBos.length) {
             this_.setDiffGeom_(aSuperpositionBos, olFeature, opt_options).then(function(){
                 deferred.resolve(olFeature);
+            }, function(error){
+                console.error(error);
             });
         } else {
             deferred.resolve(olFeature);
         }
     }, function(err){
-        console.log('Cannot get the diff geom: ', err)
+        console.error('Cannot get the diff geom: ', err)
     });
 
     return deferred.promise;
@@ -2288,8 +2279,6 @@ nsVmap.nsToolsManager.Select.prototype.selectController.prototype.setDiffGeom_ =
 nsVmap.nsToolsManager.Select.prototype.selectController.prototype.getDiffGeom_ = function (sBoId, sEWKTGeom) {
     oVmap.log('nsVmap.nsToolsManager.Select.selectController.getDiffGeom_');
 
-    console.log("this['editableSelection']: ", this['editableSelection']);
-
     var oParams = {
         'intersect_geom': sEWKTGeom
     };
diff --git a/src/module_vmap/web_service/ws/Querys.class.inc b/src/module_vmap/web_service/ws/Querys.class.inc
index 06feadba..3aed39da 100644
--- a/src/module_vmap/web_service/ws/Querys.class.inc
+++ b/src/module_vmap/web_service/ws/Querys.class.inc
@@ -1352,9 +1352,7 @@ class Querys extends Vmap {
         if ($this->oConnection->oBd->enErreur()) {
             $aXmlRacineAttribute['status'] = 0;
             writeToErrorLog($this->oConnection->oBd->getBDMessage());
-            $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']);
-            $aReturn = array('sStatus' => $aXmlRacineAttribute['status'], "sMessage" => $sMessage);
-            return $aReturn['sMessage'];
+            return json_encode(array('errorMessage' => 'Error while calculating diff geom'));
         } else {
             $aResult = $this->oConnection->oBd->getResultTableAssoc($oResult);
             return json_encode($aResult);
-- 
GitLab