RT# 80138 - Added config option to display/edit customer option to send or not send...
authorChristopher Burger <burgerc@freeside.biz>
Thu, 15 Nov 2018 16:37:27 +0000 (11:37 -0500)
committerChristopher Burger <burgerc@freeside.biz>
Fri, 16 Nov 2018 17:54:53 +0000 (12:54 -0500)
Conflicts:
FS/FS/Schema.pm
httemplate/edit/cust_main/billing.html
httemplate/view/cust_main/billing.html

FS/FS/Conf.pm
FS/FS/Schema.pm
FS/FS/cust_pay.pm
httemplate/edit/cust_main/billing.html
httemplate/view/cust_main/billing.html

index 157fbb6..597e2c9 100644 (file)
@@ -1839,6 +1839,15 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'allow_payment_receipt_noemail',
+    'section'     => 'notification',
+    'description' => 'Add option on customer edit/view page to disable emailing of payment receipts.  If this option is set to NO it will override customer specific option, so when set to NO system will not check for payment_receipt_noemail option at customer level.',
+    'type'        => 'checkbox',
+    'per_agent'   => 1,
+    'agent_bool'  => 1,
+  },
+
+  {
     'key'         => 'payment_receipt',
     'section'     => 'notification',
     'description' => 'Send payment receipts.',
index 2168c4c..a804b12 100644 (file)
@@ -1219,6 +1219,7 @@ sub tables_hashref {
         'bill_locationnum', 'int', 'NULL', '', '', '',
         'ship_locationnum', 'int', 'NULL', '', '', '',
         'invoice_ship_address', 'char', 'NULL', 1, '', '',
+        'paymentreceipt_noemail', 'char', 'NULL', 1, '', '',
       ],
       'primary_key' => 'custnum',
       'unique' => [ [ 'agentnum', 'agent_custid' ] ],
index 67f4b29..61e5ea3 100644 (file)
@@ -227,6 +227,8 @@ sub insert {
   local $FS::UID::AutoCommit = 0;
   my $dbh = dbh;
 
+  my $conf = new FS::Conf;
+
   my $cust_bill;
   if ( $self->invnum ) {
     $cust_bill = qsearchs('cust_bill', { 'invnum' => $self->invnum } )
@@ -652,6 +654,8 @@ sub send_receipt {
 
   return '' unless $conf->config_bool('payment_receipt', $cust_main->agentnum);
 
+  return '' if ($conf->config_bool('allow_payment_receipt_noemail', $cust_main->agentnum) && $cust_main->paymentreceipt_noemail);
+
   my @invoicing_list = $cust_main->invoicing_list_emailonly;
   return '' unless @invoicing_list;
 
index 135f636..858f906 100644 (file)
       </TD>
     </TR>
 
+% if ( $conf->config_bool('allow_payment_receipt_noemail', $cust_main->agentnum) ) {
+    <TR>
+      <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="paymentreceipt_noemail" VALUE="Y" <%
+
+        ( $cust_main->paymentreceipt_noemail eq 'Y' )
+          ? 'CHECKED'
+          : ''
+
+        %>> <% mt('Do not send email payment receipts') |h %>
+
+      </TD>
+    </TR>
+% }
+
 % unless ( $conf->exists('cust-email-high-visibility')) {
    <TR>
       <TD ALIGN="right" WIDTH="200">
index aeebc5a..ddc9713 100644 (file)
@@ -304,6 +304,14 @@ set_display_recurring(<% encode_json({'display_recurring' => [ $cust_main->displ
     <% $cust_main->invoice_noemail ? $no : $yes %>
   </TD>
 </TR>
+% if ( $conf->config_bool('allow_payment_receipt_noemail', $cust_main->agentnum) ) {
+<TR>
+  <TD ALIGN="right"><% mt('Email payment receipts') |h %></TD>
+  <TD BGCOLOR="#ffffff">
+    <% $cust_main->paymentreceipt_noemail ? $no : $yes %>
+  </TD>
+</TR>
+% }
 % unless ( $conf->exists('cust-email-high-visibility')) {
 <TR>
   <TD ALIGN="right"><% mt('Email address(es)') |h %></TD>