1 <% include( 'elements/process.html',
3 'viewall_dir' => 'browse',
4 'precheck_callback' => $precheck_callback,
10 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
12 my $precheck_callback = sub {
15 if ( $cgi->param('_type') eq 'Select discount type' ) {
16 return 'Please select a discount type';
17 } elsif ( $cgi->param('_type') eq 'Amount' ) {
18 $cgi->param('percent', '0');
19 return 'Amount must be greater than 0' unless $cgi->param('amount') > 0;
20 } elsif ( $cgi->param('_type') eq 'Percentage' ) {
21 $cgi->param('amount', '0.00');
22 return 'Percentage must be greater than 0' unless $cgi->param('percent') > 0;