--- /dev/null
+<% include('elements/svc_Common.html',
+ 'name' => 'Port',
+ 'table' => 'svc_port',
+ 'fields' => \@fields,
+ 'labels' => \%labels,
+ 'post_url' => popurl(1). "process/svc_Common.html", #?
+ )
+%>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
+
+my @fields = (
+ { 'field' => 'serviceid',
+ 'type' => 'select-torrus_serviceid',
+ #'label' => 'Torrus serviceid',
+ },
+);
+
+my %labels = ( 'svcnum' => 'Service',
+ 'serviceid' => 'Torrus serviceid', );
+
+</%init>
+
--- /dev/null
+<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>