[freeside-commits] freeside/httemplate/elements select-torrus_serviceid.html, NONE, 1.1 tr-select-torrus_serviceid.html, NONE, 1.1

Ivan,,, ivan at wavetail.420.am
Sun Jan 23 18:56:04 PST 2011


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv27631/httemplate/elements

Added Files:
	select-torrus_serviceid.html tr-select-torrus_serviceid.html 
Log Message:
torrus, RT#10574

--- NEW FILE: tr-select-torrus_serviceid.html ---
<TR>
  <TD ALIGN="right"><% $opt{'label'} || 'Torrus serviceid' %></TD>
  <TD><% include('select-torrus_serviceid.html', %opt) %></TD>
</TR>

<%init>

my %opt = @_;

</%init>

--- NEW FILE: select-torrus_serviceid.html ---
<SELECT NAME="<% $opt{'field'} || 'serviceid' %>">

% unless ( $opt{'multiple'} || $opt{'disable_empty'} ) {
  <OPTION VALUE="">Select serviceid</OPTION>
% }

% foreach my $serviceid ( keys %serviceid ) {
    <OPTION VALUE="<%$serviceid%>"><% $serviceid %></OPTION>
% } 

</SELECT>

<%init>

my %opt = @_;

#is this going to get too slow or will the index make it okay?
my $sth = dbh->prepare("SELECT DISTINCT(serviceid) FROM srvexport")
  or die dbh->errstr;
$sth->execute or die $sth->errstr;
my %serviceid = ();
while ( my $row = $sth->fetchrow_arrayref ) {
  my $serviceid = $row->[0];
  $serviceid =~ s/_(IN|OUT)$//;
  $serviceid{$serviceid}=1;
}

</%init>



More information about the freeside-commits mailing list