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,
27 'submit_id' => 'submit',
29 'contactnum' => ' ', #'Contact',
30 #'locationnum' => ' ',
33 { 'field' => 'contactnum',
36 'custnum' => $custnum,
37 'm2m_method' => 'cust_contact',
38 'm2m_dstcol' => 'contactnum',
39 'm2_label' => ' ', #'Contact',
40 'm2_error_callback' => $m2_error_callback,
43 #'new_callback' => $new_callback,
44 #'edit_callback' => $edit_callback,
45 #'error_callback' => $error_callback,
47 'html_table_class' => 'fsinnerbox',
48 'menubar' => [], #remove "view all" link
50 #XXX it would be nice if this could instead be after the error but before
52 'html_init' => include('/elements/small_custview.html',
54 $conf->config('countrydefault') || 'US',
61 my $curuser = $FS::CurrentUser::CurrentUser;
62 my $conf = new FS::Conf;
64 if ( $cgi->param('redirect') ) {
65 my $session = $cgi->param('redirect');
66 my $pref = $curuser->option("redirect$session");
67 die "unknown redirect session $session\n" unless length($pref);
68 $cgi = new CGI($pref);
72 if ( $cgi->param('error') ) {
73 $custnum = scalar($cgi->param('custnum'));
76 unless $curuser->access_right(($custnum ? 'Edit' : 'New'). ' customer'); #contacts?
78 } elsif ( $cgi->keywords ) { #editing
79 $custnum = ($cgi->keywords)[0];
82 unless $curuser->access_right('Edit customer');
84 } else { #new customer
86 #this doesn't really work here, we're an edit only
87 die "guru meditation #32";
90 unless $curuser->access_right('New customer');
94 #my $new_callback = sub {
95 # my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_;
98 #my $edit_callback = sub {
99 # my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_;
102 #my $error_callback = sub {
103 # my( $cgi, $prospect_main, $fields_listref, $opt_hashref ) = @_;
106 my $m2_error_callback = sub {
107 my($cgi, $object) = @_;
109 #process_o2m fields in process/cust_main-contacts.html
110 my @fields = FS::contact->cgi_contact_fields;
111 my @gfields = ( '', map "_$_", @fields );
114 if ( /^contactnum(\d+)$/ ) {
116 if ( grep $cgi->param("contactnum$num$_"), @gfields ) {
117 my $x = new FS::contact {
118 'contactnum' => scalar($cgi->param("contactnum$num")),
119 map { $_ => scalar($cgi->param("contactnum${num}_$_")) } @fields,