[otrs-cvs] TimeAccounting/Kernel/System TimeAccounting.pm, 1.62, 1.63
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/TimeAccounting/Kernel/System
In directory lancelot:/tmp/cvs-serv2709/Kernel/System
Modified Files:
TimeAccounting.pm
Log Message:
Added check to see if user actually exists.
Author: mb
Index: TimeAccounting.pm
===================================================================
RCS file: /home/cvs/TimeAccounting/Kernel/System/TimeAccounting.pm,v
retrieving revision 1.62
retrieving revision 1.63
diff -2 -u -d -r1.62 -r1.63
--- TimeAccounting.pm 10 Sep 2012 09:48:51 -0000 1.62
+++ TimeAccounting.pm 21 Nov 2012 14:53:53 -0000 1.63
@@ -878,5 +878,5 @@
# check needed stuff
if ( !$Param{UserID} ) {
- $Self->{LogObject}->Log( Priority => 'error', Message => 'Need ID!' );
+ $Self->{LogObject}->Log( Priority => 'error', Message => 'Need UserID!' );
return;
}
@@ -910,6 +910,18 @@
my ( $Self, %Param ) = @_;
- # delete cache
- delete $Self->{'Cache::UserCurrentPeriodGet'};
+ # check needed stuff
+ for my $Needed (qw (UserID Period)) {
+ if ( !$Param{$Needed} ) {
+ $Self->{LogObject}->Log( Priority => 'error', Message => "Need $Needed" );
+ return;
+ }
+ }
+
+ # check if user exists
+ if ( !$Self->{UserObject}->UserLookup( UserID => $Param{UserID} ) ) {
+ $Self->{LogObject}
+ ->Log( Priority => 'error', Message => "UserID $Param{UserID} does not exist!" );
+ return;
+ }
$Param{WeeklyHours} = $Self->{ConfigObject}->Get('TimeAccounting::DefaultUserWeeklyHours')
@@ -925,15 +937,10 @@
|| 'Put your description here.';
- # db quote
- for my $Parameter ( keys %Param ) {
- $Param{$Parameter} = $Self->{DBObject}->Quote( $Param{$Parameter} );
- if ( !defined( $Param{$Parameter} ) ) {
- $Param{$Parameter} = '';
- }
- }
-
$Param{DateStart} .= ' 00:00:00';
$Param{DateEnd} .= ' 00:00:00';
+ # delete cache
+ delete $Self->{'Cache::UserCurrentPeriodGet'};
+
# db insert
return if !$Self->{DBObject}->Do(
---------------------------------------------------------------------
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