($ob->getUid() == null and !$this->oCfg->userCanBook())) {
throw new AccessException(MOD_ROOM_RESERVATION_ERROR_ACCESS_DENIED);
}
-
+
+ // test if room is whitelisted
+ if(!$this->oCfg->isRoomWhitelisted($ob->getRoom())) {
+ throw new Exception(MOD_ROOM_RESERVATION_ERROR_ROOM_NOT_WHITELISTED);
+ }
+
$strWhere = null;
$strLog = "";
return false;
}
- // @todo Show real times in log, take it from config
+ // Show real times in log, but don't use the user's locale!
+ $oTsB = $this->oCfg->getTimesliceBeginnings(false);
+ $oTsE = $this->oCfg->getTimesliceEndings(false);
// Update or insert?
if($ob->getUid() == null) {
// No UID yet, insert new booking
- $strLog = sprintf("Raum „%s“ am %s von %s bis %s gebucht",
- $ob->getRoom(), date("d\.m\.Y", $ob->getDate()),
- intval($ob->getTsFirst()), intval($ob->getTsLast()));
+ // @todo write interval and user if interval > 0
+ $strLog = sprintf("Raum „%s“ am %s von %s bis %s gebucht ".
+ "(Begründung: %s)", $ob->getRoom(), date("d\.m\.Y", $ob->getDate()),
+ gmdate("G:i", $oTsB[$ob->getTsFirst()]), gmdate("G:i",
+ $oTsE[$ob->getTsLast()]), $ob->getReason());
} else {
// Update an existing booking
// @todo write old and new times into log
$strWhere = "rs_uid = ".qdb(intval($ob->getUid()));
$strLog = sprintf("Buchung im Raum „%s“ auf %s von %s bis %s ".
"geändert (Begründung: „%s“)", $ob->getRoom(), date("d\.m\.Y",
- $ob->getDate()), intval($ob->getTsFirst()),
- intval($ob->getTsLast()), $ob->getReason());
+ $ob->getDate()), gmdate("G:i", $oTsB[$ob->getTsFirst()]), gmdate("G:i",
+ $oTsE[$ob->getTsLast()]), $ob->getReason());
}
$aPut["rrb_room"] = $ob->getRoom();
$aPut["rrb_date"] = date("Y\-m\-d", $ob->getDate());
// message if neccessary
db_store("mod_roomreservation_bookings", $aPut, $strWhere);
- $hQuery = db_query("SELECT currval('mod_roomreservation_bookings_rrb_uid_seq') ".
- "FROM mod_roomreservation_bookings;");
+ $hQuery = db_query("SELECT currval('mod_roomreservation_bookings_rrb_uid_seq');");
$nNewUid = pg_fetch_result($hQuery, 0, "currval");
rrInsertLog($strLog);
return false;
}
- // @todo: Show real times in log, take it from config
+ // Don't use the user's locale!
+ $oTsB = $this->oCfg->getTimesliceBeginnings(false);
+ $oTsE = $this->oCfg->getTimesliceEndings(false);
$ob = $this->getBookingByUid($nUid);
$strLog = sprintf("Buchung in Raum „%s“ am %s von %s bis %s ".
- "gelöscht", $ob->getRoom(), date("d\.m\.Y", $ob->getDate()),
- $ob->getTsFirst(), $ob->getTsLast());
+ "gelöscht (Begründung war: %s)", $ob->getRoom(), date("d\.m\.Y",
+ $ob->getDate()), gmdate("G:i", $oTsB[$ob->getTsFirst()]), gmdate("G:i",
+ $oTsE[$ob->getTsLast()]), $ob->getReason());
// Delete it from the database
if(!db_query("DELETE FROM mod_roomreservation_bookings WHERE ".
"rrb_uid = $1;", $nUid)) {