import torrus 1.0.9
[freeside.git] / FS / FS / part_pkg / usage_Mixin.pm
1 package FS::part_pkg::usage_Mixin;
2
3 use strict;
4 use vars qw( @ISA %info );
5 use FS::part_pkg;
6 use FS::UI::bytecount;
7 @ISA = qw(FS::part_pkg);
8
9 # Field definitions for time and data usage, other than CDRs.
10
11 %info = (
12   'disabled' => 1,
13   'fields' => {
14     'seconds'       => { 'name' => 'Time limit for this package',
15                          'default' => '',
16                          'check' => sub { shift =~ /^\d*$/ },
17                        },
18     'upbytes'       => { 'name' => 'Upload limit for this package',
19                          'default' => '',
20                          'check' => sub { shift =~ /^\d*$/ },
21                          'format' => \&FS::UI::bytecount::display_bytecount,
22                          'parse' => \&FS::UI::bytecount::parse_bytecount,
23                        },
24     'downbytes'     => { 'name' => 'Download limit for this package',
25                          'default' => '',
26                          'check' => sub { shift =~ /^\d*$/ },
27                          'format' => \&FS::UI::bytecount::display_bytecount,
28                          'parse' => \&FS::UI::bytecount::parse_bytecount,
29                        },
30     'totalbytes'    => { 'name' => 'Transfer limit for this package',
31                          'default' => '',
32                          'check' => sub { shift =~ /^\d*$/ },
33                          'format' => \&FS::UI::bytecount::display_bytecount,
34                          'parse' => \&FS::UI::bytecount::parse_bytecount,
35                        },
36     'recharge_amount'       => { 'name' => 'Cost of recharge for this package',
37                          'default' => '',
38                          'check' => sub { shift =~ /^\d*(\.\d{2})?$/ },
39                        },
40     'recharge_seconds'      => { 'name' => 'Recharge time for this package',
41                          'default' => '',
42                          'check' => sub { shift =~ /^\d*$/ },
43                        },
44     'recharge_upbytes'      => { 'name' => 'Recharge upload for this package',
45                          'default' => '',
46                          'check' => sub { shift =~ /^\d*$/ },
47                          'format' => \&FS::UI::bytecount::display_bytecount,
48                          'parse' => \&FS::UI::bytecount::parse_bytecount,
49                        },
50     'recharge_downbytes'    => { 'name' => 'Recharge download for this package',
51                          'default' => '',
52                          'check' => sub { shift =~ /^\d*$/ },
53                          'format' => \&FS::UI::bytecount::display_bytecount,
54                          'parse' => \&FS::UI::bytecount::parse_bytecount,
55                        },
56     'recharge_totalbytes'   => { 'name' => 'Recharge transfer for this package',
57                          'default' => '',
58                          'check' => sub { shift =~ /^\d*$/ },
59                          'format' => \&FS::UI::bytecount::display_bytecount,
60                          'parse' => \&FS::UI::bytecount::parse_bytecount,
61                        },
62     'usage_rollover' => { 'name' => 'Allow usage from previous period to roll '.
63                                     ' over into current period',
64                           'type' => 'checkbox',
65                         },
66     'recharge_reset' => { 'name' => 'Reset usage to these values on manual '.
67                                     'package recharge',
68                           'type' => 'checkbox',
69                         },
70   },
71   'fieldorder' => [ qw( seconds upbytes downbytes totalbytes
72                         recharge_amount recharge_seconds recharge_upbytes
73                         recharge_downbytes recharge_totalbytes 
74                         usage_rollover recharge_reset ) ],
75 );
76
77 1;