X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2Fpart_pkg%2Fflat.pm;h=17188577050dd8df2e29d35fa9f8e97d88c0c9a0;hb=467b269c5cacef3e8486e2288f1b0eeec8fea088;hp=009e54c7895d43eb738affffc303917603a5bff3;hpb=e13421f071b4a7b872e6d40205ca736125cb294d;p=freeside.git diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm index 009e54c78..171885770 100644 --- a/FS/FS/part_pkg/flat.pm +++ b/FS/FS/part_pkg/flat.pm @@ -1,7 +1,10 @@ package FS::part_pkg::flat; use strict; -use vars qw(@ISA %info); +use vars qw( @ISA %info + %usage_fields %usage_recharge_fields + @usage_fieldorder @usage_recharge_fieldorder + ); use Tie::IxHash; #use FS::Record qw(qsearch); use FS::UI::bytecount; @@ -14,30 +17,8 @@ tie my %temporalities, 'Tie::IxHash', 'preceding' => "Preceding (past)", ; -%info = ( - 'name' => 'Flat rate (anniversary billing)', - 'shortname' => 'Anniversary', - 'fields' => { - 'setup_fee' => { 'name' => 'Setup fee for this package', - 'default' => 0, - }, - 'recur_fee' => { 'name' => 'Recurring fee for this package', - 'default' => 0, - }, - - #false laziness w/voip_cdr.pm - 'recur_temporality' => { 'name' => 'Charge recurring fee for period', - 'type' => 'select', - 'select_options' => \%temporalities, - }, +%usage_fields = ( - 'unused_credit' => { 'name' => 'Credit the customer for the unused portion'. - ' of service at cancellation', - 'type' => 'checkbox', - }, - 'externalid' => { 'name' => 'Optional External ID', - 'default' => '', - }, 'seconds' => { 'name' => 'Time limit for this package', 'default' => '', 'check' => sub { shift =~ /^\d*$/ }, @@ -60,6 +41,10 @@ tie my %temporalities, 'Tie::IxHash', 'format' => \&FS::UI::bytecount::display_bytecount, 'parse' => \&FS::UI::bytecount::parse_bytecount, }, +); + +%usage_recharge_fields = ( + 'recharge_amount' => { 'name' => 'Cost of recharge for this package', 'default' => '', 'check' => sub { shift =~ /^\d*(\.\d{2})?$/ }, @@ -94,13 +79,46 @@ tie my %temporalities, 'Tie::IxHash', 'package recharge', 'type' => 'checkbox', }, +); + +@usage_fieldorder = qw( seconds upbytes downbytes totalbytes ); +@usage_recharge_fieldorder = qw( + recharge_amount recharge_seconds recharge_upbytes + recharge_downbytes recharge_totalbytes + usage_rollover recharge_reset +); + +%info = ( + 'name' => 'Flat rate (anniversary billing)', + 'shortname' => 'Anniversary', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_fee' => { 'name' => 'Recurring fee for this package', + 'default' => 0, + }, + + #false laziness w/voip_cdr.pm + 'recur_temporality' => { 'name' => 'Charge recurring fee for period', + 'type' => 'select', + 'select_options' => \%temporalities, + }, + + %usage_fields, + %usage_recharge_fields, + + 'unused_credit' => { 'name' => 'Credit the customer for the unused portion'. + ' of service at cancellation', + 'type' => 'checkbox', + }, + 'externalid' => { 'name' => 'Optional External ID', + 'default' => '', + }, }, - 'fieldorder' => [qw( setup_fee recur_fee recur_temporality unused_credit - seconds upbytes downbytes totalbytes - recharge_amount recharge_seconds recharge_upbytes - recharge_downbytes recharge_totalbytes - usage_rollover recharge_reset externalid - ) + 'fieldorder' => [ qw( setup_fee recur_fee recur_temporality unused_credit ), + @usage_fieldorder, @usage_recharge_fieldorder, + qw( externalid ), ], 'weight' => 10, );