[otrs-cvs] otrs/Kernel/Output/HTML DashboardUserOnline.pm, 1.26, 1.27

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/Kernel/Output/HTML
In directory lancelot:/tmp/cvs-serv12812/Kernel/Output/HTML

Modified Files:
	DashboardUserOnline.pm 
Log Message:
Fixed problem with out of office feature.

Author: mh

Index: DashboardUserOnline.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Output/HTML/DashboardUserOnline.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -2 -u -d -r1.26 -r1.27
--- DashboardUserOnline.pm	20 Nov 2012 14:58:17 -0000	1.26
+++ DashboardUserOnline.pm	22 Nov 2012 23:12:43 -0000	1.27
@@ -122,4 +122,7 @@
     my $SortBy      = $Self->{Config}->{SortBy}      || 'UserLastname';
 
+    # get current timestamp
+    my $Time = $Self->{TimeObject}->SystemTime();
+
     # check cache
     my $Online = $Self->{CacheObject}->Get(
@@ -179,7 +182,5 @@
             # check last request time / idle time out
             next SESSIONID if !$Data{UserLastRequest};
-            next SESSIONID
-                if $Data{UserLastRequest} + ( $IdleMinutes * 60 )
-                < $Self->{TimeObject}->SystemTime();
+            next SESSIONID if $Data{UserLastRequest} + ( $IdleMinutes * 60 ) < $Time;
 
             # remember user and data
@@ -254,7 +255,10 @@
         last USERID if $Count >= ( $Self->{StartHit} + $Self->{PageShown} );
 
+        # extract user data
+        my $UserData = $OnlineData{$UserID};
+
         $Self->{LayoutObject}->Block(
             Name => 'ContentSmallUserOnlineRow',
-            Data => $OnlineData{$UserID},
+            Data => $UserData,
         );
 
@@ -262,14 +266,32 @@
             $Self->{LayoutObject}->Block(
                 Name => 'ContentSmallUserOnlineRowEmail',
-                Data => $OnlineData{$UserID},
+                Data => $UserData,
             );
         }
 
-        if ( $OnlineData{$UserID}->{OutOfOffice} ) {
+        next USERID if !$UserData->{OutOfOffice};
 
-            $Self->{LayoutObject}->Block(
-                Name => 'ContentSmallUserOnlineRowOutOfOffice',
-            );
-        }
+        my $Start = sprintf(
+            "%04d-%02d-%02d 00:00:00",
+            $UserData->{OutOfOfficeStartYear}, $UserData->{OutOfOfficeStartMonth},
+            $UserData->{OutOfOfficeStartDay}
+        );
+        my $TimeStart = $Self->{TimeObject}->TimeStamp2SystemTime(
+            String => $Start,
+        );
+        my $End = sprintf(
+            "%04d-%02d-%02d 23:59:59",
+            $UserData->{OutOfOfficeEndYear}, $UserData->{OutOfOfficeEndMonth},
+            $UserData->{OutOfOfficeEndDay}
+        );
+        my $TimeEnd = $Self->{TimeObject}->TimeStamp2SystemTime(
+            String => $End,
+        );
+
+        next USERID if $TimeStart > $Time || $TimeEnd < $Time;
+
+        $Self->{LayoutObject}->Block(
+            Name => 'ContentSmallUserOnlineRowOutOfOffice',
+        );
     }
 
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.