[freeside-commits] freeside/FS/FS part_pkg.pm, 1.85, 1.86 type_pkgs.pm, 1.5, 1.6

Ivan,,, ivan at wavetail.420.am
Sun Feb 22 00:41:30 PST 2009


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

Modified Files:
	part_pkg.pm type_pkgs.pm 
Log Message:
add agent type list to package def browse, RT#4880

Index: type_pkgs.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/type_pkgs.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- type_pkgs.pm	2 Apr 2005 22:46:44 -0000	1.5
+++ type_pkgs.pm	22 Feb 2009 08:41:28 -0000	1.6
@@ -83,17 +83,11 @@
 
   my $error = 
        $self->ut_numbern('typepkgnum')
-    || $self->ut_number('typenum')
-    || $self->ut_number('pkgpart')
+    || $self->ut_foreign_key('typenum', 'agent_type', 'typenum' )
+    || $self->ut_foreign_key('pkgpart', 'part_pkg',   'pkgpart' )
   ;
   return $error if $error;
 
-  return "Unknown typenum"
-    unless qsearchs( 'agent_type', { 'typenum' => $self->typenum } );
-
-  return "Unknown pkgpart"
-    unless qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } );
-
   $self->SUPER::check;
 }
 
@@ -108,6 +102,17 @@
   qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } );
 }
 
+=item agent_type
+
+Returns the FS::agent_type object associated with this record.
+
+=cut
+
+sub agent_type {
+  my $self = shift;
+  qsearchs( 'agent_type', { 'typenum' => $self->typenum } );
+}
+
 =cut
 
 =back

Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- part_pkg.pm	9 Feb 2009 01:49:27 -0000	1.85
+++ part_pkg.pm	22 Feb 2009 08:41:28 -0000	1.86
@@ -560,6 +560,18 @@
 
 =cut
 
+=item type_pkgs
+
+Returns all FS::type_pkgs objects (see L<FS::type_pkgs>) for this package
+definition.
+
+=cut
+
+sub type_pkgs {
+  my $self = shift;
+  qsearch('type_pkgs', { 'pkgpart' => $self->pkgpart } );
+}
+
 sub pkg_svc {
   my $self = shift;
 



More information about the freeside-commits mailing list