protected function _init() { $this->_period = RM_Reservation_Period::getDefault(); if ($this->_criteria->start_datetime && $this->_criteria->end_datetime) { $this->_isDefaultPeriod = false; $this->_period = new RM_Reservation_Period(new RM_Date(strtotime($this->_criteria->start_datetime)), new RM_Date(strtotime($this->_criteria->end_datetime))); } $this->_persons = new RM_Reservation_Persons(array("adults" => $this->_criteria->adults, "children" => $this->_criteria->children, "infants" => $this->_criteria->infants)); $config = new RM_Config(); $this->_showPriceWithTax = (bool) $config->getValue('rm_config_prices_with_tax'); if ($this->_showPriceWithTax) { $this->_taxSystem = RM_Environment::getInstance()->getTaxSystem(); } }
/** * Get all current prices for a unit. * * @param $unit RM_Unit_Row * @return Zend_Db_Table_Rowset with results */ public function getCurrent($unit) { $period = RM_Reservation_Period::getDefault(); // we use default period $sql = "\n \t\tSELECT\n \t\t\t*\n \t\tFROM\n \t\t\t{$this->_name}\n \t\tWHERE\n \t\t\tunit_id='{$unit->id}'\n \t\t\tAND UNIX_TIMESTAMP(end_datetime) >= UNIX_TIMESTAMP('" . $period->getStart()->toMySQL() . "')\n AND UNIX_TIMESTAMP(start_datetime) <= UNIX_TIMESTAMP('" . $period->getEnd()->toMySQL() . "')\n "; return $this->_getBySQL($sql); }