Default svcpart support for part_pkg. Fixes 'bug' with new customer and online signup.
[freeside.git] / httemplate / browse / part_pkg.cgi
index d0b572a..fd269be 100755 (executable)
@@ -1,22 +1,5 @@
+<!-- mason kludge -->
 <%
-#<!-- $Id: part_pkg.cgi,v 1.9 2001-12-27 09:26:14 ivan Exp $ -->
-
-use strict;
-use vars qw( $cgi $p $part_pkg );
-use CGI;
-use CGI::Carp qw(fatalsToBrowser);
-use FS::UID qw(cgisuidsetup);
-use FS::Record qw(qsearch qsearchs);
-use FS::CGI qw(header menubar popurl table);
-use FS::part_pkg;
-use FS::pkg_svc;
-use FS::part_svc;
-
-$cgi = new CGI;
-
-&cgisuidsetup($cgi);
-
-$p = popurl(2);
 
 my %search;
 if ( $cgi->param('showdisabled') ) {
@@ -46,7 +29,7 @@ if ( $cgi->param('showdisabled') ) {
 my $colspan = $cgi->param('showdisabled') ? 2 : 3;
 print &table(), <<END;
       <TR>
-        <TH COLSPAN=2>Package</TH>
+        <TH COLSPAN=$colspan>Package</TH>
         <TH>Comment</TH>
         <TH><FONT SIZE=-1>Freq.</FONT></TH>
         <TH><FONT SIZE=-1>Plan</FONT></TH>
@@ -56,7 +39,7 @@ print &table(), <<END;
       </TR>
 END
 
-foreach $part_pkg ( sort { 
+foreach my $part_pkg ( sort { 
   $a->getfield('pkgpart') <=> $b->getfield('pkgpart')
 } @part_pkg ) {
   my($hashref)=$part_pkg->hashref;
@@ -98,7 +81,8 @@ END
     my($svcpart)=$pkg_svc->getfield('svcpart');
     my($part_svc) = qsearchs('part_svc',{'svcpart'=> $svcpart });
     print $n,qq!<TD><A HREF="${p}edit/part_svc.cgi?$svcpart">!,
-          $part_svc->getfield('svc'),"</A></TD><TD>",
+          $part_svc->getfield('svc'),"</A>",
+          (($hashref->{def_svcpart} == $svcpart) ? "*</TD><TD>" : "</TD><TD>"),
           $pkg_svc->getfield('quantity'),"</TD></TR>\n";
     $n="<TR>";
   }
@@ -106,9 +90,11 @@ END
   print "</TR>";
 }
 
+$colspan = $cgi->param('showdisabled') ? 8 : 9;
 print <<END;
-   <TR><TD COLSPAN=8><I><A HREF="${p}edit/part_pkg.cgi">Add a new package definition</A></I></TD></TR>
+   <TR><TD COLSPAN=$colspan><I><A HREF="${p}edit/part_pkg.cgi">Add a new package definition</A></I></TD></TR>
     </TABLE>
+    &nbsp* - Default service
   </BODY>
 </HTML>
 END