From 33f038359e4720dcf6187ae67bc1e855bf75a540 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 4 Nov 2009 00:39:27 -0600 Subject: [PATCH] Fixed a compatibility problem between WRE and new Spectre code. --- docs/changelog/7.x.x.txt | 1 + lib/Spectre/Workflow.pm | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 4a69e4997..3473994ff 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.8.4 + - Fixed a compatibility problem between WRE and new Spectre code. 7.8.3 - Rewrote Spectre's workflow queues to prevent it from "forgetting" about some workflows. diff --git a/lib/Spectre/Workflow.pm b/lib/Spectre/Workflow.pm index e8aab9caf..20be6644e 100644 --- a/lib/Spectre/Workflow.pm +++ b/lib/Spectre/Workflow.pm @@ -294,18 +294,21 @@ sub getJsonStatus { ); my %output; if ($sitename) { #must have entry for each queue - $output{$sitename} = \%queues; - } - foreach my $instance ($self->getInstances) { - my $site = $instance->{sitename}; - unless (exists $output{$site}) { # must have an entry for each queue in each site - $output{$site} = \%queues; + %output = %queues; + foreach my $instance ($self->getInstances) { + my $queue = ucfirst($instance->{status}); + push @{$output{$queue}}, [$instance->{workingPriority}, $instance->{instanceId}, $instance]; } - my $queue = ucfirst($instance->{status}); - push @{$output{$site}{$queue}}, [$instance->{workingPriority}, $instance->{instanceId}, $instance]; } - if ($sitename) { # single sitename option - %output = %{$output{$sitename}}; + else { + foreach my $instance ($self->getInstances) { + my $site = $instance->{sitename}; + unless (exists $output{$site}) { # must have an entry for each queue in each site + $output{$site} = \%queues; + } + my $queue = ucfirst($instance->{status}); + push @{$output{$site}{$queue}}, $instance; + } } $kernel->call(IKC=>post=>$rsvp, encode_json(\%output)); }