From 1651cbd3fb21fef56127feee060d75ac4323eb99 Mon Sep 17 00:00:00 2001 From: Chris Nehren Date: Sat, 5 Jan 2008 00:39:14 +0000 Subject: [PATCH] Add a check in update() for whether isExportable exists, preventing problems with users upgrading from previous versions of WebGUI. Tested in an upgrade from 7.4.0 -> SVN head (i.e., 7.5.0). --- lib/WebGUI/Asset.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 583e29b16..d88eaf6ad 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -2159,6 +2159,17 @@ sub update { # skip a property if it has the display only flag set next if ($definition->{properties}{$property}{displayOnly}); + # if this is the new-to-7.5 isExportable field, check if the + # database field for it exists. if not, setting it will break, so + # skip it. this facilitates updating from previous versions. + if($property eq 'isExportable') { + my $db = $self->session->db; + my $assetDataDescription = $db->buildHashRef('describe assetData'); + unless(grep { $_ =~ /^isExportable/ } keys %{$assetDataDescription}) { + next; + } + } + # use the update value my $value = $properties->{$property};