2637729554bdbb94b8b619836d4579097d9f49c8
[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     'a2billing_carrier_cost_min' => {
69       'name'        => 'A2Billing inbound carrier cost',
70       'display_if'  => sub {
71         FS::part_export->count("exporttype = 'a2billing'") > 0;
72       },
73     },
74    'a2billing_carrer_initblock_offp' => {
75       'name'        => 'A2Billing inbound carrier min duration',
76       'display_if'  => sub {
77         FS::part_export->count("exporttype = 'a2billing'") > 0;
78       },
79     },
80     'a2billing_carrier_increment_offp' => {
81       'name'        => 'A2Billing inbound carrier billing block',
82       'display_if'  => sub {
83         FS::part_export->count("exporttype = 'a2billing'") > 0;
84       },
85     },
86     'a2billing_retail_cost_min_offp' => {
87       'name'        => 'A2Billing inbound retail cost',
88       'display_if'  => sub {
89         FS::part_export->count("exporttype = 'a2billing'") > 0;
90       },
91     },
92     'a2billing_retail_initblock_offp' => {
93       'name'        => 'A2Billing inbound retail min duration',
94       'display_if'  => sub {
95         FS::part_export->count("exporttype = 'a2billing'") > 0;
96       },
97     },
98     'a2billing_retail_increment_offp' => {
99       'name'        => 'A2Billing inbound retail billing block',
100       'display_if'  => sub {
101         FS::part_export->count("exporttype = 'a2billing'") > 0;
102      },
103    },
104
105  },
106   'fieldorder' => [ qw(
107     setup_fee
108     recur_fee
109     unused_credit_cancel
110     unused_credit_suspend
111     unused_credit_change
112
113     a2billing_tariff
114     a2billing_type
115     a2billing_simultaccess
116     a2billing_carrier_cost_min
117     a2billing_carrer_initblock_offp
118     a2billing_carrier_increment_offp
119     a2billing_retail_cost_min_offp
120     a2billing_retail_initblock_offp
121     a2billing_retail_increment_offp
122   )],
123 );
124
125 1;