[rt-users] Create drop down list with customer names

Tommy Abrahamsson tab at secu.dk
Sat Jun 16 10:50:48 EDT 2007


I'm trying to create a drop down list when creating a new ticket. The value of the drop down list is supposed to be filled into a CF (this part I haven't gotten to yet). 
I've taken inspiration from the Ticket/Create.html and Elements/SelectOwner, but I can't quite figure out the meaning of the Elements pages. I'm no perl expert - far from, but I've tried to put together a few lines in a new file Elements/SelectCustomer. But when I call it from the Create.html page, I just get a bunch of errors. 
Any help on how I can proceed with this? 

Thanks in advance. 

Best regards 
Tommy Abrahamsson 

Error during compilation of /var/www/rt3/Elements/SelectCustomer: 
Useless use of push with no values at /var/www/rt3/Elements/SelectCustomer line 75. 
Type of arg 1 to push must be array (not hash element) at /var/www/rt3/Elements/SelectCustomer line 75, near "})" 
Global symbol "@assetcustomers" requires explicit package name at /var/www/rt3/Elements/SelectCustomer line 50. 

<SELECT NAME="<%$Name%>"> 
%if ($DefaultValue) { 
<OPTION <% !$Default ? "SELECTED" : '' %> VALUE=""><%$DefaultLabel%></OPTION> 
%foreach my $AssetCustomer ( @assetcustomers) { 
<OPTION <% ($AssetCustomer->Id == $Default) ? "SELECTED" : ''%> 
%if ($ValueAttribute eq 'id') { 
%} elsif ($ValueAttribute eq 'Name') { 
my @objects; 
my %assetcustomers; 

my $assetobj = RTx::AssetTracker::Assets->new($session{CurrentUser}); 
$assetobj->FromSQL('Type = "Customers" AND Status != "retired"'); 

while (my $asset = $assetobj->Next) 
push ($assetcustomers{$asset}); 



$QueueObj => undef 
$Name => undef 
$Default => 0 
$User => undef 
$TicketObj => undef 
$DefaultValue => 1 
$DefaultLabel => "-" 
$ValueAttribute => 'id' 
$cfqueues => undef 

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

More information about the rt-users mailing list