4 my $conf = new FS::Conf;
8 foreach my $part_svc ( qsearch('part_svc',{}) ) {
9 $uiview{$part_svc->svcpart} = popurl(2). "view/". $part_svc->svcdb . ".cgi";
10 $uiadd{$part_svc->svcpart}= popurl(2). "edit/". $part_svc->svcdb . ".cgi";
13 my ($query) = $cgi->keywords;
18 my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
19 die "No package!" unless $cust_pkg;
20 my $part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')});
22 my $custnum = $cust_pkg->getfield('custnum');
23 print header('Package View', menubar(
24 "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum",
25 'Main Menu' => popurl(2)
29 my ($susp,$cancel,$expire)=(
30 $cust_pkg->getfield('susp'),
31 $cust_pkg->getfield('cancel'),
32 $cust_pkg->getfield('expire'),
34 my($pkg,$comment)=($part_pkg->getfield('pkg'),$part_pkg->getfield('comment'));
35 my($setup,$bill)=($cust_pkg->getfield('setup'),$cust_pkg->getfield('bill'));
36 my $otaker = $cust_pkg->getfield('otaker');
40 function areyousure(href) {
41 if (confirm("Permanently delete included services and cancel this package?") == true)
42 window.location.href = href;
47 print "Package information";
48 print ' (<A HREF="'. popurl(2). 'misc/unsusp_pkg.cgi?'. $pkgnum.
50 if ( $susp && ! $cancel );
52 print ' (<A HREF="'. popurl(2). 'misc/susp_pkg.cgi?'. $pkgnum.
54 unless ( $susp || $cancel );
56 print ' (<A HREF="javascript:areyousure(\''. popurl(2). 'misc/cancel_pkg.cgi?'.
57 $pkgnum. '\')">cancel</A>)'
60 print ' (<A HREF="'. popurl(2). 'edit/REAL_cust_pkg.cgi?'. $pkgnum.
63 print &ntable("#cccccc"), '<TR><TD>', &ntable("#cccccc",2),
64 '<TR><TD ALIGN="right">Package number</TD><TD BGCOLOR="#ffffff">',
65 $pkgnum, '</TD></TR>',
66 '<TR><TD ALIGN="right">Package</TD><TD BGCOLOR="#ffffff">',
68 '<TR><TD ALIGN="right">Comment</TD><TD BGCOLOR="#ffffff">',
69 $comment, '</TD></TR>',
70 '<TR><TD ALIGN="right">Setup date</TD><TD BGCOLOR="#ffffff">',
71 ( $setup ? time2str("%D",$setup) : "(Not setup)" ), '</TD></TR>',
72 '<TR><TD ALIGN="right">Next bill date</TD><TD BGCOLOR="#ffffff">',
73 ( $bill ? time2str("%D",$bill) : " " ), '</TD></TR>',
75 print '<TR><TD ALIGN="right">Suspension date</TD><TD BGCOLOR="#ffffff">',
76 time2str("%D",$susp), '</TD></TR>' if $susp;
77 print '<TR><TD ALIGN="right">Expiration date</TD><TD BGCOLOR="#ffffff">',
78 time2str("%D",$expire), '</TD></TR>' if $expire;
79 print '<TR><TD ALIGN="right">Cancellation date</TD><TD BGCOLOR="#ffffff">',
80 time2str("%D",$cancel), '</TD></TR>' if $cancel;
81 print '<TR><TD ALIGN="right">Order taker</TD><TD BGCOLOR="#ffffff">',
82 $otaker, '</TD></TR>',
83 '</TABLE></TD></TR></TABLE>'
87 #<FORM ACTION="../misc/expire_pkg.cgi" METHOD="post">
88 #<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">
89 #Expire (date): <INPUT TYPE="text" NAME="date" VALUE="" >
90 #<INPUT TYPE="submit" VALUE="Cancel later">
96 print '<BR>Service Information', &table();
98 #list of services this pkgpart includes
101 foreach $pkg_svc ( qsearch('pkg_svc',{'pkgpart'=> $cust_pkg->pkgpart }) ) {
102 $pkg_svc{$pkg_svc->svcpart} = $pkg_svc->quantity if $pkg_svc->quantity;
105 #list of records from cust_svc
107 foreach $svcpart (sort {$a <=> $b} keys %pkg_svc) {
109 my($svc)=qsearchs('part_svc',{'svcpart'=>$svcpart})->getfield('svc');
111 my(@cust_svc)=qsearch('cust_svc',{'pkgnum'=>$pkgnum,
116 for $enum ( 1 .. $pkg_svc{$svcpart} ) {
119 if ( $cust_svc=shift @cust_svc ) {
120 my($svcnum)=$cust_svc->svcnum;
121 my($label, $value, $svcdb) = $cust_svc->label;
123 <TR><TD><A HREF="$uiview{$svcpart}?$svcnum">(View/Edit) $svc: $value<A></TD></TR>
127 qq!<A HREF="$uiadd{$svcpart}?pkgnum$pkgnum-svcpart$svcpart">!.
128 qq!(Provision) $svc</A>!;
130 print qq! or <A HREF="../misc/link.cgi?pkgnum$pkgnum-svcpart$svcpart">!.
131 qq!(Link to legacy) $svc</A>!
132 if $conf->exists('legacy_link');
138 warn "WARNING: Leftover services pkgnum $pkgnum!" if @cust_svc;;
141 print "</TABLE><FONT SIZE=-1>",
142 "Choose (View/Edit) to view or edit an existing service<BR>",
143 "Choose (Provision) to setup a new service<BR>";
145 print "Choose (Link to legacy) to link to a legacy (pre-Freeside) service"
146 if $conf->exists('legacy_link');