[freeside-commits] freeside/FS/FS AccessRight.pm, NONE, 1.1 CGI.pm, 1.30, 1.31 Schema.pm, 1.14, 1.15 access_group.pm, NONE, 1.1 access_groupagent.pm, NONE, 1.1 access_right.pm, NONE, 1.1 access_user.pm, NONE, 1.1 access_user_pref.pm, NONE, 1.1 access_usergroup.pm, NONE, 1.1 agent_type.pm, 1.3, 1.4 cust_bill.pm, 1.145, 1.146 m2m_Common.pm, NONE, 1.1 payby.pm, 1.2, 1.3 svc_domain.pm, 1.45, 1.46

Ivan,,, ivan at wavetail.420.am
Sun May 14 09:47:33 PDT 2006


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv14201/FS/FS

Modified Files:
	CGI.pm Schema.pm agent_type.pm cust_bill.pm payby.pm 
	svc_domain.pm 
Added Files:
	AccessRight.pm access_group.pm access_groupagent.pm 
	access_right.pm access_user.pm access_user_pref.pm 
	access_usergroup.pm m2m_Common.pm 
Log Message:
first part of ACL and re-skinning work and some other small stuff

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Schema.pm	20 Mar 2006 19:13:26 -0000	1.14
+++ Schema.pm	14 May 2006 16:47:31 -0000	1.15
@@ -244,6 +244,8 @@
 
   my $username_len = 32; #usernamemax config file
 
+    # name type nullability length default local
+
   return {
 
     'agent' => {
@@ -445,6 +447,9 @@
       'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ],
                    [ 'daytime' ], [ 'night' ], [ 'fax' ], [ 'refnum' ],
                    [ 'county' ], [ 'state' ], [ 'country' ], [ 'zip' ],
+                   [ 'ship_last' ], [ 'ship_company' ],
+                   [ 'payby' ], [ 'paydate' ],
+
                  ],
     },
 
@@ -1444,16 +1449,94 @@
 
     'inventory_class' => {
       'columns' => [
-        'classnum',  'serial',       '', '', '', '',
-        'classname', 'varchar', $char_d, '', '', '',
+        'classnum',  'serial',       '',      '', '', '',
+        'classname', 'varchar',      '', $char_d, '', '',
       ],
       'primary_key' => 'classnum',
       'unique' => [],
       'index'  => [],
     },
 
+    'access_user' => {
+      'columns' => [
+        'usernum',   'serial',  '',      '', '', '',
+        'username',  'varchar', '', $char_d, '', '',
+        '_password', 'varchar', '', $char_d, '', '',
+        'last',      'varchar', '', $char_d, '', '', 
+        'first',     'varchar', '', $char_d, '', '', 
+      ],
+      'primary_key' => 'usernum',
+      'unique' => [ [ 'username' ] ],
+      'index'  => [],
+    },
+
+    'access_user_pref' => {
+      'columns' => [
+        'prefnum',    'serial',       '', '', '', '',
+        'usernum',     'int',       '', '', '', '',
+        'prefname', 'varchar', '', $char_d, '', '', 
+        'prefvalue', 'text', 'NULL', '', '', '', 
+      ],
+      'primary_key' => 'prefnum',
+      'unique' => [],
+      'index'  => [ [ 'usernum' ] ],
+    },
+
+    'access_group' => {
+      'columns' => [
+        'groupnum',   'serial', '',      '', '', '',
+        'groupname', 'varchar', '', $char_d, '', '',
+      ],
+      'primary_key' => 'groupnum',
+      'unique' => [ [ 'groupname' ] ],
+      'index'  => [],
+    },
+
+    'access_usergroup' => {
+      'columns' => [
+        'usergroupnum', 'serial', '', '', '', '',
+        'usernum',         'int', '', '', '', '',
+        'groupnum',        'int', '', '', '', '',
+      ],
+      'primary_key' => 'usergroupnum',
+      'unique' => [ [ 'usernum', 'groupnum' ] ],
+      'index'  => [ [ 'usernum' ] ],
+    },
+
+    'access_groupagent' => {
+      'columns' => [
+        'groupagentnum', 'serial', '', '', '', '',
+        'groupnum',         'int', '', '', '', '',
+        'agentnum',         'int', '', '', '', '',
+      ],
+      'primary_key' => 'groupagentnum',
+      'unique' => [ [ 'groupnum', 'agentnum' ] ],
+      'index'  => [ [ 'groupnum' ] ],
+    },
+
+    'access_right' => {
+      'columns' => [
+        'rightnum',   'serial', '',      '', '', '',
+        'righttype', 'varchar', '', $char_d, '', '',
+        'rightobjnum',   'int', '',      '', '', '',
+        'rightname', 'varchar', '',      '', '', '',
+      ],
+      'primary_key' => 'rightnum',
+      'unique' => [ [ 'righttype', 'rightobjnum', 'rightname' ] ],
+      'index'  => [],
+    },
+
   };
 
