+ // ovelapsWithNewDuration - determines if an already existing tt_log record will overlap others
+ // if we were to change its duration to a new value.
+ //
+ // Another error condition we check for is whether new duration puts the existing record beyond the 24:00 day boundary.
+ static function ovelapsWithNewDuration($tt_log_id, $new_duration, $err) {
+ global $i18n;
+ $mdb2 = getConnection();
+
+ // Determine if we have start time in record, as checking does not makes sense otherwise.
+ $sql = "select start from tt_log where id = $tt_log_id";
+ $res = $mdb2->query($sql);
+ if (!is_a($res, 'PEAR_Error')) {
+ if (!$res->numRows()) {
+ $err->add($i18n->getKey('error.db')); // This is not expected.
+ return true;
+ }
+ $val = $res->fetchRow();
+ if (!$val['start'])
+ return false; // No start time, therefore no overlap.
+ }
+
+ // TODO: Determine finish based on the existing record start and $new_duration.
+ // By probably using PHP time functions or toMinutes().
+
+ // Then check whether new duration puts the existing records beyond 24:00 boundary.
+ // and call the existing overlaps function.
+
+ // For now return an error, until we implement the above.
+
+ $err->add("Week view is work in progress. Editing records with existing start times is currently not supported in week view. Try day view instead.");
+ return true;
+ }
+