diff options
author | ivan <ivan> | 2004-07-30 04:54:41 +0000 |
---|---|---|
committer | ivan <ivan> | 2004-07-30 04:54:41 +0000 |
commit | 918bbc9ce36a3dc5943f521e26751ea94a5a5539 (patch) | |
tree | 813ee68a86715499f673f884799b6c226f324845 /httemplate | |
parent | c69dd0d922bba433b16e3408f71f1cac0e16a069 (diff) |
svcpart changes now trigger all necessary export actions, manual svcpart changing on svc_acct view, linking changes svcpart if you ask it to, closes: Bug#671, Bug#644
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/edit/process/cust_svc.cgi | 30 | ||||
-rwxr-xr-x | httemplate/misc/process/link.cgi | 7 | ||||
-rwxr-xr-x | httemplate/view/svc_acct.cgi | 42 |
3 files changed, 77 insertions, 2 deletions
diff --git a/httemplate/edit/process/cust_svc.cgi b/httemplate/edit/process/cust_svc.cgi new file mode 100644 index 000000000..187ede5e5 --- /dev/null +++ b/httemplate/edit/process/cust_svc.cgi @@ -0,0 +1,30 @@ +<% + +my $svcnum = $cgi->param('svcnum'); + +my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}) if $svcnum; + +my $new = new FS::cust_svc ( { + map { + $_, scalar($cgi->param($_)); + } fields('cust_svc') +} ); + +my $error; +if ( $svcnum ) { + $error=$new->replace($old); +} else { + $error=$new->insert; + $svcnum=$new->getfield('svcnum'); +} + +if ( $error ) { + #$cgi->param('error', $error); + #print $cgi->redirect(popurl(2). "cust_svc.cgi?". $cgi->query_string ); + eidiot($error); +} else { + my $svcdb = $new->part_svc->svcdb; + print $cgi->redirect(popurl(3). "view/$svcdb.cgi?$svcnum"); +} + + diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 32a5360d9..acdd1ad03 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -16,8 +16,11 @@ unless ( $svcnum ) { if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) { $search{$1} = $cgi->param('link_value2'); } - my $svc_x = ( grep { $_->cust_svc->svcpart == $svcpart } - qsearch( $svcdb, \%search ) + my $svc_x = ( sort { ($b->cust_svc->pkgnum > 0) <=> ($a->cust_svc->pkgnum > 0) + or ($b->cust_svc->svcpart == $svcpart) + <=> ($a->cust_svc->svcpart == $svcpart) + } + qsearch( $svcdb, \%search ) )[0]; eidiot("$link_field not found!") unless $svc_x; $svcnum = $svc_x->svcnum; diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 14d2745a2..be58e4e1d 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -108,6 +108,48 @@ if ( $part_svc->part_export('sqlradius') #print qq!<BR><A HREF="../misc/sendconfig.cgi?$svcnum">Send account information</A>!; +%> + +<% + my @part_svc = (); + if ( $pkgnum ) { + @part_svc = grep { $_->svcdb eq 'svc_acct' + && $_->svcpart != $part_svc->svcpart } + $cust_pkg->available_part_svc; + } else { + @part_svc = qsearch('part_svc', { + svcdb => 'svc_acct', + disabled => '', + svcpart => { op=>'!=', value=>$part_svc->svcpart }, + } ); + } + if ( @part_svc ) { +%> + <SCRIPT TYPE="text/javascript"> + function enable_change () { + if ( document.OneTrueForm.svcpart.selectedIndex > 1 ) { + document.OneTrueForm.submit.disabled = false; + } else { + document.OneTrueForm.submit.disabled = true; + } + } + </SCRIPT> + <FORM NAME="OneTrueForm" ACTION="<%=$p%>edit/process/cust_svc.cgi"> + <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%= $svcnum %>"> + <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%= $pkgnum %>"> + <SELECT NAME="svcpart" onChange="enable_change()"> + <OPTION VALUE="">Change service</OPTION> + <OPTION VALUE="">--------------</OPTION> + <% foreach my $part_svc ( @part_svc ) { %> + <OPTION VALUE="<%= $part_svc->svcpart %>"><%= $part_svc->svc %></OPTION> + <% } %> + </SELECT> + <INPUT NAME="submit" TYPE="submit" VALUE="Change" disabled> + </FORM> +<% } %> + +<% + print qq!<A HREF="${p}edit/svc_acct.cgi?$svcnum">Edit this information</A><BR>!. &ntable("#cccccc"). '<TR><TD>'. &ntable("#cccccc",2). "<TR><TD ALIGN=\"right\">Service number</TD>". |