Compare commits
10 Commits
40e76403f5
...
1fb1a585f9
Author | SHA1 | Date | |
---|---|---|---|
|
1fb1a585f9 | ||
|
0e3f741c02 | ||
|
639d950889 | ||
|
042999aeb4 | ||
|
0e3b864ecb | ||
|
f3304fbeb1 | ||
|
b7b89160ef | ||
|
96c945bfc4 | ||
|
b09277ee7b | ||
|
f2cf94e636 |
@ -49,22 +49,26 @@ while ($user = $doldb->result->fetch_assoc())
|
||||
if ( $ncdb->result->num_rows != 0 )
|
||||
{
|
||||
// le validité de l'utilisateur est définie
|
||||
echo "utilisateur valide";
|
||||
$r = $ncdb->result->fetch_assoc();
|
||||
$status = $r["configvalue"] ;
|
||||
}else
|
||||
{
|
||||
// pas de définition de la validité de l'utilisateur => par défaut utilisateur valide
|
||||
echo "utilisateur valide par défaut";
|
||||
$insert = true; // insertion de la validité dans la table préférence
|
||||
$status = 1;
|
||||
$status = 'true';
|
||||
}
|
||||
if ( $user["fk_user_valid"] != $status )
|
||||
$fk_user_valid = ($user["fk_user_valid"]==0?"false":"true");
|
||||
if ( $fk_user_valid != $status )
|
||||
{
|
||||
// différence entre nexcloud et dolibarr
|
||||
// echo "\ndifférent\n##############################\n" . $user['fk_user_valid'] . "!=" . $status . "\n";
|
||||
write_status( $insert, $user["login"], $user["fk_user_valid"] );
|
||||
echo "\ndifférent\n##############################\n" . $fk_user_valid . "!=" . $status . "\n";
|
||||
write_status( $insert, $user["login"], $fk_user_valid, $ncdb );
|
||||
}
|
||||
// vérification si l'utilisateur est à jour de cotisation
|
||||
if( !empty($datefin) )
|
||||
echo "datefin =>" . $user['datefin'];
|
||||
if( !empty($user['datefin']) )
|
||||
{
|
||||
$datefin = DateTime::createFromFormat("Y-m-d H:i:s", $user['datefin']);
|
||||
$interval = new DateInterval('P0000Y02M00D');
|
||||
@ -73,11 +77,11 @@ while ($user = $doldb->result->fetch_assoc())
|
||||
print_r($datefin);
|
||||
if ( $datefin->getTimestamp() <= time() )
|
||||
{
|
||||
echo "write_status( $insert, " . $user['login'] . ", 0 )";
|
||||
}elseif ( $status == 0 )
|
||||
write_status( $insert, $user['login'] , "false", $ncdb );
|
||||
}elseif ( $status == "false" )
|
||||
{
|
||||
// ré active l'utlisateur désactivé à jour de cotisation.
|
||||
echo "write_status( $insert, " . $user['login'] . ", 1 )";
|
||||
write_status( $insert, $user['login'] , "true", $ncdb );
|
||||
}
|
||||
}
|
||||
}else
|
||||
@ -94,7 +98,7 @@ while ($user = $doldb->result->fetch_assoc())
|
||||
$data["displayname"]["value"] = addslashes(concat(utf8_encode($user["firstname"]), utf8_encode($user["lastname"])));
|
||||
$address = concat(utf8_encode($user['address']), $user["zip"]);
|
||||
$data["address"]["value"] = (concat ($address, utf8_encode($user["town"])));
|
||||
$data["email"]["value"] = $user["email"];
|
||||
$data["email"]["value"] = "'" . $user["email"] . "'";
|
||||
print_r($data);
|
||||
if ( ($account_data = json_encode($data)) == false )
|
||||
{
|
||||
@ -144,17 +148,17 @@ while ($user = $doldb->result->fetch_assoc())
|
||||
//if ($flag > 12) exit;
|
||||
}
|
||||
//$doldb->result->close();
|
||||
function write_status( $insert, $uid, $status )
|
||||
function write_status( $mode, $uid, $status, $db )
|
||||
{
|
||||
if ( $insert )
|
||||
if ( $mode )
|
||||
{
|
||||
$query = "INSERT INTO oc_preferences (userid, appid, configkey, configvalue) VALUES ( '" . $uid . "', 'core', 'enabled', '" . ($status==1?"true":"false") . "' ) ";
|
||||
$query = "INSERT INTO oc_preferences (userid, appid, configkey, configvalue) VALUES ( '" . $uid . "', 'core', 'enabled', '" . $status . "' ) ";
|
||||
}else
|
||||
{
|
||||
$query = "UPDATE oc_preferences SET configvalue = '" . ($status==1?"true":"false") ."' WHERE userid='" . $uid . "' AND appid='core' AND configkey='enabled'" ;
|
||||
$query = "UPDATE oc_preferences SET configvalue = '" . $status ."' WHERE userid='" . $uid . "' AND appid='core' AND configkey='enabled'" ;
|
||||
|
||||
}
|
||||
$ncdb->query( $query );
|
||||
$db->query( $query );
|
||||
echo $query;
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user