[freeside-commits] freeside/FS/FS Conf.pm, 1.402, 1.403 cust_pay.pm, 1.90, 1.91 cust_pkg.pm, 1.181, 1.182

Mark Wells mark at wavetail.420.am
Tue Dec 7 14:26:19 PST 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv12123/FS/FS

Modified Files:
	Conf.pm cust_pay.pm cust_pkg.pm 
Log Message:
per-agent notification options, RT#10797

Index: cust_pay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay.pm,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -w -d -r1.90 -r1.91
--- cust_pay.pm	4 Nov 2010 20:35:53 -0000	1.90
+++ cust_pay.pm	7 Dec 2010 22:26:16 -0000	1.91
@@ -297,7 +297,8 @@
   $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'},
@@ -533,7 +534,7 @@
 
   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;
@@ -547,13 +548,9 @@
        || ! $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') ) {

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.402
retrieving revision 1.403
diff -u -w -d -r1.402 -r1.403
--- Conf.pm	7 Dec 2010 19:04:42 -0000	1.402
+++ Conf.pm	7 Dec 2010 22:26:16 -0000	1.403
@@ -568,16 +568,20 @@
 
 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 => '' });
+  '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 { require FS::msg_template;
+  'option_sub'  => sub { 
                          my $msg_template = FS::msg_template->by_key(shift);
                          $msg_template ? $msg_template->msgname : ''
                        },
+  'per_agent' => 1,
 );
 
 
@@ -1246,6 +1250,7 @@
     'section'     => 'notification',
     'description' => 'Send payment receipts.',
     'type'        => 'checkbox',
+    'per_agent'   => 1,
   },
 
   {
@@ -1271,6 +1276,7 @@
                        'cust_pay'          => 'When payment is made.',
                        'cust_bill_pay_pkg' => 'When payment is applied.',
                      ],
+    'per_agent'   => 1,
   },
 
   {
@@ -1874,6 +1880,7 @@
     'section'     => 'notification',
     'description' => 'Enable emailing of credit card and electronic check decline notices.',
     'type'        => 'checkbox',
+    'per_agent'   => 1,
   },
 
   {
@@ -1881,6 +1888,7 @@
     'section'     => 'notification',
     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
     'type'        => 'textarea',
+    'per_agent'   => 1,
   },
 
   {
@@ -1909,6 +1917,7 @@
     'section'     => 'notification',
     'description' => 'Enable emailing of cancellation notices.  Make sure to select the template in the cancel_msgnum option.',
     'type'        => 'checkbox',
+    'per_agent'   => 1,
   },
 
   {
@@ -2930,6 +2939,13 @@
     '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',

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -w -d -r1.181 -r1.182
--- cust_pkg.pm	14 Nov 2010 09:10:21 -0000	1.181
+++ cust_pkg.pm	7 Dec 2010 22:26:17 -0000	1.182
@@ -707,7 +707,9 @@
   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 ) {



More information about the freeside-commits mailing list