+    #'new_table' => {
+    #  'columns' => [
+    #    'num', 'serial',       '', '', '', '',
+    #  ],
+    #  'primary_key' => 'num',
+    #  'unique' => [],
+    #  'index'  => [],
+    #},
+
 }
 
 =back

Index: agent_type.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/agent_type.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- agent_type.pm	26 Nov 2004 09:39:51 -0000	1.3
+++ agent_type.pm	14 May 2006 16:47:31 -0000	1.4
@@ -3,10 +3,11 @@
 use strict;
 use vars qw( @ISA );
 use FS::Record qw( qsearch );
+use FS::m2m_Common;
 use FS::agent;
 use FS::type_pkgs;
 
- at ISA = qw( FS::Record );
+ at ISA = qw( FS::m2m_Common FS::Record );
 
 =head1 NAME
 

Index: svc_domain.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_domain.pm,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- svc_domain.pm	3 Apr 2006 20:49:18 -0000	1.45
+++ svc_domain.pm	14 May 2006 16:47:31 -0000	1.46
@@ -230,7 +230,11 @@
     my $error = $domain_record->delete;
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;
-      return $error;
+      return "can't delete DNS entry: ".
+             join(' ', map $domain_record->$_(),
+                           qw( reczone recaf rectype recdata )
+                 ).
+             ":$error";
     }
   }
 

--- NEW FILE: access_right.pm ---
package FS::access_right;

use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );

@ISA = qw(FS::Record);

=head1 NAME

FS::access_right - Object methods for access_right records

=head1 SYNOPSIS

  use FS::access_right;

  $record = new FS::access_right \%hash;
  $record = new FS::access_right { 'column' => 'value' };

  $error = $record->insert;

  $error = $new_record->replace($old_record);

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::access_right object represents an example.  FS::access_right inherits from
FS::Record.  The following fields are currently supported:

=over 4

=item rightnum - primary key

=item righttype - 

=item rightobjnum - 

=item rightname - 


=back

=head1 METHODS

=over 4

=item new HASHREF

Creates a new example.  To add the example to the database, see L<"insert">.

Note that this stores the hash reference, not a distinct copy of the hash it
points to.  You can ask the object for a copy with the I<hash> method.

=cut

# the new method can be inherited from FS::Record, if a table method is defined

sub table { 'access_right'; }

=item insert

Adds this record to the database.  If there is an error, returns the error,
otherwise returns false.

=cut

# the insert method can be inherited from FS::Record

=item delete

Delete this record from the database.

=cut

# the delete method can be inherited from FS::Record

=item replace OLD_RECORD

Replaces the OLD_RECORD with this one in the database.  If there is an error,
returns the error, otherwise returns false.

=cut

# the replace method can be inherited from FS::Record

=item check

Checks all fields to make sure this is a valid example.  If there is
an error, returns the error, otherwise returns false.  Called by the insert
and replace methods.

=cut

# the check method should currently be supplied - FS::Record contains some
# data checking routines

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('rightnum')
    || $self->ut_text('righttype')
    || $self->ut_text('rightobjnum')
    || $self->ut_text('rightname')
  ;
  return $error if $error;

  $self->SUPER::check;
}

=back

=head1 BUGS

The author forgot to customize this manpage.

=head1 SEE ALSO

L<FS::Record>, schema.html from the base documentation.

=cut

1;


--- NEW FILE: access_user_pref.pm ---
package FS::access_user_pref;

use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );

@ISA = qw(FS::Record);

=head1 NAME

FS::access_user_pref - Object methods for access_user_pref records

