diff --git a/manager/module/machineDefault.php b/manager/module/machineDefault.php index 879606d..4330c14 100755 --- a/manager/module/machineDefault.php +++ b/manager/module/machineDefault.php @@ -230,7 +230,7 @@ $_SESSION['WAREHOUSE']['id'], $id_machine ]); - $answer = $request->answer(); + $answer = $request->answer(); // Si aucun resultat, on retourne une erreur if( $answer === false ) diff --git a/manager/module/userDefault.php b/manager/module/userDefault.php index 9096c8d..a844d75 100755 --- a/manager/module/userDefault.php +++ b/manager/module/userDefault.php @@ -52,7 +52,7 @@ /* [3] Creation du groupe de meme nom que l'username =========================================================*/ - $create_cluster = new Repo('cluster/create', [ + $create_cluster = new Repo('user_cluster/create', [ $_SESSION['WAREHOUSE']['id'], $username, clusterRepo::USER_CLASS, @@ -92,7 +92,7 @@ /* [1] Creation de l'association =========================================================*/ - $link_user = new Repo('cluster/link', [ + $link_user = new Repo('user_cluster/link', [ $_SESSION['WAREHOUSE']['id'], $id_cluster, $id_user, @@ -121,7 +121,7 @@ /* [1] Suppression de l'association =========================================================*/ - $link_user = new Repo('cluster/unlink', [ + $link_user = new Repo('user_cluster/unlink', [ $_SESSION['WAREHOUSE']['id'], $id_cluster, $id_user, @@ -399,7 +399,7 @@ /* [2] On récupère le groupe personnel =========================================================*/ - $get_personal_cluster = new Repo('cluster/getPersonal', [ + $get_personal_cluster = new Repo('user_cluster/getPersonal', [ $id_warehouse, $id_user, clusterRepo::USER_CLASS @@ -414,7 +414,7 @@ /* [3] On supprime le groupe personnel =========================================================*/ - $del_cluster = new Repo('cluster/delete', [ + $del_cluster = new Repo('user_cluster/delete', [ $id_warehouse, $personal_cluster['id_cluster'] ]); diff --git a/manager/repo/machine.php b/manager/repo/machine.php index 4b3d272..0357a83 100755 --- a/manager/repo/machine.php +++ b/manager/repo/machine.php @@ -94,18 +94,17 @@ public static function getClusters($id_warehouse, $id_machine){ /* [1] On redige/execute la requete =========================================================*/ - $get_clusters = Database::getPDO()->prepare("SELECT c.id_cluster, c.name - FROM cluster as c, cluster_merge as cm, machine as m - WHERE cm.id_cluster = c.id_cluster - AND cm.id_entity = m.id_machine - AND m.id_warehouse = :id_warehouse - AND cm.id_entity = :id_machine - AND c.class = :class - ORDER BY c.id_cluster"); + $get_clusters = Database::getPDO()->prepare("SELECT c.* + FROM machine_cluster as c, machine_cluster_merge as cm, machine as m + WHERE cm.id_machine_cluster = c.id_machine_cluster + AND cm.id_machine = m.id_machine + AND cm.id_machine = :id_machine + AND c.id_warehouse = m.id_warehouse + AND m.id_warehouse = :id_warehouse + ORDER BY c.name"); $get_clusters->execute([ ':id_warehouse' => $id_warehouse, - ':id_machine' => $id_machine, - ':class' => clusterRepo::MACHINE_CLASS + ':id_machine' => $id_machine ]); /* [2] On retourne la liste des groupes diff --git a/manager/repo/user.php b/manager/repo/user.php index dfdc79c..436adf8 100755 --- a/manager/repo/user.php +++ b/manager/repo/user.php @@ -2,7 +2,7 @@ namespace manager\repo; use \manager\Database; - use \manager\repo\cluster as clusterRepo; + use \manager\repo\uesr_cluster; class user extends parentRepo{ @@ -110,18 +110,17 @@ public static function getClusters($id_warehouse, $id_user){ /* [1] On redige/execute la requete =========================================================*/ - $get_clusters = Database::getPDO()->prepare("SELECT c.id_cluster, c.name - FROM cluster as c, cluster_merge as cm, user as u - WHERE cm.id_cluster = c.id_cluster - AND cm.id_entity = u.id_user - AND cm.id_entity = :id_user - AND c.class = :class - AND u.id_warehouse = :id_warehouse - ORDER BY c.id_cluster"); + $get_clusters = Database::getPDO()->prepare("SELECT c.* + FROM user_cluster as c, user_cluster_merge as cm, user as u + WHERE cm.id_user_cluster = c.id_user_cluster + AND cm.id_user = u.id_user + AND cm.id_user = :id_user + AND c.id_warehouse = u.id_warehouse + AND u.id_warehouse = :id_warehouse + ORDER BY c.name"); $get_clusters->execute([ ':id_warehouse' => $id_warehouse, - ':id_user' => $id_user, - ':class' => clusterRepo::USER_CLASS + ':id_user' => $id_user ]); /* [2] On retourne la liste des groupes diff --git a/test/automate.php b/test/automate.php index a3374ae..91cd9fa 100755 --- a/test/automate.php +++ b/test/automate.php @@ -337,9 +337,10 @@ debug(); - $req = new Repo('user_cluster/delete', [ + $req = new Repo('machine_cluster/link', [ 7, - 1 + 2, + 3 ]); var_dump( $req->error ); diff --git a/view/machines.php b/view/machines.php index db45cc5..e5b2f49 100755 --- a/view/machines.php +++ b/view/machines.php @@ -39,6 +39,7 @@ $v) diff --git a/view/users.php b/view/users.php index 79db065..d1ef018 100755 --- a/view/users.php +++ b/view/users.php @@ -40,7 +40,6 @@ $v) array_push($post, $k); @@ -53,7 +52,7 @@ =========================================================*/ echo "
"; - $userlist = new View('user.view'); + $userlist = new View('user.view', []); $userlist->view(); echo '
';