communigate provisioning phase 2: add svc_domain.trailer -> communigate TrailerText...
[freeside.git] / FS / FS / rate_prefix.pm
index 500462a..ce780fe 100644 (file)
@@ -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);
@@ -122,7 +122,28 @@ Returns the rate region (see L<FS::rate_region>) for this prefix.
 
 sub rate_region {
   my $self = shift;
-  qsearch('rate_region', { 'regionnum' => $self->regionnum } );
+  qsearchs('rate_region', { 'regionnum' => $self->regionnum } );
+}
+
+=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