diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt
index ae8f095ce..4fecfc73f 100644
--- a/docs/changelog/7.x.x.txt
+++ b/docs/changelog/7.x.x.txt
@@ -21,6 +21,8 @@
- fixed: Tree Navigation menu shows level numbers
- fixed: loginBox macro no longer can return user to "logout" page, logging them out
- fixed: Template Assets broken
+ - fixed: edit operation sql error, Thingy (Yung Han Khoe)
+ - fixed: Thingy: default thing property hidden (Yung Han Khoe)
7.5.20
- fixed: DataForm acknowledgement screen shows incorrect value for Date/Time fields
diff --git a/lib/WebGUI/Asset/Wobject/Thingy.pm b/lib/WebGUI/Asset/Wobject/Thingy.pm
index 9290617ac..c54e79a6f 100644
--- a/lib/WebGUI/Asset/Wobject/Thingy.pm
+++ b/lib/WebGUI/Asset/Wobject/Thingy.pm
@@ -585,7 +585,7 @@ sub getEditForm {
my $things = $self->session->db->buildHashRef('select thingId, label from Thingy_things where assetId = ?',[$self->get("assetId")]);
- unless (scalar(keys(%{$things}))) {
+ if (scalar(keys(%{$things}))) {
$tabform->getTab("display")->selectBox(
-name=>"defaultThingId",
-value=>$self->get("defaultThingId"),
@@ -2419,13 +2419,19 @@ sequenceNumber');
});
}
}
-
- $query = "select thingDataId, ";
- $query .= join(", ",map {$dbh->quote_identifier('field_'.$_->{fieldId})} @displayInSearchFields);
- $query .= " from ".$dbh->quote_identifier("Thingy_".$thingId);
- $query .= " where ".join(" and ",@constraints) if (scalar(@constraints) > 0);
- if ($orderBy){
- $query .= " order by ".$dbh->quote_identifier("field_".$orderBy);
+
+ if (scalar(@displayInSearchFields)){
+ $query = "select thingDataId, ";
+ $query .= join(", ",map {$dbh->quote_identifier('field_'.$_->{fieldId})} @displayInSearchFields);
+ $query .= " from ".$dbh->quote_identifier("Thingy_".$thingId);
+ $query .= " where ".join(" and ",@constraints) if (scalar(@constraints) > 0);
+ if ($orderBy){
+ $query .= " order by ".$dbh->quote_identifier("field_".$orderBy);
+ }
+ }
+ else{
+ $self->session->errorHandler->warn("The default Thing has no fields selected to display in the search.");
+ return undef;
}
# store query in cache for thirty minutes
diff --git a/www/extras/wobject/Thingy/thingy.js b/www/extras/wobject/Thingy/thingy.js
index 87f9a6df2..c91ba32c9 100644
--- a/www/extras/wobject/Thingy/thingy.js
+++ b/www/extras/wobject/Thingy/thingy.js
@@ -210,6 +210,7 @@ function initAddFieldDialog() {
// Add table row to fields on search tab
var search_fields_table = new YAHOO.util.Element('search_fields_table');
+ var search_fields_table_rows = search_fields_table.getElementsByTagName("tr");
var search_tr = document.createElement('tr');
search_tr.id = "search_tr_"+listItemId;
search_fields_table.appendChild(search_tr);
@@ -229,7 +230,12 @@ function initAddFieldDialog() {
var searchIn_td = document.createElement('td');
searchIn_td.id = "search_searchIn_"+listItemId;
searchIn_td.className = 'tableData';
- searchIn_td.innerHTML = "";
+ // only the first field should be checked by default
+ if (search_fields_table_rows.length == 2){
+ searchIn_td.innerHTML = "";
+ }else{
+ searchIn_td.innerHTML = "";
+ }
search_tr.appendChild(searchIn_td);
var sortBy_td = document.createElement('td');