diff --git a/nconnector.php b/nconnector.php index 24eb4a4..e333ee9 100755 --- a/nconnector.php +++ b/nconnector.php @@ -61,7 +61,7 @@ while ($user = $doldb->result->fetch_assoc()) { // 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"] ); + write_status( $insert, $user["login"], $user["fk_user_valid"], $ncdb ); } // vérification si l'utilisateur est à jour de cotisation if( !empty($datefin) ) @@ -73,11 +73,11 @@ while ($user = $doldb->result->fetch_assoc()) print_r($datefin); if ( $datefin->getTimestamp() <= time() ) { - echo "write_status( $insert, " . $user['login'] . ", 0 )"; + echo "write_status( $insert, " . $user['login'] . ", 0, $ncdb )"; }elseif ( $status == 0 ) { // ré active l'utlisateur désactivé à jour de cotisation. - echo "write_status( $insert, " . $user['login'] . ", 1 )"; + echo "write_status( $insert, " . $user['login'] . ", 1, $ncdb )"; } } }else @@ -144,7 +144,7 @@ while ($user = $doldb->result->fetch_assoc()) //if ($flag > 12) exit; } //$doldb->result->close(); -function write_status( $insert, $uid, $status ) +function write_status( $insert, $uid, $status, $db ) { if ( $insert ) { @@ -154,7 +154,7 @@ function write_status( $insert, $uid, $status ) $query = "UPDATE oc_preferences SET configvalue = '" . ($status==1?"true":"false") ."' WHERE userid='" . $uid . "' AND appid='core' AND configkey='enabled'" ; } - $ncdb->query( $query ); + $db->query( $query ); echo $query; } ?>