rework addRevision to work with Moose.
This commit is contained in:
parent
d47438d9ae
commit
8b52d3ff76
1 changed files with 11 additions and 20 deletions
|
|
@ -108,35 +108,26 @@ sub addRevision {
|
||||||
#Create a dummy revision to be updated with real data later
|
#Create a dummy revision to be updated with real data later
|
||||||
$session->db->beginTransaction;
|
$session->db->beginTransaction;
|
||||||
|
|
||||||
my $sql = "insert into assetData"
|
# prime the tables
|
||||||
. " (assetId, revisionDate, revisedBy, tagId, status, url, ownerUserId, groupIdEdit, groupIdView)"
|
foreach my $table ($self->meta->get_tables) {
|
||||||
. " values (?, ?, ?, ?, 'pending', ?, '3','3','7')"
|
$session->db->write( "insert into ".$table." (assetId,revisionDate) values (?,?)", [$self->getId, $now]);
|
||||||
;
|
}
|
||||||
|
$session->db->commit;
|
||||||
|
|
||||||
|
my $sql = "update assetData set revisedBy=?, tagId=? where assetId=? and revisionDate=?";
|
||||||
|
|
||||||
$session->db->write($sql,[
|
$session->db->write($sql,[
|
||||||
$self->getId,
|
|
||||||
$now,
|
|
||||||
$session->user->userId,
|
$session->user->userId,
|
||||||
$workingTag->getId,
|
$workingTag->getId,
|
||||||
$self->getId,
|
$self->getId,
|
||||||
|
$now,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
# prime the tables
|
|
||||||
foreach my $table ($self->meta->get_tables) {
|
|
||||||
unless ($table eq "assetData") {
|
|
||||||
$session->db->write( "insert into ".$table." (assetId,revisionDate) values (?,?)", [$self->getId, $now]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$session->db->commit;
|
|
||||||
|
|
||||||
# current values, and the user set properties
|
# current values, and the user set properties
|
||||||
my %mergedProperties = (%{$self->get}, %{$properties}, (status => 'pending'));
|
my %mergedProperties = (%{$self->get}, %{$properties}, (status => 'pending'));
|
||||||
|
|
||||||
# Force the packed head block to be regenerated
|
|
||||||
delete $mergedProperties{extraHeadTagsPacked};
|
|
||||||
|
|
||||||
#Instantiate new revision and fill with real data
|
#Instantiate new revision and fill with real data
|
||||||
my $newVersion = WebGUI::Asset->new($session, $self->getId, $self->className, $now);
|
my $newVersion = WebGUI::Asset->newById($session, $self->getId, $now);
|
||||||
$newVersion->setSkipNotification if ($options->{skipNotification});
|
$newVersion->setSkipNotification if ($options->{skipNotification});
|
||||||
$newVersion->updateHistory("created revision");
|
$newVersion->updateHistory("created revision");
|
||||||
$newVersion->setVersionLock;
|
$newVersion->setVersionLock;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue