From 78d27ad03171fd8dd96134d742ffa8c131375683 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 7 Mar 2011 08:50:24 -0800 Subject: [PATCH] Revert "Thingy asset collateral import does not need to check for existance of the asset. If the asset doesn't exist, package import will create it or it will die. Fixes bug #12060." This reverts commit 2c0334d709faf51ab65d29add6c554ae333be459. --- docs/changelog/7.x.x.txt | 1 - lib/WebGUI/Asset/Wobject/Thingy.pm | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 6a773be45..a1fc5bbd5 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -8,7 +8,6 @@ - fixed #12061: TimeField form plugin doesn't work with all names. - fixed #12055: Thingy pagination breaks after editing data - fixed #12066: Thingy CSV export overrides ExportHTML - - fixed #12060: Thingy: importAssetCollateralData and asset checking 7.10.10 - fixed #12035: Story Manager - make keywords from Story view work diff --git a/lib/WebGUI/Asset/Wobject/Thingy.pm b/lib/WebGUI/Asset/Wobject/Thingy.pm index 27a896b4c..0e9041072 100644 --- a/lib/WebGUI/Asset/Wobject/Thingy.pm +++ b/lib/WebGUI/Asset/Wobject/Thingy.pm @@ -1367,14 +1367,18 @@ sub importAssetCollateralData { my $session = $self->session; my $error = $session->errorHandler; my $data = shift; + my $id = $data->{properties}{assetId}; + my $class = $data->{properties}{className}; + my $version = $data->{properties}{revisionDate}; + my $assetExists = WebGUI::Asset->assetExists($self->session, $id, $class, $version); - $error->info("Importing Things for Thingy ".$self->get('title')); + $error->info("Importing Things for Thingy ".$data->{properties}{title}); my @importThings; foreach my $thing (@{$data->{things}}) { push(@importThings,$thing->{thingId}); my ($thingIdExists) = $session->db->quickArray("select thingId from Thingy_things where thingId = ?", [$thing->{thingId}]); - if ($thingIdExists){ + if ($assetExists && $thingIdExists){ # update existing thing $error->info("Updating Thing, label: ".$thing->{label}.", id: ".$thing->{thingId}); $self->setCollateral("Thingy_things","thingId",$thing,0,0); @@ -1398,7 +1402,7 @@ sub importAssetCollateralData { push(@importFields,$field->{fieldId}); my $dbDataType = $self->_getDbDataType($field->{fieldType}); my ($fieldIdExists) = $session->db->quickArray("select fieldId from Thingy_fields where fieldId = ? and thingId = ? ",[$field->{fieldId},$field->{thingId}]); - if ($fieldIdExists){ + if ($assetExists && $fieldIdExists){ # update existing field $error->info("Updating Field, label: ".$field->{label}.", id: ".$field->{fieldId}.",seq :" .$field->{sequenceNumber});