3 my $svcpart = $cgi->param('svcpart');
5 my $old = qsearchs('part_svc',{'svcpart'=>$svcpart}) if $svcpart;
7 $cgi->param( 'svc_acct__usergroup',
8 join(',', $cgi->param('svc_acct__usergroup') ) );
10 my $new = new FS::part_svc ( {
12 $_, scalar($cgi->param($_));
13 # } qw(svcpart svc svcdb)
14 } ( fields('part_svc'),
16 my @fields = fields($svcdb);
17 push @fields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge
18 map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ) } @fields;
19 } grep defined( $FS::Record::dbdef->table($_) ),
20 qw( svc_acct svc_domain svc_forward svc_www svc_broadband )
26 $error = $new->replace($old, '1.3-COMPAT', [ 'usergroup' ] );
28 $error = $new->insert( [ 'usergroup' ] );
29 $svcpart=$new->getfield('svcpart');
33 $cgi->param('error', $error);
34 print $cgi->redirect(popurl(2). "part_svc.cgi?". $cgi->query_string );
37 #false laziness w/ edit/process/agent_type.cgi
38 foreach my $part_export (qsearch('part_export',{})) {
39 my $exportnum = $part_export->exportnum;
40 my $export_svc = qsearchs('export_svc', {
41 'exportnum' => $part_export->exportnum,
42 'svcpart' => $new->svcpart,
44 if ( $export_svc && ! $cgi->param("exportnum". $part_export->exportnum) ) {
45 $error = $export_svc->delete;
47 } elsif ( $cgi->param("exportnum". $part_export->exportnum)
49 $export_svc = new FS::export_svc ( {
50 'exportnum' => $part_export->exportnum,
51 'svcpart' => $new->svcpart,
53 $error = $export_svc->insert;
59 print $cgi->redirect(popurl(3)."browse/part_svc.cgi");