my %msg_template_options = (
'type' => 'select-sub',
- 'options_sub' => sub { require FS::Record;
- require FS::agent;
- require FS::msg_template;
- map { $_->msgnum, $_->msgname }
- qsearch('msg_template', { disabled => '' });
- },
- 'option_sub' => sub { require FS::msg_template;
+ 'options_sub' => sub {
+ my @templates = qsearch({
+ 'table' => 'msg_template',
+ 'hashref' => { 'disabled' => '' },
+ 'extra_sql' => ' AND '.
+ $FS::CurrentUser::CurrentUser->agentnums_sql(null => 1),
+ });
+ map { $_->msgnum, $_->msgname } @templates;
+ },
+ 'option_sub' => sub {
my $msg_template = FS::msg_template->by_key(shift);
$msg_template ? $msg_template->msgname : ''
},
+ 'per_agent' => 1,
);
'section' => 'notification',
'description' => 'Send payment receipts.',
'type' => 'checkbox',
+ 'per_agent' => 1,
},
{
'cust_pay' => 'When payment is made.',
'cust_bill_pay_pkg' => 'When payment is applied.',
],
+ 'per_agent' => 1,
},
{
'section' => 'notification',
'description' => 'Enable emailing of credit card and electronic check decline notices.',
'type' => 'checkbox',
+ 'per_agent' => 1,
},
{
'section' => 'notification',
'description' => 'List of error messages that should not trigger email decline notices, one per line.',
'type' => 'textarea',
+ 'per_agent' => 1,
},
{
'section' => 'notification',
'description' => 'Enable emailing of cancellation notices. Make sure to select the template in the cancel_msgnum option.',
'type' => 'checkbox',
+ 'per_agent' => 1,
},
{
'type' => 'textarea',
},
+# {
+# 'key' => 'batch-manual_approval',
+# 'section' => 'billing',
+# 'description' => 'Allow manual batch closure, which will approve all payments that do not yet have a status. This is dangerous, but may be needed if your processor does not provide a list of approved payments.',
+# 'type' => 'checkbox',
+# },
+#
{
'key' => 'payment_history-years',
'section' => 'UI',
}
if ( !$options{'quiet'} && !$realtime_bop_decline_quiet
- && $conf->exists('emaildecline')
+ && $conf->exists('emaildecline', $self->agentnum)
&& grep { $_ ne 'POST' } $self->invoicing_list
&& ! grep { $transaction->error_message =~ /$_/ }
- $conf->config('emaildecline-exclude')
+ $conf->config('emaildecline-exclude', $self->agentnum)
) {
# Send a decline alert to the customer.
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
#payment receipt
- my $trigger = $conf->config('payment_receipt-trigger') || 'cust_pay';
+ my $trigger = $conf->config('payment_receipt-trigger',
+ $self->cust_main->agentnum) || 'cust_pay';
if ( $trigger eq 'cust_pay' ) {
my $error = $self->send_receipt(
'manual' => $options{'manual'},
my $conf = new FS::Conf;
- return '' unless $conf->exists('payment_receipt');
+ return '' unless $conf->exists('payment_receipt', $cust_main->agentnum);
my @invoicing_list = $cust_main->invoicing_list_emailonly;
return '' unless @invoicing_list;
|| ! $cust_bill
)
{
-
- if ( $conf->exists('payment_receipt_msgnum')
- && $conf->config('payment_receipt_msgnum')
- )
- {
- my $msg_template =
- FS::msg_template->by_key($conf->config('payment_receipt_msgnum'));
+ my $msgnum = $conf->config('payment_receipt_msgnum', $cust_main->agentnum);
+ if ( $msgnum ) {
+ my $msg_template = FS::msg_template->by_key($msgnum);
$error = $msg_template->send('cust_main'=> $cust_main, 'object'=> $self);
} elsif ( $conf->exists('payment_receipt_email') ) {
return '' if $date; #no errors
my @invoicing_list = grep { $_ !~ /^(POST|FAX)$/ } $self->cust_main->invoicing_list;
- if ( !$options{'quiet'} && $conf->exists('emailcancel') && @invoicing_list ) {
+ if ( !$options{'quiet'} &&
+ $conf->exists('emailcancel', $self->cust_main->agentnum) &&
+ @invoicing_list ) {
my $msgnum = $conf->config('cancel_msgnum', $self->cust_main->agentnum);
my $error = '';
if ( $msgnum ) {