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/validate_password_js.html', &>
22 <& elements/edit.html,
23 'name_singular' => 'customer contacts', #yes, we're editing all of them
24 'table' => 'cust_main',
25 'post_url' => popurl(1). 'process/cust_main-contacts.html',
26 'no_pkey_display' => 1,
28 'contactnum' => ' ', #'Contact',
29 #'locationnum' => ' ',
32 { 'field' => 'contactnum',
35 'custnum' => $custnum,
36 'm2m_method' => 'cust_contact',
37 'm2m_dstcol' => 'contactnum',
38 'm2_label' => ' ', #'Contact',
39 'm2_error_callback' => $m2_error_callback,
42 #'new_callback' => $new_callback,
43 #'edit_callback' => $edit_callback,
44 #'error_callback' => $error_callback,
46 'html_table_class' => 'fsinnerbox',
47 'menubar' => [], #remove "view all" link
49 #XXX it would be nice if this could instead be after the error but before
51 'html_init' => include('/elements/small_custview.html',
53 $conf->config('countrydefault') || 'US',
60 my $curuser = $FS::CurrentUser::CurrentUser;
61 my $conf = new FS::Conf;
63 if ( $cgi->param('redirect') ) {
64 my $session = $cgi->param('redirect');
65 my $pref = $curuser->option("redirect$session");
66 die "unknown redirect session $session\n" unless length($pref);
67 $cgi = new CGI($pref);
71 if ( $cgi->param('error') ) {
72 $custnum = scalar($cgi->param('custnum'));
75 unless $curuser->access_right(($custnum ? 'Edit' : 'New'). ' customer'); #contacts?
77 } elsif ( $cgi->keywords ) { #editing
78 $custnum = ($cgi->keywords)[0];
81 unless $curuser->access_right('Edit customer');
83 } else { #new customer
85 #this doesn't really work here, we're an edit only
86 die "guru meditation #32";
89 unless $curuser->access_right('New customer');
93 #my $new_callback = sub {
94 # my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_;
97 #my $edit_callback = sub {
98 # my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_;
101 #my $error_callback = sub {
102 # my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_;
105 my $m2_error_callback = sub {
106 my($cgi, $object) = @_;
108 #process_o2m fields in process/cust_main-contacts.html
109 my @fields = FS::contact->cgi_contact_fields;
110 my @gfields = ( '', map "_$_", @fields );
113 if ( /^contactnum(\d+)$/ ) {
115 if ( grep $cgi->param("contactnum$num$_"), @gfields ) {
116 my $x = new FS::contact {
117 'contactnum' => scalar($cgi->param("contactnum$num")),
118 map { $_ => scalar($cgi->param("contactnum${num}_$_")) } @fields,