freeside/httemplate/misc link.cgi,1.8,1.9

ivan ivan at pouncequick.420.am
Mon Apr 5 07:06:10 PDT 2004


Update of /home/cvs/cvsroot/freeside/httemplate/misc
In directory pouncequick:/tmp/cvs-serv4561/httemplate/misc

Modified Files:
	link.cgi 
Log Message:
add a domain pulldown to svc_acct linking, closes: Bug#277 / prevent "stealing" services with link unless you set legacy_link-steal config option, closes: Bug#321

Index: link.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/link.cgi,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- link.cgi	17 Sep 2002 09:19:42 -0000	1.8
+++ link.cgi	5 Apr 2004 14:05:55 -0000	1.9
@@ -4,8 +4,16 @@
 my %link_field = (
   'svc_acct'    => 'username',
   'svc_domain'  => 'domain',
-  'svc_charge'  => '',
-  'svc_wo'      => '',
+);
+
+my %link_field2 = (
+  'svc_acct'    => { label => 'Domain',
+                     field => 'domsvc',
+                     type  => 'select',
+                     select_table => 'svc_domain',
+                     select_key   => 'svcnum',
+                     select_label => 'domain'
+                   },
 );
 
 my($query) = $cgi->keywords;
@@ -19,27 +27,48 @@
 my $svc = $part_svc->getfield('svc');
 my $svcdb = $part_svc->getfield('svcdb');
 my $link_field = $link_field{$svcdb};
+my $link_field2 = $link_field2{$svcdb};
 
-print header("Link to existing $svc"),
-      qq!<FORM ACTION="!, popurl(1), qq!process/link.cgi" METHOD=POST>!;
+%>
 
-if ( $link_field ) { 
-  print <<END;
+<%= header("Link to existing $svc") %>
+<FORM ACTION="<%= popurl(1) %>process/link.cgi" METHOD=POST>
+
+<% if ( $link_field ) { %>
   <INPUT TYPE="hidden" NAME="svcnum" VALUE="">
-  <INPUT TYPE="hidden" NAME="link_field" VALUE="$link_field">
-  $link_field of existing service: <INPUT TYPE="text" NAME="link_value">
-END
-} else {
-  print qq!Service # of existing service: <INPUT TYPE="text" NAME="svcnum" VALUE="">!;
-}
+  <INPUT TYPE="hidden" NAME="link_field" VALUE="<%= $link_field %>">
+  <%= $link_field %> of existing service: <INPUT TYPE="text" NAME="link_value">
+  <BR>
+  <% if ( $link_field2 ) { %>
+    <INPUT TYPE="hidden" NAME="link_field2" VALUE="<%= $link_field2->{field} %>">
+    <%= $link_field2->{'label'} %> of existing service: 
+    <% if ( $link_field2->{'type'} eq 'select' ) { %>
+      <% if ( $link_field2->{'select_table'} ) { %>
+        <SELECT NAME="link_value2">
+        <OPTION> </OPTION>
+        <% foreach my $r ( qsearch( $link_field2->{'select_table'}, {})) { %>
+          <% my $key = $link_field2->{'select_key'}; %>
+          <% my $label = $link_field2->{'select_label'}; %>
+          <OPTION VALUE="<%= $r->$key() %>"><%= $r->$label() %></OPTION>
+        <% } %>
+        </SELECT>
+      <% } else { %>
+        Don't know how to process secondary link field for <%= $svcdb %>
+        (type=>select but no select_table)
+      <% } %>
+    <% } else { %>
+      Don't know how to process secondary link field for <%= $svcdb %>
+        (unknown type <%= $link_field2->{'type'} %>)
+    <% } %>
+    <BR>
+  <% } %>
+<% } else { %>
+  Service # of existing service: <INPUT TYPE="text" NAME="svcnum" VALUE="">
+<% } %>
 
-print <<END;
-<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">
-<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">
-<P><CENTER><INPUT TYPE="submit" VALUE="Link"></CENTER>
+<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%= $pkgnum %>">
+<INPUT TYPE="hidden" NAME="svcpart" VALUE="<%= $svcpart %>">
+<BR><INPUT TYPE="submit" VALUE="Link">
     </FORM>
   </BODY>
 </HTML>
-END
-
-%>




More information about the freeside-commits mailing list