public function CheckBookingPossibility(Apartment $app, $pax) { /* Avalibility check. Expecting TRUE or FALSE */ $avalibility = $app->CheckBookingsInPeriod($this->date_from, $this->date_to); /* Are dates valid for individual apartment ? */ $dates = true; /* Minimum or maximum pax for individual apartment or ... ? */ $pax_valid = false; if ($pax >= 1 && $pax <= $app->getMaxPax()) { $pax_valid = true; } /* Are there periods for dates... Can we get real price ? */ $price = false; if (Booking::CalculatePrice($app, $this->date_from, $this->date_to) > 0) { $price = true; } if ($dates === true && $avalibility === false && $pax_valid === true && $price === true) { return $this; } else { return false; } }