From d34861c4d32675dac5f0405f078adddb35d4c863 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Thu, 15 Nov 2018 11:37:27 -0500 Subject: [PATCH] RT# 80138 - Added config option to display/edit customer option to send or not send payment receipts Conflicts: FS/FS/Schema.pm httemplate/edit/cust_main/billing.html httemplate/view/cust_main/billing.html --- FS/FS/Conf.pm | 9 +++++++++ FS/FS/Schema.pm | 1 + FS/FS/cust_pay.pm | 4 ++++ httemplate/edit/cust_main/billing.html | 14 ++++++++++++++ httemplate/view/cust_main/billing.html | 8 ++++++++ 5 files changed, 36 insertions(+) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 157fbb6be..597e2c945 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -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.', diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 2168c4c39..a804b12a0 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -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' ] ], diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 67f4b297d..61e5ea387 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -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; diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 135f636cd..858f906dd 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -516,6 +516,20 @@ +% if ( $conf->config_bool('allow_payment_receipt_noemail', $cust_main->agentnum) ) { + + paymentreceipt_noemail eq 'Y' ) + ? 'CHECKED' + : '' + + %>> <% mt('Do not send email payment receipts') |h %> + + + +% } + % unless ( $conf->exists('cust-email-high-visibility')) { diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index aeebc5ab2..ddc971307 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -304,6 +304,14 @@ set_display_recurring(<% encode_json({'display_recurring' => [ $cust_main->displ <% $cust_main->invoice_noemail ? $no : $yes %> +% if ( $conf->config_bool('allow_payment_receipt_noemail', $cust_main->agentnum) ) { + + <% mt('Email payment receipts') |h %> + + <% $cust_main->paymentreceipt_noemail ? $no : $yes %> + + +% } % unless ( $conf->exists('cust-email-high-visibility')) { <% mt('Email address(es)') |h %> -- 2.11.0