From e594cb3d6c4b6163ddf0df03bc0f73b63a96459a Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 15 Feb 2007 23:27:09 +0000 Subject: [PATCH] - Fixed a problem where you couldn't upgrade directly to 7.3.9 from versions earlier than 7.3.8. --- docs/changelog/7.x.x.txt | 2 ++ lib/WebGUI/Asset.pm | 5 ---- lib/WebGUI/Asset/Post.pm | 2 +- lib/WebGUI/Asset/Wobject/SQLForm.pm | 2 +- lib/WebGUI/AssetVersioning.pm | 38 +++++++++++++++++++++++------ 5 files changed, 35 insertions(+), 14 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 5f1d682b9..80cb5c8e0 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -4,6 +4,8 @@ DateTime. - fix: SQL Report: Paginate After - fix: Incomplete asset cause manage Trash to fail + - Fixed a problem where you couldn't upgrade directly to 7.3.9 from versions + earlier than 7.3.8. - fix: Rich Text Editor - Add Asset Tree Link doesn't work with images 7.3.9 diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index b4c5d105c..a3499462d 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -337,11 +337,6 @@ sub definition { fieldType=>'hidden', defaultValue=>0 }, - skipNotification=>{ - noFormPost=>1, - fieldType=>'hidden', - defaultValue=>0 - }, ); push(@{$definition}, { assetName=>$i18n->get("asset"), diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 641ab38ab..34086af44 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -143,7 +143,7 @@ sub commit { my $self = shift; $self->SUPER::commit; - $self->notifySubscribers unless ($self->get("skipNotification")); + $self->notifySubscribers unless ($self->shouldSkipNotification); if ($self->isNew) { if ($self->session->setting->get("useKarma") && $self->getThread->getParent->get("karmaPerPost")) { diff --git a/lib/WebGUI/Asset/Wobject/SQLForm.pm b/lib/WebGUI/Asset/Wobject/SQLForm.pm index 948fe2697..398afe459 100644 --- a/lib/WebGUI/Asset/Wobject/SQLForm.pm +++ b/lib/WebGUI/Asset/Wobject/SQLForm.pm @@ -958,7 +958,7 @@ sub definition { push(@{$definition}, { tableName=>'SQLForm', className=>'WebGUI::Asset::Wobject::SQLForm', - name=>$i18n->get('assetName'), + assetName=>$i18n->get('assetName'), icon=>'sqlform.gif', properties=>{ formId => { diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm index cd79cff55..16ac0812f 100644 --- a/lib/WebGUI/AssetVersioning.pm +++ b/lib/WebGUI/AssetVersioning.pm @@ -84,10 +84,6 @@ sub addRevision { my $autoCommitId = $self->getAutoCommitWorkflowId() unless ($options->{skipAutoCommitWorkflows}); - #Handle skip notifications - my $skipNotification = $options->{skipNotification} || 0; - $properties->{skipNotification} = $skipNotification; - my $workingTag = ($autoCommitId) ? WebGUI::VersionTag->create($self->session, {groupToUse=>'12', workflowId=>$autoCommitId}) @@ -98,8 +94,8 @@ sub addRevision { $self->session->db->beginTransaction; my $sql = "insert into assetData" - . " (assetId, revisionDate, revisedBy, tagId, status, url, ownerUserId, groupIdEdit, groupIdView, skipNotification)" - . " values (?, ?, ?, ?, 'pending', ?, '3','3','7',?)" + . " (assetId, revisionDate, revisedBy, tagId, status, url, ownerUserId, groupIdEdit, groupIdView)" + . " values (?, ?, ?, ?, 'pending', ?, '3','3','7')" ; $self->session->db->write($sql,[ @@ -108,7 +104,6 @@ sub addRevision { $self->session->user->userId, $workingTag->getId, $self->getId, - $skipNotification, ] ); @@ -124,6 +119,7 @@ sub addRevision { #Instantiate new revision and fill with real data my $newVersion = WebGUI::Asset->new($self->session,$self->getId, $self->get("className"), $now); + $newVersion->setSkipNotification if ($options->{skipNotification}); $newVersion->updateHistory("created revision"); $newVersion->update($self->get); $newVersion->setVersionLock; @@ -338,6 +334,19 @@ sub setAutoCommitTag { #------------------------------------------------------------------- +=head2 setSkipNotification ( ) + +Sets a flag so that developers know whether to send notifications out on certain types of edits. + +=cut + +sub setSkipNotification { + my $self = shift; + $self->session->db->write("update assetData set skipNotification=1 where assetId=? and revisionDate=?", [$self->getId, $self->get("revisionDate")]); +} + +#------------------------------------------------------------------- + =head2 setVersionLock ( ) Sets the versioning lock to "on" so that this piece of content may not be edited by anyone else now that it has been edited. @@ -352,6 +361,21 @@ sub setVersionLock { } + +#------------------------------------------------------------------- + +=head2 shouldSkipNotification ( ) + +Returns true if the asset should disable whatever notifications it does for this edit. + +=cut + +sub shouldSkipNotification { + my $self = shift; + return $self->get("skipNotification"); +} + + #------------------------------------------------------------------- =head2 unsetVersionLock ( )