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

Emmanuel Lacour elacour at easter-eggs.com
Thu Jun 16 04:12:33 EDT 2016


Le 13/06/2016 à 06:18, Stephen Switzer a écrit :
> 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.


why not playing with privileged/unprivileged users, your customers
should be unprivileged, and RT 4.4 Customer role (or a few lines of code
to add a role on RT 4.2) which would point to groups that represents a
company, so each of a company group memeber can see all tickets of this
company ?

> 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. 

don't do it thi way, it will be hard to follow RT upgrades. You have a
callback in share/htmls/Elements/Tabs named "SelfService" so you just
have to create a
local/html/Callbacks/MyCompany/Elements/Tabs/SelfService file with a
content such as:

<%INIT>
my $accounting = Menu->child( accounting => title => loc('Accounting'),
path => '/SelfService/AccountingARInvoices.html' );
</%INIT>


> 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:
> 


I never played with Collections using other than a query, so I let
others confirm (or not)  if it's possible.



More information about the rt-users mailing list