Customization / Callback Question for "Ticket/Elements/Tabs"

Good morning,

I am currently trying to customize RTs Action Listing in the top of the Ticket Display (Comment, Correspond, Forward, Resolve). I am using callbacks, but they do not invoke as expected. As a basic idea I have been using the example of Dirk Pape, specifically http://page.mi.fu-berlin.de/dirkpape/rt3/Callbacks/MI/Ticket/Elements/Tabs/Default

The code I am actually using looks like this:

<%INIT>
if ($Ticket) {
# overwrite the default Action for Resolve to Correspond
if ( $Ticket->CurrentUserHasRight(‘ModifyTicket’) && ( $Ticket->Status ne ‘resolved’ ) ) {
$actions->{‘G’}->{‘path’} = “Ticket/Update.html?Action=Respond&DefaultStatus=resolved&id=”.$Ticket->id;
}

    # Set To Test
    if ( $Ticket->CurrentUserHasRight('ModifyTicket') && ( $Ticket->Status ne 'test' ) ) {
            $actions->{'T'} = {
                    title => 'Test',
                    path => "Ticket/Update.html?Action=Respond&DefaultStatus=test&id="
                            . $Ticket->id };
    }

    # Add as Watcher
    if ( $Ticket->CurrentUserHasRight('Watch') ) {
            $actions->{'W'} = {
                    title => loc('Watch'),
                    path => 'Ticket/ModifyPeople.html?Ticket-AddWatcher-Principal-'
                            . $Ticket->CurrentUser->id
                            . '=Cc&id='.$Ticket->id };
    }

}

$actions->{‘ZZ2’} = { title => ‘test2’, path => ‘test2’ };

</%INIT>
<%ARGS>
$Ticket => undef
$actions => undef
</%ARGS>

The callback actually gets called, if I uncomment the “ZZ2” entry, it gets shown as expected. Unfortunately, the $Ticket object is undefined and thus breaks the entire idea.

I am using RT 3.8.8 installed from Debian packages, the callback has been placed into /usr/local/share/request-tracker3.8/html/Callbacks/Ticket/Elements/Tabs/Default.

I would appreciate any hints, why this does not work.

Best regards,
Torben Nehmer
Torben Nehmer
Diplom Informatiker (FH)
Business System Developer
CANCOM Deutschland GmbH
Messerschmittstr. 20
89343 Scheppach
Germany
Tel.: +49 8225 - 996-1118
Fax: +49 8225 - 996-41118
torben.nehmer@cancom.demailto:torben.nehmer@cancom.de
www.cancom.dehttp://www.cancom.de
CANCOM Deutschland GmbH
Sitz der Gesellschaft: Jettingen-Scheppach
HRB 10653 Memmingen
Geschäftsführer: Martin Mayr, Tobias Hörmann
Diese E-Mail und alle mitgesendeten Dateien sind vertraulich und ausschließlich für den Gebrauch durch den Empfänger bestimmt!
This e-mail and any files transmitted with it are confidential intended solely for the use of the addressee!

Hi Torben,

you should move your callback from
/usr/local/share/request-tracker3.8/html/Callbacks/Ticket/Elements/Tabs/Default
to
/usr/local/share/request-tracker3.8/html/Callbacks/MyCallbacks/Ticket/Elements/Tabs/Default
and replace MyCallbacks with a name of your choice.
Restart the webserver and everything should be fine.

You should take a look at:
http://wiki.bestpractical.com/view/CustomizingWithCallbacks

ChrisAm 21.07.2010 09:50, schrieb Nehmer Torben:

Good morning,

I am currently trying to customize RTs Action Listing in the top of the
Ticket Display (Comment, Correspond, Forward, Resolve). I am using
callbacks, but they do not invoke as expected. As a basic idea I have
been using the example of Dirk Pape, specifically
http://page.mi.fu-berlin.de/dirkpape/rt3/Callbacks/MI/Ticket/Elements/Tabs/Default

The code I am actually using looks like this:

<%INIT>

if ($Ticket) {

    # overwrite the default Action for Resolve to Correspond

    if ( $Ticket->CurrentUserHasRight('ModifyTicket') && (

$Ticket->Status ne ‘resolved’ ) ) {

            $actions->{'G'}->{'path'} =

“Ticket/Update.html?Action=Respond&DefaultStatus=resolved&id=”.$Ticket->id;

    }



    # Set To Test

    if ( $Ticket->CurrentUserHasRight('ModifyTicket') && (

$Ticket->Status ne ‘test’ ) ) {

            $actions->{'T'} = {

                    title => 'Test',

                    path =>

“Ticket/Update.html?Action=Respond&DefaultStatus=test&id=”

                            . $Ticket->id };

    }



    # Add as Watcher

    if ( $Ticket->CurrentUserHasRight('Watch') ) {

            $actions->{'W'} = {

                    title => loc('Watch'),

                    path =>

‘Ticket/ModifyPeople.html?Ticket-AddWatcher-Principal-’

                            . $Ticket->CurrentUser->id

                            . '=Cc&id='.$Ticket->id };

    }

}

$actions->{‘ZZ2’} = { title => ‘test2’, path => ‘test2’ };

</%INIT>

<%ARGS>

$Ticket => undef

$actions => undef

</%ARGS>

The callback actually gets called, if I uncomment the �ZZ2� entry, it
gets shown as expected. Unfortunately, the $Ticket object is undefined
and thus breaks the entire idea.

I am using RT 3.8.8 installed from Debian packages, the callback has
been placed into
/usr/local/share/request-tracker3.8/html/Callbacks/Ticket/Elements/Tabs/Default.

I would appreciate any hints, why this does not work.

Best regards,
Torben Nehmer