+<!-- mason kludge -->
<%
-# <!-- $Id: cust_pkg.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ -->
-
-use strict;
-use vars qw ( $cgi %uiview %uiadd $part_svc $query $pkgnum $cust_pkg $part_pkg
- $custnum $susp $cancel $expire $pkg $comment $setup $bill
- $otaker );
-use Date::Format;
-use CGI;
-use CGI::Carp qw(fatalsToBrowser);
-use FS::UID qw(cgisuidsetup);
-use FS::CGI qw(popurl header menubar ntable table);
-use FS::Record qw(qsearch qsearchs);
-use FS::part_svc;
-use FS::cust_pkg;
-use FS::part_pkg;
-use FS::pkg_svc;
-use FS::cust_svc;
-
-$cgi = new CGI;
-cgisuidsetup($cgi);
-
-foreach $part_svc ( qsearch('part_svc',{}) ) {
+
+my $conf = new FS::Conf;
+
+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";
}
-($query) = $cgi->keywords;
+my ($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
-$pkgnum = $1;
+my $pkgnum = $1;
#get package record
-$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
+my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
die "No package!" unless $cust_pkg;
-$part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')});
+my $part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')});
-$custnum = $cust_pkg->getfield('custnum');
+my $custnum = $cust_pkg->getfield('custnum');
print header('Package View', menubar(
"View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum",
'Main Menu' => popurl(2)
));
#print info
-($susp,$cancel,$expire)=(
+my ($susp,$cancel,$expire)=(
$cust_pkg->getfield('susp'),
$cust_pkg->getfield('cancel'),
$cust_pkg->getfield('expire'),
);
-($pkg,$comment)=($part_pkg->getfield('pkg'),$part_pkg->getfield('comment'));
-($setup,$bill)=($cust_pkg->getfield('setup'),$cust_pkg->getfield('bill'));
-$otaker = $cust_pkg->getfield('otaker');
+my($pkg,$comment)=($part_pkg->getfield('pkg'),$part_pkg->getfield('comment'));
+my($setup,$bill)=($cust_pkg->getfield('setup'),$cust_pkg->getfield('bill'));
+my $otaker = $cust_pkg->getfield('otaker');
print <<END;
<SCRIPT>
function areyousure(href) {
- if (confirm("Permanantly delete included services and cancel this package?") == true)
+ if (confirm("Permanently delete included services and cancel this package?") == true)
window.location.href = href;
}
</SCRIPT>
'<TR><TD ALIGN="right">Comment</TD><TD BGCOLOR="#ffffff">',
$comment, '</TD></TR>',
'<TR><TD ALIGN="right">Setup date</TD><TD BGCOLOR="#ffffff">',
- ( $setup ? time2str("%D",$setup) : "(Not setup)" ), '</TD></TR>',
- '<TR><TD ALIGN="right">Next bill date</TD><TD BGCOLOR="#ffffff">',
- ( $bill ? time2str("%D",$bill) : " " ), '</TD></TR>',
-;
+ ( $setup ? time2str("%D",$setup) : "(Not setup)" ), '</TD></TR>';
+
+print '<TR><TD ALIGN="right">Last bill date</TD><TD BGCOLOR="#ffffff">',
+ ( $cust_pkg->get('last_bill') ? time2str("%D",$cust_pkg->get('last_bill')) : " " ),
+ '</TD></TR>'
+ if $cust_pkg->dbdef_table->column('last_bill');
+
+print '<TR><TD ALIGN="right">Next bill date</TD><TD BGCOLOR="#ffffff">',
+ ( $bill ? time2str("%D",$bill) : " " ), '</TD></TR>';
+
print '<TR><TD ALIGN="right">Suspension date</TD><TD BGCOLOR="#ffffff">',
time2str("%D",$susp), '</TD></TR>' if $susp;
print '<TR><TD ALIGN="right">Expiration date</TD><TD BGCOLOR="#ffffff">',
time2str("%D",$cancel), '</TD></TR>' if $cancel;
print '<TR><TD ALIGN="right">Order taker</TD><TD BGCOLOR="#ffffff">',
$otaker, '</TD></TR>',
- '</TABLE></TD></TR></TABLE>'
-;
-
-# print <<END;
-#<FORM ACTION="../misc/expire_pkg.cgi" METHOD="post">
-#<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">
-#Expire (date): <INPUT TYPE="text" NAME="date" VALUE="" >
-#<INPUT TYPE="submit" VALUE="Cancel later">
-#END
+ '</TABLE></TD></TR></TABLE>';
+
+unless ($expire) {
+ print <<END;
+<FORM ACTION="../misc/expire_pkg.cgi" METHOD="post">
+<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">
+Expire (date): <INPUT TYPE="text" NAME="date" VALUE="" >
+<INPUT TYPE="submit" VALUE="Cancel later">
+END
+}
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>';
}
}
}
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