summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Jackson <mitch@freeside.biz>2018-01-27 21:21:59 -0600
committerMitch Jackson <mitch@freeside.biz>2018-09-25 22:36:05 -0400
commit774a522ebf772f28ccf3b19f531e2424c62fcc0f (patch)
treec53970489aaab8f04f58a3d20945642f5fad0371
parent4af1201514d154f0f76c35085d6a9f33d85ecfdc (diff)
RT# 73421 Add allow messages flag message_dest to contact_email
-rw-r--r--FS/FS/Schema.pm3
-rw-r--r--FS/FS/contact.pm7
-rw-r--r--FS/FS/cust_contact.pm7
-rw-r--r--httemplate/edit/process/cust_main-contacts.html8
-rw-r--r--httemplate/elements/contact.html6
-rw-r--r--httemplate/view/cust_main/contacts_new.html2
6 files changed, 25 insertions, 8 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 08eae6a..873c67e 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1764,7 +1764,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 fc06ca8..9505dee 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->$_('');
}
@@ -437,7 +437,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->$_('');
}
@@ -968,7 +968,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
@@ -1041,4 +1041,3 @@ L<FS::Record>, schema.html from the base documentation.
=cut
1;
-
diff --git a/FS/FS/cust_contact.pm b/FS/FS/cust_contact.pm
index 118a9e0..adad46e 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<FS::contact>, L<FS::cust_main>, L<FS::Record>
=cut
1;
-
diff --git a/httemplate/edit/process/cust_main-contacts.html b/httemplate/edit/process/cust_main-contacts.html
index 6e94a29..6b7f1c2 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.
+
+</%doc>
<% 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 31b4e49..909ff78 100644
--- a/httemplate/elements/contact.html
+++ b/httemplate/elements/contact.html
@@ -46,7 +46,8 @@
% $value = $contact->get('_password') ? '********' : '';
% } 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);
@@ -79,7 +80,7 @@
<SCRIPT>
<% $js %>
</SCRIPT>
-% } 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,
@@ -173,6 +174,7 @@ tie my %label, 'Tie::IxHash',
unless ($opt{'for_prospect'}) {
$label{'invoice_dest'} = 'Send&nbsp;invoices';
+ $label{'message_dest'} = 'Send&nbsp;messages';
$label{'selfservice_access'} = 'Self-service';
$label{'password'} = 'Password';
}
diff --git a/httemplate/view/cust_main/contacts_new.html b/httemplate/view/cust_main/contacts_new.html
index 2209d30..45187b1 100644
--- a/httemplate/view/cust_main/contacts_new.html
+++ b/httemplate/view/cust_main/contacts_new.html
@@ -11,6 +11,7 @@
<%$th%>Email</TH>
<%$th%>Send invoices</TH>
<%$th%>Self-service</TH>
+ <%$th%>Send messages</TH>
% foreach my $phone_type (@phone_type) {
<%$th%><% $phone_type->typename |h %></TH>
% }
@@ -33,6 +34,7 @@
% my @contact_email = $contact->contact_email;
<%$td%><% join(', ', map $_->emailaddress, @contact_email) %></TD>
<%$td%><% $cust_contact->invoice_dest eq 'Y' ? 'Yes' : 'No' %></TD>
+ <%$td%><% $cust_contact->message_dest eq 'Y' ? 'Yes' : 'No' %></TD>
<%$td%>
% if ( $cust_contact->selfservice_access ) {
Enabled