From 69b3b149f2a83cf280022388b1cd37e62990c721 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 24 Jan 2011 02:56:02 +0000 Subject: [PATCH] torrus, RT#10574 --- FS/FS/Mason.pm | 1 + httemplate/edit/svc_port.cgi | 25 +++++++++++++++++++++ httemplate/elements/select-torrus_serviceid.html | 28 ++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 httemplate/edit/svc_port.cgi create mode 100644 httemplate/elements/select-torrus_serviceid.html diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm index 2d45e78a1..8fb435826 100644 --- a/FS/FS/Mason.pm +++ b/FS/FS/Mason.pm @@ -264,6 +264,7 @@ if ( -e $addl_handler_use_file ) { use FS::dsl_note; use FS::part_pkg_vendor; use FS::cust_note_class; + use FS::svc_port; # Sammath Naur if ( $FS::Mason::addl_handler_use ) { diff --git a/httemplate/edit/svc_port.cgi b/httemplate/edit/svc_port.cgi new file mode 100644 index 000000000..e17b38087 --- /dev/null +++ b/httemplate/edit/svc_port.cgi @@ -0,0 +1,25 @@ +<% 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', ); + + + diff --git a/httemplate/elements/select-torrus_serviceid.html b/httemplate/elements/select-torrus_serviceid.html new file mode 100644 index 000000000..a8cfca8b8 --- /dev/null +++ b/httemplate/elements/select-torrus_serviceid.html @@ -0,0 +1,28 @@ + + +<%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; +} + + -- 2.11.0