[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 7abae1137cfd0830f108cd65fff01370c42e3028

Mike Robinson miker at 420.am
Tue May 1 10:41:16 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  7abae1137cfd0830f108cd65fff01370c42e3028 (commit)
      from  6487b344f2d3944d2ce6b185556516887836d3b9 (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 7abae1137cfd0830f108cd65fff01370c42e3028
Author: Mike Robinson <miker at freeside.biz>
Date:   Tue May 1 12:40:56 2012 -0500

    17528 Backdate payment access right.

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index 8a13ab3..a39fb37 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -188,6 +188,7 @@ tie my %rights, 'Tie::IxHash',
   'Customer payment rights' => [
     'View payments',
     { rightname=>'Post payment', desc=>'Make check or cash payments.' },
+    { rightname=>'Backdate payment', desc=>'Enable payments to be posted for days other than today.' },
     'Post check payment',
     'Post cash payment',
     'Post payment batch',
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index 815c6d9..719577f 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -185,6 +185,7 @@ sub _upgrade_data { # class method
   my %onetime = (
     'List customers' => 'List all customers',
     'List packages'  => 'Summarize packages',
+    'Post payment'   => 'Backdate payment',
   );
 
   foreach my $old_acl ( keys %onetime ) {
diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi
index 7a1bb00..f0826f6 100755
--- a/httemplate/edit/cust_pay.cgi
+++ b/httemplate/edit/cust_pay.cgi
@@ -23,6 +23,7 @@
 <% mt('Payment') |h %> 
 <% ntable("#cccccc", 2) %>
 
+% if ( $FS::CurrentUser::CurrentUser->access_right(['Backdate payment']) ) {
 <TR>
   <TD ALIGN="right"><% mt('Date') |h %></TD>
   <TD COLSPAN=2>
@@ -39,6 +40,15 @@
     align:      "BR"
   });
 </SCRIPT>
+% }
+% else {
+<TR>
+  <TD ALIGN="right"><% mt('Date') |h %></TD>
+  <TD COLSPAN=2>
+    <% time2str($date_format.' %r',$_date) %>
+  </TD>
+</TR>
+% }
 
 <TR>
   <TD ALIGN="right"><% mt('Amount') |h %></TD>
diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi
index 06f5e64..8664883 100755
--- a/httemplate/edit/process/cust_pay.cgi
+++ b/httemplate/edit/process/cust_pay.cgi
@@ -39,7 +39,13 @@ $cgi->param('link') =~ /^(custnum|invnum|popup)$/
 my $field = my $link = $1;
 $field = 'custnum' if $field eq 'popup';
 
-my $_date = parse_datetime($cgi->param('_date'));
+my $_date;
+if ( $FS::CurrentUser::CurrentUser->access_right(['Backdate payment']) ) {
+  $_date = parse_datetime($cgi->param('_date'));
+}
+else {
+  $_date = time;
+}
 
 my $new = new FS::cust_pay ( {
   $field => $linknum,

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

Summary of changes:
 FS/FS/AccessRight.pm                 |    1 +
 FS/FS/access_right.pm                |    1 +
 httemplate/edit/cust_pay.cgi         |   10 ++++++++++
 httemplate/edit/process/cust_pay.cgi |    8 +++++++-
 4 files changed, 19 insertions(+), 1 deletions(-)




More information about the freeside-commits mailing list