From 125fb1a284ae96b46fe433c418aafa87862c4382 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Jan 2009 00:26:54 +0000 Subject: [PATCH] add rate copying, RT#4431 --- FS/FS/rate_prefix.pm | 23 +++++- httemplate/browse/rate.cgi | 7 +- httemplate/elements/checkboxes-table-name.html | 88 ++++----------------- httemplate/elements/checkboxes.html | 103 +++++++++++++++++++++++++ httemplate/elements/select-rate.html | 9 +++ httemplate/elements/tr-select-rate.html | 21 +++++ httemplate/misc/copy-rate_detail.html | 61 +++++++++++++++ httemplate/misc/process/copy-rate_detail.html | 61 +++++++++++++++ 8 files changed, 294 insertions(+), 79 deletions(-) create mode 100644 httemplate/elements/checkboxes.html create mode 100644 httemplate/elements/select-rate.html create mode 100644 httemplate/elements/tr-select-rate.html create mode 100644 httemplate/misc/copy-rate_detail.html create mode 100644 httemplate/misc/process/copy-rate_detail.html 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(