From 77def6c1c51fc6f7273b7c23221f13850d6be1dd Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 12 Aug 2001 00:07:55 +0000 Subject: [PATCH 1/1] use transactional invoice_list setting & eliminate non-sticky "first package"! --- httemplate/edit/cust_main.cgi | 31 +++++++------ httemplate/edit/process/cust_main.cgi | 85 +++++++---------------------------- 2 files changed, 32 insertions(+), 84 deletions(-) diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 2941acdf3..f331e5321 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,11 +1,12 @@ <% -# +# use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip $daytime $night $fax @invoicing_list $invoicing_list $payinfo $payname %payby %paybychecked $refnum $otaker $r ); -use vars qw ( $conf $pkgpart $username $password $popnum $ulen $ulen2 ); +use vars qw ( $conf $saved_pkgpart $username $password $popnum $ulen $ulen2 ); +use vars qw ( $error ); #use CGI::Switch; use CGI; use CGI::Carp qw(fatalsToBrowser); @@ -32,16 +33,18 @@ $conf = new FS::Conf; #get record +$error = ''; if ( $cgi->param('error') ) { + $error = $cgi->param('error'); $cust_main = new FS::cust_main ( { map { $_, scalar($cgi->param($_)) } fields('cust_main') } ); $custnum = $cust_main->custnum; - $pkgpart = $cgi->param('pkgpart_svcpart') || ''; - if ( $pkgpart =~ /^(\d+)_/ ) { - $pkgpart = $1; + $saved_pkgpart = $cgi->param('pkgpart_svcpart') || ''; + if ( $saved_pkgpart =~ /^(\d+)_/ ) { + $saved_pkgpart = $1; } else { - $pkgpart = ''; + $saved_pkgpart = ''; } $username = $cgi->param('username'); $password = $cgi->param('_password'); @@ -51,7 +54,7 @@ if ( $cgi->param('error') ) { $query =~ /^(\d+)$/; $custnum=$1; $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); - $pkgpart = 0; + $saved_pkgpart = 0; $username = ''; $password = ''; $popnum = 0; @@ -59,20 +62,20 @@ if ( $cgi->param('error') ) { $custnum=''; $cust_main = new FS::cust_main ( {} ); $cust_main->setfield('otaker',&getotaker); - $pkgpart = 0; + $saved_pkgpart = 0; $username = ''; $password = ''; $popnum = 0; } +$cgi->delete_all(); $action = $custnum ? 'Edit' : 'Add'; # top $p1 = popurl(1); print $cgi->header( '-expires' => 'now' ), header("Customer $action", ''); -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); +print qq!Error: !, $error, "" + if $error; print qq!
!, qq!!, @@ -210,7 +213,7 @@ print <Service address ', - '(ship_last ) { print ' CHECKED'; foreach ( @@ -369,7 +372,7 @@ unless ( $custnum ) { #false laziness, copied from FS::cust_pkg::order my $pkgpart; if ( scalar(@agents) == 1 ) { - # $pkgpart->{PKGPART} is true iff $custnum may purchase $pkgpart + # $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART my($agent)=qsearchs('agent',{'agentnum'=> $agentnum }); $pkgpart = $agent->pkgpart_hashref; } else { @@ -397,7 +400,7 @@ unless ( $custnum ) { print qq!