Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / FS / FS / part_pkg / global_Mixin.pm
1 package FS::part_pkg::global_Mixin;
2
3 use strict;
4 use vars qw(%info);
5
6 use Tie::IxHash;
7 tie my %a2billing_types, 'Tie::IxHash', (
8   0 => 'Prepaid',
9   1 => 'Postpaid',
10 );
11
12 tie my %a2billing_simultaccess, 'Tie::IxHash', (
13   0 => 'Disabled',
14   1 => 'Enabled',
15 );
16
17 %info = (
18   'disabled' => 1,
19   'fields' => {
20     'setup_fee' => { 
21       'name' => 'Setup fee for this package',
22       'default' => 0,
23     },
24     'recur_fee' => { 
25       'name' => 'Recurring fee for this package',
26       'default' => 0,
27     },
28     'unused_credit_cancel' => {
29       'name' => 'Credit the customer for the unused portion of service at '.
30                  'cancellation',
31       'type' => 'checkbox',
32     },
33     'unused_credit_suspend' => {
34       'name' => 'Credit the customer for the unused portion of service when '.
35                 'suspending',
36       'type' => 'checkbox',
37     },
38     'unused_credit_change' => {
39       'name' => 'Credit the customer for the unused portion of service when '.
40                 'changing packages',
41       'type' => 'checkbox',
42     },
43
44     # miscellany--maybe put this in a separate module?
45
46     'a2billing_tariff' => {
47       'name'        => 'A2Billing tariff group ID',
48       'display_if'  => sub {
49         FS::part_export->count("exporttype = 'a2billing'") > 0;
50       }
51     },
52     'a2billing_type' => {
53       'name'        => 'A2Billing card type',
54       'display_if'  => sub {
55         FS::part_export->count("exporttype = 'a2billing'") > 0;
56       },
57       'type'        => 'select',
58       'select_options' => \%a2billing_types,
59     },
60     'a2billing_simultaccess' => {
61       'name'        => 'A2Billing Simultaneous Access',
62       'display_if'  => sub {
63         FS::part_export->count("exporttype = 'a2billing'") > 0;
64       },
65       'type'        => 'select',
66       'select_options' => \%a2billing_simultaccess,
67     },  
68   },
69   'fieldorder' => [ qw(
70     setup_fee
71     recur_fee
72     unused_credit_cancel
73     unused_credit_suspend
74     unused_credit_change
75
76     a2billing_tariff
77     a2billing_type
78     a2billing_simultaccess
79   )],
80 );
81
82 1;