X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Flink.cgi;h=77546f3f7102049733294d1f2249183a313c692a;hb=3a02c437eadd9a39f7e56056ca987a4846650209;hp=c3d79e22c8870cbf088ed910b6218ebd56dcfa29;hpb=6e8f3245e71ed4484d5d289f2a455c9a08a900ee;p=freeside.git diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index c3d79e22c..77546f3f7 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,4 +1,20 @@ -<% +%unless ($error) { +% #no errors, so let's view this customer. +% my $custnum = $new->cust_pkg->custnum; +% my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ +% ? '' +% : ';show=packages'; +% my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment +<% $cgi->redirect(popurl(3). "view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag" ) %> +%} else { +% errorpage($error); +%} +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('View/link unlinked services'); my $DEBUG = 0; @@ -39,7 +55,7 @@ unless ( $svcnum ) { my $svc_x = $svc_x[0]; - eidiot("$link_field not found!") unless $svc_x; + errorpage("$link_field not found!") unless $svc_x; $svcnum = $svc_x->svcnum; @@ -52,25 +68,11 @@ my($error, $new); if ( $old->pkgnum && ! $conf->exists('legacy_link-steal') ) { $error = "svcnum $svcnum already linked to package ". $old->pkgnum; } else { - $new = new FS::cust_svc ({ - 'svcnum' => $svcnum, - 'pkgnum' => $pkgnum, - 'svcpart' => $svcpart, - }); + $new = new FS::cust_svc { $old->hash }; + $new->pkgnum($pkgnum); + $new->svcpart($svcpart); $error = $new->replace($old); } -unless ($error) { - #no errors, so let's view this customer. - my $custnum = $new->cust_pkg->custnum; - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum". - "#cust_pkg$pkgnum" ); -} else { -%> - -<% - idiot($error); -} - -%> +