From: root@iserv.zuhause.test Date: Sun, 13 Jul 2008 17:41:49 +0000 (+0200) Subject: log messages in delete(), write(): added reason and real times. write(): fixed SQL... X-Git-Tag: REL_3.0-beta~29 X-Git-Url: https://git.rohieb.name/iserv-mod-room-reservation.git/commitdiff_plain/f3f8fe1912b2ad071f64a8156ddd088b7947cca1 log messages in delete(), write(): added reason and real times. write(): fixed SQL query to fetch the current UID serial value --- diff --git a/includes/mod_roomReservationBookingsManager.inc b/includes/mod_roomReservationBookingsManager.inc old mode 100644 new mode 100755 index 573f340..a7065ed --- a/includes/mod_roomReservationBookingsManager.inc +++ b/includes/mod_roomReservationBookingsManager.inc @@ -170,22 +170,25 @@ class mod_roomReservationBookingsManager { 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())); + $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()); @@ -199,9 +202,12 @@ class mod_roomReservationBookingsManager { // 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"); + ############## + #FIXME remove this + echo "inserted new UID: $nNewUid
"; + ##### rrInsertLog($strLog); @@ -222,11 +228,14 @@ class mod_roomReservationBookingsManager { 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)) {