diff options
author | ivan <ivan> | 2008-03-26 01:03:32 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-03-26 01:03:32 +0000 |
commit | 97eaeb6bd50c560ed8c0fe50b0605bd26c1f51ab (patch) | |
tree | 2a7b733fddfbd0288bb97f57e459cfa60f14d520 | |
parent | d980ecde67efa844cb36ec10c989e964a86d280e (diff) |
quick shortcut for easier adding of new 1.7-style invoice events
-rwxr-xr-x | httemplate/edit/part_bill_event.cgi | 2 | ||||
-rwxr-xr-x | httemplate/edit/process/part_bill_event.cgi | 32 |
2 files changed, 24 insertions, 10 deletions
diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 7b30d988d..3b6b06b92 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -22,7 +22,7 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> <TR> <TD ALIGN="right">For </TD> <TD> - <SELECT NAME="payby"> + <SELECT NAME="payby" <% $hashref->{eventpart} ? '' : 'MULTIPLE SIZE=7'%>> % tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname; % foreach my $payby ( keys %payby ) { % diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi index 3534519fd..eb0529bb8 100755 --- a/httemplate/edit/process/part_bill_event.cgi +++ b/httemplate/edit/process/part_bill_event.cgi @@ -72,21 +72,35 @@ if ( ! $cgi->param('plan_weight_eventcode') ) { $cgi->param('eventcode', $eventcode); $cgi->param('plandata', $plandata); - unless($error){ - my $new = new FS::part_bill_event ( { - map { - $_, scalar($cgi->param($_)); - } fields('part_bill_event'), - } ); - $new->setfield('reason', $rnum); + unless($error) { if ( $eventpart ) { + + my $new = new FS::part_bill_event ( { + map { $_ => scalar($cgi->param($_)) } + fields('part_bill_event'), + } ); + $new->setfield('reason' => $rnum); $error = $new->replace($old); + } else { - $error = $new->insert; - $eventpart = $new->getfield('eventpart'); + + foreach my $payby ( $cgi->param('payby') ) { + my $new = new FS::part_bill_event ( { + map { $_ => scalar($cgi->param($_)) } + grep { $_ ne 'payby' } + fields('part_bill_event') + } ); + $new->setfield('payby' => $payby); + $new->setfield('reason' => $rnum ); + $error = $new->insert; + last if $error; + } + } + } + } </%init> |