From e517b3733dd3d19a7af586c9f4b8cf9982a8b3d2 Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Sat, 27 Jan 2018 21:21:59 -0600 Subject: [PATCH] RT# 73421 Add allow messages flag message_dest to contact_email --- FS/FS/Schema.pm | 3 ++- FS/FS/contact.pm | 7 +++---- FS/FS/cust_contact.pm | 7 ++++++- httemplate/edit/process/cust_main-contacts.html | 8 ++++++++ httemplate/elements/contact.html | 6 ++++-- httemplate/view/cust_main/contacts_new.html | 2 ++ 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index f7ac973be..65eadad21 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -1793,7 +1793,8 @@ sub tables_hashref { 'classnum', 'int', 'NULL', '', '', '', 'comment', 'varchar', 'NULL', 255, '', '', 'selfservice_access', 'char', 'NULL', 1, '', '', - 'invoice_dest', 'char', 'NULL', 1, '', '', + 'invoice_dest', 'char', 'NULL', 1, '', '', # Y or NULL + 'message_dest', 'char', 'NULL', 1, '', '', # Y or NULL ], 'primary_key' => 'custcontactnum', 'unique' => [ [ 'custnum', 'contactnum' ], ], diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index 44c538806..fa047f59d 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -155,7 +155,7 @@ sub insert { $self->custnum(''); my %link_hash = (); - for (qw( classnum comment selfservice_access invoice_dest )) { + for (qw( classnum comment selfservice_access invoice_dest message_dest)) { $link_hash{$_} = $self->get($_); $self->$_(''); } @@ -430,7 +430,7 @@ sub replace { $self->custnum(''); my %link_hash = (); - for (qw( classnum comment selfservice_access invoice_dest )) { + for (qw( classnum comment selfservice_access invoice_dest message_dest )) { $link_hash{$_} = $self->get($_); $self->$_(''); } @@ -955,7 +955,7 @@ sub cgi_contact_fields { my @contact_fields = qw( classnum first last title comment emailaddress selfservice_access - invoice_dest password + invoice_dest message_dest password ); push @contact_fields, 'phonetypenum'. $_->phonetypenum @@ -1028,4 +1028,3 @@ L, schema.html from the base documentation. =cut 1; - diff --git a/FS/FS/cust_contact.pm b/FS/FS/cust_contact.pm index 118a9e000..adad46e9e 100644 --- a/FS/FS/cust_contact.pm +++ b/FS/FS/cust_contact.pm @@ -59,6 +59,11 @@ empty or Y 'Y' if the customer should get invoices sent to this address, null if not +=item message_dest + +'Y' if contact should get non-invoice email messages sent to this address, +NULL if not + =back =head1 METHODS @@ -119,6 +124,7 @@ sub check { || $self->ut_textn('comment') || $self->ut_enum('selfservice_access', [ '', 'Y' ]) || $self->ut_flag('invoice_dest') + || $self->ut_flag('message_dest') ; return $error if $error; @@ -148,4 +154,3 @@ L, L, L =cut 1; - diff --git a/httemplate/edit/process/cust_main-contacts.html b/httemplate/edit/process/cust_main-contacts.html index 2a7185b5c..5b8319f5a 100644 --- a/httemplate/edit/process/cust_main-contacts.html +++ b/httemplate/edit/process/cust_main-contacts.html @@ -1,3 +1,11 @@ +<%doc> + + This form works indirectly with the tables contact_email and + contact_phone. The columns are updated against an FS::contact + object. The insert/update methods of FS::contact will make the + necessary inserts/updates to contact_email and contact_phone. + + <% include('elements/process.html', 'table' => 'cust_main', 'error_redirect' => popurl(3). 'edit/cust_main-contacts.html?', diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index faee7ead4..43e520155 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -42,7 +42,8 @@ % $value = join(', ', map $_->emailaddress, $contact->contact_email); % } elsif ( $field eq 'selfservice_access' % or $field eq 'comment' -% or $field eq 'invoice_dest' ) { +% or $field eq 'invoice_dest' +% or $field eq 'message_dest' ) { % $value = $X_contact->get($field); % } else { % $value = $contact->get($field); @@ -78,7 +79,7 @@ return false } -% } elsif ( $field eq 'invoice_dest' ) { +% } elsif ( $field eq 'invoice_dest' || $field eq 'message_dest' ) { % my $curr_value = $cgi->param($name . '_' . $field); % $curr_value = $value if !defined($curr_value); <& select.html, @@ -168,6 +169,7 @@ tie my %label, 'Tie::IxHash', unless ($opt{'for_prospect'}) { $label{'invoice_dest'} = 'Send invoices'; + $label{'message_dest'} = 'Send messages'; $label{'selfservice_access'} = 'Self-service'; } diff --git a/httemplate/view/cust_main/contacts_new.html b/httemplate/view/cust_main/contacts_new.html index 94488670d..a28b44934 100644 --- a/httemplate/view/cust_main/contacts_new.html +++ b/httemplate/view/cust_main/contacts_new.html @@ -11,6 +11,7 @@ <%$th%>Email <%$th%>Send invoices <%$th%>Self-service + <%$th%>Send messages % foreach my $phone_type (@phone_type) { <%$th%><% $phone_type->typename |h %> % } @@ -32,6 +33,7 @@ % my @contact_email = $contact->contact_email; <%$td%><% join(', ', map $_->emailaddress, @contact_email) %> <%$td%><% $cust_contact->invoice_dest eq 'Y' ? 'Yes' : 'No' %> + <%$td%><% $cust_contact->message_dest eq 'Y' ? 'Yes' : 'No' %> <%$td%> % if ( $cust_contact->selfservice_access ) { Enabled -- 2.11.0