Update getAssetsInTrash method for wg8 instanciations and exception handling.
This commit is contained in:
parent
cd2c1f5e76
commit
2147d7f689
1 changed files with 19 additions and 19 deletions
|
|
@ -62,31 +62,31 @@ sub getAssetsInTrash {
|
||||||
$limit = "and asset.stateChangedBy=".$self->session->db->quote($userId);
|
$limit = "and asset.stateChangedBy=".$self->session->db->quote($userId);
|
||||||
}
|
}
|
||||||
my $sth = $self->session->db->read("
|
my $sth = $self->session->db->read("
|
||||||
select
|
select
|
||||||
asset.assetId,
|
asset.assetId,
|
||||||
assetData.revisionDate,
|
assetData.revisionDate,
|
||||||
asset.className
|
from
|
||||||
from
|
asset
|
||||||
asset
|
left join
|
||||||
left join
|
assetData on asset.assetId=assetData.assetId
|
||||||
assetData on asset.assetId=assetData.assetId
|
where
|
||||||
where
|
asset.state='trash'
|
||||||
asset.state='trash'
|
and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId)
|
||||||
and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId)
|
$limit
|
||||||
$limit
|
|
||||||
group by
|
group by
|
||||||
assetData.assetId
|
assetData.assetId
|
||||||
order by
|
order by
|
||||||
assetData.title desc
|
assetData.title desc
|
||||||
");
|
");
|
||||||
while (my ($id, $date, $class) = $sth->array) {
|
while (my ($id, $date) = $sth->array) {
|
||||||
my $asset = WebGUI::Asset->new($self->session,$id,$class,$date);
|
my $asset = WebGUI::Asset->new($self->session, $id, $date);
|
||||||
if ($asset){
|
if (!Exception::Class->caught()) {
|
||||||
push(@assets, $asset);
|
push(@assets, $asset);
|
||||||
}else{
|
|
||||||
$self->session->errorHandler->error("AssetTrash::getAssetsInTrash - failed to instanciate asset with assetId $id, className $class, and revisionDate $date");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$self->session->errorHandler->error("AssetTrash::getAssetsInTrash - failed to instanciate asset with assetId $id and revisionDate $date");
|
||||||
|
}
|
||||||
|
}
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
return \@assets;
|
return \@assets;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue