X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprospect_main.html;h=8ae76a9a10e2c8a388ff20f48f89ec2421707576;hb=7b125e587a4d1ee0aca692e23ea7897f671855ae;hp=c4123a078cd3b5bd06cbfe2b25a39fb6bb4f22a6;hpb=03ceab71dad1e5eb366865d304e5e459cc905ce4;p=freeside.git diff --git a/httemplate/edit/prospect_main.html b/httemplate/edit/prospect_main.html index c4123a078..8ae76a9a1 100644 --- a/httemplate/edit/prospect_main.html +++ b/httemplate/edit/prospect_main.html @@ -18,11 +18,16 @@ { 'field' => 'contactnum', 'type' => 'contact', 'colspan' => 6, - #actually o2m, but this seems to be working for edit so far - 'm2name_table' => 'contact', - 'm2name_namecol' => 'contactnum', - 'm2_label' => 'Contact', - 'm2_error_callback' => sub { my($cgi, $object) = @_; (); }, #XXX + ##actually o2m, but this seems to be working for edit so far + #'m2name_table' => 'contact', + #'m2name_namecol' => 'contactnum', + #'m2_label' => 'Contact', + #'m2_error_callback' => $m2_error_callback, + + 'o2m_table' => 'contact', + 'm2_label' => 'Contact', + 'm2_error_callback' => $m2_error_callback, + }, { 'field' => 'locationnum', 'type' => 'select-cust_location', @@ -78,6 +83,33 @@ my $error_callback = sub { $prospect_main->set('locationnum', $locationnum); }; +my $m2_error_callback = sub { + my($cgi, $object) = @_; + + #process_o2m fields in process/prospect_main.html + my @fields = qw( first last title comment ); + my @gfields = ( '', map "_$_", @fields ); + + map { + if ( /^contactnum(\d+)$/ ) { + my $num = $1; + if ( grep $cgi->param("contactnum$num$_"), @gfields ) { + my $x = new FS::contact { + 'contactnum' => $cgi->param("contactnum$num"), + map { $_ => scalar($cgi->param("contactnum${num}_$_")) } @fields, + }; + use Data::Dumper; warn Dumper $x; + $x; + } else { + (); + } + } else { + (); + } + } + $cgi->param; +}; + my @agentnums = $FS::CurrentUser::CurrentUser->agentnums;