1
0

Compare commits

...

10 Commits

Author SHA1 Message Date
Daniel Tartavel
1fb1a585f9 debug 2019-12-18 23:02:14 +01:00
Daniel Tartavel
0e3f741c02 debug 2019-12-18 22:56:57 +01:00
Daniel Tartavel
639d950889 debug 2019-12-18 22:35:57 +01:00
Daniel Tartavel
042999aeb4 bug $datefin au lieu de user['datefin'] 2019-12-18 22:34:14 +01:00
Daniel Tartavel
0e3b864ecb debug 2019-12-18 22:30:26 +01:00
Daniel Tartavel
f3304fbeb1 resolu: bug lorsque adresse courriel est vide 2019-12-18 22:11:05 +01:00
Daniel Tartavel
b7b89160ef debuggage 2019-12-01 11:16:26 +01:00
Daniel Tartavel
96c945bfc4 debuggage 2019-12-01 01:53:51 +01:00
Daniel Tartavel
b09277ee7b debuggage 2019-12-01 01:52:08 +01:00
Daniel Tartavel
f2cf94e636 Debuggage 2019-12-01 01:50:13 +01:00

View File

@ -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;
}
?>