} fields('cust_main')
} );
+$new->invoice_noemail( ($cgi->param('invoice_email') eq 'Y') ? '' : 'Y' );
+
$cgi->param('duplicate_of_custnum') =~ /^(\d+)$/;
my $duplicate_of = $1;
if ( $duplicate_of ) {
$new->tagnum( [ $cgi->param('tagnum') ] );
-my %usedatetime = ( 'birthdate' => 1 );
+my %usedatetime = ( 'birthdate' => 1,
+ 'spouse_birthdate' => 1,
+ );
-foreach my $dfield (qw( birthdate signupdate )) {
+foreach my $dfield (qw( birthdate spouse_birthdate signupdate )) {
if ( $cgi->param($dfield) && $cgi->param($dfield) =~ /^([ 0-9\-\/]{0,10})$/) {
my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
my @tax_exempt = grep { $cgi->param("tax_$_") eq 'Y' } @exempt_groups;
+my %tax_exempt = map { $_ => scalar($cgi->param("tax_$_".'_num')) } @tax_exempt;
#perhaps this stuff should go to cust_main.pm
if ( $new->custnum eq '' or $duplicate_of ) {
else {
# create the customer
$error ||= $new->insert( \%hash, \@invoicing_list,
- 'tax_exemption'=> \@tax_exempt,
+ 'tax_exemption'=> \%tax_exempt,
'prospectnum' => scalar($cgi->param('prospectnum')),
);
local($FS::Record::DEBUG) = $DEBUG if $DEBUG;
$error ||= $new->replace( $old, \@invoicing_list,
- 'tax_exemption' => \@tax_exempt,
+ 'tax_exemption' => \%tax_exempt,
);
warn "$me returned from replace" if $DEBUG;
}
+unless ( $error ) { #XXX i guess i should be transactional... all in the insert
+ # or replace call
+ my @contact_fields = qw( classnum first last title comment emailaddress );
+ foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) {
+ push @contact_fields, 'phonetypenum'.$phone_type->phonetypenum;
+ }
+
+ $error = $new->process_o2m( 'table' => 'contact',
+ 'fields' => \@contact_fields,
+ 'params' => scalar($cgi->Vars),
+ );
+}
+
</%init>