[freeside-commits] freeside/httemplate/edit svc_phone.cgi, 1.19, 1.20

Ivan,,, ivan at wavetail.420.am
Tue Aug 9 22:22:33 PDT 2011


Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv18995/httemplate/edit

Modified Files:
	svc_phone.cgi 
Log Message:
multiple DID provisioning, RT#13721

Index: svc_phone.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/svc_phone.cgi,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -w -d -r1.19 -r1.20
--- svc_phone.cgi	26 Mar 2011 00:19:44 -0000	1.19
+++ svc_phone.cgi	10 Aug 2011 05:22:31 -0000	1.20
@@ -1,36 +1,56 @@
-<% include( 'elements/svc_Common.html',
+<& elements/svc_Common.html,
                'table'    => 'svc_phone',
-               'fields'   => \@fields,
+     'fields'           => [],
+     'begin_callback'   => $begin_callback,
                'svc_new_callback' => sub {
                  my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt ) = @_;
                  $svc_x->locationnum($cust_pkg->locationnum) if $cust_pkg;
                },
-           )
-%>
+&>
 <%init>
 
+my $begin_callback = sub {
+  my( $cgi, $fields, $opt ) = @_;
+
+  my $bulk = $cgi->param('bulk') ? 1 : 0;
+
+  my $right = $bulk ? 'Bulk provision customer service'
+                    :      'Provision customer service';
+
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
+    unless $FS::CurrentUser::CurrentUser->access_right($right);
 
 my $conf = new FS::Conf;
 
-my @fields = ( 'countrycode',
+  push @$fields,
+              'countrycode',
                { field => 'phonenum',
                  type  => 'select-did',
                  label => 'Phone number',
-               },
-             );
+                multiple => $bulk,
+              };
 
-push @fields, { field => 'domsvc',
+  push @$fields, { field => 'domsvc',
                 type  => 'select-svc-domain',
                 label => 'Domain',
               }
   if $conf->exists('svc_phone-domain');
 
-push @fields, { field => 'pbxsvc',
+  push @$fields, { field => 'pbxsvc',
                 type  => 'select-svc_pbx',
                 label => 'PBX',
-              },
+                 };
+
+  if ( $bulk ) {
+
+    push @$fields, { field => 'bulk',
+                     type  => 'hidden',
+                     value => '1',
+                   };
+
+  } else {
+
+    push @$fields,
               'sip_password',
               'pin',
               { field => 'phone_name',
@@ -63,9 +83,10 @@
               },
               { field => 'custnum', type=> 'hidden' }, #for new cust_locations
 ;
+  }
 
-if ( $conf->exists('svc_phone-lnp') ) {
-    push @fields,
+  if ( $conf->exists('svc_phone-lnp') && !$bulk ) {
+    push @$fields,
             { value   => 'Number Portability',
 	      type    => 'tablebreak-tr-title',
 				colspan => 8,
@@ -90,4 +111,6 @@
 ;
 }
 
+};
+
 </%init>



More information about the freeside-commits mailing list