From c43b255ff2ff167a861c2371c3ac676ef5183127 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Sat, 30 Nov 2019 00:04:49 +0100 Subject: [PATCH] =?UTF-8?q?ajout=20de=20l'activation/d=C3=A9sactivation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nconnector.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/nconnector.php b/nconnector.php index 3fa7028..a18877c 100755 --- a/nconnector.php +++ b/nconnector.php @@ -31,7 +31,7 @@ $data = array("displayname"=>array("value"=>"","scope"=>"contacts","verified"=>" $doldb = new db("dolibarr"); $ncdb = new db("nextcloud"); -$doldb->query("SELECT login, firstname, lastname, pass_crypted, fk_adherent_type, address, email, phone_perso, phone_mobile, zip, town FROM llx_adherent"); +$doldb->query("SELECT login, firstname, lastname, pass_crypted, fk_adherent_type, address, email, phone_perso, phone_mobile, zip, town, fk_user_valid FROM llx_adherent"); //print_r ($ncdb); while ($user = $doldb->result->fetch_assoc()) { @@ -42,6 +42,21 @@ while ($user = $doldb->result->fetch_assoc()) { $ncuser = $ncdb->result->fetch_assoc(); echo "uid:" . $ncuser["uid"] . "existe" . EOL; + $ncdb->query("SELECT uid FROM oc_preferences WHERE user_id='" . $user["login"] . "' AND appid='core' AND configkey='enabled'"); + if ( $ncdb->result->num_rows != 0 ) + { + $r = $ncdb->result->fetch_assoc(); + $status = $r["configkey"] ; + }else + { + $status = 1; + } + if ( $user["fk_user_valid"] != $status ) + { + $query = "UPDATE oc_preferences SET configvalue = '" . $user["fk_user_valid"] ."' WHERE user_id='" . $user["login"] . "' AND appid='core' AND configkey='enabled'" ; + $ncdb->query( $query ); + echo $query; + } }else { //echo $user["login"] . " n'existe pas";