summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-svc-domain.html
diff options
context:
space:
mode:
authorivan <ivan>2010-03-08 07:02:58 +0000
committerivan <ivan>2010-03-08 07:02:58 +0000
commit611624bc08f525d19e1bd548a7d005aa73a53145 (patch)
treef53bcfab25e8038ae485f707da619e37f46741a9 /httemplate/elements/select-svc-domain.html
parent919bcddcb7a1ec551d27faac925fedc7d9644f3c (diff)
domain names in netsapiens export (domain name association w/svc_phone), RT#5864
Diffstat (limited to 'httemplate/elements/select-svc-domain.html')
-rw-r--r--httemplate/elements/select-svc-domain.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/httemplate/elements/select-svc-domain.html b/httemplate/elements/select-svc-domain.html
new file mode 100644
index 000000000..4c04466db
--- /dev/null
+++ b/httemplate/elements/select-svc-domain.html
@@ -0,0 +1,50 @@
+<SELECT NAME="domsvc" SIZE=1>
+% foreach my $svcnum (
+% sort { $svc_domain{$a} cmp $svc_domain{$b} }
+% keys %svc_domain
+% ) {
+
+ <OPTION VALUE="<% $svcnum %>"
+ <% ($svcnum == $domsvc) ? ' SELECTED' : '' %>
+ ><% $svc_domain{$svcnum} %>
+
+% }
+
+</SELECT>
+<%init>
+
+my %opt = @_;
+
+my %svc_domain = ();
+my $domsvc;
+
+my $domsvc = $opt{'curr_value'};
+my $part_svc = $opt{'part_svc'}
+ || qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} });
+
+#optional
+my $cust_pkg = $opt{'cust_pkg'};
+$cust_pkg ||= qsearchs('cust_pkg', { 'pkgnum' => $opt{'pkgnum'} })
+ if $opt{'pkgnum'};
+
+my $pkgnum = $cust_pkg ? $cust_pkg->pkgnum : '';
+
+my %svc_domain = ();
+
+if ( $domsvc ) {
+ my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $domsvc } );
+ if ( $svc_domain ) {
+ $svc_domain{$svc_domain->svcnum} = $svc_domain;
+ } else {
+ warn "unknown svc_domain.svcnum for svc_acct.domsvc: $domsvc";
+ }
+}
+
+%svc_domain = (
+ %svc_domain,
+ FS::svc_Domain_Mixin->domain_select_hash( 'svcpart' => $part_svc->svcpart,
+ 'pkgnum' => $pkgnum,
+ )
+);
+
+</%init>