X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttUser.class.php;h=e0bbbe5acf2d82e1b1ae75524850c455a850f13c;hb=2ccee198591bc2ad5d80b5e1076246449d9232c1;hp=420f1caca28b450448c37a39fd759ac42a9e84c0;hpb=24364413261819a3a13dce97639fa6a3f670c4ca;p=timetracker.git diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 420f1cac..e0bbbe5a 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -204,21 +204,27 @@ class ttUser { // isDateLocked checks whether a specifc date is locked for modifications. function isDateLocked($date) { - if ($this->isPluginEnabled('lk') && $this->lock_spec) { + if (!$this->isPluginEnabled('lk')) + return false; // Locking feature is disabled. - // Override. - if ($this->can('override_date_lock')) return false; + if (!$this->lock_spec) + return false; // There is no lock specification. - require_once(LIBRARY_DIR.'/tdcron/class.tdcron.php'); - require_once(LIBRARY_DIR.'/tdcron/class.tdcron.entry.php'); + if (!$this->behalf_id && $this->can('override_own_date_lock')) + return false; // User is working as self and can override own date lock. + + if ($this->behalf_id && $this->can('override_date_lock')) + return false; // User is working on behalf of someone else and can override date lock. + + require_once(LIBRARY_DIR.'/tdcron/class.tdcron.php'); + require_once(LIBRARY_DIR.'/tdcron/class.tdcron.entry.php'); + + // Calculate the last occurrence of a lock. + $last = tdCron::getLastOccurrence($this->lock_spec, time()); + $lockdate = new DateAndTime(DB_DATEFORMAT, strftime('%Y-%m-%d', $last)); + if ($date->before($lockdate)) + return true; - // Calculate the last occurrence of a lock. - $last = tdCron::getLastOccurrence($this->lock_spec, time()); - $lockdate = new DateAndTime(DB_DATEFORMAT, strftime('%Y-%m-%d', $last)); - if ($date->before($lockdate)) { - return true; - } - } return false; }