From: ivan Date: Wed, 26 Mar 2008 01:03:32 +0000 (+0000) Subject: quick shortcut for easier adding of new 1.7-style invoice events X-Git-Tag: freeside_1_7_3rc1~39 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=97eaeb6bd50c560ed8c0fe50b0605bd26c1f51ab;p=freeside.git quick shortcut for easier adding of new 1.7-style invoice events --- 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)" %> For - {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; + } + } + } + }