+
+ // insertDurationFromWeekView - inserts a new record in log tables from a week view post.
+ static function insertDurationFromWeekView($fields, $err) {
+ $err->add("Week view is work in progress. Inserting records is not yet implemented. Try again later.");
+ // $row_id, $day_header, $posted_duration, $start_date) { // TODO: potential fields?
+
+ return false; // Not implemented.
+ }
+
+
+ // modifyFromWeekView - modifies a duration of an existing record from a week view post.
+ static function modifyDurationFromWeekView($fields, $err) {
+ $err->add("Week view is work in progress. Editing records is not yet implemented. Try again later.");
+ return false;
+
+ // static function modifyDurationFromWeekView($tt_log_id, $new_duration, $user_id) {
+
+ // TODO: handle overlaps and potential other error conditions such as going beyond 24 hr mark. Other errors?
+ // If the entry has start time, check if new duration goes beyond the existing day.
+
+ // Future entries. Possibly do this check out of this function.
+ /*
+ * // Prohibit creating entries in future.
+ if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) {
+ $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null));
+ if ($selected_date->after($browser_today))
+ $err->add($i18n->getKey('error.future_date'));
+ }
+ */
+
+ /*
+ * // Prohibit creating an overlapping record.
+ if ($err->no()) {
+ if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
+ $err->add($i18n->getKey('error.overlap'));
+ }
+ */
+
+ $mdb2 = getConnection();
+
+ $sql = "update tt_log set duration = '$new_duration' where id = $tt_log_id and user_id = $user_id";
+ $affected = $mdb2->exec($sql);
+ if (is_a($affected, 'PEAR_Error'))
+ return false;
+
+ return true;
+ }