[freeside-commits] freeside/httemplate/edit/process qual.cgi, 1.5, 1.6
Ivan,,,
ivan at wavetail.420.am
Sun Mar 13 11:56:05 PDT 2011
Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail.420.am:/tmp/cvs-serv3526/httemplate/edit/process
Modified Files:
qual.cgi
Log Message:
qualification address handling changes, RT#7111
Index: qual.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/qual.cgi,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- qual.cgi 12 Mar 2011 21:13:34 -0000 1.5
+++ qual.cgi 13 Mar 2011 18:56:03 -0000 1.6
@@ -45,14 +45,18 @@
my $error = '';
my $cust_location = '';
-if ( $locationnum == -1 ) { # adding a new one
-
- $cust_location = new FS::cust_location {
- $cust_or_prospect."num" => $custnum_or_prospectnum,
+my %location_hash = (
map { $_ => scalar($cgi->param($_)) }
qw( address1 address2 city county state zip country geocode ),
grep scalar($cgi->param($_)),
qw( location_type location_number location_kind )
+);
+
+if ( $locationnum == -1 ) { # adding a new one
+
+ $cust_location = new FS::cust_location {
+ $cust_or_prospect."num" => $custnum_or_prospectnum,
+ %location_hash,
};
#locationnum '': default service location
@@ -62,15 +66,21 @@
#locationnum -2: address not required for qual
} elsif ( $locationnum == -2 && $phonenum eq '' ) {
$error = "Nothing to qualify - neither phone number nor address specified";
+
+} else { #existing location, possibly with an edit
+ $cust_location = qsearchs('cust_location', { 'locationnum'=>$locationnum })
+ or die "Unknown locationnum $locationnum";
+ $cust_location->$_($location_hash{$_}) foreach keys %location_hash;
}
my $qual = new FS::qual {
'status' => 'N',
};
$qual->phonenum($phonenum) if $phonenum ne '';
+#$qual->locationnum($locationnum) if $locationnum > 0;
+$qual->exportnum($exportnum) if $exportnum > 0;
$qual->set( $cust_or_prospect."num" => $custnum_or_prospectnum )
unless $locationnum == -1 || $locationnum > 0;
-$qual->exportnum($exportnum) if $exportnum > 0;
$error ||= $qual->insert( 'cust_location' => $cust_location );
More information about the freeside-commits
mailing list