1 <% include('/elements/header.html', "Mail Forward $action") %>
3 <% include('/elements/error.html') %>
5 Service #<% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR>
6 Service: <B><% $part_svc->svc %></B><BR><BR>
8 <FORM ACTION="process/svc_forward.cgi" METHOD="POST">
10 <% include('elements/svc_forward.html',
14 'svcpart' => $svcpart,
22 <BR><INPUT TYPE="submit" VALUE="Submit">
25 <% include('/elements/footer.html') %>
30 unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
32 my $conf = new FS::Conf;
34 my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_forward);
35 if ( $cgi->param('error') ) {
36 $svc_forward = new FS::svc_forward ( {
37 map { $_, scalar($cgi->param($_)) } fields('svc_forward')
39 $svcnum = $svc_forward->svcnum;
40 $pkgnum = $cgi->param('pkgnum');
41 $svcpart = $cgi->param('svcpart');
42 $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
43 die "No part_svc entry!" unless $part_svc;
45 } elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding
47 $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum';
49 $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart';
52 $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
53 die "No part_svc entry!" unless $part_svc;
55 $svc_forward = new FS::svc_forward({});
59 $svc_forward->set_default_and_fixed;
63 my($query) = $cgi->keywords;
65 $query =~ /^(\d+)$/ or die "unparsable svcnum";
67 $svc_forward=qsearchs('svc_forward',{'svcnum'=>$svcnum})
68 or die "Unknown (svc_forward) svcnum!";
70 my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum})
71 or die "Unknown (cust_svc) svcnum!";
73 $pkgnum=$cust_svc->pkgnum;
74 $svcpart=$cust_svc->svcpart;
76 $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
77 die "No part_svc entry!" unless $part_svc;
80 my $action = $svc_forward->svcnum ? 'Edit' : 'Add';
86 #find all possible user svcnums (and emails)
88 my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
89 die "Specified package not found" unless $cust_pkg;
90 %email = $cust_pkg->forward_emails('svc_forward' => $svc_forward);
92 } elsif ( $action eq 'Add' ) {
94 die "\$action eq Add, but \$pkgnum is null!\n";
99 %email = FS::cust_pkg->forward_emails('svc_forward' => $svc_forward);
103 my($srcsvc,$dstsvc,$dst)=(
104 $svc_forward->srcsvc,
105 $svc_forward->dstsvc,
108 my $src = $svc_forward->dbdef_table->column('src') ? $svc_forward->src : '';