[otrs-cvs] TimeAccounting/Kernel/Output/HTML ToolBarIncompleteWorkingDays.pm, 1.3, 1.4
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/TimeAccounting/Kernel/Output/HTML
In directory lancelot:/tmp/cvs-serv9351/Kernel/Output/HTML
Modified Files:
ToolBarIncompleteWorkingDays.pm
Log Message:
Improved output of toolbar icon.
Author: mh
Index: ToolBarIncompleteWorkingDays.pm
===================================================================
RCS file: /home/cvs/TimeAccounting/Kernel/Output/HTML/ToolBarIncompleteWorkingDays.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -2 -u -d -r1.3 -r1.4
--- ToolBarIncompleteWorkingDays.pm 20 Jan 2011 13:27:39 -0000 1.3
+++ ToolBarIncompleteWorkingDays.pm 6 Dec 2012 08:44:49 -0000 1.4
@@ -1,5 +1,5 @@
# --
# Kernel/Output/HTML/ToolBarIncompleteWorkingDays.pm
-# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id$
@@ -49,4 +49,7 @@
my $Group = 'time_accounting';
+ # do not show icon if frontend module is not registered
+ return if !$Self->{ConfigObject}->Get('Frontend::Module')->{$Action};
+
# get the group id
my $GroupID = $Self->{GroupObject}->GroupLookup( Group => $Group );
@@ -78,31 +81,46 @@
return if !$UserCurrentPeriod{ $Self->{UserID} };
- # do not show icon if frontend module is not registered
- return if !$Self->{ConfigObject}->Get('Frontend::Module')->{$Action};
-
# get the number of incomplete working days
my $Count = 0;
my %IncompleteWorkingDays = $Self->{TimeAccountingObject}->WorkingUnitsCompletnessCheck();
+ YEARID:
for my $YearID ( sort keys %{ $IncompleteWorkingDays{Incomplete} } ) {
- for my $MonthID ( sort keys %{ $IncompleteWorkingDays{Incomplete}{$YearID} } ) {
- for my $DayID (
- sort keys %{ $IncompleteWorkingDays{Incomplete}{$YearID}{$MonthID} }
- )
- {
- $Count++;
- }
+
+ next YEARID if !$YearID;
+ next YEARID if !$IncompleteWorkingDays{Incomplete}{$YearID};
+ next YEARID if ref $IncompleteWorkingDays{Incomplete}{$YearID} ne 'HASH';
+
+ # extract year
+ my %Year = %{ $IncompleteWorkingDays{Incomplete}{$YearID} };
+
+ MONTH:
+ for my $MonthID ( sort keys %Year ) {
+
+ next MONTH if !$MonthID;
+ next MONTH if !$Year{$MonthID};
+ next MONTH if ref $Year{$MonthID} ne 'HASH';
+
+ # extract month
+ my %Month = $Year{$MonthID};
+
+ $Count += scalar keys %Month;
}
}
+ # remove current day because it makes no sense to show the current day as incompleted
+ if ( $Count > 0 ) {
+ $Count--;
+ }
+
# get ToolBar object parameters
my $Class = $Param{Config}->{CssClass};
my $Text = $Self->{LayoutObject}->{LanguageObject}->Get('Incomplete working days');
+ my $URL = $Self->{LayoutObject}->{Baselink};
- # set ToolBar object
- my $URL = $Self->{LayoutObject}->{Baselink};
- my %Return;
- if ($Count) {
- $Return{'1000810'} = {
+ return () if !$Count;
+
+ my %Return = (
+ 1000810 => {
Block => 'ToolBarItem',
Description => $Text,
@@ -111,6 +129,7 @@
Link => $URL . 'Action=' . $Action . ';Subaction=' . $Subaction,
AccessKey => '',
- };
- }
+ }
+ );
+
return %Return;
}
---------------------------------------------------------------------
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