Commit dd2dcd3b authored by mbriand's avatar mbriand
Browse files

Laverie : les responsables peuvent voir les noms pour les créneaux réservés

parent 6c14c336
......@@ -203,21 +203,38 @@ elseif ( $_REQUEST["action"] == "searchmc" )
if ( $_REQUEST["operation"] == 3 )
{
$sql =
"SELECT
CONCAT(MIN(cl.id_creneau),',',MIN(cs.id_creneau)) AS id_creneau,
cl.debut_creneau, SUBTIME(cl.fin_creneau,'00:00:01') AS fin_creneau,
'Choisir' AS texte
FROM mc_creneaux AS cl
INNER JOIN mc_machines AS ml ON ( cl.id_machine = ml.id AND ml.type='laver' )
INNER JOIN mc_creneaux AS cs ON ( cs.debut_creneau = cl.fin_creneau )
INNER JOIN mc_machines AS ms ON ( cs.id_machine = ms.id AND ms.type='secher' )
WHERE ml.loc='".mysql_real_escape_string($_REQUEST["id_salle"])."'
AND ms.loc='".mysql_real_escape_string($_REQUEST["id_salle"])."'
AND cs.id_utilisateur IS NULL
AND cl.id_utilisateur IS NULL
AND cl.debut_creneau > NOW()";
if ( $site->user->is_in_group_id(20084))
$sql =
"SELECT
CONCAT(MIN(cl.id_creneau),',',MIN(cs.id_creneau)) AS id_creneau,
cl.debut_creneau, SUBTIME(cl.fin_creneau,'00:00:01') AS fin_creneau,
COALESCE(CONCAT(prenom_utl, ' ', nom_utl), 'Choisir') AS texte
FROM mc_creneaux AS cl
INNER JOIN mc_machines AS ml ON ( cl.id_machine = ml.id AND ml.type='laver' )
INNER JOIN mc_creneaux AS cs ON ( cs.debut_creneau = cl.fin_creneau )
INNER JOIN mc_machines AS ms ON ( cs.id_machine = ms.id AND ms.type='secher' )
INNER JOIN utilisateurs ON ( cs.id_utilisateur = utilisateurs.id_utilisateur )
WHERE ml.loc='".mysql_real_escape_string($_REQUEST["id_salle"])."'
AND ms.loc='".mysql_real_escape_string($_REQUEST["id_salle"])."'
AND cl.id_utilisateur IS NULL
AND cl.debut_creneau > NOW()";
else
$sql =
"SELECT
CONCAT(MIN(cl.id_creneau),',',MIN(cs.id_creneau)) AS id_creneau,
cl.debut_creneau, SUBTIME(cl.fin_creneau,'00:00:01') AS fin_creneau,
'Choisir' AS texte
FROM mc_creneaux AS cl
INNER JOIN mc_machines AS ml ON ( cl.id_machine = ml.id AND ml.type='laver' )
INNER JOIN mc_creneaux AS cs ON ( cs.debut_creneau = cl.fin_creneau )
INNER JOIN mc_machines AS ms ON ( cs.id_machine = ms.id AND ms.type='secher' )
WHERE ml.loc='".mysql_real_escape_string($_REQUEST["id_salle"])."'
AND ms.loc='".mysql_real_escape_string($_REQUEST["id_salle"])."'
AND cs.id_utilisateur IS NULL
AND cl.id_utilisateur IS NULL
AND cl.debut_creneau > NOW()";
$pl = new weekplanning ( "Selectionner un creneau", $site->db, $sql, "id_creneau", "cl.debut_creneau", "cl.fin_creneau", "texte", "index.php?action=searchmc&operation=".$_REQUEST["operation"]."&id_salle=".$_REQUEST["id_salle"].$extraurl, "index.php?page=reserver".$extraurl, "GROUP BY cl.debut_creneau" );
$pl = new weekplanning ( "Selectionner un creneau", $site->db, $sql, "id_creneau", "cl.debut_creneau", "cl.fin_creneau", "texte", "index.php?action=searchmc&operation=".$_REQUEST["operation"]."&id_salle=".$_REQUEST["id_salle"].$extraurl, "index.php?page=reserver".$extraurl, "GROUP BY cl.debut_creneau" );
$cts->add($pl,true);
}
......@@ -225,17 +242,30 @@ elseif ( $_REQUEST["action"] == "searchmc" )
{
$type = $_REQUEST["operation"] == 1 ? 'laver' : 'secher';
$sql =
"SELECT
id_creneau,
debut_creneau, SUBTIME(fin_creneau,'00:00:01') as fin_creneau,
'Choisir' AS texte
FROM mc_creneaux
INNER JOIN mc_machines ON ( mc_creneaux.id_machine = mc_machines.id )
WHERE mc_machines.type='".mysql_real_escape_string($type)."'
AND mc_machines.loc='".mysql_real_escape_string($_REQUEST["id_salle"])."'
AND id_utilisateur IS NULL
AND debut_creneau > NOW()";
if ( $site->user->is_in_group_id(20084))
$sql =
"SELECT
id_creneau,
debut_creneau, SUBTIME(fin_creneau,'00:00:01') as fin_creneau,
COALESCE(CONCAT(prenom_utl, ' ', nom_utl), 'Choisir') AS texte
FROM mc_creneaux
INNER JOIN mc_machines ON ( mc_creneaux.id_machine = mc_machines.id )
INNER JOIN utilisateurs ON ( mc_creneaux.id_utilisateur = utilisateurs.id_utilisateur )
WHERE mc_machines.type='".mysql_real_escape_string($type)."'
AND mc_machines.loc='".mysql_real_escape_string($_REQUEST["id_salle"])."'
AND debut_creneau > NOW()";
else
$sql =
"SELECT
id_creneau,
debut_creneau, SUBTIME(fin_creneau,'00:00:01') as fin_creneau,
'Choisir' AS texte
FROM mc_creneaux
INNER JOIN mc_machines ON ( mc_creneaux.id_machine = mc_machines.id )
WHERE mc_machines.type='".mysql_real_escape_string($type)."'
AND mc_machines.loc='".mysql_real_escape_string($_REQUEST["id_salle"])."'
AND id_utilisateur IS NULL
AND debut_creneau > NOW()";
$pl = new weekplanning ( "Selectionner un creneau", $site->db, $sql, "id_creneau", "debut_creneau", "fin_creneau", "texte", "index.php?action=searchmc&operation=".$_REQUEST["operation"]."&id_salle=".$_REQUEST["id_salle"].$extraurl, "index.php?page=reserver".$extraurl, "GROUP BY debut_creneau" );
$cts->add($pl,true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment