diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-03-25 23:17:38 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-03-25 23:17:38 -0700 |
commit | 06e353b743e7be88afa8fce50ea10f27ebb7adef (patch) | |
tree | f8bd2217de55b2f2aca9c01794aafbad302307b8 /httemplate/misc/process/manage_cust_email.html | |
parent | 56230080801b578c595f5807c7e878452b6bc12d (diff) | |
parent | 8e73bf5782dc6fe2b299ba759ad15780a8946cc4 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
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> |