diff --git a/core/ajax/mobile.ajax.php b/core/ajax/mobile.ajax.php
index 0ef77d87..08a74158 100755
--- a/core/ajax/mobile.ajax.php
+++ b/core/ajax/mobile.ajax.php
@@ -49,6 +49,17 @@
}
}
+ if (init('action') == 'getAffectUserByEqlogic') {
+ $eqLogic = mobile::byId(init('id'));
+ $return = '';
+ if (is_object($eqLogic)) {
+ if (is_object($user = user::byId($eqLogic->getConfiguration('affect_user')))) {
+ $return = $user->getLogin();
+ }
+ }
+ ajax::success($return);
+ }
+
throw new Exception(__('Aucune methode correspondante à : ', __FILE__) . init('action'));
} catch (Exception $e) {
diff --git a/core/api/mobile.api.php b/core/api/mobile.api.php
index e7dcf21c..6837bbfd 100755
--- a/core/api/mobile.api.php
+++ b/core/api/mobile.api.php
@@ -142,6 +142,10 @@ function saveMenuFromAppV2($menu, $mobile) {
log::add('mobile', 'debug', '| [NOTICE] Token vide ');
}
}
+ if (is_object($user = user::byHash($params['apikey']))) {
+ log::add('mobile', 'debug', '| [INFO] affect_user > ' . $user->getLogin() . ' (' . $user->getId() . ')');
+ $mobile->setConfiguration('affect_user', $user->getId());
+ }
$mobile->save();
/* moved to new method setCustomMenu
diff --git a/desktop/js/mobile.js b/desktop/js/mobile.js
index ef9bc0fc..da5e5cc0 100755
--- a/desktop/js/mobile.js
+++ b/desktop/js/mobile.js
@@ -44,7 +44,7 @@ function printEqLogic(_eqLogic) {
type: "POST",
url: "plugins/mobile/core/ajax/mobile.ajax.php",
data: {
- action: "getQrCode",
+ action: "getAffectUserByEqlogic",
id: _eqLogic.id,
},
dataType: "json",
@@ -57,16 +57,9 @@ function printEqLogic(_eqLogic) {
jeedomUtils.showAlert({ message: data.result, level: "danger" })
return
}
- let el = document.querySelector(".qrCodeImg")
- el.innerHTML = ""
- if (data.result == "internalError") {
- el.innerHTML = "{{Erreur pas d'adresse interne (voir configuration de votre Jeedom !)}}"
- } else if (data.result == "externalError") {
- el.innerHTML = "{{Erreur pas d'adresse externe (voir configuration de votre Jeedom !)}}"
- } else if (data.result == "UserError") {
- el.innerHTML = "{{Erreur pas d'utilisateur selectionné}}"
- } else {
- el.innerHTML = ''
+ let el = document.querySelector(".affect_user")
+ if (el != null) {
+ el.value = data.result
}
}
})
diff --git a/desktop/php/mobile.php b/desktop/php/mobile.php
index f2d3af0c..c5f2bda8 100755
--- a/desktop/php/mobile.php
+++ b/desktop/php/mobile.php
@@ -211,16 +211,7 @@