From f584a12273cda1eb32b88f04f5a4d6a3e44a4dcd Mon Sep 17 00:00:00 2001 From: Yung Han Khoe Date: Thu, 27 Mar 2008 13:47:08 +0000 Subject: [PATCH] fixed: Thingy: field type includes things without fields --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/Thingy.pm | 4 +++- www/extras/wobject/Thingy/thingy.js | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 97d047200..1decff181 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -25,6 +25,7 @@ - fixed: Syndicated Content picks wrong entries for interleaving - fixed: Syndicated Content URLs using macros not updated by caching workflow - fixed: Syndicated Content asset tries too hard to get URLs returning errors + - fixed: Thingy: field type includes things without fields - fix: Users now have permission to add comments - fix: Username for comment poster is now shown correctly - fix: Slideshow now works diff --git a/lib/WebGUI/Asset/Wobject/Thingy.pm b/lib/WebGUI/Asset/Wobject/Thingy.pm index a1484b57c..fc0143a76 100644 --- a/lib/WebGUI/Asset/Wobject/Thingy.pm +++ b/lib/WebGUI/Asset/Wobject/Thingy.pm @@ -372,7 +372,9 @@ sub getEditFieldForm { $fieldTypes{$fieldType} = $form->getName($self->session); } - $things = $self->session->db->read('select thingId, label from Thingy_things where assetId =?',[$self->getId]); + $things = $self->session->db->read('select thingId, Thingy_things.label, count(*) from Thingy_things ' + .'left join Thingy_fields using(thingId) where Thingy_things.assetId = ? and fieldId != "" ' + .'group by thingId',[$self->getId]); while (my $thing = $things->hashRef) { my $fieldType = "otherThing_".$thing->{thingId}; $fieldTypes{$fieldType} = $thing->{label}; diff --git a/www/extras/wobject/Thingy/thingy.js b/www/extras/wobject/Thingy/thingy.js index 9462c1883..02a6315d1 100644 --- a/www/extras/wobject/Thingy/thingy.js +++ b/www/extras/wobject/Thingy/thingy.js @@ -87,7 +87,8 @@ function initOptionalFields(prefix,fieldId) { if (fieldInThing_module_rendered == thingId){ fieldInThing_module.show(); - }else{ + defaultFieldInThing_module.show(); + }else{ var url = location.pathname + "?func=selectFieldInThing;thingId=" + thingId + ";prefix=" +prefix + ";fieldId=" + fieldId; var handleSuccess = function(o){ fieldInThing_module.setBody(o.responseText);