diff options
author | Mark Wells <mark@freeside.biz> | 2015-11-18 13:07:47 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-11-18 13:12:12 -0800 |
commit | ded0cb9e764cd806a13aaf6ddb8cdfe0f3215999 (patch) | |
tree | 3edbfb27d1f72bc7326893035d01fe0a35e9e42c /httemplate/edit/process/cust_main-contacts.html | |
parent | f4ebbb57fd21146b936e73fbcf34b76adf664904 (diff) |
track customer invoice destination emails using contact_email, #25536
Diffstat (limited to 'httemplate/edit/process/cust_main-contacts.html')
-rw-r--r-- | httemplate/edit/process/cust_main-contacts.html | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/httemplate/edit/process/cust_main-contacts.html b/httemplate/edit/process/cust_main-contacts.html index 10ec3638f..2a7185b5c 100644 --- a/httemplate/edit/process/cust_main-contacts.html +++ b/httemplate/edit/process/cust_main-contacts.html @@ -3,6 +3,7 @@ 'error_redirect' => popurl(3). 'edit/cust_main-contacts.html?', 'agent_virt' => 1, 'skip_process' => 1, #we don't want to make any changes to cust_main + 'precheck_callback' => $precheck_callback, 'process_o2m' => { 'table' => 'contact', 'fields' => FS::contact->cgi_contact_fields, @@ -10,3 +11,22 @@ 'redirect' => popurl(3). 'view/cust_main.cgi?', ) %> +<%init> +my $precheck_callback = sub { + my $cgi = shift; + my $conf = FS::Conf->new; + if ( $conf->exists('cust_main-require_invoicing_list_email') ) { + my $has_email = 0; + foreach my $prefix (grep /^contactnum\d+$/, $cgi->param) { + if ( length($cgi->param($prefix . '_emailaddress')) + and $cgi->param($prefix . '_invoice_dest') ) { + $has_email = 1; + last; + } + } + return "At least one contact must receive email invoices" + unless $has_email; + } + ''; +}; +</%init> |