X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg_usageprice.pm;h=9c3b1be876cd47f7783cdb7d5b4b3bf68c283097;hb=292ef074d01bb925e9a466ed771bf2ac418bb44f;hp=0fa6bca978cdbb49390e212502c71d47008d48df;hpb=013646e6629fc94b4cda03c495aa56677f2de381;p=freeside.git diff --git a/FS/FS/part_pkg_usageprice.pm b/FS/FS/part_pkg_usageprice.pm index 0fa6bca97..9c3b1be87 100644 --- a/FS/FS/part_pkg_usageprice.pm +++ b/FS/FS/part_pkg_usageprice.pm @@ -2,6 +2,7 @@ package FS::part_pkg_usageprice; use base qw( FS::Record ); use strict; +use Tie::IxHash; #use FS::Record qw( qsearch qsearchs ); =head1 NAME @@ -120,6 +121,51 @@ sub check { $self->SUPER::check; } +=item target_info + +Returns a hash reference of information about the target of this object. +Keys are "label" and "multiplier". + +=cut + +sub target_info { + my $self = shift; + $self->targets->{$self->target}; +} + +=item targets + +(Class method) +Returns a hash reference. Keys are possible values for the "target" field. +Values are hash references with "label" and "multiplier" keys. + +=cut + +sub targets { + + tie my %targets, 'Tie::IxHash', # once? + #'svc_acct.totalbytes' => { label => 'Megabytes', + # multiplier => 1048576, + # }, + 'svc_acct.totalbytes' => { label => 'Gigabytes', + multiplier => 1073741824, + }, + 'svc_acct.seconds' => { label => 'Hours', + multiplier => 3600, + }, + 'svc_conferencing.participants' => { label => 'Conference Participants', + multiplier=> 1, + }, + #this will take more work: set action, not increment.. + # and then value comes from a select, not a text field + # 'svc_conferencing.confqualitynum' => { label => 'Conference Quality', + # }, + ; + + \%targets; + +} + =back =head1 BUGS