diff options
author | jeff <jeff> | 2006-10-18 23:07:08 +0000 |
---|---|---|
committer | jeff <jeff> | 2006-10-18 23:07:08 +0000 |
commit | 52281cbeaf8d4e02345eca3c1aa0500133823558 (patch) | |
tree | c0174e1f4b9fb952c7976db92d464b74d82cf11f /httemplate/edit/process | |
parent | 609fe46a015c92be8a93c1b05a2fb67133bfd22b (diff) |
suspension and cancellation reasons
Diffstat (limited to 'httemplate/edit/process')
-rwxr-xr-x | httemplate/edit/process/part_bill_event.cgi | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi index 4811d9c9b..dd5cd0c8e 100755 --- a/httemplate/edit/process/part_bill_event.cgi +++ b/httemplate/edit/process/part_bill_event.cgi @@ -1,5 +1,4 @@ % -% %my $eventpart = $cgi->param('eventpart'); % %my $old = qsearchs('part_bill_event',{'eventpart'=>$eventpart}) if $eventpart; @@ -29,17 +28,51 @@ % $cgi->param('eventcode', $eventcode); % $cgi->param('plandata', $plandata); % -% my $new = new FS::part_bill_event ( { -% map { -% $_, scalar($cgi->param($_)); -% } fields('part_bill_event'), -% } ); -% -% if ( $eventpart ) { -% $error = $new->replace($old); -% } else { -% $error = $new->insert; -% $eventpart = $new->getfield('eventpart'); +% my $rnum; +% my $rtype; +% my $reasonm; +% if ($eventcode =~ /cancel/) { +% $cgi->param('creason') =~ /^(-?\d+)$/ || die "Invalid creason"; +% $rnum = $1; +% if ($rnum == -1) { +% $cgi->param('newcreasonT') =~ /^(\d+)$/ || die "Invalid newcreasonT"; +% $rtype = $1; +% $cgi->param('newcreason') =~ /^([\s\w]+)$/ || die "Invalid newcreasonT"; +% $reasonm = $1; +% } +% } +% if ($eventcode =~ /suspend/) { +% $cgi->param('sreason') =~ /^(-?\d+)$/ || die "Invalid sreason"; +% $rnum = $1; +% if ($rnum == -1) { +% $cgi->param('newsreasonT') =~ /^(\d+)$/ || die "Invalid newsreasonT"; +% $rtype = $1; +% $cgi->param('newsreason') =~ /^([\s\w]+)$/ || die "Invalid newsreasonT"; +% $reasonm = $1; +% } +% } +% +% if ($rnum == -1 && !$error) { +% my $reason = new FS::reason ({ 'reason' => $reasonm, +% 'reason_type' => $rtype, +% }); +% $error = $reason->insert or $rnum = $reason->reasonnum; +% } +% +% unless($error){ +% my $new = new FS::part_bill_event ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('part_bill_event'), +% } ); +% $new->setfield('reason', $rnum); +% +% if ( $eventpart ) { +% $error = $new->replace($old); +% } else { +% $error = $new->insert; +% $eventpart = $new->getfield('eventpart'); +% } % } %} % |