1 <% include( 'elements/process.html',
3 'table' => 'part_event',
4 'viewall_dir' => 'browse',
7 'link_table' => 'part_event_condition',
8 'num_col' => 'eventpart',
9 'name_col' => 'conditionname',
10 'names_list' => [ FS::part_event_condition->all_conditionnames() ],
11 'param_style' => 'name_colN values',
12 'args_callback' => sub { # FS/FS/m2name_Common.pm
13 my( $object, $prefix, $params, $listref ) = @_;
14 #warn "$object $prefix $params $listref\n";
16 my $cond = $object->conditionname;
18 my %option_fields = $object->option_fields;
23 my $cgi_field = "$prefix$cond.$field";
25 my $value = $params->{$cgi_field};
27 my $info = $option_fields{$_};
28 $info = { label=>$info, type=>'text' }
31 if ( $info->{'type'} =~
32 /^(select|checkbox)-?multiple$/
33 or $info->{'type'} =~ /^select/
34 && $info->{'multiple'}
37 #special processing for compound fields
38 $value = { map { $_ => 1 }
41 } elsif ( $info->{'type'} eq 'freq' ) {
42 $value .= $params->{$cgi_field.'_units'};
45 #warn "value of $cgi_field is $value\n";
53 'args_callback' => sub {
55 my( $cgi, $object ) = @_;
57 my $prefix = $object->action.'.';
59 map { my $option = $_;
60 #my $value = scalar( $cgi->param( "$prefix$option" ) );
61 my $value = join(',', $cgi->param( "$prefix$option" ) );
63 if ( $option eq 'reasonnum' && $value == -1 ) {
65 'typenum' => scalar( $cgi->param( "new$prefix${option}T" ) ),
66 'reason' => scalar( $cgi->param( "new$prefix${option}" ) ),
70 ( $option => $value );
72 @{ $object->option_fields_listref };
75 'precheck_callback' => sub {
77 my $action = $cgi->param('action') or return;
78 my %actionfields = map { $_ =~ /^$action\.(.*)/; $1 => $cgi->param($_) }
79 grep { /^$action\./ } $cgi->param;
80 if ( exists($actionfields{'reasonnum'}) and
81 length($actionfields{'reasonnum'}) == 0 ) {
82 return 'Reason required';
88 'agent_null_right' => 'Edit global billing events',
94 unless $FS::CurrentUser::CurrentUser->access_right('Edit billing events')
95 || $FS::CurrentUser::CurrentUser->access_right('Edit global billing events');