freeside/httemplate/misc/process link.cgi,1.6.6.2,1.6.6.3
ivan
ivan at pouncequick.420.am
Mon Apr 5 07:06:26 PDT 2004
Update of /home/cvs/cvsroot/freeside/httemplate/misc/process
In directory pouncequick:/tmp/cvs-serv4635/httemplate/misc/process
Modified Files:
Tag: FREESIDE_1_4_BRANCH
link.cgi
Log Message:
add a domain pulldown to svc_acct linking, closes: Bug#277 / prevent "stealing" services with link unless you set legacy_link-steal config option, closes: Bug#321
Index: link.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/process/link.cgi,v
retrieving revision 1.6.6.2
retrieving revision 1.6.6.3
diff -u -d -r1.6.6.2 -r1.6.6.3
--- link.cgi 22 Mar 2004 11:06:28 -0000 1.6.6.2
+++ link.cgi 5 Apr 2004 14:06:20 -0000 1.6.6.3
@@ -12,8 +12,12 @@
my $svcdb = $part_svc->getfield('svcdb');
$cgi->param('link_field') =~ /^(\w+)$/;
my $link_field = $1;
+ my %search = ( $link_field => $cgi->param('link_value') );
+ if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) {
+ $search{$1} = $cgi->param('link_value2');
+ }
my $svc_x = ( grep { $_->cust_svc->svcpart == $svcpart }
- qsearch( $svcdb, { $link_field => $cgi->param('link_value') })
+ qsearch( $svcdb, \%search )
)[0];
eidiot("$link_field not found!") unless $svc_x;
$svcnum = $svc_x->svcnum;
@@ -21,19 +25,24 @@
my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum});
die "svcnum not found!" unless $old;
-#die "svcnum $svcnum already linked to package ". $old->pkgnum if $old->pkgnum;
-my $new = new FS::cust_svc ({
- 'svcnum' => $svcnum,
- 'pkgnum' => $pkgnum,
- 'svcpart' => $svcpart,
-});
+my $conf = new FS::Conf;
+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,
+ });
-my $error = $new->replace($old);
+ $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"
+ print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum".
"#cust_pkg$pkgnum" );
} else {
%>
More information about the freeside-commits
mailing list