log messages in delete(), write(): added reason and real times. write(): fixed SQL...
authorroot@iserv.zuhause.test <root@iserv.zuhause.test>
Sun, 13 Jul 2008 17:41:49 +0000 (19:41 +0200)
committerroot@iserv.zuhause.test <root@iserv.zuhause.test>
Sun, 13 Jul 2008 17:41:49 +0000 (19:41 +0200)
includes/mod_roomReservationBookingsManager.inc [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 573f340..a7065ed
@@ -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<br />";
+    #####
     
     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)) {
This page took 0.036132 seconds and 4 git commands to generate.