X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Frate_detail.pm;h=89333540121f86ef53a222b9f3f72d3da79319f1;hp=d81d9dbda61b685040080e3ec5d1bcc5fba47485;hb=HEAD;hpb=b988005162046dcbaa3d4f167f507ba6d6bb80e4 diff --git a/FS/FS/rate_detail.pm b/FS/FS/rate_detail.pm index d81d9dbda..893335401 100644 --- a/FS/FS/rate_detail.pm +++ b/FS/FS/rate_detail.pm @@ -60,6 +60,13 @@ inherits from FS::Record. The following fields are currently supported: =item region_group - Group in region group for rate plan +=item upstream_mult_charge - the multiplier to apply to the upstream price. +Defaults to zero, and should stay zero unless this rate is intended to include +a markup on pre-rated CDRs. + +=item upstream_mult_cost - the multiplier to apply to the upstream price to +calculate the wholesale cost. + =back =head1 METHODS @@ -124,7 +131,8 @@ sub check { $self->ut_numbern('ratedetailnum') || $self->ut_foreign_key('ratenum', 'rate', 'ratenum') || $self->ut_foreign_keyn('orig_regionnum', 'rate_region', 'regionnum' ) - || $self->ut_foreign_key('dest_regionnum', 'rate_region', 'regionnum' ) + || $self->ut_foreign_keyn('dest_regionnum', 'rate_region', 'regionnum' ) + || $self->ut_foreign_keyn('cdrtypenum', 'cdr_type', 'cdrtypenum' ) || $self->ut_number('min_included') #|| $self->ut_money('min_charge') @@ -138,6 +146,9 @@ sub check { || $self->ut_foreign_keyn('classnum', 'usage_class', 'classnum' ) || $self->ut_enum('region_group', [ '', 'Y' ]) + + || $self->ut_floatn('upstream_mult_charge') + || $self->ut_floatn('upstream_mult_cost') ; return $error if $error; @@ -182,10 +193,13 @@ with this call plan rate. sub dest_regionname { my $self = shift; - $self->dest_region->regionname; + my $dest_region = $self->dest_region; + $dest_region ? $dest_region->regionname : 'Global default'; + # should be 'Anywhere' or something, to indicate that it's the + # cross-region default } -=item dest_regionname +=item dest_prefixes_short Returns a short list of the prefixes for the destination region (see L) associated with this call plan rate. @@ -194,7 +208,8 @@ Returns a short list of the prefixes for the destination region sub dest_prefixes_short { my $self = shift; - $self->dest_region->prefixes_short; + my $dest_region = $self->dest_region; + $dest_region ? $dest_region->prefixes_short : ''; } =item rate_time @@ -218,7 +233,7 @@ associated with this rate plan. sub rate_time_name { my $self = shift; - $self->ratetimenum ? $self->rate_time->ratetimename : '(default)'; + $self->ratetimenum ? $self->rate_time->ratetimename : '(any time)'; } =item classname @@ -298,9 +313,7 @@ sub conn_secs { =cut -use Storable qw(thaw); use Data::Dumper; -use MIME::Base64; sub process_edit_import { my $job = shift; @@ -339,7 +352,7 @@ sub process_edit_import { my @pass_params = @{ $opt->{params} }; my %formats = %{ $opt->{formats} }; - my $param = thaw(decode_base64(shift)); + my $param = shift; warn Dumper($param) if $DEBUG; my $files = $param->{'uploaded_files'}