1 package FS::part_pkg::flat_comission_pkg;
4 use vars qw(@ISA %info);
5 #use FS::Record qw(qsearch qsearchs);
6 use FS::part_pkg::flat;
8 @ISA = qw(FS::part_pkg::flat);
11 'name' => 'Flat rate with recurring commission per (selected) active package',
12 'shortname' => 'Commission per (selected) active package',
13 'inherit_fields' => [ 'flat_comission', 'global_Mixin' ],
15 'comission_pkgpart' => { 'name' => 'Applicable packages<BR><FONT SIZE="-1">(hold <b>ctrl</b> to select multiple packages)</FONT>',
16 'type' => 'select_multiple',
17 'select_table' => 'part_pkg',
18 'select_hash' => { 'disabled' => '' } ,
19 'select_key' => 'pkgpart',
20 'select_label' => 'pkg',
23 'fieldorder' => [ 'comission_depth', 'comission_amount', 'comission_pkgpart', 'reason_type' ],
24 #'setup' => 'what.setup_fee.value',
25 #'recur' => '""; var pkgparts = ""; for ( var c=0; c < document.flat_comission_pkg.comission_pkgpart.options.length; c++ ) { if (document.flat_comission_pkg.comission_pkgpart.options[c].selected) { pkgparts = pkgparts + document.flat_comission_pkg.comission_pkgpart.options[c].value + \', \'; } } what.recur.value = \'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar( grep { my $pkgpart = $_->pkgpart; grep { $_ == $pkgpart } ( \' + pkgparts + \' ) } $cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'',
30 # XXX this needs to be fixed!!!
32 my($self, $cust_pkg ) = @_;
33 $self->option('recur_fee');
36 sub can_discount { 0; }