& /Elements/Header, Title => loc("Assets") &> <& /Elements/Tabs &> % $m->callback(CallbackName => 'BeforeActionList', ARGSRef => \%ARGS, Assets => $assets, Actions => \@results); <& /Elements/ListActions, actions => \@results &>
<%INIT> my @results; $m->callback(ARGSRef => \%ARGS, Results => \@results, CallbackName => 'Initial'); my $catalog_obj = LoadDefaultCatalog($ARGS{'Catalog'} || ''); $ARGS{'Catalog'} = $catalog_obj->Id; my $assets = RT::Assets->new($session{CurrentUser}); my %search; if ( $ARGS{Query} ) { $assets->FromSQL($ARGS{Query}); } else { %search = ProcessAssetsSearchArguments( Assets => $assets, Catalog => $catalog_obj, ARGSRef => \%ARGS, ); } $search{Format} ||= RT->Config->Get('AssetSearchFormat'); my $DisplayFormat = "'__CheckBox.{UpdateAsset}__',". ($ARGS{Format} || $search{'Format'}); $DisplayFormat =~ s/\s*,\s*('?__NEWLINE__'?)/,$1,''/gi; my $asset = RT::Asset->new( $session{'CurrentUser'} ); delete $ARGS{$_} foreach grep { $ARGS{$_} =~ /^$/ } keys %ARGS; $DECODED_ARGS->{'UpdateAssetAll'} = 1 unless @UpdateAsset; if ( $ARGS{Update} ) { my @attributes = $asset->WritableAttributes; @attributes = grep exists $ARGS{ 'Update'. $_ }, @attributes; my %basics = map { $_ => $ARGS{ 'Update'. $_ } } @attributes; foreach my $aid ( @UpdateAsset ) { my $asset = LoadAsset($aid); my @tmp_res; push @tmp_res, UpdateRecordObject( Object => $asset, AttributesRef => \@attributes, ARGSRef => \%basics, ); push @tmp_res, ProcessAssetRoleMembers( $asset => %ARGS ); push @tmp_res, ProcessObjectCustomFieldUpdates( Object => $asset, ARGSRef => \%ARGS ); push @tmp_res, ProcessRecordLinks( RecordObj => $asset, RecordId => 'Asset', ARGSRef => \%ARGS ); push @tmp_res, ProcessRecordBulkCustomFields( RecordObj => $asset, ARGSRef => \%ARGS ); push @results, map { loc( "Asset #[_1]: [_2]", $asset->id, $_ ) } @tmp_res; } MaybeRedirectForResults( Actions => \@results, Arguments => { map { $_ => $ARGS{$_} } grep { defined $ARGS{$_} } @{$search{'PassArguments'}}, qw(Query Format OrderBy Order Rows Page Token) }, ); } %INIT> <%ARGS> @UpdateAsset => () %ARGS>