X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fflat_comission_cust.pm;h=5db46585ebb2a4711eceddb94e83a39c88d0fd32;hb=ad7f49821d40ffd099a45acc32ba91e0e211aede;hp=4abe66ad2ca91ef11563709025079b3abf0bf30a;hpb=c8cccb4a92adceb943c635fe62dad0d034462ce0;p=freeside.git diff --git a/FS/FS/part_pkg/flat_comission_cust.pm b/FS/FS/part_pkg/flat_comission_cust.pm index 4abe66ad2..5db46585e 100644 --- a/FS/FS/part_pkg/flat_comission_cust.pm +++ b/FS/FS/part_pkg/flat_comission_cust.pm @@ -9,6 +9,7 @@ use FS::part_pkg::flat; %info = ( 'name' => 'Flat rate with recurring commission per active customer', + 'shortname' => 'Commission per active customer', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -26,8 +27,15 @@ use FS::part_pkg::flat; 'comission_depth' => { 'name' => 'Number of layers', 'default' => 1, }, + 'reason_type' => { 'name' => 'Reason type for commission credits', + 'type' => 'select_table', + 'select_table' => 'reason_type', + 'select_hash' => { 'class' => 'R' }, + 'select_key' => 'typenum', + 'select_label' => 'type', + }, }, - 'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit', 'comission_depth', 'comission_amount' ], + 'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit', 'comission_depth', 'comission_amount', 'reason_type' ], #'setup' => 'what.setup_fee.value', #'recur' => '\'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_main_ncancelled(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'', 'weight' => '60', @@ -45,11 +53,15 @@ sub calc_recur { if ( $amount && $num_active ) { my $error = - $cust_pkg->cust_main->credit( $amount*$num_active, "commission" ); + $cust_pkg->cust_main->credit( $amount*$num_active, "commission", + 'reason_type'=>$self->option('reason_type'), + ); die $error if $error; } $self->option('recur_fee'); } +sub can_discount { 0; } + 1;