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 commit is contained in:
Colin Kuskie 2011-03-07 08:35:15 -08:00
parent 8a527f830c
commit 2c0334d709
2 changed files with 4 additions and 7 deletions

View file

@ -1367,18 +1367,14 @@ 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 ".$data->{properties}{title});
$error->info("Importing Things for Thingy ".$self->get('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 ($assetExists && $thingIdExists){
if ($thingIdExists){
# update existing thing
$error->info("Updating Thing, label: ".$thing->{label}.", id: ".$thing->{thingId});
$self->setCollateral("Thingy_things","thingId",$thing,0,0);
@ -1402,7 +1398,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 ($assetExists && $fieldIdExists){
if ($fieldIdExists){
# update existing field
$error->info("Updating Field, label: ".$field->{label}.", id: ".$field->{fieldId}.",seq :"
.$field->{sequenceNumber});