X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fpart_event.html;h=481439d5302e0ff4ba89180dea03806ed6c9bf2a;hb=529413f23d545179ff07ac393713a225a78014c2;hp=6a8ddd1ea1ba9ffb471ec9ef51cac5923b2d9cff;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git diff --git a/httemplate/edit/process/part_event.html b/httemplate/edit/process/part_event.html index 6a8ddd1ea..481439d53 100644 --- a/httemplate/edit/process/part_event.html +++ b/httemplate/edit/process/part_event.html @@ -39,6 +39,7 @@ split(/\0/, $value) }; } elsif ( $info->{'type'} eq 'freq' ) { + $value = '0' if !length($value); $value .= $params->{$cgi_field.'_units'}; } @@ -81,8 +82,36 @@ length($actionfields{'reasonnum'}) == 0 ) { return 'Reason required'; } + if ( $cgi->param('_initialize') ) { + $cgi->param('disabled', 'Y'); + } + + my $balance_age_rx = qr/^(condition.+)\.balance_age\.age$/; + + foreach my $param ( keys %{ $cgi->Vars() } ){ + + next unless ( $param =~ /$balance_age_rx/ ); + next unless $cgi->param($1) eq 'balance_age'; + + my $errstr = FS::part_event::Condition::balance_age-> + check_options( { age => $cgi->param($param), + age_units => $cgi->param("${param}_units") } ); + + return $errstr if $errstr; + } + return ''; }, + 'noerror_callback' => sub { + my ($cgi, $new) = @_; + if ( $cgi->param('_initialize') ) { + my $job = new FS::queue { + 'job' => 'FS::part_event::process_initialize' + }; + my $error = $job->insert('eventpart' => $new->eventpart); + warn "error queueing job: $error\n" if $error; # can't do anything else + } + }, 'agent_virt' => 1, 'agent_null_right' => 'Edit global billing events',