diff options
author | Mark Wells <mark@freeside.biz> | 2013-03-25 15:47:34 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-03-25 15:47:34 -0700 |
commit | dfc85a4245f2d15f258d840b98f0508c50228e40 (patch) | |
tree | 0c4b59b89ab068e2ccd34d05abe49542ef8efaf6 /httemplate/misc/process/manage_cust_email.html | |
parent | 6bf3df8177a22d2275b1a68045ab5ff2e831af42 (diff) |
email opt-out flag, #19312
Diffstat (limited to 'httemplate/misc/process/manage_cust_email.html')
-rw-r--r-- | httemplate/misc/process/manage_cust_email.html | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/httemplate/misc/process/manage_cust_email.html b/httemplate/misc/process/manage_cust_email.html new file mode 100644 index 000000000..5bf1470d1 --- /dev/null +++ b/httemplate/misc/process/manage_cust_email.html @@ -0,0 +1,32 @@ +<% $cgi->redirect($fsurl.'misc/manage_cust_email.html?' . + $cgi->query_string) %> +<%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Edit customer'); + +my $error; +foreach my $custnum ($cgi->param('custnum')) { + my $cust = FS::cust_main->by_key($custnum) + or die "customer not found: $custnum\n"; + my $new_invoice_noemail = + $cgi->param('custnum'.$custnum.'_invoice_email') ? '' : 'Y'; + my $new_message_noemail = + $cgi->param('custnum'.$custnum.'_message_email') ? '' : 'Y'; + if ( $new_invoice_noemail ne $cust->invoice_noemail + or $new_message_noemail ne $cust->message_noemail ) { + + $cust->set('invoice_noemail', $new_invoice_noemail); + $cust->set('message_noemail', $new_message_noemail); + $error ||= $cust->replace; + + } + $cgi->delete('custnum'.$custnum.'_invoice_email'); + $cgi->delete('custnum'.$custnum.'_message_email'); +} +$cgi->delete('custnum'); +if ( $error ) { + $cgi->param('error' => $error); # probably unnecessary... +} else { + $cgi->param('done' => 1) unless $error; +} +</%init> |