RT# 82949 - changes section name from fees to pricing, better opiton
[freeside.git] / httemplate / edit / process / cust_main-contacts.html
1 <%doc>
2
3   This form works indirectly with the tables contact_email and
4   contact_phone.  The columns are updated against an FS::contact
5   object.  The insert/update methods of FS::contact will make the
6   necessary inserts/updates to contact_email and contact_phone.
7
8 </%doc>
9 <% include('elements/process.html',
10      'table'          => 'cust_main',
11      'error_redirect' => popurl(3). 'edit/cust_main-contacts.html',
12      'agent_virt'     => 1,
13      'skip_process'   => 1, #we don't want to make any changes to cust_main
14      'precheck_callback' => $precheck_callback,
15      'process_o2m' => {
16        'table'  => 'contact',
17        'fields' => FS::contact->cgi_contact_fields,
18      },
19      'redirect' => popurl(3). 'view/cust_main.cgi?',
20    )
21 %>
22 <%init>
23 my $precheck_callback = sub {
24   my $cgi = shift;
25   my $conf = FS::Conf->new;
26   if ( $conf->exists('cust_main-require_invoicing_list_email') ) {
27     my $has_email = 0;
28     foreach my $prefix (grep /^contactnum\d+$/, $cgi->param) {
29       if ( length($cgi->param($prefix . '_emailaddress'))
30            and $cgi->param($prefix . '_invoice_dest') ) {
31         $has_email = 1;
32         last;
33       }
34     }
35     return "At least one contact must receive email invoices"
36       unless $has_email;
37   }
38   '';
39 };
40 </%init>