=head1 SYNOPSIS

  use FS::access_user_pref;

  $record = new FS::access_user_pref \%hash;
  $record = new FS::access_user_pref { 'column' => 'value' };

  $error = $record->insert;

  $error = $new_record->replace($old_record);

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::access_user_pref object represents an example.  FS::access_user_pref inherits from
FS::Record.  The following fields are currently supported:

=over 4

=item prefnum - primary key

=item usernum - 

=item prefname - 

=item prefvalue - 


=back

=head1 METHODS

=over 4

=item new HASHREF

Creates a new example.  To add the example to the database, see L<"insert">.

Note that this stores the hash reference, not a distinct copy of the hash it
points to.  You can ask the object for a copy with the I<hash> method.

=cut

# the new method can be inherited from FS::Record, if a table method is defined

sub table { 'access_user_pref'; }

=item insert

Adds this record to the database.  If there is an error, returns the error,
otherwise returns false.

=cut

# the insert method can be inherited from FS::Record

=item delete

Delete this record from the database.

=cut

# the delete method can be inherited from FS::Record

=item replace OLD_RECORD

Replaces the OLD_RECORD with this one in the database.  If there is an error,
returns the error, otherwise returns false.

=cut

# the replace method can be inherited from FS::Record

=item check

Checks all fields to make sure this is a valid example.  If there is
an error, returns the error, otherwise returns false.  Called by the insert
and replace methods.

=cut

# the check method should currently be supplied - FS::Record contains some
# data checking routines

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('prefnum')
    || $self->ut_number('usernum')
    || $self->ut_text('prefname')
    || $self->ut_textn('prefvalue')
  ;
  return $error if $error;

  $self->SUPER::check;
}

=back

=head1 BUGS

The author forgot to customize this manpage.

=head1 SEE ALSO

L<FS::Record>, schema.html from the base documentation.

=cut

1;


--- NEW FILE: access_groupagent.pm ---
package FS::access_groupagent;

use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );

@ISA = qw(FS::Record);

=head1 NAME

FS::access_groupagent - Object methods for access_groupagent records

=head1 SYNOPSIS

  use FS::access_groupagent;

  $record = new FS::access_groupagent \%hash;
  $record = new FS::access_groupagent { 'column' => 'value' };

  $error = $record->insert;

  $error = $new_record->replace($old_record);

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::access_groupagent object represents an example.  FS::access_groupagent inherits from
FS::Record.  The following fields are currently supported:

=over 4

=item groupagentnum - primary key

=item groupnum - 

=item agentnum - 


=back

=head1 METHODS

=over 4

=item new HASHREF

Creates a new example.  To add the example to the database, see L<"insert">.

Note that this stores the hash reference, not a distinct copy of the hash it
points to.  You can ask the object for a copy with the I<hash> method.

=cut

# the new method can be inherited from FS::Record, if a table method is defined

sub table { 'access_groupagent'; }

=item insert

Adds this record to the database.  If there is an error, returns the error,
otherwise returns false.

=cut

# the insert method can be inherited from FS::Record

=item delete

Delete this record from the database.

=cut

# the delete method can be inherited from FS::Record

=item replace OLD_RECORD

Replaces the OLD_RECORD with this one in the database.  If there is an error,
returns the error, otherwise returns false.

=cut

# the replace method can be inherited from FS::Record

=item check

Checks all fields to make sure this is a valid example.  If there is
an error, returns the error, otherwise returns false.  Called by the insert
and replace methods.

=cut

# the check method should currently be supplied - FS::Record contains some
# data checking routines

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('groupagentnum')
    || $self->ut_number('groupnum')
    || $self->ut_number('agentnum')
  ;
  return $error if $error;

  $self->SUPER::check;
}

=back

=head1 BUGS

The author forgot to customize this manpage.

=head1 SEE ALSO

L<FS::Record>, schema.html from the base documentation.

=cut

1;


Index: CGI.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/CGI.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- CGI.pm	22 Feb 2006 07:12:28 -0000	1.30
+++ CGI.pm	14 May 2006 16:47:31 -0000	1.31
@@ -62,9 +62,9 @@
       </HEAD>
       <BODY BGCOLOR="#e8e8e8"$etc>
           <FONT SIZE=6>
-            $title
+            <CENTER>$title</CENTER>
           </FONT>
