[freeside-commits] freeside/FS/FS access_user.pm, 1.21, 1.22 part_pkg.pm, 1.84, 1.85
Ivan,,,
ivan at wavetail.420.am
Sun Feb 8 17:49:30 PST 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv4506/FS/FS
Modified Files:
access_user.pm part_pkg.pm
Log Message:
further work on agents editing own packages: fix fallout on package customization from turning agent_virt on in edit/part_pkg.cgi, add a "clone package" to package browse, like clone service, and have agent type selection disappear when you set an agentnum. RT#1331
Index: access_user.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/access_user.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- access_user.pm 8 Feb 2009 02:05:24 -0000 1.21
+++ access_user.pm 9 Feb 2009 01:49:27 -0000 1.22
@@ -425,11 +425,7 @@
$self->{_ACLcache} = {};
}
- my $has_right = ' ( '. join(' OR ',
- map { 'rightname = '. dbh->quote($_) }
- @$rightname
- ).
- ' ) ';
+ my $has_right = ' rightname IN ('. join(',', map '?', @$rightname ). ') ';
my $sth = dbh->prepare("
SELECT groupnum FROM access_usergroup
@@ -441,7 +437,7 @@
AND $has_right
LIMIT 1
") or die dbh->errstr;
- $sth->execute($self->usernum) or die $sth->errstr;
+ $sth->execute($self->usernum, @$rightname) or die $sth->errstr;
my $row = $sth->fetchrow_arrayref;
#$row ? $row->[0] : '';
Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- part_pkg.pm 3 Feb 2009 21:33:12 -0000 1.84
+++ part_pkg.pm 9 Feb 2009 01:49:27 -0000 1.85
@@ -1100,10 +1100,48 @@
sub calc_cancel { 0; }
sub calc_units { 0; }
+=item format OPTION DATA
+
+Returns data formatted according to the function 'format' described
+in the plan info. Returns DATA if no such function exists.
+
+=cut
+
+sub format {
+ my ($self, $option, $data) = (shift, shift, shift);
+ if (exists($plans{$self->plan}->{fields}->{$option}{format})) {
+ &{$plans{$self->plan}->{fields}->{$option}{format}}($data);
+ }else{
+ $data;
+ }
+}
+
+=item parse OPTION DATA
+
+Returns data parsed according to the function 'parse' described
+in the plan info. Returns DATA if no such function exists.
+
+=cut
+
+sub parse {
+ my ($self, $option, $data) = (shift, shift, shift);
+ if (exists($plans{$self->plan}->{fields}->{$option}{parse})) {
+ &{$plans{$self->plan}->{fields}->{$option}{parse}}($data);
+ }else{
+ $data;
+ }
+}
+
=back
=cut
+=head1 CLASS METHODS
+
+=over 4
+
+=cut
+
# _upgrade_data
#
# Used by FS::Upgrade to migrate to a new database.
@@ -1170,6 +1208,37 @@
}
+=item curuser_pkgs_sql
+
+Returns an SQL fragment for searching for packages the current user can
+use, either via part_pkg.agentnum directly, or via agent type (see
+L<FS::type_pkgs>).
+
+=cut
+
+sub curuser_pkgs_sql {
+ #my($class) = shift;
+
+ my $agentnums = join(',', $FS::CurrentUser::CurrentUser->agentnums);
+
+ "
+ (
+ agentnum IS NOT NULL
+ OR
+ 0 < ( SELECT COUNT(*)
+ FROM type_pkgs
+ LEFT JOIN agent_type USING ( typenum )
+ LEFT JOIN agent AS typeagent USING ( typenum )
+ WHERE type_pkgs.pkgpart = part_pkg.pkgpart
+ AND typeagent.agentnum IN ($agentnums)
+ )
+ )
+ ";
+
+}
+
+=back
+
=head1 SUBROUTINES
=over 4
@@ -1217,38 +1286,6 @@
\%plans;
}
-=item format OPTION DATA
-
-Returns data formatted according to the function 'format' described
-in the plan info. Returns DATA if no such function exists.
-
-=cut
-
-sub format {
- my ($self, $option, $data) = (shift, shift, shift);
- if (exists($plans{$self->plan}->{fields}->{$option}{format})) {
- &{$plans{$self->plan}->{fields}->{$option}{format}}($data);
- }else{
- $data;
- }
-}
-
-=item parse OPTION DATA
-
-Returns data parsed according to the function 'parse' described
-in the plan info. Returns DATA if no such function exists.
-
-=cut
-
-sub parse {
- my ($self, $option, $data) = (shift, shift, shift);
- if (exists($plans{$self->plan}->{fields}->{$option}{parse})) {
- &{$plans{$self->plan}->{fields}->{$option}{parse}}($data);
- }else{
- $data;
- }
-}
-
=back
More information about the freeside-commits
mailing list