From 911e30c43cf01aea1cf9a4cca9cebc31fd35c7c8 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 6 Feb 2009 18:58:10 +0000 Subject: [PATCH] Prevent an imported package from changing the a current asset's status from pending to anything else. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/AssetPackage.pm | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 7f9d31183..07efe8830 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -28,6 +28,7 @@ - fixed #9681: Form-related template errors in gallery - fixed #9683: Problem with EMS related workflow - fixed #9611: Transaction Manage View, no go in ie6 (Henry Tang, Long Term Results B.v.) + - fixed #9686: Importing a package twice locks assets forever. 7.6.10 - fixed #9577: WebGUI::Form::Url::getValue returns blank rather than undef for blank fields diff --git a/lib/WebGUI/AssetPackage.pm b/lib/WebGUI/AssetPackage.pm index 07dc7b21a..71717536d 100644 --- a/lib/WebGUI/AssetPackage.pm +++ b/lib/WebGUI/AssetPackage.pm @@ -149,13 +149,20 @@ sub importAssetData { } if ($revisionExists) { # update an existing revision $asset = WebGUI::Asset->new($self->session, $id, $class, $version); + + ##If the existing asset is not committed, do not allow the new package data to + ##change the version control status. + if ( $asset->get('status') eq 'pending' + && $properties{'status'} ne 'pending' ) { + delete $properties{status}; + } $error->info("Updating an existing revision of asset $id"); - $asset->update($data->{properties}); + $asset->update(\%properties); ##Pending assets are assigned a new version tag - if ($data->{properties}->{status} eq 'pending') { + if ($properties{status} eq 'pending') { $self->session->db->write( - 'update assetData set tagId=? where assetId=? and revisionDate='.$data->{properties}->{revisionDate}, - [WebGUI::VersionTag->getWorking($self->session)->getId, $data->{properties}->{assetId}] + 'update assetData set tagId=? where assetId=? and revisionDate=?', + [WebGUI::VersionTag->getWorking($self->session)->getId, $properties{assetId}, $properties{revisionDate},] ); } }