X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fglobal_Mixin.pm;h=31d178d8cd3bcdb823a33a5f79d4972f11f31d5a;hb=c894ab1b3132128b297d7fb556882c1753ef80ec;hp=899e73abc4767e70b099196e6f6ccb9d33285091;hpb=d03ab0df1ccbd3bdf54b3a85391879906d499097;p=freeside.git diff --git a/FS/FS/part_pkg/global_Mixin.pm b/FS/FS/part_pkg/global_Mixin.pm index 899e73abc..31d178d8c 100644 --- a/FS/FS/part_pkg/global_Mixin.pm +++ b/FS/FS/part_pkg/global_Mixin.pm @@ -14,16 +14,35 @@ tie my %a2billing_simultaccess, 'Tie::IxHash', ( 1 => 'Enabled', ); +# much false laziness with FS::Record::ut_money +sub validate_moneyn { + my ($option, $valref) = @_; + if ( $$valref eq '' ) { + return ''; + } elsif ( $$valref =~ /^\s*(\-)?\s*(\d*)(\.\d{1})\s*$/ ) { + #handle one decimal place without barfing out + $$valref = ( ($1||''). ($2||''). ($3.'0') ) || 0; + } elsif ( $$valref =~ /^\s*(\-)?\s*(\d*)(\.\d{2})?\s*$/ ) { + $$valref = ( ($1||''). ($2||''). ($3||'') ) || 0; + } else { + return "Illegal (money) $option: ". $$valref; + } + return ''; +} + + %info = ( 'disabled' => 1, 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, + 'validate' => \&validate_moneyn, }, 'recur_fee' => { 'name' => 'Recurring fee for this package', 'default' => 0, + 'validate' => \&validate_moneyn, }, 'unused_credit_cancel' => { 'name' => 'Credit the customer for the unused portion of service at '. @@ -40,6 +59,10 @@ tie my %a2billing_simultaccess, 'Tie::IxHash', ( 'changing packages', 'type' => 'checkbox', }, + 'delay_cancel' => { + 'name' => 'Automatic suspension period before cancelling (configuration setting part_pkg-delay_cancel-days)', + 'type' => 'checkbox', + }, # miscellany--maybe put this in a separate module? @@ -65,17 +88,61 @@ tie my %a2billing_simultaccess, 'Tie::IxHash', ( 'type' => 'select', 'select_options' => \%a2billing_simultaccess, }, - }, + 'a2billing_carrier_cost_min' => { + 'name' => 'A2Billing inbound carrier cost', + 'display_if' => sub { + FS::part_export->count("exporttype = 'a2billing'") > 0; + }, + }, + 'a2billing_carrer_initblock_offp' => { + 'name' => 'A2Billing inbound carrier min duration', + 'display_if' => sub { + FS::part_export->count("exporttype = 'a2billing'") > 0; + }, + }, + 'a2billing_carrier_increment_offp' => { + 'name' => 'A2Billing inbound carrier billing block', + 'display_if' => sub { + FS::part_export->count("exporttype = 'a2billing'") > 0; + }, + }, + 'a2billing_retail_cost_min_offp' => { + 'name' => 'A2Billing inbound retail cost', + 'display_if' => sub { + FS::part_export->count("exporttype = 'a2billing'") > 0; + }, + }, + 'a2billing_retail_initblock_offp' => { + 'name' => 'A2Billing inbound retail min duration', + 'display_if' => sub { + FS::part_export->count("exporttype = 'a2billing'") > 0; + }, + }, + 'a2billing_retail_increment_offp' => { + 'name' => 'A2Billing inbound retail billing block', + 'display_if' => sub { + FS::part_export->count("exporttype = 'a2billing'") > 0; + }, + }, + + }, 'fieldorder' => [ qw( setup_fee recur_fee unused_credit_cancel unused_credit_suspend unused_credit_change + delay_cancel a2billing_tariff a2billing_type a2billing_simultaccess + a2billing_carrier_cost_min + a2billing_carrer_initblock_offp + a2billing_carrier_increment_offp + a2billing_retail_cost_min_offp + a2billing_retail_initblock_offp + a2billing_retail_increment_offp )], );