From bba9788f927acee1a199e3785b9fd8d1d2a75107 Mon Sep 17 00:00:00 2001 From: Frank Dillon Date: Fri, 20 Jun 2008 20:05:45 +0000 Subject: [PATCH] Fixed issue which caused time tracker to complete on post and not allow you to make changes --- lib/WebGUI/Asset/Wobject/TimeTracking.pm | 23 ++++++++++++----------- lib/WebGUI/Form/Checkbox.pm | 2 +- lib/WebGUI/FormValidator.pm | 3 +-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/TimeTracking.pm b/lib/WebGUI/Asset/Wobject/TimeTracking.pm index 730997c84..95e78573c 100644 --- a/lib/WebGUI/Asset/Wobject/TimeTracking.pm +++ b/lib/WebGUI/Asset/Wobject/TimeTracking.pm @@ -251,8 +251,10 @@ sub www_editTimeEntrySave { # Clobber other entries. We can't just do this beforehand # because otherwise setCollateral will fail. - $db->write("DELETE FROM TT_timeEntry WHERE reportId = ? AND entryId NOT IN (".join(', ', ('?') x @entryIds).")", [$reportId, @entryIds]); - + if(scalar(@entryIds) > 0) { + $db->write("DELETE FROM TT_timeEntry WHERE reportId = ? AND entryId NOT IN (".join(', ', ('?') x @entryIds).")", [$reportId, @entryIds]); + } + # Update Project Management App if integrated if ($self->getValue("pmIntegration")) { foreach my $projectId (keys %deltaHours) { @@ -701,12 +703,11 @@ sub www_buildTimeTable { }); my $reportComplete = $report->{reportComplete}; - $viewVar->{'form.isComplete'} = WebGUI::Form::checkbox($session, { + $var->{'form.isComplete'} = WebGUI::Form::checkbox($session, { -name=>"isComplete", -value=>1, -checked=>$reportComplete - }); - + }); #Build Entries Loop my $entries = $db->buildArrayRefOfHashRefs("select * from TT_timeEntry where reportId=? order by taskDate",[$reportId]); my $rowCount = 1; @@ -742,12 +743,12 @@ sub _buildRow { my ($session,$dt,$eh,$form,$db,$user) = $self->getSessionVars("datetime","errorHandler","form","db","user"); my $i18n = WebGUI::International->new($session,'Asset_TimeTracking'); - my $entry = $_[0] || {}; - my $rowCount = $_[1]; - my $daysInWeek = $_[2]; - my $projectList = $_[3]; - my $taskList = $_[4]; - my $var = $_[5] || {}; + my $entry = $_[0] || {}; + my $rowCount = $_[1]; + my $daysInWeek = $_[2]; + my $projectList = $_[3]; + my $taskList = $_[4]; + my $var = $_[5] || {}; my $reportComplete = $_[6] || 0; my $entryId = $entry->{entryId} || "new"; diff --git a/lib/WebGUI/Form/Checkbox.pm b/lib/WebGUI/Form/Checkbox.pm index 2931971a2..28896e3fe 100644 --- a/lib/WebGUI/Form/Checkbox.pm +++ b/lib/WebGUI/Form/Checkbox.pm @@ -64,7 +64,7 @@ sub definition { defaultValue=> 0 }, defaultValue=>{ - defaultValue=>1 + defaultValue=>undef }, }); return $class->SUPER::definition($session, $definition); diff --git a/lib/WebGUI/FormValidator.pm b/lib/WebGUI/FormValidator.pm index 0c03cbe60..06cac1439 100644 --- a/lib/WebGUI/FormValidator.pm +++ b/lib/WebGUI/FormValidator.pm @@ -161,8 +161,7 @@ sub process { die __PACKAGE__."::process requires an href" unless ref $args eq 'HASH'; my ($name, $type, $default, $params) = @$args{qw( name type default params )}; - - $params->{name} = $name; + $params->{name} = $name; if (wantarray) { my @values = $self->$type($params); if (scalar(@values) < 1 && ref $default eq "ARRAY") {