X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_pkg.cgi;h=d8a0041eee80328f19b6d38b72688d207752e3d5;hp=78b42f127c997fc4a929a55c579c20075c621e2a;hb=3f2a7b01b59902faed5767d81e2959e131bdbdfd;hpb=3ce7691203a7737406bf2d4442f7fd84b81f847e diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index 78b42f127..d8a0041ee 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -1,166 +1,11 @@ - -% -% -%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"; -%} -% -%my ($query) = $cgi->keywords; -%$query =~ /^(\d+)$/; -%my $pkgnum = $1; -% -%#get package record -%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -%die "No package!" unless $cust_pkg; -%my $part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')}); -% -%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 -%my ($susp,$cancel,$expire)=( -% $cust_pkg->getfield('susp'), -% $cust_pkg->getfield('cancel'), -% $cust_pkg->getfield('expire'), -%); -%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 < -%function areyousure(href) { -% if (confirm("Permanently delete included services and cancel this package?") == true) -% window.location.href = href; -%} -% -%END -% -%print "Package information"; -%print ' (unsuspend)' -% if ( $susp && ! $cancel ); -% -%print ' (suspend)' -% unless ( $susp || $cancel ); -% -%print ' (cancel)' -% unless $cancel; -% -%print ' (edit dates)'; -% -%print &ntable("#cccccc"), '', &ntable("#cccccc",2), -% 'Package number', -% $pkgnum, '', -% 'Package', -% $pkg, '', -% 'Comment', -% $comment, '', -% 'Setup date', -% ( $setup ? time2str("%D",$setup) : "(Not setup)" ), ''; -% -%print 'Last bill date', -% ( $cust_pkg->get('last_bill') ? time2str("%D",$cust_pkg->get('last_bill')) : " " ), -% '' -% if $cust_pkg->dbdef_table->column('last_bill'); -% -%print 'Next bill date', -% ( $bill ? time2str("%D",$bill) : " " ), ''; -% -%print 'Suspension date', -% time2str("%D",$susp), '' if $susp; -%print 'Expiration date', -% time2str("%D",$expire), '' if $expire; -%print 'Cancellation date', -% time2str("%D",$cancel), '' if $cancel; -%print 'Order taker', -% $otaker, '', -% ''; -% -%unless ($expire) { -% print < -% -%Expire (date): -% -%END -%} -% -%unless ($cancel) { -% -% #services -% print '
Service Information', &table(); -% -% #list of services this pkgpart includes -% my $pkg_svc; -% my %pkg_svc; -% #foreach $pkg_svc ( qsearch('pkg_svc',{'pkgpart'=> $cust_pkg->pkgpart }) ) { -% foreach $pkg_svc ( $cust_pkg->part_pkg->pkg_svc ) { -% $pkg_svc{$pkg_svc->svcpart} = $pkg_svc->quantity if $pkg_svc->quantity; -% } -% -% #list of records from cust_svc -% my $svcpart; -% foreach $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, -% }); -% -% my($enum); -% for $enum ( 1 .. $pkg_svc{$svcpart} ) { -% -% my($cust_svc); -% if ( $cust_svc=shift @cust_svc ) { -% my($svcnum)=$cust_svc->svcnum; -% my($label, $value, $svcdb) = $cust_svc->label; -% print <(View/Edit) $svc: $value -%END -% } else { -% print qq!!. -% qq!!. -% qq!(Provision) $svc!; -% -% print qq! or !. -% qq!(Link to legacy) $svc! -% if $conf->exists('legacy_link'); -% -% print ''; -% } -% -% } -% warn "WARNING: Leftover services pkgnum $pkgnum!" if @cust_svc;; -% } -% -% print "", -% "Choose (View/Edit) to view or edit an existing service
", -% "Choose (Provision) to setup a new service
"; -% -% print "Choose (Link to legacy) to link to a legacy (pre-Freeside) service" -% if $conf->exists('legacy_link'); -% -% print "
"; -%} -% -%#formatting -%print < -% -%END -% -% +<% $cgi->redirect($path) %> +<%init> +# since cust_pkgs can't be viewed directly, just throw a redirect +my ($pkgnum) = $cgi->keywords; +$pkgnum =~ /^\d+$/ or die "invalid pkgnum '$pkgnum'"; +my $show = $FS::CurrentUser::CurrentUser->default_customer_view =~ /^(jumbo|packages)$/ ? '' : ';show=packages'; +my $self = FS::cust_pkg->by_key($pkgnum) or die "pkgnum $pkgnum not found"; +my $frag = 'cust_pkg'. $self->pkgnum; +my $path = $p.'view/cust_main.cgi?custnum='.$self->custnum.";$show#$frag"; +