backport select_list changes from 1.5 so the fix for #118 works in 1.4 branch too
[freeside.git] / httemplate / edit / part_svc.cgi
index 0ee0a46..ce8c463 100755 (executable)
@@ -50,9 +50,9 @@ Disable new orders <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<%= $hashref-
 Services are items you offer to your customers.
 <UL><LI>svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts
     <LI>svc_domain - Domains
+    <LI>svc_acct_sm - <B>deprecated</B> (use svc_forward for new installations) Virtual domain mail aliasing.
     <LI>svc_forward - mail forwarding
     <LI>svc_www - Virtual domain website
-    <LI>svc_broadband - Broadband/High-speed Internet service
 <!--   <LI>svc_charge - One-time charges (Partially unimplemented)
        <LI>svc_wo - Work orders (Partially unimplemented)
 -->
@@ -67,6 +67,7 @@ blank <B>slipip</B> as well as a fixed shell something like <B>/bin/true</B> or
 <%
 #these might belong somewhere else for other user interfaces 
 #pry need to eventually create stuff that's shared amount UIs
+my $conf = new FS::Conf;
 my %defs = (
   'svc_acct' => {
     'dir'       => 'Home directory',
@@ -87,7 +88,11 @@ my %defs = (
     'quota'     => '',
     '_password' => 'Password',
     'gid'       => 'GID (when blank, defaults to UID)',
-    'shell'     => 'Shell (all service definitions should have a default or fixed shell that is present in the <b>shells</b> configuration file)',
+    'shell'     => {
+                     desc =>'Shell (all service definitions should have a default or fixed shell that is present in the <b>shells</b> configuration file)',
+                     type =>'select',
+                     select_list => [ $conf->config('shells') ],
+                   },
     'finger'    => 'GECOS',
     'domsvc'    => {
                      desc =>'svcnum from svc_domain',
@@ -104,6 +109,11 @@ my %defs = (
   'svc_domain' => {
     'domain'    => 'Domain',
   },
+  'svc_acct_sm' => {
+    'domuser'   => 'domuser@virtualdomain.com',
+    'domuid'    => 'UID where domuser@virtualdomain.com mail is forwarded',
+    'domsvc'    => 'svcnum from svc_domain for virtualdomain.com',
+  },
   'svc_forward' => {
     'srcsvc'    => 'service from which mail is to be forwarded',
     'dstsvc'    => 'service to which mail is to be forwarded',
@@ -120,21 +130,11 @@ my %defs = (
     #'recnum' => '',
     #'usersvc' => '',
   },
-  'svc_broadband' => {
-    'actypenum' => 'This is the actypenum that refers to the type of AC that can be provisioned for this service.  This field must be set fixed.',
-    'speed_down' => 'Maximum download speed for this service in Kbps.  0 denotes unlimited.',
-    'speed_up' => 'Maximum upload speed for this service in Kbps.  0 denotes unlimited.',
-    'acnum' => 'acnum of a specific AC that this service is restricted to.  Not required',
-    'ip_addr' => 'IP address.  Leave blank for automatic assignment.',
-    'ip_netmask' => 'Mask length, aka. netmask bits.  (Eg. 255.255.255.0 == 24)',
-    'mac_addr' => 'MAC address which is used by some ACs for access control.  Specified by 6 colon seperated hex octets. (Eg. 00:00:0a:bc:1a:2b)',
-    'location' => 'Defines the physically location at which this service was installed.  This is not necessarily the billing address',
-  },
 );
 
   my @dbs = $hashref->{svcdb}
              ? ( $hashref->{svcdb} )
-             : qw( svc_acct svc_domain svc_forward svc_www svc_broadband );
+             : qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www );
 
   tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } @dbs;
   my $widget = new HTML::Widgets::SelectLayers(
@@ -160,10 +160,11 @@ my %defs = (
         $html .= '<TD><INPUT TYPE="checkbox"'.
                  ' NAME="exportnum'. $part_export->exportnum. '"  VALUE="1" ';
         $html .= 'CHECKED'
-          if qsearchs( 'export_svc', {
+          if ( $clone || $part_svc->svcpart ) #null svcpart search causing error
+              && qsearchs( 'export_svc', {
                                    exportnum => $part_export->exportnum,
                                    svcpart   => $clone || $part_svc->svcpart });
-        $html .= '>'. $part_export->exportnum. ': '.  $part_export->exporttype.
+        $html .= '>'. $part_export->exportnum. ': '. $part_export->exporttype.
                  ' to '. $part_export->machine. '</TD>';
         $count++;
         $html .= '</TR><TR>' unless $count % $columns;
@@ -208,12 +209,20 @@ my %defs = (
           if ( $def->{type} eq 'select' ) {
             $html .= qq!<SELECT NAME="${layer}__${field}">!;
             $html .= '<OPTION> </OPTION>' unless $value;
-            foreach my $record ( qsearch( $def->{select_table}, {} ) ) {
-              my $rvalue = $record->getfield($def->{select_key});
-              $html .= qq!<OPTION VALUE="$rvalue"!.
-                       ( $rvalue==$value ? ' SELECTED>' : '>' ).
-                       $record->getfield($def->{select_label}). '</OPTION>';
-            }
+            if ( $def->{select_table} ) {
+              foreach my $record ( qsearch( $def->{select_table}, {} ) ) {
+                my $rvalue = $record->getfield($def->{select_key});
+                $html .= qq!<OPTION VALUE="$rvalue"!.
+                         ( $rvalue==$value ? ' SELECTED>' : '>' ).
+                         $record->getfield($def->{select_label}). '</OPTION>';
+              } #next $record
+            } else { # select_list
+              foreach my $item ( @{$def->{select_list}} ) {
+                $html .= qq!<OPTION VALUE="$item"!.
+                         ( $item eq $value ? ' SELECTED>' : '>' ).
+                         $item. '</OPTION>';
+              } #next $item
+            } #endif
             $html .= '</SELECT>';
           } elsif ( $def->{type} eq 'radius_usergroup_selector' ) {
             $html .= FS::svc_acct::radius_usergroup_selector(