X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fselect-state.html;h=785b2ec248d162dc9e74a85fb2835114acbea1c8;hp=2d60fde0f0f031ae02201e58b3f5ec5883a7b4b5;hb=c3da5cf1caa244937d280e0f406927103beef148;hpb=5fdd19665fb7c0ad425a99d3dbf9ad7e27fbf44a diff --git a/httemplate/elements/select-state.html b/httemplate/elements/select-state.html index 2d60fde0f..785b2ec24 100644 --- a/httemplate/elements/select-state.html +++ b/httemplate/elements/select-state.html @@ -42,7 +42,9 @@ Example: <%init> my %opt = @_; -foreach my $opt (qw( state country prefix onchange disabled empty_label )) { +foreach my $opt (qw( + state country prefix onchange disabled empty_label svcpart +)) { $opt{$opt} = '' unless exists($opt{$opt}) && defined($opt{$opt}); } @@ -62,5 +64,16 @@ my $style = 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 }; + + delete $states{$_} foreach grep ! $avail_states{$_}, keys %states; +} +