diff options
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rwxr-xr-x | httemplate/view/cust_main.cgi | 106 | ||||
-rwxr-xr-x | httemplate/view/cust_pkg.cgi | 34 |
3 files changed, 117 insertions, 30 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index f8d646254..226702e5c 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -766,6 +766,13 @@ httemplate/docs/config.html 'type' => 'checkbox', }, + { + 'key' => 'legacy_link', + 'section' => 'UI', + 'description' => 'Display options in the web interface to link legacy pre-Freeside services.', + 'type' => 'checkbox', + }, + ); 1; diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 8ae7ce295..1a04ff61c 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -3,6 +3,14 @@ my $conf = new FS::Conf; +#false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so +my %uiview = (); +my %uiadd = (); +foreach my $part_svc ( qsearch('part_svc',{}) ) { + $uiview{$part_svc->svcpart} = popurl(2). "view/". $part_svc->svcdb . ".cgi"; + $uiadd{$part_svc->svcpart}= popurl(2). "edit/". $part_svc->svcdb . ".cgi"; +} + print header("Customer View", menubar( 'Main Menu' => popurl(2) )); @@ -260,6 +268,15 @@ foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { print '</SELECT><INPUT TYPE="submit" VALUE="Order Package"><BR>'; +print <<END; +<SCRIPT> +function cust_pkg_areyousure(href) { + if (confirm("Permanantly delete included services and cancel this package?") == true) + window.location.href = href; +} +</SCRIPT> +END + print qq!<BR><A NAME="cust_pkg">Packages</A> !, # qq!<BR>Click on package number to view/edit package.!, qq!( <A HREF="!, popurl(2), qq!edit/cust_pkg.cgi?$custnum">Order and cancel packages</A> (preserves services) )!, @@ -292,8 +309,25 @@ foreach my $package (@packages) { my $pkg = $package->part_pkg->pkg; my $comment = $package->part_pkg->comment; my $pkgview = popurl(2). "view/cust_pkg.cgi?$pkgnum"; - my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); - my $rowspan = scalar(@cust_svc) || 1; + + #my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); + #my $rowspan = scalar(@cust_svc) || 1; + my @cust_svc = (); + my $rowspan = 0; + my %pkg_svc = (); + unless ( $package->getfield('cancel') ) { + foreach my $pkg_svc ( + grep { $_->quantity } + qsearch('pkg_svc',{'pkgpart'=> $package->pkgpart }) + ) { + $rowspan += ( $pkg_svc{$pkg_svc->svcpart} = $pkg_svc->quantity ); + } + } else { + #@cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); + @cust_svc = (); + $rowspan = scalar(@cust_svc) || 1; + } + $rowspan ||= 1; my $button_cgi = new CGI; $button_cgi->param('clone', $package->part_pkg->pkgpart); @@ -304,9 +338,30 @@ foreach my $package (@packages) { print $n1, qq!<TD ROWSPAN=$rowspan>$pkgnum</TD>!, qq!<TD ROWSPAN=$rowspan><FONT SIZE=-1>!, #qq!<A HREF="$pkgview">$pkg - $comment</A>!, - qq!$pkg - $comment!, - qq! ( <A HREF="$pkgview">Edit</A> | <A HREF="$button_url">Customize</A> )</FONT></TD>!, - ; + qq!$pkg - $comment ( <a href="$pkgview">Details</a> )!; + # | !; + + #false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so + unless ( $package->getfield('cancel') ) { + print ' ( '; + if ( $package->getfield('susp') ) { + print qq!<A HREF="${p}misc/unsusp_pkg.cgi?$pkgnum">Unsuspend</A>!; + } else { + print qq!<A HREF="${p}misc/susp_pkg.cgi?$pkgnum">Suspend</A>!; + } + print ' | <A HREF="javascript:cust_pkg_areyousure(\''. popurl(2). + 'misc/cancel_pkg.cgi?'. $pkgnum. '\')">Cancel</A>'; + + print ' ) '; + + print ' ( <A HREF="'. popurl(2). 'edit/REAL_cust_pkg.cgi?'. $pkgnum. + '">Edit dates</A> | '; + + print qq!<A HREF="$button_url">Customize</A> )!; + + } + print '</FONT></TD>'; + for ( qw( setup bill susp expire cancel ) ) { print "<TD ROWSPAN=$rowspan><FONT SIZE=-1>", ( $package->getfield($_) ? time2str("%D", $package->getfield($_) ) @@ -316,14 +371,35 @@ foreach my $package (@packages) { } my $n2 = ''; - foreach my $cust_svc ( @cust_svc ) { - my($label, $value, $svcdb) = $cust_svc->label; - my($svcnum) = $cust_svc->svcnum; - my($sview) = popurl(2). "view"; - print $n2,qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$label</FONT></A></TD>!, - qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$value</FONT></A></TD>!; - $n2="</TR><TR>"; + #false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so + #foreach my $cust_svc ( @cust_svc ) { + foreach my $svcpart ( sort { $a<=>$b } keys %pkg_svc ) { + my $svc = qsearchs('part_svc',{'svcpart'=>$svcpart})->getfield('svc'); + my(@cust_svc)=qsearch('cust_svc',{'pkgnum'=>$pkgnum, + 'svcpart'=>$svcpart, + }); + for my $enum ( 1 .. $pkg_svc{$svcpart} ) { + my $cust_svc; + if ( $cust_svc = shift @cust_svc ) { + my($label, $value, $svcdb) = $cust_svc->label; + my($svcnum) = $cust_svc->svcnum; + my($sview) = popurl(2). "view"; + print $n2,qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$label</FONT></A></TD>!, + qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$value</FONT></A></TD>!; + } else { + print $n2, qq!<TD COLSPAN=2><A HREF="$uiadd{$svcpart}?pkgnum$pkgnum-svcpart$svcpart"><b><font size="+1" color="#ff0000">!. + qq!Provision $svc</A></b></font>!; + + print qq!<BR><A HREF="../misc/link.cgi?pkgnum$pkgnum-svcpart$svcpart">!. + qq!<b><font size="+1" color="#ff0000">Link to legacy $svc</A></b></font>! + if $conf->exists('legacy_link'); + + print '</TD>'; + } + $n2="</TR><TR>"; + } } + $n1="</TR><TR>"; } print "</TR>"; @@ -333,7 +409,7 @@ print "</TABLE>"; print <<END; <SCRIPT> -function areyousure(href) { +function cust_pay_areyousure(href) { if (confirm("Are you sure you want to delete this payment?") == true) window.location.href = href; @@ -389,7 +465,7 @@ foreach my $bill (@bills) { $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^(CARD|COMP)$/$1 /; my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') - ? qq! (<A HREF="javascript:areyousure('${p}misc/delete-cust_pay.cgi?!. $payment->paynum. qq!')">delete</A>)! + ? qq! (<A HREF="javascript:cust_pay_areyousure('${p}misc/delete-cust_pay.cgi?!. $payment->paynum. qq!')">delete</A>)! : ''; push @history, "$date\tPayment, Invoice #$invnum ($payby$payinfo)$delete\t\t$paid\t\t\t$target"; @@ -451,7 +527,7 @@ foreach my $payment (@unapplied_payments) { $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^(CARD|COMP)$/$1 /; my $delete = $payment->closed !~ /^Y/i && $conf->exists('deletepayments') - ? qq! (<A HREF="javascript:areyousure('${p}misc/delete-cust_pay.cgi?!. $payment->paynum. qq!')">delete</A>)! + ? qq! (<A HREF="javascript:cust_pay_areyousure('${p}misc/delete-cust_pay.cgi?!. $payment->paynum. qq!')">delete</A>)! : ''; push @history, $payment->_date. "\t". diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index e9670cd22..75fe983b4 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -1,6 +1,8 @@ <!-- mason kludge --> <% +my $conf = new FS::Conf; + my %uiview = (); my %uiadd = (); foreach my $part_svc ( qsearch('part_svc',{}) ) { @@ -118,18 +120,18 @@ unless ($cancel) { my($svcnum)=$cust_svc->svcnum; my($label, $value, $svcdb) = $cust_svc->label; print <<END; -<TR><TD><A HREF="$uiview{$svcpart}?$svcnum">(View) $svc: $value<A></TD></TR> +<TR><TD><A HREF="$uiview{$svcpart}?$svcnum">(View/Edit) $svc: $value<A></TD></TR> END } else { - print <<END; -<TR> - <TD><A HREF="$uiadd{$svcpart}?pkgnum$pkgnum-svcpart$svcpart"> - (Add) $svc</A> - or <A HREF="../misc/link.cgi?pkgnum$pkgnum-svcpart$svcpart"> - (Link to existing) $svc</A> - </TD> -</TR> -END + print qq!<TR><TD>!. + qq!<A HREF="$uiadd{$svcpart}?pkgnum$pkgnum-svcpart$svcpart">!. + qq!(Provision) $svc</A>!; + + print qq! or <A HREF="../misc/link.cgi?pkgnum$pkgnum-svcpart$svcpart">!. + qq!(Link to legacy) $svc</A>! + if $conf->exists('legacy_link'); + + print '</TD></TR>'; } } @@ -137,11 +139,13 @@ END } print "</TABLE><FONT SIZE=-1>", - "Choose (View) to view or edit an existing service<BR>", - "Choose (Add) to setup a new service<BR>", - "Choose (Link to existing) to link to a legacy (pre-Freeside) service", - "</FONT>" - ; + "Choose (View/Edit) to view or edit an existing service<BR>", + "Choose (Provision) to setup a new service<BR>"; + + print "Choose (Link to legacy) to link to a legacy (pre-Freeside) service" + if $conf->exists('legacy_link'); + + print "</FONT>"; } #formatting |