1 package FS::part_pkg::global_Mixin;
7 tie my %a2billing_types, 'Tie::IxHash', (
12 tie my %a2billing_simultaccess, 'Tie::IxHash', (
17 # much false laziness with FS::Record::ut_money
19 my ($option, $valref) = @_;
20 if ( $$valref eq '' ) {
22 } elsif ( $$valref =~ /^\s*(\d*)(\.\d{1})\s*$/ ) {
23 #handle one decimal place without barfing out
24 $$valref = ( ($1||''). ($2.'0') ) || 0;
25 } elsif ( $$valref =~ /^\s*(\d*)(\.\d{2})?\s*$/ ) {
26 $$valref = ( ($1||''). ($2||'') ) || 0;
28 return "Illegal (money) $option: ". $$valref;
33 tie my %count_available_phones, 'Tie::IxHash', (
34 0 => 'Provisioned phone services',
35 1 => 'All available phone services',
42 'name' => 'Setup fee for this package',
44 'validate' => \&validate_moneyn,
47 'name' => 'Recurring fee for this package',
49 'validate' => \&validate_moneyn,
51 'unused_credit_cancel' => {
52 'name' => 'Credit the customer for the unused portion of service at '.
56 'unused_credit_suspend' => {
57 'name' => 'Credit the customer for the unused portion of service when '.
61 'unused_credit_change' => {
62 'name' => 'Credit the customer for the unused portion of service when '.
67 'name' => 'Automatic suspension period before cancelling (configuration setting part_pkg-delay_cancel-days)',
70 'count_available_phones' => { 'name' => 'Count taxable phone lines',
72 'options' => \%count_available_phones,
76 # miscellany--maybe put this in a separate module?
78 'a2billing_tariff' => {
79 'name' => 'A2Billing tariff group ID',
81 FS::part_export->count("exporttype = 'a2billing'") > 0;
85 'name' => 'A2Billing card type',
87 FS::part_export->count("exporttype = 'a2billing'") > 0;
90 'select_options' => \%a2billing_types,
92 'a2billing_simultaccess' => {
93 'name' => 'A2Billing Simultaneous Access',
95 FS::part_export->count("exporttype = 'a2billing'") > 0;
98 'select_options' => \%a2billing_simultaccess,
100 'a2billing_carrier_cost_min' => {
101 'name' => 'A2Billing inbound carrier cost',
102 'display_if' => sub {
103 FS::part_export->count("exporttype = 'a2billing'") > 0;
106 'a2billing_carrer_initblock_offp' => {
107 'name' => 'A2Billing inbound carrier min duration',
108 'display_if' => sub {
109 FS::part_export->count("exporttype = 'a2billing'") > 0;
112 'a2billing_carrier_increment_offp' => {
113 'name' => 'A2Billing inbound carrier billing block',
114 'display_if' => sub {
115 FS::part_export->count("exporttype = 'a2billing'") > 0;
118 'a2billing_retail_cost_min_offp' => {
119 'name' => 'A2Billing inbound retail cost',
120 'display_if' => sub {
121 FS::part_export->count("exporttype = 'a2billing'") > 0;
124 'a2billing_retail_initblock_offp' => {
125 'name' => 'A2Billing inbound retail min duration',
126 'display_if' => sub {
127 FS::part_export->count("exporttype = 'a2billing'") > 0;
130 'a2billing_retail_increment_offp' => {
131 'name' => 'A2Billing inbound retail billing block',
132 'display_if' => sub {
133 FS::part_export->count("exporttype = 'a2billing'") > 0;
138 'fieldorder' => [ qw(
142 unused_credit_suspend
146 count_available_phones
150 a2billing_simultaccess
151 a2billing_carrier_cost_min
152 a2billing_carrer_initblock_offp
153 a2billing_carrier_increment_offp
154 a2billing_retail_cost_min_offp
155 a2billing_retail_initblock_offp
156 a2billing_retail_increment_offp