freeside/FS/FS rate.pm,1.2,1.3
ivan
ivan at pouncequick.420.am
Thu Feb 10 22:44:31 PST 2005
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory pouncequick:/tmp/cvs-serv15732/FS/FS
Modified Files:
rate.pm
Log Message:
generalize progressbar code in preparation for using it wherever needed
Index: rate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/rate.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rate.pm 27 Jan 2005 10:21:17 -0000 1.2
+++ rate.pm 11 Feb 2005 06:44:26 -0000 1.3
@@ -2,6 +2,8 @@
use strict;
use vars qw( @ISA $DEBUG );
+use Storable qw(thaw);
+use Data::Dumper;
use FS::Record qw( qsearch qsearchs dbh fields );
use FS::rate_detail;
@@ -307,25 +309,29 @@
=cut
+use MIME::Base64;
sub process {
my $job = shift;
#my %param = @_;
- my $param = shift;
- my %param = split(/[;=]/, $param);
+ #my $param = shift;
+ #my %param = split(/[;=]/, $param);
- my $old = qsearchs('rate', { 'ratenum' => $param{'ratenum'} } )
- if $param{'ratenum'};
+ my $param = thaw(decode_base64(shift));
+ warn Dumper($param) if $DEBUG;
+
+ my $old = qsearchs('rate', { 'ratenum' => $param->{'ratenum'} } )
+ if $param->{'ratenum'};
my @rate_detail = map {
my $regionnum = $_->regionnum;
- if ( $param{"sec_granularity$regionnum"} ) {
+ if ( $param->{"sec_granularity$regionnum"} ) {
new FS::rate_detail {
'dest_regionnum' => $regionnum,
- map { $_ => $param{"$_$regionnum"} }
+ map { $_ => $param->{"$_$regionnum"} }
qw( min_included min_charge sec_granularity )
};
@@ -343,13 +349,13 @@
} qsearch('rate_region', {} );
my $rate = new FS::rate {
- map { $_ => $param{$_} }
+ map { $_ => $param->{$_} }
fields('rate')
};
my $error = '';
- if ( $param{'ratenum'} ) {
- warn "$rate replacing $old ($param{'ratenum'})\n" if $DEBUG;
+ if ( $param->{'ratenum'} ) {
+ warn "$rate replacing $old (". $param->{'ratenum'}. ")\n" if $DEBUG;
$error = $rate->replace( $old,
'rate_detail' => \@rate_detail,
'job' => $job,
More information about the freeside-commits
mailing list