1 <% $cgi->redirect($fsurl.'misc/manage_cust_email.html?' .
5 unless $FS::CurrentUser::CurrentUser->access_right('Edit customer');
8 foreach my $custnum ($cgi->param('custnum')) {
9 my $cust = FS::cust_main->by_key($custnum)
10 or die "customer not found: $custnum\n";
11 my $new_invoice_noemail =
12 $cgi->param('custnum'.$custnum.'_invoice_email') ? '' : 'Y';
13 my $new_message_noemail =
14 $cgi->param('custnum'.$custnum.'_message_email') ? '' : 'Y';
15 if ( $new_invoice_noemail ne $cust->invoice_noemail
16 or $new_message_noemail ne $cust->message_noemail ) {
18 $cust->set('invoice_noemail', $new_invoice_noemail);
19 $cust->set('message_noemail', $new_message_noemail);
20 $error ||= $cust->replace;
23 $cgi->delete('custnum'.$custnum.'_invoice_email');
24 $cgi->delete('custnum'.$custnum.'_message_email');
26 $cgi->delete('custnum');
28 $cgi->param('error' => $error); # probably unnecessary...
30 $cgi->param('done' => 1) unless $error;