Skip to content

Conversation

@tbrumm
Copy link

@tbrumm tbrumm commented Sep 2, 2014

Hi Bradley,
hope the code is fine so far and you like it

Torsten

Add Clone Asset tot he Menu
Clone an Asset fromexsisting Asset
Subroutine to clone an asset
@btb
Copy link
Member

btb commented Sep 2, 2014

Thanks Torsten,
There is cloning code in Asset/Display.html, which works, but is incomplete. Could you either update that code or remove it? Also the Clone method should just go into Asset.pm

Brad

@tbrumm
Copy link
Author

tbrumm commented Sep 4, 2014

Hi Brad,
is there code already? OK, will check it and sent another Pull request.

Thanks

Torsten

moved code from asset_local.pm to general asset.pm
Moved to general File
@tbrumm
Copy link
Author

tbrumm commented Sep 4, 2014

Hi Brad,
changed the sub routine from Asset_local.pm to Asset.pm, but this part: (There is cloning code in Asset/Display.html) i cant find inside that file....can you pls point me to this? (possibly i'm not wake enough).

@btb
Copy link
Member

btb commented Sep 4, 2014

My mistake. It should be in Asset/Create.html
It's closely modeled on the cloning code in Ticket/Create.html

RT's _Overlay.pm mechanism was never meant to be used by distributed
extensions, and causes problems when used that way. Instead the code should
be loaded when the extension itself is loaded.

-Brad

On Sep 3, 2014, at 11:57 PM, Torsten Brumm [email protected] wrote:

Hi Brad,
changed the sub routine from Asset_local.pm to Asset.pm, but this part:
(There is cloning code in Asset/Display.html) i cant find inside that
file....can you pls point me to this? (possibly i'm not wake enough).


Reply to this email directly or view it on GitHub
#68 (comment)
.

Clone Asset Parts removed from Create HTML

Uncommented Transaction Customfields also cleaned from Code
@tbrumm
Copy link
Author

tbrumm commented Sep 4, 2014

OK, removed from Create HTML all Clone Parts, no idea where they are from.

@btb
Copy link
Member

btb commented Sep 4, 2014

After looking again, I think I mostly like the old method better - I've been using it for years already, it's just not exposed in the menus. This callback to Elements/Tabs/Privileged works, we could just make it part of the default menu.

<%perl>
my $request_path = $HTML::Mason::Commands::r->path_info;

    if ( $request_path =~ m{^/AssetTracker/Asset/} ) {
        if ( ( $DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
            my $id  = $1;
            my $Asset = RTx::AssetTracker::Asset->new( $session{'CurrentUser'} );
            $Asset->Load($id);

            my $actions = PageMenu()->child( actions => title => loc('Actions'), sort_order  => 95 );
            $actions->child( 'clone' =>
                title => 'Clone',
                path => "/AssetTracker/Asset/Create.html?Type=" . $Asset->Type . "&CloneAsset=" . $Asset->id,
            );
        }
    }
</%perl>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants