+ } elsif ( $flag eq 'A' ) {
+ $f->{'type'} = 'hidden';
+ } elsif ( $flag eq 'M' ) {
+ $f->{'empty_label'} = 'Select inventory item';
+ $f->{'type'} = 'select-table';
+ $f->{'table'} = 'inventory_item';
+ $f->{'name_col'} = 'item';
+ $f->{'value_col'} = 'item';
+ $f->{'agent_virt'} = 1;
+ $f->{'agent_null'} = 1;
+ $f->{'hashref'} = {
+ 'classnum'=>$columndef->columnvalue,
+ #'svcnum' => '',
+ };
+ $f->{'extra_sql'} = 'AND ( svcnum IS NULL ';
+ $f->{'extra_sql'} .= ' OR svcnum = '. $object->svcnum
+ if $object->svcnum;
+ $f->{'extra_sql'} .= ' ) ';
+ $f->{'disable_empty'} = $object->svcnum ? 1 : 0,
+ } elsif ( $flag eq 'H' ) {
+ $f->{'type'} = 'select-hardware_type';
+ $f->{'hashref'} = {
+ 'classnum'=>$columndef->columnvalue
+ };
+ $f->{'empty_label'} = 'Select hardware type';
+ }
+
+ if ( $f->{'type'} eq 'select-svc_pbx'
+ || $f->{'type'} eq 'select-svc-domain'
+ )
+ {
+ $f->{'include_opt_callback'} =
+ sub { ( 'pkgnum' => $pkgnum,
+ 'svcpart' => $svcpart,
+ );
+ };
+ }
+
+ if ( $f->{'field'} eq 'custnum' && $pkgnum ) {
+ my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
+ $object->set('custnum', $cust_pkg->custnum);