RT# 81961 Repair broken links in POD documentation
[freeside.git] / FS / FS / inventory_item.pm
index 3bba1cd..61a929c 100644 (file)
@@ -106,8 +106,12 @@ sub check {
   my $error = 
     $self->ut_numbern('itemnum')
     || $self->ut_foreign_key('classnum', 'inventory_class', 'classnum' )
+    #|| $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum' )
+    || $self->ut_agentnum_acl('agentnum', ['Configuration',
+                                           'Edit global inventory'] )
     || $self->ut_text('item')
     || $self->ut_foreign_keyn('svcnum', 'cust_svc', 'svcnum' )
+    || $self->ut_alphan('svc_field')
   ;
   return $error if $error;
 
@@ -127,6 +131,17 @@ sub cust_svc {
   qsearchs( 'cust_svc', { 'svcnum' => $self->svcnum } );
 }
 
+=item agent 
+
+Returns the associated agent for this event, if any, as an FS::agent object.
+
+=cut
+
+sub agent {
+  my $self = shift;
+  qsearchs('agent', { 'agentnum' => $self->agentnum } );
+}
+
 =back
 
 =head1 SUBROUTINES
@@ -142,7 +157,7 @@ sub process_batch_import {
 
   my $opt = { 'table'   => 'inventory_item',
               #'params'  => [ 'itembatch', 'classnum', ],
-              'params'  => [ 'classnum', ],
+              'params'  => [ 'classnum', 'agentnum', ],
               'formats' => { 'default' => [ 'item' ] },
               'default_csv' => 1,
             };
@@ -159,7 +174,7 @@ maybe batch_import should be a regular method in FS::inventory_class
 
 =head1 SEE ALSO
 
-L<inventory_class>, L<cust_svc>, L<FS::Record>, schema.html from the base
+L<FS::inventory_class>, L<FS::cust_svc>, L<FS::Record>, schema.html from the base
 documentation.
 
 =cut