svc_broadband merge
[freeside.git] / httemplate / edit / part_svc.cgi
index e9c571f..a23107a 100755 (executable)
@@ -1,10 +1,17 @@
 <!-- mason kludge -->
 <% 
    my $part_svc;
+   my $clone = '';
    if ( $cgi->param('error') ) { #error
      $part_svc = new FS::part_svc ( {
        map { $_, scalar($cgi->param($_)) } fields('part_svc')
      } );
+   } elsif ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {#clone
+     #$cgi->param('clone') =~ /^(\d+)$/ or die "malformed query: $query";
+     $part_svc = qsearchs('part_svc', { 'svcpart'=>$1 } )
+       or die "unknown svcpart: $1";
+     $clone = $part_svc->svcpart;
+     $part_svc->svcpart('');
    } elsif ( $cgi->keywords ) { #edit
      my($query) = $cgi->keywords;
      $query =~ /^(\d+)$/ or die "malformed query: $query";
@@ -46,6 +53,7 @@ Services are items you offer to your customers.
     <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)
 -->
@@ -115,11 +123,21 @@ 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_acct_sm svc_forward svc_www );
+             : qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www svc_broadband );
 
   tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } @dbs;
   my $widget = new HTML::Widgets::SelectLayers(
@@ -137,17 +155,17 @@ my %defs = (
       my $columns = 3;
       my $count = 0;
       my @part_export =
-        grep { $layer eq FS::part_export::exporttype2svcdb($_->exporttype) }
-          qsearch( 'part_export', {} );
-      $html .= '<BR><BR>'. table().
+        map { qsearch( 'part_export', {exporttype => $_ } ) }
+          keys %{FS::part_export::export_info($layer)};
+     $html .= '<BR><BR>'. table().
                table(). "<TR><TH COLSPAN=$columns>Exports</TH></TR><TR>";
       foreach my $part_export ( @part_export ) {
         $html .= '<TD><INPUT TYPE="checkbox"'.
                  ' NAME="exportnum'. $part_export->exportnum. '"  VALUE="1" ';
         $html .= 'CHECKED'
           if qsearchs( 'export_svc', {
-                                       exportnum => $part_export->exportnum,
-                                       svcpart   => $part_svc->svcpart       });
+                                   exportnum => $part_export->exportnum,
+                                   svcpart   => $clone || $part_svc->svcpart });
         $html .= '> '. $part_export->exporttype. ' to '. $part_export->machine.
                  '</TD>';
         $count++;
@@ -161,6 +179,7 @@ my %defs = (
                       ? grep { $_ ne 'svcnum' } fields($layer)
                       : ();
       push @fields, 'usergroup' if $layer eq 'svc_acct'; #kludge
+      $part_svc->svcpart($clone) if $clone; #haha, undone below
       foreach my $field (@fields) {
         my $part_svc_column = $part_svc->part_svc_column($field);
         my $value = $cgi->param('error')
@@ -206,6 +225,7 @@ my %defs = (
         }
         $html .= "</TD></TR>\n";
       }
+      $part_svc->svcpart('') if $clone; #undone
       $html .= "</TABLE>";
 
       $html .= '<BR><INPUT TYPE="submit" VALUE="'.