[rt-users] Adding menu items with external data to SelfService

Stephen Switzer steve at sbsroc.com
Mon Jun 13 00:18:34 EDT 2016


Hi Everyone!
    I have a goal to make RT's Self Service interface a full customer 
portal where they can log in to see their outstanding invoices as well 
as report trouble by creating a ticket. I imagine adding a custom field 
to the users to store an external ID for any user that I would like to 
enable this option for. No big deal there. It took a little time to 
figure it out but I have added an "Accounting" option to the top of the 
page, right after "Tickets" by editing 
/opt/rt4/local/html/Elements/Tabs. I then added 
/opt/rt4/local/html/SelfService/AccountingARInvoices.html (which I coped 
from Closed.html and modified). Here's an Excerpt:

    <& /SelfService/Elements/ARInvoices,
         %ARGS,
         status          => [ RT::Queue->InactiveStatusArray ],
         title           => loc('My Open Invoices'),
         BaseURL         => RT->Config->Get('WebPath')
    ."/SelfService/AccountingARInvoices.html?",
         Page            => $Page,
    &>

This then calls /opt/rt4/local/html/SelfService/Elements/ARInvoices. I 
found that in the call to CollectionList, I can comment out the Query 
parameter, and pass Collection instead.

This is where I seem to have a mental block. I'm not a perl newbie, but 
I infrequently code in perl and keep forgetting things I'd once learned, 
so it might be obvious to others. However, I am new to the Mason 
approach. I'd like to use as many of the built in RT components as 
possible to display the data. I have already built an API that can 
return a list of open invoices in JSON format, and I plan to call this 
API then pass the data as a collection. However, in testing the approach 
I tried hard coding the collection parameter to figure out what this 
collection needs to look like to work... such as: Collection => [('a' => 
'1'), ('b' => '2')]; ... but I kept getting:

    [error]: Odd number of parameters passed to component expecting
    name/value pairs

until I simply passed "()" which led me to see

    [error]: Can't call method "CountAll" on unblessed reference at
    /opt/rt4/share/html/Elements/CollectionList line 55

Has anyone else added to the SelfService interface? What format should 
the collection be in to work? I tried to modify 
/opt/rt4/share/html/Elements/CollectionList to call Data::Dumper so I 
could see the format, but for some reason I only saw the currently 
logged in user table data, not data about the list of tickets I was 
looking at. I'd appreciate any help that can be offered.

Thank you!


-- 
Best regards,

*Stephen H. Switzer*


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160613/141fbfa7/attachment.htm>


More information about the rt-users mailing list