diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2018-05-30 12:32:48 -0700 | 
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2018-05-30 12:32:48 -0700 | 
| commit | ec61d63e707e874ae5ba606accb192dfb6b5ef82 (patch) | |
| tree | eafaf790c9735eb4eee878ab5bb8159ff80159d7 /FS/FS | |
| parent | efdfd4f1dc1ad957c9aa9d4aca0d8d0f2f49806d (diff) | |
| parent | a7f520e2c78a791d32f62eacfbfef025ba7f1bc4 (diff) | |
Merge branch 'FREESIDE_3_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_3_BRANCH
Diffstat (limited to 'FS/FS')
| -rw-r--r-- | FS/FS/ClientAPI/MasonComponent.pm | 1 | ||||
| -rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 1 | ||||
| -rw-r--r-- | FS/FS/Conf.pm | 8 | ||||
| -rw-r--r-- | FS/FS/UI/Web.pm | 4 | ||||
| -rw-r--r-- | FS/FS/cust_main/Billing.pm | 3 | ||||
| -rw-r--r-- | FS/FS/cust_main/Billing_Realtime.pm | 20 | ||||
| -rw-r--r-- | FS/FS/part_pkg.pm | 17 | ||||
| -rw-r--r-- | FS/FS/part_pkg/voip_cdr.pm | 8 | ||||
| -rw-r--r-- | FS/FS/pay_batch/RBC.pm | 8 | ||||
| -rwxr-xr-x | FS/FS/svc_broadband.pm | 2 | 
10 files changed, 54 insertions, 18 deletions
| diff --git a/FS/FS/ClientAPI/MasonComponent.pm b/FS/FS/ClientAPI/MasonComponent.pm index 3a4bfe133..d615c271c 100644 --- a/FS/FS/ClientAPI/MasonComponent.pm +++ b/FS/FS/ClientAPI/MasonComponent.pm @@ -63,6 +63,7 @@ my %session_callbacks = (        'process-skip_first' => $conf->exists('selfservice_process-skip_first'),        'num_payments'       => scalar($cust_main->cust_pay),         'surcharge_percentage' => scalar($conf->config('credit-card-surcharge-percentage', $cust_main->agentnum)), +      'surcharge_flatfee'  => scalar($conf->config('credit-card-surcharge-flatfee', $cust_main->agentnum)),      );      @$argsref = ( %args ); diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index d604491af..476ef0789 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -935,6 +935,7 @@ sub payment_info {    $return{paybatch} = $return{payunique};  #back compat    $return{credit_card_surcharge_percentage} = $conf->config('credit-card-surcharge-percentage', $cust_main->agentnum); +  $return{credit_card_surcharge_flatfee} = $conf->config('credit-card-surcharge-flatfee', $cust_main->agentnum);    return { 'error' => '',             %return, diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index c58ca33f4..8b18a3c3c 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -887,6 +887,14 @@ my $validate_email = sub { $_[0] =~    },    { +    'key'         => 'credit-card-surcharge-flatfee', +    'section'     => 'credit_cards', +    'description' => 'Add a credit card surcharge to invoices, as a flat fee.', +    'type'        => 'text', +    'per_agent'   => 1, +  }, + +  {      'key'         => 'discount-show-always',      'section'     => 'billing',      'description' => 'Generate a line item on an invoice even when a package is discounted 100%', diff --git a/FS/FS/UI/Web.pm b/FS/FS/UI/Web.pm index 6d6f7fbb6..43a387227 100644 --- a/FS/FS/UI/Web.pm +++ b/FS/FS/UI/Web.pm @@ -739,7 +739,8 @@ use vars qw($DEBUG);  use Carp;  use Storable qw(nfreeze);  use MIME::Base64; -use JSON::XS; +#use JSON::XS;        ! maintainers deployed app breaking changes +use Cpanel::JSON::XS; # safe, compatible drop-in replacement  use FS::UID qw(getotaker);  use FS::Record qw(qsearchs);  use FS::queue; @@ -893,4 +894,3 @@ sub job_status {  }  1; - diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm index debff8a53..79a0c9ed1 100644 --- a/FS/FS/cust_main/Billing.pm +++ b/FS/FS/cust_main/Billing.pm @@ -1253,6 +1253,9 @@ sub _make_lines {          }      } +    $lineitems++ +    if $cust_pkg->waive_setup && $part_pkg->can('prorate_setup') && $part_pkg->prorate_setup($cust_pkg, $time); +      $cust_pkg->setfield('setup', $time)        unless $cust_pkg->setup;            #do need it, but it won't get written to the db diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm index 63ae777e6..ae41c70c4 100644 --- a/FS/FS/cust_main/Billing_Realtime.pm +++ b/FS/FS/cust_main/Billing_Realtime.pm @@ -358,16 +358,24 @@ sub realtime_bop {      if $conf->config('credit-card-surcharge-percentage', $self->agentnum)      && $options{method} eq 'CC'; +  my $cc_surcharge_flat = 0; +  $cc_surcharge_flat = $conf->config('credit-card-surcharge-flatfee', $self->agentnum) +    if $conf->config('credit-card-surcharge-flatfee', $self->agentnum) +    && $options{method} eq 'CC'; +    # always add cc surcharge if called from event  -  if($options{'cc_surcharge_from_event'} && $cc_surcharge_pct > 0) { -      $cc_surcharge = $options{'amount'} * $cc_surcharge_pct / 100; +  if($options{'cc_surcharge_from_event'} && ($cc_surcharge_pct > 0 || $cc_surcharge_flat > 0)) { +    if ($options{'amount'} > 0) { +      $cc_surcharge = ($options{'amount'} * ($cc_surcharge_pct / 100)) + $cc_surcharge_flat;        $options{'amount'} += $cc_surcharge;        $options{'amount'} = sprintf("%.2f", $options{'amount'}); # round (again)? +    }    } -  elsif($cc_surcharge_pct > 0) { # we're called not from event (i.e. from a  -                                 # payment screen), so consider the given  -				 # amount as post-surcharge -    $cc_surcharge = $options{'amount'} - ($options{'amount'} / ( 1 + $cc_surcharge_pct/100 )); +  elsif($cc_surcharge_pct > 0 || $cc_surcharge_flat > 0) { +    # we're called not from event (i.e. from a +    # payment screen), so consider the given +		# amount as post-surcharge +    $cc_surcharge = $options{'amount'} - (($options{'amount'} - $cc_surcharge_flat) / ( 1 + $cc_surcharge_pct/100 )) if $options{'amount'} > 0;    }    $cc_surcharge = sprintf("%.2f",$cc_surcharge) if $cc_surcharge > 0; diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 5f7c831bc..cad761498 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -671,11 +671,17 @@ sub check {  =item check_options -For a passed I<$options> hashref, validates any options that -have 'validate' subroutines defined in the info hash,  -then validates the entire hashref if the price plan has  -its own 'validate' subroutine defined in the info hash  -(I<$options> values might be altered.)   +Pass an I<$options> hashref that contains the values to be +inserted or updated for any FS::part_pkg::MODULE.pm. + +For each key in I<$options>, validates the value by calling +the 'validate' subroutine defined for that option e.g. +FS::part_pkg::MODULE::plan_info()->{$KEY}->{validate}.  The +option validation function is only called when the hashkey for +that option exists in I<$options>. + +Then the module validation function is called, from +FS::part_pkg::MODULE::plan_info()->{validate}  Returns error message, or empty string if valid. @@ -2201,4 +2207,3 @@ schema.html from the base documentation.  =cut  1; - diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index 2d8c359cf..7947a143d 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -371,6 +371,13 @@ tie my %accountcode_tollfree_field, 'Tie::IxHash',                       )                    ],    'weight' => 41, +  'validate' => sub { +    # Validation function for FS::part_pkg::check_options() +    my $options = shift; +    return "Please choose a Rate Plan for use with selected Rating Method" +      if $options->{rating_method} eq 'prefix' &&  !$options->{ratenum}; +    return; +  },  );  sub price_info { @@ -754,4 +761,3 @@ sub hide_svc_detail {  1; - diff --git a/FS/FS/pay_batch/RBC.pm b/FS/FS/pay_batch/RBC.pm index b0136786b..142c50b79 100644 --- a/FS/FS/pay_batch/RBC.pm +++ b/FS/FS/pay_batch/RBC.pm @@ -174,6 +174,11 @@ $name = 'RBC';        die "invalid branch/routing number '$aba'\n";      } +    ## set custname to business name if business checking or savings account is used otherwise leave as first and last name. +    my $custname = $cust_pay_batch->cust_main->first . ' ' . $cust_pay_batch->cust_main->last; +    $custname = $cust_pay_batch->cust_main->company +      if (($cust_pay_batch->cust_main->paytype eq "Business checking" || $cust_pay_batch->cust_main->paytype eq "Business savings") && $cust_pay_batch->cust_main->company); +      $i++;      sprintf("%06u", $i).      'D'. @@ -189,8 +194,7 @@ $name = 'RBC';      sprintf("%010.0f",$cust_pay_batch->amount*100).      '      '.      time2str("%Y%j", time + 86400). -    sprintf("%-30.30s", encode('utf8', $cust_pay_batch->cust_main->first . ' ' . -                     $cust_pay_batch->cust_main->last)). +    sprintf("%-30.30s", encode('utf8', $custname)).      'E'. # English      ' '.      sprintf("%-15s", $shortname). diff --git a/FS/FS/svc_broadband.pm b/FS/FS/svc_broadband.pm index 2cdc284d7..b94fc69e0 100755 --- a/FS/FS/svc_broadband.pm +++ b/FS/FS/svc_broadband.pm @@ -134,6 +134,7 @@ sub table_info {                           #select_table => 'radius_group',                           #select_key   => 'groupnum',                           #select_label => 'groupname', +                         disable_select => 1,                           disable_inventory => 1,                           multiple => 1,                         }, @@ -523,4 +524,3 @@ FS::part_svc, schema.html from the base documentation.  =cut  1; - | 
