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

2016-06-16 Thread Emmanuel Lacour
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' );



> 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.
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


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

2016-06-12 Thread Stephen Switzer

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*


-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016