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;
38 'name' => 'Setup fee for this package',
40 'validate' => \&validate_moneyn,
43 'name' => 'Recurring fee for this package',
45 'validate' => \&validate_moneyn,
47 'unused_credit_cancel' => {
48 'name' => 'Credit the customer for the unused portion of service at '.
52 'unused_credit_suspend' => {
53 'name' => 'Credit the customer for the unused portion of service when '.
57 'unused_credit_change' => {
58 'name' => 'Credit the customer for the unused portion of service when '.
63 'name' => 'Automatic suspension period before cancelling (configuration setting part_pkg-delay_cancel-days)',
67 # miscellany--maybe put this in a separate module?
69 'a2billing_tariff' => {
70 'name' => 'A2Billing tariff group ID',
72 FS::part_export->count("exporttype = 'a2billing'") > 0;
76 'name' => 'A2Billing card type',
78 FS::part_export->count("exporttype = 'a2billing'") > 0;
81 'select_options' => \%a2billing_types,
83 'a2billing_simultaccess' => {
84 'name' => 'A2Billing Simultaneous Access',
86 FS::part_export->count("exporttype = 'a2billing'") > 0;
89 'select_options' => \%a2billing_simultaccess,
91 'a2billing_carrier_cost_min' => {
92 'name' => 'A2Billing inbound carrier cost',
94 FS::part_export->count("exporttype = 'a2billing'") > 0;
97 'a2billing_carrer_initblock_offp' => {
98 'name' => 'A2Billing inbound carrier min duration',
100 FS::part_export->count("exporttype = 'a2billing'") > 0;
103 'a2billing_carrier_increment_offp' => {
104 'name' => 'A2Billing inbound carrier billing block',
105 'display_if' => sub {
106 FS::part_export->count("exporttype = 'a2billing'") > 0;
109 'a2billing_retail_cost_min_offp' => {
110 'name' => 'A2Billing inbound retail cost',
111 'display_if' => sub {
112 FS::part_export->count("exporttype = 'a2billing'") > 0;
115 'a2billing_retail_initblock_offp' => {
116 'name' => 'A2Billing inbound retail min duration',
117 'display_if' => sub {
118 FS::part_export->count("exporttype = 'a2billing'") > 0;
121 'a2billing_retail_increment_offp' => {
122 'name' => 'A2Billing inbound retail billing block',
123 'display_if' => sub {
124 FS::part_export->count("exporttype = 'a2billing'") > 0;
129 'fieldorder' => [ qw(
133 unused_credit_suspend
139 a2billing_simultaccess
140 a2billing_carrier_cost_min
141 a2billing_carrer_initblock_offp
142 a2billing_carrier_increment_offp
143 a2billing_retail_cost_min_offp
144 a2billing_retail_initblock_offp
145 a2billing_retail_increment_offp