[freeside-commits] freeside/FS/FS/part_export thirdlane.pm, 1.7, 1.8

Ivan,,, ivan at wavetail.420.am
Thu Feb 11 19:26:36 PST 2010


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv13417

Modified Files:
	thirdlane.pm 
Log Message:
add omit_countrycode option, RT#7379

Index: thirdlane.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/thirdlane.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- thirdlane.pm	29 Jan 2010 19:52:42 -0000	1.7
+++ thirdlane.pm	12 Feb 2010 03:26:34 -0000	1.8
@@ -18,6 +18,7 @@
                         },
   'port'             => { label => 'Port number if not 80 or 443', },
   'prototype_tenant' => { label => 'Prototype tenant name', },
+  'omit_countrycode' => { label => 'Omit country code', type => 'checkbox' },
   'debug'            => { label => 'Checkbox label', type => 'checkbox' },
 #  'select_option'   => { label   => 'Select option description',
 #                         type    => 'select', options=>[qw(chocolate vanilla)],
@@ -74,7 +75,7 @@
 
     my $result = $self->_thirdlane_command(
       'asterisk::rpc_did_create',
-      $svc_x->countrycode. $svc_x->phonenum,
+      $self->_thirdlane_did($svc_x)
     );
 
     #use Data::Dumper;
@@ -85,7 +86,7 @@
 
     $result = $self->_thirdlane_command(
       'asterisk::rpc_did_assign',
-      $svc_x->countrycode. $svc_x->phonenum,
+      $self->_thirdlane_did($svc_x),
       $svc_x->pbx_title,
     );
 
@@ -156,7 +157,7 @@
       if ( $old->pbxsvc ) {
         my $result = $self->_thirdlane_command(
           'asterisk::rpc_did_unassign',
-          $new->countrycode. $new->phonenum,
+          $self->_thirdlane_did($svc_x),
         );
         $result eq '0' or return 'Thirdlane API failure (rpc_did_unassign)';
       }
@@ -164,7 +165,7 @@
       if ( $new->pbxsvc ) {
         my $result = $self->_thirdlane_command(
           'asterisk::rpc_did_assign',
-          $new->countrycode. $new->phonenum,
+          $self->_thirdlane_did($svc_x),
           $new->pbx_title,
         );
         $result eq '0' or return 'Thirdlane API failure (rpc_did_assign)';
@@ -219,14 +220,14 @@
     if ( $svc_x->pbxsvc ) {
       my $result = $self->_thirdlane_command(
         'asterisk::rpc_did_unassign',
-        $svc_x->countrycode. $svc_x->phonenum,
+        $self->_thirdlane_did($svc_x),
       );
       $result eq '0' or return 'Thirdlane API failure (rpc_did_unassign)';
     }
 
     my $result = $self->_thirdlane_command(
       'asterisk::rpc_did_delete',
-      $svc_x->countrycode. $svc_x->phonenum,
+      $self->_thirdlane_did($svc_x),
     );
     $result eq '0' ? '' : 'Thirdlane API failure (rpc_did_delete)';
 
@@ -276,6 +277,15 @@
   
 }
 
+sub _thirdlane_did {
+  my($self, $svc_x) = @_;
+  if ( $self->option('omit_countrycode') ) {
+    $svc_x->phonenum;
+  } else {
+    $svc_x->countrycode. $svc_x->phonenum;
+  }
+}
+
   #my( $self, $svc_something ) = (shift, shift);
   #$err_or_queue = $self->thirdlane_queue( $svc_something->svcnum,
   #  'delete', $svc_something->username );



More information about the freeside-commits mailing list