X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-state.html;h=7606e25273223a2880fc1a526a8046838cb01740;hb=62b18c75989a1b00a25079f8f110992aaad81bba;hp=490dafa80f5d44f39d115b2099ccb636e40506ec;hpb=f9924b31d40fddfeb1e0e176532440f551f50837;p=freeside.git diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html index 490dafa80..7606e2527 100644 --- a/httemplate/elements/select-state.html +++ b/httemplate/elements/select-state.html @@ -27,16 +27,13 @@ Example: > % unless ( $opt{'disable_empty'} ) { - % } % foreach my $state ( keys %states ) { - - % } - <%init> @@ -66,14 +63,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 }; + 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; + } - if ( %avail_states ) { - delete $states{$_} foreach grep ! $avail_states{$_}, keys %states; } }