[freeside-commits] freeside/FS/FS Record.pm, 1.178, 1.179 part_pkg.pm, 1.82, 1.83

Ivan,,, ivan at wavetail.420.am
Sun Jan 25 15:58:26 PST 2009


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

Modified Files:
	Record.pm part_pkg.pm 
Log Message:
fix one-time charges and package customization for employees who don't have 'Edit global package definition' ACL, RT#4668

Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- part_pkg.pm	22 Jan 2009 17:29:21 -0000	1.82
+++ part_pkg.pm	25 Jan 2009 23:58:24 -0000	1.83
@@ -432,6 +432,12 @@
     $self->freq($1);
   }
 
+  my @null_agentnum_right = ( 'Edit global package definitions' );
+  push @null_agentnum_right, 'One-time charge'
+    if $self->freq =~ /^0/;
+  push @null_agentnum_right, 'Customize customer package'
+    if $self->disabled eq 'Y'; #good enough
+
   my $error = $self->ut_numbern('pkgpart')
     || $self->ut_text('pkg')
     || $self->ut_text('comment')
@@ -448,7 +454,7 @@
                               'part_pkg_taxproduct',
                               'taxproductnum'
                              )
-    || $self->ut_agentnum_acl('agentnum', 'Edit global package definitions')
+    || $self->ut_agentnum_acl('agentnum', \@null_agentnum_right)
     || $self->SUPER::check
   ;
   return $error if $error;

Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Record.pm,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -d -r1.178 -r1.179
--- Record.pm	12 Jan 2009 23:51:34 -0000	1.178
+++ Record.pm	25 Jan 2009 23:58:24 -0000	1.179
@@ -2326,15 +2326,18 @@
     : '';
 }
 
-=item ut_agentnum_acl
+=item ut_agentnum_acl COLUMN [ NULL_RIGHT | NULL_RIGHT_LISTREF ]
 
 Checks this column as an agentnum, taking into account the current users's
-ACLs.
+ACLs.  NULL_RIGHT or NULL_RIGHT_LISTREF, if specified, indicates the access
+right or rights allowing no agentnum.
 
 =cut
 
 sub ut_agentnum_acl {
-  my( $self, $field, $null_acl ) = @_;
+  my( $self, $field ) = (shift, shift);
+  my $null_acl = scalar(@_) ? shift : [];
+  $null_acl = [ $null_acl ] unless ref($null_acl);
 
   my $error = $self->ut_foreign_keyn($field, 'agent', 'agentnum');
   return "Illegal agentnum: $error" if $error;
@@ -2349,7 +2352,7 @@
   } else {
 
     return "Access denied"
-      unless $curuser->access_right($null_acl);
+      unless grep $curuser->access_right($_), @$null_acl;
 
   }
 



More information about the freeside-commits mailing list