X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FMisc.pm;h=dca906cdead14387acf24981faf1e8a9c55b1074;hb=0b94e40c533288be69a4fe60da36a385d31eff7f;hp=d79f86e0c39367ae5660c13b48ab422c9b331694;hpb=f32fab28c5cea2b5619c9b1d5cc6e3fe7beef126;p=freeside.git diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index d79f86e0c..dca906cde 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -14,7 +14,7 @@ use File::Temp; @ISA = qw( Exporter ); @EXPORT_OK = qw( generate_email send_email send_fax - states_hash counties state_label + states_hash counties cities state_label card_types generate_ps generate_pdf do_print csv_from_fixed @@ -556,6 +556,7 @@ Returns a list of counties for this state and country. sub counties { my( $state, $country ) = @_; + map { $_ } #return num_counties($state, $country) unless wantarray; sort map { s/[\n\r]//g; $_; } map { $_->county } qsearch({ @@ -567,6 +568,28 @@ sub counties { }); } +=item cities COUNTY STATE COUNTRY + +Returns a list of cities for this county, state and country. + +=cut + +sub cities { + my( $county, $state, $country ) = @_; + + map { $_ } #return num_cities($county, $state, $country) unless wantarray; + sort map { s/[\n\r]//g; $_; } + map { $_->city } + qsearch({ + 'select' => 'DISTINCT city', + 'table' => 'cust_main_county', + 'hashref' => { 'county' => $county, + 'state' => $state, + 'country' => $country, + }, + }); +} + =item state_label STATE COUNTRY_OR_LOCALE_SUBCOUNRY_OBJECT =cut @@ -799,7 +822,7 @@ sub csv_from_fixed { my $template = join('', map {$total += $_; "A$_"} @$lengths) if $lengths; my $dir = "%%%FREESIDE_CACHE%%%/cache.$FS::UID::datasrc"; - my $fh = new File::Temp( TEMPLATE => "CODE.csv.XXXXXXXX", + my $fh = new File::Temp( TEMPLATE => "FILE.csv.XXXXXXXX", DIR => $dir, UNLINK => 0, ) or return "can't open temp file: $!\n"