-          <BR><BR>
+          <BR><!--<BR>-->
 END
   $x .=  $menubar. "<BR><BR>" if $menubar;
   $x;
@@ -115,6 +115,7 @@
   my($item,$url, at html);
   while (@_) {
     ($item,$url)=splice(@_,0,2);
+    next if $item =~ /^\s*Main\s+Menu\s*$/i;
     push @html, qq!<A HREF="$url">$item</A>!;
   }
   join(' | ', at html);

--- NEW FILE: access_group.pm ---
package FS::access_group;

use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );

@ISA = qw(FS::Record);

=head1 NAME

FS::access_group - Object methods for access_group records

=head1 SYNOPSIS

  use FS::access_group;

  $record = new FS::access_group \%hash;
  $record = new FS::access_group { 'column' => 'value' };

  $error = $record->insert;

  $error = $new_record->replace($old_record);

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::access_group object represents an example.  FS::access_group inherits from
FS::Record.  The following fields are currently supported:

=over 4

=item groupnum - primary key

=item groupname - 


=back

=head1 METHODS

=over 4

=item new HASHREF

Creates a new example.  To add the example to the database, see L<"insert">.

Note that this stores the hash reference, not a distinct copy of the hash it
points to.  You can ask the object for a copy with the I<hash> method.

=cut

# the new method can be inherited from FS::Record, if a table method is defined

sub table { 'access_group'; }

=item insert

Adds this record to the database.  If there is an error, returns the error,
otherwise returns false.

=cut

# the insert method can be inherited from FS::Record

=item delete

Delete this record from the database.

=cut

# the delete method can be inherited from FS::Record

=item replace OLD_RECORD

Replaces the OLD_RECORD with this one in the database.  If there is an error,
returns the error, otherwise returns false.

=cut

# the replace method can be inherited from FS::Record

=item check

Checks all fields to make sure this is a valid example.  If there is
an error, returns the error, otherwise returns false.  Called by the insert
and replace methods.

=cut

# the check method should currently be supplied - FS::Record contains some
# data checking routines

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('groupnum')
    || $self->ut_text('groupname')
  ;
  return $error if $error;

  $self->SUPER::check;
}

=back

=head1 BUGS

The author forgot to customize this manpage.

=head1 SEE ALSO

L<FS::Record>, schema.html from the base documentation.

=cut

1;


--- NEW FILE: m2m_Common.pm ---
package FS::m2m_Common;

use strict;
use vars qw( @ISA $DEBUG );
use FS::Schema qw( dbdef );
use FS::Record qw( qsearch qsearchs ); #dbh );

@ISA = qw( FS::Record );

$DEBUG = 0;

=head1 NAME

FS::m2m_Common - Base class for classes in a many-to-many relationship

=head1 SYNOPSIS

use FS::m2m_Common;

@ISA = qw( FS::m2m_Common );

=head1 DESCRIPTION

FS::m2m_Common is intended as a base class for classes which have a
many-to-many relationship with another table (via a linking table).

Note: It is currently assumed that the link table contains two fields
named the same as the primary keys of ths base and target tables.

=head1 METHODS

=over 4

=item process_m2m

=cut

sub process_m2m {
  my( $self, %opt ) = @_;

  my $self_pkey = $self->dbdef_table->primary_key;

  my $link_table = $self->_load_table($opt{'link_table'});

  my $target_table = $self->_load_table($opt{'target_table'});
  my $target_pkey = dbdef->table($target_table)->primary_key;

  foreach my $target_obj ( qsearch($target_table, {} ) ) {

    my $targetnum = $target_obj->$target_pkey();

    my $link_obj = qsearchs( $link_table, {
        $self_pkey   => $self->$self_pkey(),
        $target_pkey => $targetnum,
    });

    if ( $link_obj && ! $opt{'params'}->{"$target_pkey$targetnum"} ) {

      my $d_link_obj = $link_obj; #need to save $link_obj for below.
      my $error = $d_link_obj->delete;
      die $error if $error;

    } elsif ( $opt{'params'}->{"$target_pkey$targetnum"} && ! $link_obj ) {

      #ok to clobber it now (but bad form nonetheless?)
      #$link_obj = new "FS::$link_table" ( {
      $link_obj = "FS::$link_table"->new( {
        $self_pkey   => $self->$self_pkey(),
        $target_pkey => $targetnum,
      });
      my $error = $link_obj->insert;
      die $error if $error;
    }

  }

  '';
}

