Newbie to RT hacking - orphaned tickets

Hi All,

I am new to RT2 hacking - just trying to get my feet wet. :slight_smile:

I am trying to add a box that displays the oldest 25 unowned
tickets. I added an Elements/Orphans file, added a link in
index.html, and things are working fine so far. But I have
to hardcode the Id of Nobody in my code. :frowning:

This is what it looks like:

<%INIT>
my $OrphanedTickets;
$OrphanedTickets = new RT::Tickets ($session{‘CurrentUser’});
$OrphanedTickets->LimitOwner(VALUE => 2);
$OrphanedTickets->LimitStatus(VALUE => “new”);
$OrphanedTickets->OrderBy(FIELD => ‘Id’, ORDER => ‘ASC’);
$OrphanedTickets->RowsPerPage(25);
</%INIT>

  1. Why do I have to use $session{‘CurrentUser’} ? Since the
    list of tickets generated has nothing to do with CurrentUser
    anyway. What do I use here? (I just copy/pasted that from
    the MyTickets file there, btw).

  2. How do I give the name (“Nobody”) rather than VALUE => 2 in
    the next line?

  3. Does anyone have any pointers to documentation of the
    RT::*.pm modules? Or is it RTFS?

RT is 2.0.13, Apache with mod_fastcgi on Redhat 7.2+updates.

Thanks,

Binand

Binand Raj S. wrote:

<%INIT>
my $OrphanedTickets;
$OrphanedTickets = new RT::Tickets ($session{‘CurrentUser’});
$OrphanedTickets->LimitOwner(VALUE => 2);
$OrphanedTickets->LimitStatus(VALUE => “new”);
$OrphanedTickets->OrderBy(FIELD => ‘Id’, ORDER => ‘ASC’);
$OrphanedTickets->RowsPerPage(25);
</%INIT>

  1. Why do I have to use $session{‘CurrentUser’} ? Since the
    list of tickets generated has nothing to do with CurrentUser
    anyway. What do I use here? (I just copy/pasted that from
    the MyTickets file there, btw).

$session{‘CurrentUser’} is the correct thing to use, for
arcane reasons. (Actually, reading the code, I suspect this
is not actually used by anything, but that’s not important.)

  1. How do I give the name (“Nobody”) rather than VALUE => 2 in
    the next line?

You can actually do LimitOwner(VALUE => ‘Nobody’), although the
doco doesn’t clearly state that you can.

  1. Does anyone have any pointers to documentation of the
    RT::*.pm modules? Or is it RTFS?

man RT::Tickets

etc.
Phil Homewood, Systems Janitor, www.SnapGear.com
pdh@snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
SnapGear - Custom Embedded Solutions and Security Appliances