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 2c0334d709.
This commit is contained in:
Colin Kuskie 2011-03-07 08:50:24 -08:00
parent 2c0334d709
commit 78d27ad031
2 changed files with 7 additions and 4 deletions

View file

@ -8,7 +8,6 @@
- fixed #12061: TimeField form plugin doesn't work with all names. - fixed #12061: TimeField form plugin doesn't work with all names.
- fixed #12055: Thingy pagination breaks after editing data - fixed #12055: Thingy pagination breaks after editing data
- fixed #12066: Thingy CSV export overrides ExportHTML - fixed #12066: Thingy CSV export overrides ExportHTML
- fixed #12060: Thingy: importAssetCollateralData and asset checking
7.10.10 7.10.10
- fixed #12035: Story Manager - make keywords from Story view work - fixed #12035: Story Manager - make keywords from Story view work

View file

@ -1367,14 +1367,18 @@ sub importAssetCollateralData {
my $session = $self->session; my $session = $self->session;
my $error = $session->errorHandler; my $error = $session->errorHandler;
my $data = shift; 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; my @importThings;
foreach my $thing (@{$data->{things}}) { foreach my $thing (@{$data->{things}}) {
push(@importThings,$thing->{thingId}); push(@importThings,$thing->{thingId});
my ($thingIdExists) = $session->db->quickArray("select thingId from Thingy_things where thingId = ?", my ($thingIdExists) = $session->db->quickArray("select thingId from Thingy_things where thingId = ?",
[$thing->{thingId}]); [$thing->{thingId}]);
if ($thingIdExists){ if ($assetExists && $thingIdExists){
# update existing thing # update existing thing
$error->info("Updating Thing, label: ".$thing->{label}.", id: ".$thing->{thingId}); $error->info("Updating Thing, label: ".$thing->{label}.", id: ".$thing->{thingId});
$self->setCollateral("Thingy_things","thingId",$thing,0,0); $self->setCollateral("Thingy_things","thingId",$thing,0,0);
@ -1398,7 +1402,7 @@ sub importAssetCollateralData {
push(@importFields,$field->{fieldId}); push(@importFields,$field->{fieldId});
my $dbDataType = $self->_getDbDataType($field->{fieldType}); my $dbDataType = $self->_getDbDataType($field->{fieldType});
my ($fieldIdExists) = $session->db->quickArray("select fieldId from Thingy_fields where fieldId = ? and thingId = ? ",[$field->{fieldId},$field->{thingId}]); 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 # update existing field
$error->info("Updating Field, label: ".$field->{label}.", id: ".$field->{fieldId}.",seq :" $error->info("Updating Field, label: ".$field->{label}.", id: ".$field->{fieldId}.",seq :"
.$field->{sequenceNumber}); .$field->{sequenceNumber});