diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2012-12-20 18:25:09 -0800 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2012-12-20 18:25:09 -0800 |
| commit | 63075e170262a1aebd7acd3a1d2a1ef06a84fce9 (patch) | |
| tree | 9774d591c233d18ddb78a56b5c7842fd478a9aeb /httemplate | |
| parent | 96bb37b68d74110d2875e011baa955d7c55dc892 (diff) | |
fix state selection w/voip innovations API, add better error logging, RT#15150
Diffstat (limited to 'httemplate')
| -rw-r--r-- | httemplate/elements/select-state.html | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html index 490dafa80..115a98d98 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; + } + } } |
