From: ivan Date: Mon, 5 Jan 2009 00:26:54 +0000 (+0000) Subject: add rate copying, RT#4431 X-Git-Tag: root_of_webpay_support~155 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=125fb1a284ae96b46fe433c418aafa87862c4382 add rate copying, RT#4431 --- diff --git a/FS/FS/rate_prefix.pm b/FS/FS/rate_prefix.pm index 42b004f5b..ce780fefe 100644 --- a/FS/FS/rate_prefix.pm +++ b/FS/FS/rate_prefix.pm @@ -2,7 +2,7 @@ package FS::rate_prefix; use strict; use vars qw( @ISA ); -use FS::Record qw( qsearch qsearchs ); +use FS::Record qw( qsearch qsearchs dbh ); use FS::rate_region; @ISA = qw(FS::Record); @@ -127,6 +127,27 @@ sub rate_region { =back +=head1 CLASS METHODS + +=over 4 + +=item all_countrycodes + +Returns a list of all countrycodes listed in rate_prefix + +=cut + +sub all_countrycodes { + #my $class = shift; + my $sql = + "SELECT DISTINCT(countrycode) FROM rate_prefix ORDER BY countrycode"; + my $sth = dbh->prepare($sql) or die dbh->errstr; + $sth->execute or die $sth->errstr; + map $_->[0], @{ $sth->fetchall_arrayref }; +} + +=back + =head1 BUGS =head1 SEE ALSO diff --git a/httemplate/browse/rate.cgi b/httemplate/browse/rate.cgi index b20c45c0c..911b2fd28 100644 --- a/httemplate/browse/rate.cgi +++ b/httemplate/browse/rate.cgi @@ -17,12 +17,8 @@ %> <%once> -my $sth = dbh->prepare("SELECT DISTINCT(countrycode) FROM rate_prefix") - or die dbh->errstr; -$sth->execute or die $sth->errstr; -my @all_countrycodes = map $_->[0], @{ $sth->fetchall_arrayref }; my $all_countrycodes = join("\n", map qq(