1 package FS::part_pkg::usage_Mixin;
4 use vars qw( @ISA %info );
7 @ISA = qw(FS::part_pkg);
9 # Field definitions for time and data usage, other than CDRs.
14 'seconds' => { 'name' => 'Time limit for this package',
16 'check' => sub { shift =~ /^\d*$/ },
18 'upbytes' => { 'name' => 'Upload limit for this package',
20 'check' => sub { shift =~ /^\d*$/ },
21 'format' => \&FS::UI::bytecount::display_bytecount,
22 'parse' => \&FS::UI::bytecount::parse_bytecount,
24 'downbytes' => { 'name' => 'Download limit for this package',
26 'check' => sub { shift =~ /^\d*$/ },
27 'format' => \&FS::UI::bytecount::display_bytecount,
28 'parse' => \&FS::UI::bytecount::parse_bytecount,
30 'totalbytes' => { 'name' => 'Transfer limit for this package',
32 'check' => sub { shift =~ /^\d*$/ },
33 'format' => \&FS::UI::bytecount::display_bytecount,
34 'parse' => \&FS::UI::bytecount::parse_bytecount,
36 'recharge_amount' => { 'name' => 'Cost of recharge for this package',
38 'check' => sub { shift =~ /^\d*(\.\d{2})?$/ },
40 'recharge_seconds' => { 'name' => 'Recharge time for this package',
42 'check' => sub { shift =~ /^\d*$/ },
44 'recharge_upbytes' => { 'name' => 'Recharge upload for this package',
46 'check' => sub { shift =~ /^\d*$/ },
47 'format' => \&FS::UI::bytecount::display_bytecount,
48 'parse' => \&FS::UI::bytecount::parse_bytecount,
50 'recharge_downbytes' => { 'name' => 'Recharge download for this package',
52 'check' => sub { shift =~ /^\d*$/ },
53 'format' => \&FS::UI::bytecount::display_bytecount,
54 'parse' => \&FS::UI::bytecount::parse_bytecount,
56 'recharge_totalbytes' => { 'name' => 'Recharge transfer for this package',
58 'check' => sub { shift =~ /^\d*$/ },
59 'format' => \&FS::UI::bytecount::display_bytecount,
60 'parse' => \&FS::UI::bytecount::parse_bytecount,
62 'usage_rollover' => { 'name' => 'Allow usage from previous period to roll '.
63 ' over into current period',
66 'recharge_reset' => { 'name' => 'Reset usage to these values on manual '.
71 'fieldorder' => [ qw( seconds upbytes downbytes totalbytes
72 recharge_amount recharge_seconds recharge_upbytes
73 recharge_downbytes recharge_totalbytes
74 usage_rollover recharge_reset ) ],