X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcommission_schedule.html;fp=httemplate%2Fedit%2Fcommission_schedule.html;h=c76a3618e17a8c2d945486404be08567bb4106ae;hb=cf54023e010df76e0c39ac70902877d7c4c94c6e;hp=0000000000000000000000000000000000000000;hpb=d7759b49c2ff3b220ab328767645bfed85d18f31;p=freeside.git diff --git a/httemplate/edit/commission_schedule.html b/httemplate/edit/commission_schedule.html new file mode 100644 index 000000000..c76a3618e --- /dev/null +++ b/httemplate/edit/commission_schedule.html @@ -0,0 +1,53 @@ +<& elements/edit.html, + name_singular => 'schedule', + table => 'commission_schedule', + viewall_dir => 'browse', + fields => [ 'schedulename', + { field => 'reasonnum', + type => 'select-reason', + reason_class => 'R', + }, + { field => 'basis', + type => 'select', + options => [ keys %FS::commission_schedule::basis_options ], + labels => { %FS::commission_schedule::basis_options }, + }, + { type => 'tablebreak-tr-title', value => 'Billing cycles' }, + { field => 'commissionratenum', + type => 'commission_rate', + o2m_table => 'commission_rate', + m2_label => ' ', + m2_error_callback => $m2_error_callback, + colspan => 2, + }, + ], + labels => { 'schedulenum' => '', + 'schedulename' => 'Name', + 'basis' => 'Based on', + 'commissionratenum' => '', + }, +&> +<%init> + +my $m2_error_callback = sub { + my ($cgi, $object) = @_; + + my @rates; + foreach my $k ( grep /^commissionratenum\d+/, $cgi->param ) { + my $num = $cgi->param($k); + my $cycle = $cgi->param($k.'_cycle'); + my $amount = $cgi->param($k.'_amount'); + my $percent = $cgi->param($k.'_percent'); + if ($cycle > 0) { + push @rates, FS::commission_rate->new({ + 'commissionratenum' => $num, + 'cycle' => $cycle, + 'amount' => $amount, + 'percent' => $percent, + }); + } + } + @rates; +}; + +