From 16c122a550ac419e1efcc5d436e21a16a54d865e Mon Sep 17 00:00:00 2001 From: Patrick Donelan Date: Mon, 16 Feb 2009 01:21:47 +0000 Subject: [PATCH] Fixed regression in ResponseJSON's sectionId, questionId and answerId methods --- lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm b/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm index a5f8a2f2d..ab56e6091 100644 --- a/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm +++ b/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm @@ -957,7 +957,10 @@ A Section Id is identical to a Section index. This method is only present for co sub sectionId { my $self = shift; - my ($sIndex) = validate_pos(@_, { type => SCALAR } ); + my ($sIndex) = validate_pos(@_, { type => SCALAR | UNDEF } ); + + return if !defined $sIndex; + return $sIndex; } @@ -971,7 +974,10 @@ The id is constructed by hyphenating the Section index and Question index. sub questionId { my $self = shift; - my ($sIndex, $qIndex) = validate_pos(@_, { type => SCALAR }, { type => SCALAR } ); + my ($sIndex, $qIndex) = validate_pos(@_, { type => SCALAR | UNDEF }, { type => SCALAR | UNDEF } ); + + return if !defined $sIndex || !defined $qIndex; + return "$sIndex-$qIndex"; } @@ -985,7 +991,10 @@ The id is constructed by hyphenating all three indices. sub answerId { my $self = shift; - my ($sIndex, $qIndex, $aIndex) = validate_pos(@_, { type => SCALAR }, { type => SCALAR }, { type => SCALAR } ); + my ($sIndex, $qIndex, $aIndex) = validate_pos(@_, { type => SCALAR | UNDEF }, { type => SCALAR | UNDEF }, { type => SCALAR | UNDEF } ); + + return if !defined $sIndex || !defined $qIndex || !defined $aIndex; + return "$sIndex-$qIndex-$aIndex"; }