1
0

ajout de l'activation/désactivation

This commit is contained in:
Daniel Tartavel 2019-11-30 00:04:49 +01:00
parent 6447626b66
commit c43b255ff2

View File

@ -31,7 +31,7 @@ $data = array("displayname"=>array("value"=>"","scope"=>"contacts","verified"=>"
$doldb = new db("dolibarr"); $doldb = new db("dolibarr");
$ncdb = new db("nextcloud"); $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); //print_r ($ncdb);
while ($user = $doldb->result->fetch_assoc()) while ($user = $doldb->result->fetch_assoc())
{ {
@ -42,6 +42,21 @@ while ($user = $doldb->result->fetch_assoc())
{ {
$ncuser = $ncdb->result->fetch_assoc(); $ncuser = $ncdb->result->fetch_assoc();
echo "uid:" . $ncuser["uid"] . "existe" . EOL; 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 }else
{ {
//echo $user["login"] . " n'existe pas"; //echo $user["login"] . " n'existe pas";