17528: back-date payment access-right
authorMike Robinson <miker@freeside.biz>
Tue, 1 May 2012 17:32:53 +0000 (12:32 -0500)
committerMike Robinson <miker@freeside.biz>
Tue, 1 May 2012 17:32:53 +0000 (12:32 -0500)
FS/FS/AccessRight.pm
FS/FS/access_right.pm
httemplate/edit/cust_pay.cgi
httemplate/edit/process/cust_pay.cgi

index 8a13ab3..a39fb37 100644 (file)
@@ -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',
index 815c6d9..719577f 100644 (file)
@@ -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 ) {
index 7a1bb00..f0826f6 100755 (executable)
@@ -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>
     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>
index 06f5e64..8664883 100755 (executable)
@@ -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,