From 4dbbbee37e78a035022974d19b3b80aeaead6049 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 22 Feb 2002 01:07:23 +0000 Subject: [PATCH] UI work: make all functions of view/cust_pkg.cgi available on view/cust_main.cgi - having them one link down in "Edit" is confusing. closes: Bug#325 --- FS/FS/Conf.pm | 7 +++ httemplate/view/cust_main.cgi | 106 ++++++++++++++++++++++++++++++++++++------ 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 '
'; +print < +function cust_pkg_areyousure(href) { + if (confirm("Permanantly delete included services and cancel this package?") == true) + window.location.href = href; +} + +END + print qq!
Packages !, # qq!
Click on package number to view/edit package.!, qq!( Order and cancel packages (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!$pkgnum!, qq!!, #qq!$pkg - $comment!, - qq!$pkg - $comment!, - qq! ( Edit | Customize )!, - ; + qq!$pkg - $comment ( Details )!; + # | !; + + #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!Unsuspend!; + } else { + print qq!Suspend!; + } + print ' | Cancel'; + + print ' ) '; + + print ' ( Edit dates | '; + + print qq!Customize )!; + + } + print ''; + for ( qw( setup bill susp expire cancel ) ) { print "", ( $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!$label!, - qq!$value!; - $n2=""; + #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!$label!, + qq!$value!; + } else { + print $n2, qq!!. + qq!Provision $svc!; + + print qq!
!. + qq!Link to legacy $svc! + if $conf->exists('legacy_link'); + + print ''; + } + $n2=""; + } } + $n1=""; } print ""; @@ -333,7 +409,7 @@ print ""; print < -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! (delete)! + ? qq! (delete)! : ''; 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! (delete)! + ? qq! (delete)! : ''; 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 @@ <% +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 <(View) $svc: $value +(View/Edit) $svc: $value END } else { - print < - - (Add) $svc - or - (Link to existing) $svc - - -END + print qq!!. + qq!!. + qq!(Provision) $svc!; + + print qq! or !. + qq!(Link to legacy) $svc! + if $conf->exists('legacy_link'); + + print ''; } } @@ -137,11 +139,13 @@ END } print "", - "Choose (View) to view or edit an existing service
", - "Choose (Add) to setup a new service
", - "Choose (Link to existing) to link to a legacy (pre-Freeside) service", - "
" - ; + "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 -- 2.11.0