X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Finventory_item.pm;h=9a58a6463526fa71ddfbfe1b93f04a406e0e0f2c;hp=5312d95f15348f1190ec1dddd613fec553b16369;hb=3adb46fccf9f631e188ea5383bd147b340477639;hpb=600a0939e7e7e589dae4f4f5bfef3650728940b7 diff --git a/FS/FS/inventory_item.pm b/FS/FS/inventory_item.pm index 5312d95f1..9a58a6463 100644 --- a/FS/FS/inventory_item.pm +++ b/FS/FS/inventory_item.pm @@ -1,11 +1,7 @@ package FS::inventory_item; +use base qw( FS::cust_main_Mixin FS::Record ); use strict; -use vars qw( @ISA ); -use FS::Record qw( qsearch qsearchs ); -use FS::inventory_class; - -@ISA = qw(FS::Record); =head1 NAME @@ -104,21 +100,61 @@ 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_numbern('svcnum') + || $self->ut_foreign_keyn('svcnum', 'cust_svc', 'svcnum' ) + || $self->ut_alphan('svc_field') ; return $error if $error; $self->SUPER::check; } +=item cust_svc + +Returns the customer service associated with this inventory item, if the +item has been used (see L). + +=item agent + +Returns the associated agent for this event, if any, as an FS::agent object. + +=back + +=head1 SUBROUTINES + +=over 4 + +=item process_batch_import + +=cut + +sub process_batch_import { + my $job = shift; + + my $opt = { 'table' => 'inventory_item', + #'params' => [ 'itembatch', 'classnum', ], + 'params' => [ 'classnum', 'agentnum', ], + 'formats' => { 'default' => [ 'item' ] }, + 'default_csv' => 1, + }; + + FS::Record::process_batch_import( $job, $opt, @_ ); + +} + =back =head1 BUGS +maybe batch_import should be a regular method in FS::inventory_class + =head1 SEE ALSO -L, schema.html from the base documentation. +L, L, L, schema.html from the base +documentation. =cut