Compare commits
No commits in common. "1fb1a585f924dbbd2923bfec21f4cf801071c814" and "40e76403f5d992eee2ca549ca5a46d70cc52d400" have entirely different histories.
1fb1a585f9
...
40e76403f5
@ -49,26 +49,22 @@ 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 = 'true';
|
||||
$status = 1;
|
||||
}
|
||||
$fk_user_valid = ($user["fk_user_valid"]==0?"false":"true");
|
||||
if ( $fk_user_valid != $status )
|
||||
if ( $user["fk_user_valid"] != $status )
|
||||
{
|
||||
// différence entre nexcloud et dolibarr
|
||||
echo "\ndifférent\n##############################\n" . $fk_user_valid . "!=" . $status . "\n";
|
||||
write_status( $insert, $user["login"], $fk_user_valid, $ncdb );
|
||||
// echo "\ndifférent\n##############################\n" . $user['fk_user_valid'] . "!=" . $status . "\n";
|
||||
write_status( $insert, $user["login"], $user["fk_user_valid"] );
|
||||
}
|
||||
// vérification si l'utilisateur est à jour de cotisation
|
||||
echo "datefin =>" . $user['datefin'];
|
||||
if( !empty($user['datefin']) )
|
||||
if( !empty($datefin) )
|
||||
{
|
||||
$datefin = DateTime::createFromFormat("Y-m-d H:i:s", $user['datefin']);
|
||||
$interval = new DateInterval('P0000Y02M00D');
|
||||
@ -77,11 +73,11 @@ while ($user = $doldb->result->fetch_assoc())
|
||||
print_r($datefin);
|
||||
if ( $datefin->getTimestamp() <= time() )
|
||||
{
|
||||
write_status( $insert, $user['login'] , "false", $ncdb );
|
||||
}elseif ( $status == "false" )
|
||||
echo "write_status( $insert, " . $user['login'] . ", 0 )";
|
||||
}elseif ( $status == 0 )
|
||||
{
|
||||
// ré active l'utlisateur désactivé à jour de cotisation.
|
||||
write_status( $insert, $user['login'] , "true", $ncdb );
|
||||
echo "write_status( $insert, " . $user['login'] . ", 1 )";
|
||||
}
|
||||
}
|
||||
}else
|
||||
@ -98,7 +94,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 )
|
||||
{
|
||||
@ -148,17 +144,17 @@ while ($user = $doldb->result->fetch_assoc())
|
||||
//if ($flag > 12) exit;
|
||||
}
|
||||
//$doldb->result->close();
|
||||
function write_status( $mode, $uid, $status, $db )
|
||||
function write_status( $insert, $uid, $status )
|
||||
{
|
||||
if ( $mode )
|
||||
if ( $insert )
|
||||
{
|
||||
$query = "INSERT INTO oc_preferences (userid, appid, configkey, configvalue) VALUES ( '" . $uid . "', 'core', 'enabled', '" . $status . "' ) ";
|
||||
$query = "INSERT INTO oc_preferences (userid, appid, configkey, configvalue) VALUES ( '" . $uid . "', 'core', 'enabled', '" . ($status==1?"true":"false") . "' ) ";
|
||||
}else
|
||||
{
|
||||
$query = "UPDATE oc_preferences SET configvalue = '" . $status ."' WHERE userid='" . $uid . "' AND appid='core' AND configkey='enabled'" ;
|
||||
$query = "UPDATE oc_preferences SET configvalue = '" . ($status==1?"true":"false") ."' WHERE userid='" . $uid . "' AND appid='core' AND configkey='enabled'" ;
|
||||
|
||||
}
|
||||
$db->query( $query );
|
||||
$ncdb->query( $query );
|
||||
echo $query;
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user