X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-state.html;h=115a98d98244005af58a998b68f7b124808ce148;hb=ecd1baba392d971b49a50f133349f85aaec548a0;hp=785b2ec248d162dc9e74a85fb2835114acbea1c8;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924;p=freeside.git diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html index 785b2ec24..115a98d98 100644 --- a/httemplate/elements/select-state.html +++ b/httemplate/elements/select-state.html @@ -66,13 +66,20 @@ 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 }; + my $part_svc = qsearchs('part_svc', { 'svcpart' => $opt{'svcpart'} } ); + if ( $part_svc && $part_svc->exporttype eq 'internal_diddb' ) { - delete $states{$_} foreach grep ! $avail_states{$_}, keys %states; + 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; + } + + } }