Make revisedBy a property, so it gets written on ->update. Change addRev not to write to the db when it does not need to. Update tests to verify that addRev does the right thing for tagId and revisedBy.
This commit is contained in:
parent
9155f70555
commit
d66b3b891b
3 changed files with 11 additions and 13 deletions
|
|
@ -260,6 +260,11 @@ has assetId => (
|
|||
has revisionDate => (
|
||||
is => 'rw',
|
||||
);
|
||||
property revisedBy => (
|
||||
is => 'rw',
|
||||
noFormPost => 1,
|
||||
fieldType => 'guid',
|
||||
);
|
||||
has [qw/parentId lineage
|
||||
creationDate createdBy
|
||||
state stateChanged stateChangedBy
|
||||
|
|
@ -2313,7 +2318,7 @@ sub write {
|
|||
my @values = map { $self->$_ } @properties;
|
||||
my @columnNames = map { $db->quoteIdentifier($_).'=?' } @properties;
|
||||
push @values, $self->getId, $self->revisionDate;
|
||||
$db->write("update ".$table." set ".join(",",@columnNames)." where assetId=? and revisionDate=?",\@values);
|
||||
$db->write("update ".$table." set ".join(",",@columnNames)." where assetId=? and revisionDate=?",\@values);
|
||||
}
|
||||
|
||||
# update the asset's size, which also purges the cache.
|
||||
|
|
|
|||
|
|
@ -114,17 +114,8 @@ sub addRevision {
|
|||
}
|
||||
$session->db->commit;
|
||||
|
||||
my $sql = "update assetData set revisedBy=?, tagId=? where assetId=? and revisionDate=?";
|
||||
|
||||
$session->db->write($sql,[
|
||||
$session->user->userId,
|
||||
$workingTag->getId,
|
||||
$self->getId,
|
||||
$now,
|
||||
]);
|
||||
|
||||
# current values, and the user set properties
|
||||
my %mergedProperties = (%{$self->get}, %{$properties}, (status => 'pending'));
|
||||
my %mergedProperties = (%{$self->get}, %{$properties}, (status => 'pending', revisedBy => $session->user->userId, tagId => $workingTag->getId), );
|
||||
|
||||
#Instantiate new revision and fill with real data
|
||||
my $newVersion = WebGUI::Asset->newById($session, $self->getId, $now);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue