/**
 * @author coster
 * checks if the parent has the same reservation
 * as the child room
 * */
function hasParentSameReservation($reservierungs_id)
{
    global $unterkunft_id;
    global $link;
    global $root;
    include_once $root . "/include/zimmerFunctions.php";
    $zi_id = getZimmerID($reservierungs_id, $link);
    if (!hasRoomParentRooms($zi_id)) {
        return false;
    }
    $gast = getIDFromGast($reservierungs_id, $link);
    $datum_von = getDatumVon($reservierungs_id, $link);
    $datum_bis = getDatumBis($reservierungs_id, $link);
    $status = getState($reservierungs_id, $link);
    $query = "SELECT\t\t \n\t\t\t   r.PK_ID\n\t\t\t   FROM\n\t\t\t   Rezervi_Reservierung r, Rezervi_Zimmer z\n\t\t\t   WHERE\t\t\t\t\n\t\t\t   FK_GAST_ID = '{$gast}' and" . " r.Datum_von = '{$datum_von}' and" . " r.Datum_bis = '{$datum_bis}' and" . " r.Status = '{$status}' and\n\t\t\t\t\tz.Parent_ID is null and \n\t\t\t\t\tr.FK_Zimmer_ID = z.PK_ID ";
    $res = mysqli_query($link, $query);
    if (!$res) {
        echo "die Anfrage scheitert";
        echo "<br/>" . mysqli_error();
    } else {
        $d = mysqli_fetch_array($res);
        $id = $d["PK_ID"];
        if (!empty($id)) {
            return true;
        }
    }
    return false;
}
Ejemplo n.º 2
0
 function removeChildRooms($zimmer_ids)
 {
     $newArr = array();
     //is room with child rooms in array?
     $parentInArray = false;
     foreach ($zimmer_ids as $id) {
         if (hasChildRooms($id)) {
             $parentInArray = true;
         }
     }
     if ($parentInArray) {
         foreach ($zimmer_ids as $id) {
             if (hasRoomParentRooms($id) && in_array($id, $zimmer_ids)) {
                 //tu nix
             } else {
                 $newArr[] = $id;
             }
         }
         return $newArr;
     }
     return $zimmer_ids;
 }