sub _load_table {
  my( $self, $table ) = @_;
  eval "use FS::$table";
  die $@ if $@;
  $table;
}

#=item target_table
#
#=cut
#
#sub target_table {
#  my $self = shift;
#  my $target_table = $self->_target_table;
#  eval "use FS::$target_table";
#  die $@ if $@;
#  $target_table;
#}

=back

=head1 BUGS

=head1 SEE ALSO

L<FS::Record>

=cut

1;


Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- cust_bill.pm	1 Feb 2006 23:13:48 -0000	1.145
+++ cust_bill.pm	14 May 2006 16:47:31 -0000	1.146
@@ -2463,6 +2463,7 @@
 use MIME::Base64;
 sub process_re_X {
   my( $method, $job ) = ( shift, shift );
+  warn "process_re_X $method for job $job\n" if $DEBUG;
 
   my $param = thaw(decode_base64(shift));
   warn Dumper($param) if $DEBUG;
@@ -2478,6 +2479,10 @@
 sub re_X {
   my($method, $job, %param ) = @_;
 #              [ 'begin', 'end', 'agentnum', 'open', 'days', 'newest_percust' ],
+  if ( $DEBUG ) {
+    warn "re_X $method for job $job with param:\n".
+         join( '', map { "  $_ => ". $param{$_}. "\n" } keys %param );
+  }
 
   #some false laziness w/search/cust_bill.html
   my $distinct = '';

--- NEW FILE: access_user.pm ---
package FS::access_user;

use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );
use FS::m2m_Common;
use FS::access_usergroup;

@ISA = qw( FS::m2m_Common FS::Record );

=head1 NAME

FS::access_user - Object methods for access_user records

=head1 SYNOPSIS

  use FS::access_user;

  $record = new FS::access_user \%hash;
  $record = new FS::access_user { 'column' => 'value' };

  $error = $record->insert;

  $error = $new_record->replace($old_record);

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::access_user object represents an example.  FS::access_user inherits from
FS::Record.  The following fields are currently supported:

=over 4

=item usernum - primary key

=item username - 

=item _password - 

=item last -

=item first -

=back

=head1 METHODS

=over 4

=item new HASHREF

Creates a new example.  To add the example to the database, see L<"insert">.

Note that this stores the hash reference, not a distinct copy of the hash it
points to.  You can ask the object for a copy with the I<hash> method.

=cut

# the new method can be inherited from FS::Record, if a table method is defined

sub table { 'access_user'; }

=item insert

Adds this record to the database.  If there is an error, returns the error,
otherwise returns false.

=cut

# the insert method can be inherited from FS::Record

=item delete

Delete this record from the database.

=cut

# the delete method can be inherited from FS::Record

=item replace OLD_RECORD

Replaces the OLD_RECORD with this one in the database.  If there is an error,
returns the error, otherwise returns false.

=cut

# the replace method can be inherited from FS::Record

=item check

Checks all fields to make sure this is a valid example.  If there is
an error, returns the error, otherwise returns false.  Called by the insert
and replace methods.

=cut

# the check method should currently be supplied - FS::Record contains some
# data checking routines

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('usernum')
    || $self->ut_text('username')
    || $self->ut_text('_password')
    || $self->ut_text('last')
    || $self->ut_text('first')
  ;
  return $error if $error;

  $self->SUPER::check;
}

=item name

Returns a name string for this user: "Last, First".

=cut

sub name {
  my $self = shift;
  $self->get('last'). ', '. $self->first;
}

=item access_usergroup

=cut

sub access_usergroup {
  my $self = shift;
  qsearch( 'access_usergroup', { 'usernum' => $self->usernum } );
}

#=item access_groups
#
#=cut
#
#sub access_groups {
#
#}
#
#=item access_groupnames
#
#=cut
#
#sub access_groupnames {
#
#}

=back

=head1 BUGS

The author forgot to customize this manpage.

=head1 SEE ALSO

L<FS::Record>, schema.html from the base documentation.

=cut

1;


Index: payby.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/payby.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- payby.pm	31 Jan 2006 15:01:41 -0000	1.2
+++ payby.pm	14 May 2006 16:47:31 -0000	1.3
@@ -115,7 +115,8 @@
 
 =head1 BUGS
 
