[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 63075e170262a1aebd7acd3a1d2a1ef06a84fce9

Ivan ivan at 420.am
Thu Dec 20 18:25:10 PST 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  63075e170262a1aebd7acd3a1d2a1ef06a84fce9 (commit)
      from  96bb37b68d74110d2875e011baa955d7c55dc892 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 63075e170262a1aebd7acd3a1d2a1ef06a84fce9
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Dec 20 18:25:09 2012 -0800

    fix state selection w/voip innovations API, add better error logging, RT#15150

diff --git a/FS/FS/part_export/globalpops_voip.pm b/FS/FS/part_export/globalpops_voip.pm
index 6df21f4..fd2e93c 100644
--- a/FS/FS/part_export/globalpops_voip.pm
+++ b/FS/FS/part_export/globalpops_voip.pm
@@ -5,6 +5,7 @@ use Tie::IxHash;
 use FS::Record qw(qsearch dbh);
 use FS::part_export;
 use FS::phone_avail;
+use Data::Dumper;
 
 @ISA = qw(FS::part_export);
 
@@ -73,8 +74,13 @@ sub get_dids {
   if ( $search->{'statuscode'} == 302200 ) {
     return [];
   } elsif ( $search->{'statuscode'} != 100 ) {
-    my $error = "Error running VoIP Innovations getDIDs: ".
-                 $search->{'statuscode'}. ': '. $search->{'status'}. "\n";
+
+    my $error = "Error running VoIP Innovations getDIDs: ";
+    if ( $search->{'statuscode'} || $search->{'status'} ) {
+      $error .= $search->{'statuscode'}. ': '. $search->{'status'}. "\n";
+    } else {
+      $error .= Dumper($search);
+    }
     warn $error;
     die $error;
   }
diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html
index 490dafa..115a98d 100644
--- a/httemplate/elements/select-state.html
+++ b/httemplate/elements/select-state.html
@@ -66,14 +66,19 @@ tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} );
 
 if ( $opt{'svcpart'} ) {
 
-  my $sth = dbh->prepare(
-    'SELECT DISTINCT state FROM phone_avail WHERE svcnum IS NULL'
-  ) or die dbh->errstr;
-  $sth->execute or die $sth->errstr;
-  my %avail_states = map { $_->[0] => 1 } @{ $sth->fetchall_arrayref };
-
-  if ( %avail_states ) {
-    delete $states{$_} foreach grep ! $avail_states{$_}, keys %states;
+  my $part_svc = qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} } );
+  if ( $part_svc && $part_svc->exporttype eq 'internal_diddb' ) {
+
+    my $sth = dbh->prepare(
+      'SELECT DISTINCT state FROM phone_avail WHERE svcnum IS NULL'
+    ) or die dbh->errstr;
+    $sth->execute or die $sth->errstr;
+    my %avail_states = map { $_->[0] => 1 } @{ $sth->fetchall_arrayref };
+
+    if ( %avail_states ) {
+      delete $states{$_} foreach grep ! $avail_states{$_}, keys %states;
+    }
+
   }
 }
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_export/globalpops_voip.pm  |   10 ++++++++--
 httemplate/elements/select-state.html |   21 +++++++++++++--------
 2 files changed, 21 insertions(+), 10 deletions(-)




More information about the freeside-commits mailing list