From fe5bc93a5241bb1a8c43a85d87425d9935854110 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Wed, 2 May 2007 20:05:31 +0000 Subject: [PATCH] Added an error message to SQLForm if we can't find the privileges of the database link fix: Sometimes the error message for the Calendar Update Feeds is part of the content response. fix: Serial workflows no longer get held up in the queue --- docs/changelog/7.x.x.txt | 3 +++ lib/WebGUI/Asset/Wobject/Calendar.pm | 2 +- lib/WebGUI/Asset/Wobject/SQLForm.pm | 8 ++++++++ .../Workflow/Activity/CalendarUpdateFeeds.pm | 18 +++++++----------- lib/WebGUI/Workflow/Instance.pm | 7 +++++-- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 33eeeecc7..3c7d9c490 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -35,6 +35,9 @@ http://www.plainblack.com/bugs/tracker/help-link-broken-for-navigation-template - fix: HttpProxy no longer processes macros in proxied content http://www.plainblack.com/bugs/tracker/weird-characters-in-webgui.log-caused-by-http-proxy + - Added an error message to SQLForm if we can't find any permissions for the + database link. + - fix: Calendar events do not show up on the last day of the month. 7.3.15 - Added more documentation to WebGUI.pm diff --git a/lib/WebGUI/Asset/Wobject/Calendar.pm b/lib/WebGUI/Asset/Wobject/Calendar.pm index 16d01bb8f..4a4286d07 100644 --- a/lib/WebGUI/Asset/Wobject/Calendar.pm +++ b/lib/WebGUI/Asset/Wobject/Calendar.pm @@ -1120,7 +1120,7 @@ sub viewMonth { my $dt = WebGUI::DateTime->new($self->session, $params->{start}); $dt->truncate( to => "month"); my $start = $dt->toMysql; - my $dtEnd = $dt->clone->add(months => 1)->add(seconds => -1); + my $dtEnd = $dt->clone->add(months => 1); my $end = $dtEnd->toMysql; my @events diff --git a/lib/WebGUI/Asset/Wobject/SQLForm.pm b/lib/WebGUI/Asset/Wobject/SQLForm.pm index 5f9248220..f9446e86e 100644 --- a/lib/WebGUI/Asset/Wobject/SQLForm.pm +++ b/lib/WebGUI/Asset/Wobject/SQLForm.pm @@ -662,6 +662,14 @@ sub _databaseLinkHasPrivileges { } } + # Check if we found any privileges at all + if (!@privileges) { + $self->session->errorHandler->warn( + "SQLForm: Could not find SQL privileges or no privileges on database '$databaseName' for user '".$dbLink->get->{username}."' with database link ID '".$dbLink->getId."' using DSN '".$dbLink->get->{dsn}."'" + ); + return 0; + } + # Check if all required privs are present. return 1 if (isIn('ALL PRIVILEGES', @privileges)); diff --git a/lib/WebGUI/Workflow/Activity/CalendarUpdateFeeds.pm b/lib/WebGUI/Workflow/Activity/CalendarUpdateFeeds.pm index 8ab516f6f..ccbced279 100755 --- a/lib/WebGUI/Workflow/Activity/CalendarUpdateFeeds.pm +++ b/lib/WebGUI/Workflow/Activity/CalendarUpdateFeeds.pm @@ -85,8 +85,7 @@ sub execute { my $ua = LWP::UserAgent->new(agent => "WebGUI"); my $dt = WebGUI::DateTime->new($session, time)->toMysql; - my $sth = $self->session->db->prepare("select * from Calendar_feeds"); - $sth->execute(); + my $sth = $self->session->db->read("select * from Calendar_feeds"); #use Data::Dumper; @@ -113,21 +112,21 @@ sub execute { # Get the feed my $response = $ua->get($feed->{url}); - + if ($response->is_success) - { - my $data = $response->content; + { + my $data = $response->content; # If doesn't start with BEGIN:VCALENDAR then error unless ($data =~ /^BEGIN:VCALENDAR/i) { - # Update the result and last updated fields + # Update the result and last updated fields $self->session->db->write( "update Calendar_feeds set lastResult=?,lastUpdated=? where feedId=?", ["Not an iCalendar feed",$dt,$feed->{feedId}]); next FEED; } - + my $active = 0; # Parser on/off my %current_event = (); @@ -165,7 +164,6 @@ sub execute { # Flush old entry # KEY;ATTRIBUTE=VALUE;ATTRIBUTE=VALUE:KEYVALUE my ($key_attrs,$value) = split /:/,$current_entry,2; - my @attrs = split /;/, $key_attrs; my $key = shift @attrs; my %attrs; @@ -377,12 +375,10 @@ sub execute { { # Update the result and last updated fields $self->session->db->write("update Calendar_feeds set lastResult=?,lastUpdated=? where feedId=?", - [$response->message,$dt,$feed->{feedId}]); + [($response->message || $response->content),$dt,$feed->{feedId}]); } } - $sth->finish; - return $self->COMPLETE; } diff --git a/lib/WebGUI/Workflow/Instance.pm b/lib/WebGUI/Workflow/Instance.pm index 8d5bde338..f1d008083 100644 --- a/lib/WebGUI/Workflow/Instance.pm +++ b/lib/WebGUI/Workflow/Instance.pm @@ -273,8 +273,11 @@ sub run { return "disabled"; } if ($workflow->get("isSerial")) { - my ($firstId) = $self->session->db->quickArray("select workflowId from WorkflowInstance order by runningSince"); - if ($workflow->getId ne $firstId) { # must wait for currently running instance to complete + my ($firstId) = $self->session->db->quickArray( + "select instanceId from WorkflowInstance where workflowId=? order by runningSince", + [$workflow->getId] + ); + if ($self->getId ne $firstId) { # must wait for currently running instance to complete $self->set({lastStatus=>"waiting", notifySpectre=>0}); return "waiting"; }