-This should eventually be an actual database table.
+This should eventually be an actual database table, and all tables that
+currently have a char payby field should have a foreign key into here instead.
 
 =head1 SEE ALSO
 

--- NEW FILE: AccessRight.pm ---
package FS::AccessRight;

use strict;
user vars qw(@rights %rights);
use Tie::IxHash;

=head1 NAME

FS::AccessRight - Access control rights.

=head1 SYNOPSIS

  use FS::AccessRight;

=head1 DESCRIPTION

Access control rights - Permission to perform specific actions that can be
assigned to users and/or groups.

=cut

@rights = (
  'Reports' => [
    '_desc' => 'Access to high-level reporting',
  ],
  'Configuration' => [
    '_desc' => 'Access to configuration',

    'Settings' => {},

    'agent' => [
      '_desc' => 'Master access to reseller configuration',
      'agent_type'  => {},
      'agent'       => {},
    ],

    'export_svc_pkg' => [
      '_desc' => 'Access to export, service and package configuration',
      'part_export' => {},
      'part_svc'    => {},
      'part_pkg'    => {},
      'pkg_class'   => {},
    ],

    'billing' => [
      '_desc' => 'Access to billing configuration',
      'payment_gateway'  => {},
      'part_bill_event'  => {},
      'prepay_credit'    => {},
      'rate'             => {},
      'cust_main_county' => {},
    ],

    'dialup' => [
      '_desc' => 'Access to dialup configuraiton',
      'svc_acct_pop' => {},
    ],

    'broadband' => [
      '_desc' => 'Access to broadband configuration',
      'router'     => {},
      'addr_block' => {},
    ],

    'misc' => [
      'part_referral'      => {},
      'part_virtual_field' => {},
      'msgcat'             => {},
      'inventory_class'    => {},
    ],

  },

);

#turn it into a more hash-like structure, but ordered via IxHash


--- NEW FILE: access_usergroup.pm ---
package FS::access_usergroup;

use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );
use FS::access_user;
use FS::access_group;

@ISA = qw(FS::Record);

=head1 NAME

FS::access_usergroup - Object methods for access_usergroup records

=head1 SYNOPSIS

  use FS::access_usergroup;

  $record = new FS::access_usergroup \%hash;
  $record = new FS::access_usergroup { 'column' => 'value' };

  $error = $record->insert;

  $error = $new_record->replace($old_record);

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::access_usergroup object represents an example.  FS::access_usergroup inherits from
FS::Record.  The following fields are currently supported:

=over 4

=item usergroupnum - primary key

=item usernum - 

=item groupnum - 


=back

=head1 METHODS

=over 4

=item new HASHREF

Creates a new example.  To add the example to the database, see L<"insert">.

Note that this stores the hash reference, not a distinct copy of the hash it
points to.  You can ask the object for a copy with the I<hash> method.

=cut

# the new method can be inherited from FS::Record, if a table method is defined

sub table { 'access_usergroup'; }

=item insert

Adds this record to the database.  If there is an error, returns the error,
otherwise returns false.

=cut

# the insert method can be inherited from FS::Record

=item delete

Delete this record from the database.

=cut

# the delete method can be inherited from FS::Record

=item replace OLD_RECORD

Replaces the OLD_RECORD with this one in the database.  If there is an error,
returns the error, otherwise returns false.

=cut

# the replace method can be inherited from FS::Record

=item check

Checks all fields to make sure this is a valid example.  If there is
an error, returns the error, otherwise returns false.  Called by the insert
and replace methods.

=cut

# the check method should currently be supplied - FS::Record contains some
# data checking routines

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('usergroupnum')
    || $self->ut_number('usernum')
    || $self->ut_number('groupnum')
  ;
  return $error if $error;

  $self->SUPER::check;
}

=item access_user

=cut

sub access_user {
  my $self = shift;
  qsearchs( 'access_user', { 'usernum' => $self->usernum } );
}

=item access_group

=cut

sub access_group {
  my $self = shift;
  qsearchs( 'access_group', { 'groupnum' => $self->groupnum } );
}

=back

=head1 BUGS

The author forgot to customize this manpage.

=head1 SEE ALSO

L<FS::Record>, schema.html from the base documentation.

=cut

1;




More information about the freeside-commits mailing list