[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 32276032c4c3754b6318b9b70a934a1f8fb52586

Mark Wells mark at 420.am
Thu Mar 29 14:35:00 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  32276032c4c3754b6318b9b70a934a1f8fb52586 (commit)
      from  38bd65e50f8976c2423691fea64e70420ff1ea39 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 32276032c4c3754b6318b9b70a934a1f8fb52586
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Mar 29 14:34:24 2012 -0700

    additional fields for cash payments, #16821

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 8953469..22a618d 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2269,6 +2269,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'require_cash_deposit_info',
+    'section'     => 'billing',
+    'description' => 'When recording cash payments, display bank deposit information fields.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'paymentforcedtobatch',
     'section'     => 'deprecated',
     'description' => 'See batch-enable_payby and realtime-disable_payby.  Used to (for CHEK): Cause per customer payment entry to be forced to a batch processor rather than performed realtime.',
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 961862d..ef7a244 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1332,12 +1332,17 @@ sub tables_hashref {
                                                  # index into payby table
                                                  # eventually
         'payinfo',  'varchar',   'NULL', 512, '', '', #see cust_main above
-	'paymask', 'varchar', 'NULL', $char_d, '', '', 
+        'paymask', 'varchar', 'NULL', $char_d, '', '', 
         'paydate',  'varchar', 'NULL', 10, '', '', 
         'paybatch', 'varchar',   'NULL', $char_d, '', '', #for auditing purposes.
         'payunique', 'varchar', 'NULL', $char_d, '', '', #separate paybatch "unique" functions from current usage
         'closed',    'char', 'NULL', 1, '', '', 
         'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances
+        # cash/check deposit info fields
+        'bank',       'varchar', 'NULL', $char_d, '', '',
+        'depositor',  'varchar', 'NULL', $char_d, '', '',
+        'account',    'varchar', 'NULL', 20,      '', '',
+        'teller',     'varchar', 'NULL', 20,      '', '',
       ],
       'primary_key' => 'paynum',
       #i guess not now, with cust_pay_pending, if we actually make it here, we _do_ want to record it# 'unique' => [ [ 'payunique' ] ],
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index d98d11e..ef30809 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -113,6 +113,22 @@ books closed flag, empty or `Y'
 
 Desired pkgnum when using experimental package balances.
 
+=item bank
+
+The bank where the payment was deposited.
+
+=item depositor
+
+The name of the depositor.
+
+=item account
+
+The deposit account number.
+
+=item teller
+
+The teller number.
+
 =back
 
 =head1 METHODS
@@ -493,8 +509,11 @@ sub check {
     || $self->ut_textn('payunique')
     || $self->ut_enum('closed', [ '', 'Y' ])
     || $self->ut_foreign_keyn('pkgnum', 'cust_pkg', 'pkgnum')
+    || $self->ut_textn('bank')
+    || $self->ut_alphan('depositor')
+    || $self->ut_numbern('account')
+    || $self->ut_numbern('teller')
     || $self->payinfo_check()
-    || $self->ut_numbern('discount_term')
   ;
   return $error if $error;
 
@@ -509,6 +528,12 @@ sub check {
   return "invalid discount_term"
    if ($self->discount_term && $self->discount_term < 2);
 
+  if ( $self->payby eq 'CASH' and $conf->exists('require_cash_deposit_info') ) {
+    foreach (qw(bank depositor account teller)) {
+      return "$_ required" if $self->get($_) eq '';
+    }
+  }
+
 #i guess not now, with cust_pay_pending, if we actually make it here, we _do_ want to record it
 #  # UNIQUE index should catch this too, without race conditions, but this
 #  # should give a better error message the other 99.9% of the time...
diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi
index 3fd9c79..7a1bb00 100755
--- a/httemplate/edit/cust_pay.cgi
+++ b/httemplate/edit/cust_pay.cgi
@@ -18,7 +18,7 @@
 <INPUT TYPE="hidden" NAME="payby" VALUE="<% $payby %>">
 <INPUT TYPE="hidden" NAME="paybatch" VALUE="<% $paybatch %>">
 
-<BR><BR>
+<BR>
 
 <% mt('Payment') |h %> 
 <% ntable("#cccccc", 2) %>
@@ -56,7 +56,29 @@
     <TD ALIGN="right"><% mt('Check #') |h %></TD>
     <TD COLSPAN=2><INPUT TYPE="text" NAME="payinfo" VALUE="<% $payinfo %>" SIZE=10></TD>
   </TR>
-% } 
+% }
+% elsif ( $payby eq 'CASH' and $conf->exists('require_cash_deposit_info') ) {
+  <TR>
+    <TD ALIGN="right"><% mt('Bank') |h %></TD>
+    <TD COLSPAN=3><INPUT TYPE="text" NAME="bank" VALUE="<% $cgi->param('bank') %>"></TD>
+  </TR>
+  <TR>
+    <TD ALIGN="right"><% mt('Check #') |h %></TD>
+    <TD COLSPAN=2><INPUT TYPE="text" NAME="payinfo" VALUE="<% $payinfo %>" SIZE=10></TD>
+  </TR>
+  <TR>
+    <TD ALIGN="right"><% mt('Teller #') |h %></TD>
+    <TD COLSPAN=2><INPUT TYPE="text" NAME="teller" VALUE="<% $cgi->param('teller') %>" SIZE=10></TD>
+  </TR>
+  <TR>
+    <TD ALIGN="right"><% mt('Depositor') |h %></TD>
+    <TD COLSPAN=3><INPUT TYPE="text" NAME="depositor" VALUE="<% $cgi->param('depositor') %>"></TD>
+  </TR>
+  <TR>
+    <TD ALIGN="right"><% mt('Account #') |h %></TD>
+    <TD COLSPAN=2><INPUT TYPE="text" NAME="account" VALUE="<% $cgi->param('account') %>" SIZE=18></TD>
+  </TR>
+% }
 
 <TR>
 % if ( $link eq 'custnum' || $link eq 'popup' ) { 
diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi
index e74f902..06f5e64 100755
--- a/httemplate/edit/process/cust_pay.cgi
+++ b/httemplate/edit/process/cust_pay.cgi
@@ -28,6 +28,8 @@
 %}
 <%init>
 
+my $conf = FS::Conf->new;
+
 $cgi->param('linknum') =~ /^(\d+)$/
   or die "Illegal linknum: ". $cgi->param('linknum');
 my $linknum = $1;
@@ -46,6 +48,7 @@ my $new = new FS::cust_pay ( {
     $_, scalar($cgi->param($_));
   } qw( paid payby payinfo paybatch
         pkgnum discount_term
+        bank depositor account teller
       )
   #} fields('cust_pay')
 } );
@@ -57,6 +60,6 @@ push @rights, 'Post cash payment'  if $new->payby eq 'CASH';
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right(\@rights);
 
-my $error = $new->insert( 'manual' => 1 );
+my $error ||= $new->insert( 'manual' => 1 );
 
 </%init>
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html
index b5b7161..c453ffa 100644
--- a/httemplate/view/cust_main/payment_history.html
+++ b/httemplate/view/cust_main/payment_history.html
@@ -13,6 +13,7 @@
                'cust_main'   => $cust_main,
                'actionlabel' => emt('Enter check payment'),
                'width'       => 392,
+               'height'      => 392,
   &>
 % } 
 
@@ -24,6 +25,7 @@
                'cust_main'   => $cust_main,
                'actionlabel' => emt('Enter cash payment'),
                'width'       => 392,
+               'height'      => 392,
   &>
 % } 
 
diff --git a/httemplate/view/cust_pay.html b/httemplate/view/cust_pay.html
index d02f154..f9c8bc1 100644
--- a/httemplate/view/cust_pay.html
+++ b/httemplate/view/cust_pay.html
@@ -98,6 +98,28 @@
 
 % }
 
+% if ( $cust_pay->payby eq 'CASH' && $cust_pay->payinfo ) {
+    <TR>
+      <TD ALIGN="right"><% mt('Bank') |h %></TD>
+      <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->bank %></B></TD>
+    </TR>
+
+    <TR>
+      <TD ALIGN="right"><% mt('Teller #') |h %></TD>
+      <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->teller %></B></TD>
+    </TR>
+
+    <TR>
+      <TD ALIGN="right"><% mt('Depositor') |h %></TD>
+      <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->depositor %></B></TD>
+    </TR>
+
+    <TR>
+      <TD ALIGN="right"><% mt('Account #') |h %></TD>
+      <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->account %></B></TD>
+    </TR>
+% }
+
 % if ( $conf->exists('pkg-balances') && $cust_pay->pkgnum ) {
 %   my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } );
     <TR>

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Conf.pm                                  |    7 ++++++
 FS/FS/Schema.pm                                |    7 +++++-
 FS/FS/cust_pay.pm                              |   27 +++++++++++++++++++++++-
 httemplate/edit/cust_pay.cgi                   |   26 +++++++++++++++++++++-
 httemplate/edit/process/cust_pay.cgi           |    5 +++-
 httemplate/view/cust_main/payment_history.html |    2 +
 httemplate/view/cust_pay.html                  |   22 +++++++++++++++++++
 7 files changed, 91 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list