3 Hmm, this is now entirely redundant with edit/cust_main/contacts_new.html, and
4 this one isn't being maintained well. :/
9 function checkPasswordValidation(fieldid) {
10 var validationResult = document.getElementById(fieldid+'_result').innerHTML;
11 if (validationResult.match(/Password valid!/)) {
20 <& elements/edit.html,
21 'name_singular' => 'customer contacts', #yes, we're editing all of them
22 'table' => 'cust_main',
23 'post_url' => popurl(1). 'process/cust_main-contacts.html',
24 'no_pkey_display' => 1,
26 'contactnum' => ' ', #'Contact',
27 #'locationnum' => ' ',
30 { 'field' => 'contactnum',
33 'custnum' => $custnum,
34 'm2m_method' => 'cust_contact',
35 'm2m_dstcol' => 'contactnum',
36 'm2_label' => ' ', #'Contact',
37 'm2_error_callback' => $m2_error_callback,
40 #'new_callback' => $new_callback,
41 #'edit_callback' => $edit_callback,
42 #'error_callback' => $error_callback,
44 'html_table_class' => 'fsinnerbox',
45 'menubar' => [], #remove "view all" link
47 #XXX it would be nice if this could instead be after the error but before
49 'html_init' => include('/elements/small_custview.html',
51 $conf->config('countrydefault') || 'US',
58 my $curuser = $FS::CurrentUser::CurrentUser;
59 my $conf = new FS::Conf;
62 if ( $cgi->param('error') ) {
63 $custnum = scalar($cgi->param('custnum'));
66 unless $curuser->access_right(($custnum ? 'Edit' : 'New'). ' customer'); #contacts?
68 } elsif ( $cgi->keywords ) { #editing
69 $custnum = ($cgi->keywords)[0];
72 unless $curuser->access_right('Edit customer');
74 } else { #new customer
76 #this doesn't really work here, we're an edit only
77 die "guru meditation #32";
80 unless $curuser->access_right('New customer');
84 #my $new_callback = sub {
85 # my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_;
88 #my $edit_callback = sub {
89 # my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_;
92 #my $error_callback = sub {
93 # my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_;
96 my $m2_error_callback = sub {
97 my($cgi, $object) = @_;
99 #process_o2m fields in process/cust_main-contacts.html
100 my @fields = FS::contact->cgi_contact_fields;
101 my @gfields = ( '', map "_$_", @fields );
104 if ( /^contactnum(\d+)$/ ) {
106 if ( grep $cgi->param("contactnum$num$_"), @gfields ) {
107 my $x = new FS::contact {
108 'contactnum' => scalar($cgi->param("contactnum$num")),
109 map { $_ => scalar($cgi->param("contactnum${num}_$_")) } @fields,