From c1bb4ddb71147d0571bd301a6d8c452fdf0e1bc9 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 31 Jan 2006 04:26:54 +0000 Subject: move header() to include(/elements/header.html) so it can be changed in one place, thanks to Scott Edwards --- httemplate/view/cust_bill.cgi | 2 +- httemplate/view/cust_main.cgi | 2 +- httemplate/view/svc_acct.cgi | 4 ++-- httemplate/view/svc_broadband.cgi | 2 +- httemplate/view/svc_domain.cgi | 2 +- httemplate/view/svc_external.cgi | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 56c0c1736..45e19d436 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -23,7 +23,7 @@ my $custnum = $cust_bill->getfield('custnum'); my $link = $templatename ? "$templatename-$invnum" : $invnum; %> -<%= header('Invoice View', menubar( +<%= include("/elements/header.html",'Invoice View', menubar( "Main Menu" => $p, "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", )) %> diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 59c1a4b73..4975c52fd 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -12,7 +12,7 @@ foreach my $part_svc ( qsearch('part_svc',{}) ) { %> -<%= header("Customer View", menubar( +<%= include("/elements/header.html","Customer View", menubar( 'Main Menu' => $p, )) %> diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index b42362d91..f4f39084c 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -37,7 +37,7 @@ my $domain = $svc_domain->domain; <% if ( $custnum ) { %> - <%= header("View $svc account", menubar( + <%= include("/elements/header.html","View $svc account", menubar( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", "Main menu" => $p, )) %> @@ -54,7 +54,7 @@ my $domain = $svc_domain->domain; } - <%= header('Account View', menubar( + <%= include("/elements/header.html",'Account View', menubar( "Cancel this (unaudited) account" => "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')", "Main menu" => $p, diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index f381b5ad3..263fd70f5 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -44,7 +44,7 @@ my ( ); %> -<%=header('Broadband Service View', menubar( +<%=include("/elements/header.html",'Broadband Service View', menubar( ( ( $custnum ) ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", ) diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 428f3e9bf..f39663094 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -32,7 +32,7 @@ my $domain = $svc_domain->domain; %> -<%= header('Domain View', menubar( +<%= include("/elements/header.html",'Domain View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", ) diff --git a/httemplate/view/svc_external.cgi b/httemplate/view/svc_external.cgi index 49183cd95..2acc3f9cf 100644 --- a/httemplate/view/svc_external.cgi +++ b/httemplate/view/svc_external.cgi @@ -25,7 +25,7 @@ if ($pkgnum) { %> -<%= header('External Service View', menubar( +<%= include("/elements/header.html",'External Service View', menubar( ( ( $custnum ) ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", ) -- cgit v1.2.1 From e9b7648aa4f838e45de95128dc22053aa8eafdb4 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 22 Feb 2006 13:07:48 +0000 Subject: add vonage click2call feature --- httemplate/view/cust_main/contacts.html | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 456d117a6..89926ea64 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -51,14 +51,22 @@ Billing address %> <%= $daytime_label %> - - <%= $cust_main->daytime || ' ' %> + + <%= include('/elements/phonenumber.html', + $cust_main->daytime, + 'callable'=>1 + ) + %> <%= $night_label %> - - <%= $cust_main->night || ' ' %> + + <%= include('/elements/phonenumber.html', + $cust_main->night, + 'callable'=>1 + ) + %> @@ -111,13 +119,21 @@ Service address <%= $daytime_label %> - <%= $cust_main->get("${pre}daytime") || ' ' %> + <%= include('/elements/phonenumber.html', + $cust_main->get("${pre}daytime"), + 'callable'=>1 + ) + %> <%= $night_label %> - <%= $cust_main->get("${pre}night") || ' ' %> + <%= include('/elements/phonenumber.html', + $cust_main->get("${pre}night"), + 'callable'=>1 + ) + %> -- cgit v1.2.1 From b3d608b436cdf673a5552acf9e4b4601f4f79b9d Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 Mar 2006 11:48:06 +0000 Subject: don't use a table with WIDTH="100%", it shoves the custnum and "billing information" boxes way out to the right --- httemplate/view/cust_main.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 4975c52fd..082a93bb7 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -92,12 +92,12 @@ print "This customer's signup URL: ". %> -<%= &itable() %> + - +<% my $conf = new FS::Conf; if ( $conf->exists('voip-cust_cdr_spools') ) { %> + + + + +<% } %>
<%= include('cust_main/contacts.html', $cust_main ) %> + <%= include('cust_main/misc.html', $cust_main ) %> <% if ( $conf->config('payby-default') ne 'HIDE' ) { %>
-- cgit v1.2.1 From ff24bc786a5fd479f2252260e0da580a736f97be Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 20 Mar 2006 19:13:27 +0000 Subject: add price plan to bill on internal or external CDRs directly, add option to export CDRs to a per-customer downstream file --- httemplate/view/cust_main/billing.html | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 5786a0711..895814cc2 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -159,6 +159,12 @@ if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format <%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %>
Spool CDRs<%= $cust_main->spool_cdr ? 'yes' : 'no' %>
-- cgit v1.2.1 From 929f432c766bbe3bdeed5b80818a12ddf6ec6339 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 3 Apr 2006 09:46:57 +0000 Subject: have the UI use full country names, and state names outside the US... --- httemplate/view/cust_main/contacts.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 89926ea64..7aba11813 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -33,13 +33,13 @@ Billing address City <%= $cust_main->city %> State - <%= $cust_main->state %> + <%= state_label($cust_main->state, $cust_main->country) %> Zip <%= $cust_main->zip %> Country - <%= $cust_main->country %> + <%= code2country($cust_main->country) %> <% my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ -- cgit v1.2.1 From 7bdf17a005cf4c0fe8b6b6ad1ce97abaa52a4510 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 9 Apr 2006 23:41:01 +0000 Subject: a few more fixups for our favorite include(...) from Scott Edwards --- httemplate/view/cust_main.cgi | 3 ++- httemplate/view/cust_main/payment_history.html | 2 +- httemplate/view/cust_main/tickets.html | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 082a93bb7..58f2925d5 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -12,7 +12,8 @@ foreach my $part_svc ( qsearch('part_svc',{}) ) { %> -<%= include("/elements/header.html","Customer View", menubar( +<%= include("/elements/header.html","Customer View", + include("/elements/menubar.html", 'Main Menu' => $p, )) %> diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index ec99b8c54..a0bec3906 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -358,7 +358,7 @@ foreach my $cust_refund ($cust_main->cust_refund) { %> -<%= table() %> +<%= include("/elements/table.html") %> Date Description diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index 72d68152a..5c1d94ee1 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -31,7 +31,7 @@ Highest priority tickets (View all tickets for this customer) (New ticket for this customer) -<%= table() %> +<%= include("/elements/table.html") %> # Subject -- cgit v1.2.1 From 2c757d7db4cb6a7b9655de13206fcc84fb7ce61f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 14 May 2006 16:47:31 +0000 Subject: first part of ACL and re-skinning work and some other small stuff --- httemplate/view/cust_main/packages.html | 4 ++-- httemplate/view/cust_main/payment_history.html | 26 +++++++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index ece1b62bb..32e0ee1fc 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -67,7 +67,7 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { - > + > <%=$pkg->{pkgnum}%>: <%=$pkg->{pkg}%> - <%=$pkg->{comment}%>
<% unless ($pkg->{cancel}) { %> @@ -75,7 +75,7 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$cust_main->custnum)%> ) <% } %> - > + > <% diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index a0bec3906..f0cd993ff 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -58,7 +58,10 @@ <% } %> -
Post credit +
+ +Post credit +
<% @@ -115,8 +118,10 @@ foreach my $cust_pay ($cust_main->cust_pay) { #completely unapplied $pre = 'Unapplied '; $post = ''; - $apply = qq! (apply)'; + $apply = qq! (apply)!; + } elsif ( scalar(@cust_bill_pay) == 1 && scalar(@cust_pay_refund) == 0 && $cust_pay->unapplied == 0 ) { @@ -151,8 +156,9 @@ foreach my $cust_pay ($cust_main->cust_pay) { $desc .= '  '. '$'. $cust_pay->unapplied. ' unapplied'. - qq! (apply)'. + qq! (apply)!. '
'; } } @@ -264,8 +270,9 @@ foreach my $cust_credit ($cust_main->cust_credit) { #completely unapplied $pre = 'Unapplied '; $post = ''; - $apply = qq! (apply)'; + $apply = qq! (apply)!; } elsif ( scalar(@cust_credit_bill) == 1 && scalar(@cust_credit_refund) == 0 && $cust_credit->credited == 0 ) { @@ -299,8 +306,9 @@ foreach my $cust_credit ($cust_main->cust_credit) { if ( $cust_credit->credited > 0 ) { $desc .= '  $'. $cust_credit->credited. ' unapplied'. - qq! (apply)'. + qq! (apply)!. '
'; } } -- cgit v1.2.1 From 6b12c14cc10503d6b0783e8ef71fe44d9a9b37b6 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 19 Jun 2006 08:05:28 +0000 Subject: add ability to select specific package defs. and package status to package report for qis --- httemplate/view/cust_main/contacts.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 7aba11813..48371550b 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -114,7 +114,7 @@ Service address - + -- cgit v1.2.1 From 41a6a1b1811e337be2fca47504ff9687b6b46cf8 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 19 Jun 2006 11:25:14 +0000 Subject: ACLs, take three or four or something --- httemplate/view/cust_main.cgi | 55 +++++++++------- httemplate/view/cust_main/packages.html | 91 +++++++++++++++++++++----- httemplate/view/cust_main/payment_history.html | 78 +++++++++++++++++----- 3 files changed, 165 insertions(+), 59 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 58f2925d5..e7b3319c7 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,4 +1,3 @@ - <% my $conf = new FS::Conf; @@ -12,13 +11,17 @@ foreach my $part_svc ( qsearch('part_svc',{}) ) { %> + <%= include("/elements/header.html","Customer View", include("/elements/menubar.html", 'Main Menu' => $p, )) %> + <% +my $curuser = $FS::CurrentUser::CurrentUser; + die "No customer specified (bad URL)!" unless $cgi->keywords; my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array $query =~ /^(\d+)$/; @@ -26,10 +29,14 @@ my $custnum = $1; my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); die "Customer not found!" unless $cust_main; -print qq!Edit this customer!; - %> + +<% if ( $curuser->access_right('Edit customer') ) { %> + Edit this customer | +<% } %> + + @@ -60,37 +67,36 @@ var confirm_cancel = '
Cancel this customer | +<% } %> - | Cancel this customer +<% if ( $conf->exists('deletecustomers') + && $curuser->access_right('Delete customer') + ) { +%> + Delete this customer | <% } %> -<% -print qq! | !. - 'Delete this customer' - if $conf->exists('deletecustomers'); +<% unless ( $conf->exists('disable_customer_referrals') ) { %> + Refer a new customer | + View this customer's referrals +<% } %> -unless ( $conf->exists('disable_customer_referrals') ) { - print qq! | !, - qq!Refer a new customer!; - print qq! | !, - qq!View this customer's referrals!; -} - -print '

'; +

+<% my $signupurl = $conf->config('signupurl'); if ( $signupurl ) { -print "This customer's signup URL: ". - "$signupurl?ref=$custnum

"; -} - %> + This customer's signup URL: <%= $signupurl %>?ref=<%= $custnum %>

+<% } %>
Country<%= $cust_main->get("${pre}country") %><%= code2country( $cust_main->get("${pre}country") ) %>
<%= $daytime_label %>
@@ -135,5 +141,4 @@ Comments <%= include('cust_main/payment_history.html', $cust_main ) %> <% } %> - - +<%= include('/elements/footer.html') %> diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 32e0ee1fc..8312a8663 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -2,6 +2,8 @@ my( $cust_main ) = @_; my $conf = new FS::Conf; + my $curuser = $FS::CurrentUser::CurrentUser; + my $packages = get_packages($cust_main, $conf); %> @@ -11,13 +13,21 @@ Packages -<%= include('order_pkg.html', $cust_main ) %> +<% if ( $curuser->access_right('Order customer package') ) { %> + <%= include('order_pkg.html', $cust_main ) %> +<% } %> -<% if ( $conf->config('payby-default') ne 'HIDE' ) { %> +<% if ( $curuser->access_right('One-time charge') + && $conf->config('payby-default') ne 'HIDE' + ) { +%> <%= include('quick-charge.html', $cust_main ) %> <% } %> -Bulk order and cancel packages (preserves services) +<% if ( $curuser->access_right('Bulk change customer packages') ) { %> + Bulk order and cancel packages (preserves services) +<% } %> +

<% if ( @$packages ) { %> @@ -70,10 +80,19 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
> <%=$pkg->{pkgnum}%>: <%=$pkg->{pkg}%> - <%=$pkg->{comment}%>
-<% unless ($pkg->{cancel}) { %> - ( <%=pkg_change_link($pkg)%> ) - ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$cust_main->custnum)%> ) -<% } %> + + <% unless ( $pkg->{cancel} ) { %> + <% if ( $curuser->access_right('Change customer package') ) { %> + ( <%=pkg_change_link($pkg)%> ) + <% } %> + <% if ( $curuser->access_right('Edit customer package dates') ) { %> + ( <%=pkg_dates_link($pkg)%> ) + <% } %> + <% if ( $curuser->access_right('Customize customer package') ) { %> + ( <%=pkg_customize_link($pkg,$cust_main->custnum)%> ) + <% } %> + <% } %> +
> @@ -182,7 +201,16 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { <% } %> - + <% } else { %> @@ -196,7 +224,13 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { - + <% } else { %> @@ -258,7 +292,19 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { <% if ( $pkg->{freq} ) { %> - + <% } %> @@ -278,14 +324,20 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { print '' if ($cnt > 0); %> - + <% $cnt++; } - if ($svcpart->{count} < $svcpart->{quantity}) { + if ( $svcpart->{count} < $svcpart->{quantity} + && $curuser->access_right('Provision customer services') + ) { print qq!\n! if ($cnt > 0); - print qq! \n\n!; + print qq! \n\n!; } } } @@ -393,7 +445,7 @@ sub svc_label_link { } sub svc_provision_link { - my ($pkg, $svcpart, $conf) = @_; + my ($pkg, $svcpart, $conf, $curuser) = @_; ( my $svc_nbsp = $svcpart->{svc} ) =~ s/\s+/ /g; my $num_left = $svcpart->{quantity} - $svcpart->{count}; my $pkgnum_svcpart = "pkgnum$pkg->{pkgnum}-svcpart$svcpart->{svcpart}"; @@ -411,7 +463,10 @@ sub svc_provision_link { my $link = qq!!. "Provision $svc_nbsp ($num_left)"; - if ( $conf->exists('legacy_link') ) { + if ( $conf->exists('legacy_link') + && $curuser->access_right('View/link unlinked services') + ) + { $link .= '
'. qq!!. @@ -475,7 +530,11 @@ sub pkg_cancel_link { my $pkg = shift or return ''; qq!!. - qq!Cancel now | !. + qq!Cancel now!; +} + +sub pkg_expire_link { + my $pkg = shift or return ''; qq!Cancel later!; } diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index f0cd993ff..b7621d57a 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -4,6 +4,8 @@ my $conf = new FS::Conf; + my $curuser = $FS::CurrentUser::CurrentUser; + my @payby = grep /\w/, $conf->config('payby'); #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) @@ -16,42 +18,48 @@

Payment History
-<% if ( $payby{'BILL'} ) { %> +<% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> Post check payment <% } %> -<% if ( $payby{'CASH'} ) { %> +<% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> Post cash payment <% } %> -<% if ( $payby{'WEST'} ) { %> +<% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> Post Western Union payment <% } %> -<% if ( $payby{'CARD'} || $payby{'DCRD'} ) { %> +<% if ( ( $payby{'CARD'} || $payby{'DCRD'} ) + && $curuser->access_right('Process payment') + ) { +%> <%= $s++ ? ' | ' : '' %> Process credit card payment <% } %> -<% if ( $payby{'CHEK'} || $payby{'DCHK'} ) { %> +<% if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) + && $curuser->access_right('Process payment') + ) { +%> <%= $s++ ? ' | ' : '' %> Process electronic check (ACH) payment <% } %> -<% if ( $payby{'MCRD'} ) { %> +<% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> Post manual credit card payment @@ -60,9 +68,13 @@
-Post credit +<% if ( $curuser->access_right('Post credit') ) { %> -
+ Post credit + +
+ +<% } %> <% #get payment history @@ -75,11 +87,14 @@ foreach my $cust_bill ($cust_main->cust_bill) { : ''; my $post = ( $cust_bill->owed > 0 ) ? '' : ''; my $invnum = $cust_bill->invnum; + my $link = $curuser->access_right('View invoices') + ? qq!! + : ''; push @history, { 'date' => $cust_bill->_date, - 'desc' => qq!!. $pre. + 'desc' => $link. $pre. "Invoice #$invnum (Balance \$". $cust_bill->owed. ')'. - $post. '', + $post. ( $link ? '' : '' ), 'charge' => $cust_bill->charged, }; } @@ -169,6 +184,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { && $cust_pay->payby =~ /^(CARD|CHEK)$/ && time-$cust_pay->_date < $refund_days*86400 && $cust_pay->unrefunded > 0 + && $curuser->access_right('Refund payment') ) { $refund = qq! (cust_pay) { my $void = ''; if ( $cust_pay->closed !~ /^Y/i - && ( $cust_pay->payby ne 'CARD' || $conf->exists('cc-void') ) - && ( $cust_pay->payby ne 'CHEK' || $conf->exists('echeck-void') ) - ) { + && ( ( $cust_pay->payby eq 'CARD' + && $conf->exists('cc-void') + && $curuser->acccess_right('Credit card void') + ) + || ( $cust_pay->payby eq 'CHEK' + && $conf->exists('echeck-void') + && $curuser->acccess_right('Echeck void') + ) + ) + ) + { $void = qq! (cust_pay) { } my $delete = ''; - if ( $cust_pay->closed !~ /^Y/i && $conf->exists('deletepayments') ) { + if ( $cust_pay->closed !~ /^Y/i + && $conf->exists('deletepayments') + && $curuser->access_right('Delete payment') + ) + { $delete = qq! (cust_pay) { my $unapply = ''; if ( $cust_pay->closed !~ /^Y/i && $conf->exists('unapplypayments') - && scalar(@cust_bill_pay) ) { + && scalar(@cust_bill_pay) + && $curuser->access_right('Unapply payment') + ) + { $unapply = qq! (cust_pay_void) { my $info = $payby ? " ($payby$payinfo)" : ''; my $unvoid = ''; - if ( $cust_pay_void->closed !~ /^Y/i && $conf->exists('unvoid') ) { + if ( $cust_pay_void->closed !~ /^Y/i + && $conf->exists('unvoid') + && $curuser->access_right('Unvoid') + ) + { $unvoid = qq! (cust_credit) { } # my $delete = ''; - if ( $cust_credit->closed !~ /^Y/i && $conf->exists('deletecredits') ) { + if ( $cust_credit->closed !~ /^Y/i + && $conf->exists('deletecredits') + && $curuser->access_right('Delete credit') + ) + { $delete = qq! (!. @@ -324,7 +363,10 @@ foreach my $cust_credit ($cust_main->cust_credit) { my $unapply = ''; if ( $cust_credit->closed !~ /^Y/i && $conf->exists('unapplycredits') - && scalar(@cust_credit_bill) ) { + && scalar(@cust_credit_bill) + && $curuser->access_right('Unapply credit') + ) + { $unapply = qq! (!. -- cgit v1.2.1 From b5c26536197f16a3e1ea47c14c94884312c7fd24 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 19 Jun 2006 13:09:14 +0000 Subject: fix ACL name for service provisioning and prevent disabled service provisioning from messing up table formatting --- httemplate/view/cust_main/packages.html | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 8312a8663..beb67f325 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -333,12 +333,18 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { <% $cnt++; } - if ( $svcpart->{count} < $svcpart->{quantity} - && $curuser->access_right('Provision customer services') - ) { - print qq!\n! if ($cnt > 0); - print qq! \n\n!; + if ( $svcpart->{count} < $svcpart->{quantity} ) { + print '' if ($cnt > 0); + if ( $curuser->access_right('Provision customer service') ) { + print ''; + } else { + #print ''; + print ''; + } } + } } #end display packages -- cgit v1.2.1 From 265a8a9728e907ccee97ed395e6eca3014deb890 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 21 Jun 2006 12:58:43 +0000 Subject: need the OLiframecontent sub --- httemplate/view/cust_main.cgi | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index e7b3319c7..89ddc38f2 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -40,6 +40,7 @@ die "Customer not found!" unless $cust_main; + + + <%= include("/elements/header.html","View $label: $value", menubar( + "Cancel this (unaudited) $label" => + "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" + )) %> + +<% } %> + +Service #<%= $svcnum %> +| Edit this <%= $label %> +
+ +<%= ntable("#cccccc") %> + + + <% + #eventually more options for + +<% } %> + +<% foreach (sort { $a cmp $b } $svc_x->virtual_fields) { %> + <%= $svc_x->pvf($_)->widget('HTML', 'view', $svc_x->getfield($_)) %> +<% } %> + +
>( <%= pkg_unsuspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> )> + + <% if ( $curuser->access_right('Unsuspend customer package') ) { %> + ( <%= pkg_unsuspend_link($pkg) %> ) + <% } %> + <% if ( $curuser->access_right('Cancel customer package') ) { %> + ( <%= pkg_cancel_link($pkg) %> ) + <% } %> + +
>( <%= pkg_cancel_link($pkg) %> )> + + <% if ( $curuser->access_right('Cancel customer package immediately') ) { %> + ( <%= pkg_cancel_link($pkg) %> ) + <% } %> + +
>( <%= pkg_suspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> )> + + <% if ( $curuser->access_right('Suspend customer package') ) { %> + ( <%= pkg_suspend_link($pkg) %> ) + <% } %> + <% if ( $curuser->access_right('Cancel customer package immediately') ) { %> + ( <%= pkg_cancel_link($pkg) %> ) + <% } %> + <% if ( $curuser->access_right('Cancel customer package later') ) { %> + ( <%= pkg_expire_link($pkg) %> ) + <% } %> + +
<%=svc_link($svcpart,$service)%><%=svc_label_link($svcpart,$service)%>
( <%=svc_unprovision_link($service)%> )
<%=svc_label_link($svcpart,$service)%> + <% if ( $curuser->access_right('Unprovision customer service') ) { %> +
( <%=svc_unprovision_link($service)%> ) + <% } %> +
!.svc_provision_link($pkg, $svcpart, $conf).qq!
!.svc_provision_link($pkg, $svcpart, $conf, $curuser).qq!
!.svc_provision_link($pkg, $svcpart, $conf, $curuser).qq!
'. + svc_provision_link($pkg, $svcpart, $conf, $curuser). + '
 
<%= ntable("#cccccc",2) %> + +<% foreach my $f ( @$fields ) { + + my( $field, $type); + if ( ref($f) ) { + $field = $f->{'field'}, + $type = $f->{'type'} || 'text', + } else { + $field = $f; + $type = 'text'; + } +%> + +
+ <%= ( $opt{labels} && exists $opt{labels}->{$field} ) + ? $opt{labels}->{$field} + : $field + %> + <%= $svc_x->$field %> + +
+ +
+<%= joblisting({'svcnum'=>$svcnum}, 1) %> + +<%= include('/elements/footer.html') %> diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi new file mode 100644 index 000000000..8de7cc8e7 --- /dev/null +++ b/httemplate/view/svc_phone.cgi @@ -0,0 +1,10 @@ +<%= include('elements/svc_Common.html', + 'table' => 'svc_phone', + 'fields' => [qw( countrycode phonenum )], #pin + 'labels' => { + 'countrycode' => 'Country code', + 'phonenum' => 'Phone number', + 'pin' => 'PIN', + }, + ) +%> -- cgit v1.2.1 From 580330233cbf32c58d9f29dc391bd2ebd83e16d5 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 16 Jul 2006 00:55:06 +0000 Subject: odds and ends --- httemplate/view/svc_external.cgi | 1 - 1 file changed, 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/svc_external.cgi b/httemplate/view/svc_external.cgi index 2acc3f9cf..7816d88dc 100644 --- a/httemplate/view/svc_external.cgi +++ b/httemplate/view/svc_external.cgi @@ -1,4 +1,3 @@ - <% my($query) = $cgi->keywords; -- cgit v1.2.1 From 0a7d9371d3514312edd8661c621876cece4d5221 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 10 Aug 2006 13:50:45 +0000 Subject: add cust_main.agent_custid (at least to schema and customer view, no manual editing yet) --- httemplate/view/cust_main/misc.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 69e120573..742b35958 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -1,5 +1,6 @@ <% my( $cust_main ) = @_; + my $conf = new FS::Conf; %> <%= ntable("#cccccc") %><%= &ntable("#cccccc",2) %> @@ -25,8 +26,18 @@ $agent = $agents[0]; } - my @referrals = qsearch( 'part_referral', {} ); - unless ( scalar(@referrals) == 1 ) { + if ( $cust_main->agent_custid ) { +%> + + + Agent customer ref# + <%= $cust_main->agent_custid %> + + +<% + } + + unless ( FS::part_referral->num_part_referral == 1 ) { my $referral = qsearchs('part_referral', { 'refnum' => $cust_main->refnum } ); -- cgit v1.2.1 From b8ec621c59747a1c2fcd7fbd603d0c6de41e7df5 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Aug 2006 10:47:51 +0000 Subject: fix acl rewrite causing problems: void now shows up properly, deprecate all the redundant config values --- httemplate/view/cust_main/payment_history.html | 86 +++++++++++++++++--------- 1 file changed, 56 insertions(+), 30 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 5c2aa24c9..482136fa1 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -135,7 +135,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { $post = ''; $apply = qq! (apply)!; + qq!', 392, 336, 'cust_bill_pay_popup' ), CAPTION, 'Apply payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply)!; } elsif ( scalar(@cust_bill_pay) == 1 && scalar(@cust_pay_refund) == 0 @@ -161,7 +161,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { } elsif ( $app->isa('FS::cust_pay_refund') ) { $desc .= '  '. '$'. $app->amount. - ' refunded on'. time2str("%D", $app->_date). + ' refunded on '. time2str("%D", $app->_date). '
'; } else { die "$app is not a FS::cust_bill_pay or FS::cust_pay_refund"; @@ -173,7 +173,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { $cust_pay->unapplied. ' unapplied'. qq! (apply)!. + qq!', 392, 336, 'cust_bill_pay_popup' ), CAPTION, 'Apply payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply)!. '
'; } } @@ -195,13 +195,14 @@ foreach my $cust_pay ($cust_main->cust_pay) { my $void = ''; if ( $cust_pay->closed !~ /^Y/i && ( ( $cust_pay->payby eq 'CARD' - && $conf->exists('cc-void') - && $curuser->acccess_right('Credit card void') + && $curuser->access_right('Credit card void') ) || ( $cust_pay->payby eq 'CHEK' - && $conf->exists('echeck-void') - && $curuser->acccess_right('Echeck void') - ) + && $curuser->access_right('Echeck void') + ) + || ( $cust_pay->payby !~ /^(CARD|CHEK)$/ + && $curuser->access_right('Regular void') + ) ) ) { @@ -231,7 +232,6 @@ foreach my $cust_pay ($cust_main->cust_pay) { my $unapply = ''; if ( $cust_pay->closed !~ /^Y/i - && $conf->exists('unapplypayments') && scalar(@cust_bill_pay) && $curuser->access_right('Unapply payment') ) @@ -268,7 +268,6 @@ foreach my $cust_pay_void ($cust_main->cust_pay_void) { my $unvoid = ''; if ( $cust_pay_void->closed !~ /^Y/i - && $conf->exists('unvoid') && $curuser->access_right('Unvoid') ) { @@ -307,7 +306,7 @@ foreach my $cust_credit ($cust_main->cust_credit) { $post = ''; $apply = qq! (apply)!; + qq!', 392, 336, 'cust_credit_bill_popup' ), CAPTION, 'Apply credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply)!; } elsif ( scalar(@cust_credit_bill) == 1 && scalar(@cust_credit_refund) == 0 && $cust_credit->credited == 0 ) { @@ -332,7 +331,7 @@ foreach my $cust_credit ($cust_main->cust_credit) { } elsif ( $app->isa('FS::cust_credit_refund') ) { $desc .= '  '. '$'. $app->amount. - ' refunded on'. time2str("%D", $app->_date). + ' refunded on '. time2str("%D", $app->_date). '
'; } else { die "$app is not a FS::cust_credit_bill or a FS::cust_credit_refund"; @@ -343,14 +342,18 @@ foreach my $cust_credit ($cust_main->cust_credit) { $cust_credit->credited. ' unapplied'. qq! (apply)!. + qq!', 392, 336, 'cust_credit_bill_popup' ), CAPTION, 'Apply credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply)!. '
'; } } # my $delete = ''; if ( $cust_credit->closed !~ /^Y/i - && $conf->exists('deletecredits') + + #s'pose deleting a credit isn't bad like deleting a payment + # and this needs to be generally available until we have credit voiding.. + #&& $conf->exists('deletecredits') + && $curuser->access_right('Delete credit') ) { @@ -362,7 +365,6 @@ foreach my $cust_credit ($cust_main->cust_credit) { my $unapply = ''; if ( $cust_credit->closed !~ /^Y/i - && $conf->exists('unapplycredits') && scalar(@cust_credit_bill) && $curuser->access_right('Unapply credit') ) @@ -408,15 +410,21 @@ foreach my $cust_refund ($cust_main->cust_refund) { %> -<%= include("/elements/table.html") %> +<%= include("/elements/table-grid.html") %> + +<% my $bgcolor1 = '#eeeeee'; + my $bgcolor2 = '#ffffff'; + my $bgcolor = ''; +%> + - Date - Description - Charge - Payment - In-house
Credit
- Refund - Balance + Date + Description + Charge + Payment + In-house
Credit
+ Refund + Balance <% @@ -426,6 +434,12 @@ my %target; my $balance = 0; foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { + if ( $bgcolor eq $bgcolor1 ) { + $bgcolor = $bgcolor2; + } else { + $bgcolor = $bgcolor1; + } + my $charge = exists($item->{'charge'}) ? sprintf('$%.2f', $item->{'charge'}) : ''; @@ -454,7 +468,7 @@ foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { %> - + <% unless ( !$target || $target{$target}++ ) { %> <% } %> @@ -464,12 +478,24 @@ foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { <% } %> - <%= $item->{'desc'} %> - <%= $charge %> - <%= $payment %> - <%= $credit %> - <%= $refund %> - <%= $showbalance %> + + <%= $item->{'desc'} %> + + + <%= $charge %> + + + <%= $payment %> + + + <%= $credit %> + + + <%= $refund %> + + + <%= $showbalance %> + <% } %> -- cgit v1.2.1 From 8e3dfb380406e145494a5fffa7a0e4aab7b38253 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 13 Aug 2006 10:25:58 +0000 Subject: customer view work: DONE 1. add status and balance to top DONE 2. add some sort of oldest date thing so the history doesn't get too big (# years and a link to "show older") 3. make the rest of the action links into js popups? maybe later, weird IENess when closing em DONE (finished) - so revert out or finish/commit the Enter check payment one - Process page can wait until another day.. it should be more of an *action* DONE 4. Ticket list config knobs for wtxs (grid it too) DONE 5. grid the package list --- httemplate/view/cust_main.cgi | 19 +---- httemplate/view/cust_main/billing.html | 14 +++- httemplate/view/cust_main/misc.html | 15 +++- httemplate/view/cust_main/packages.html | 100 +++++++++++++------------ httemplate/view/cust_main/payment_history.html | 92 +++++++++++++++++++---- httemplate/view/cust_main/tickets.html | 46 +++++++++--- 6 files changed, 192 insertions(+), 94 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 89ddc38f2..8267fea51 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -2,24 +2,6 @@ my $conf = new FS::Conf; -my %uiview = (); -my %uiadd = (); -foreach my $part_svc ( qsearch('part_svc',{}) ) { - $uiview{$part_svc->svcpart} = $p. "view/". $part_svc->svcdb . ".cgi"; - $uiadd{$part_svc->svcpart}= $p. "edit/". $part_svc->svcdb . ".cgi"; -} - -%> - - -<%= include("/elements/header.html","Customer View", - include("/elements/menubar.html", - 'Main Menu' => $p, -)) %> - - -<% - my $curuser = $FS::CurrentUser::CurrentUser; die "No customer specified (bad URL)!" unless $cgi->keywords; @@ -31,6 +13,7 @@ die "Customer not found!" unless $cust_main; %> +<%= include("/elements/header.html","Customer View: ". $cust_main->name ) %> <% if ( $curuser->access_right('Edit customer') ) { %> Edit this customer | diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 895814cc2..191d3092f 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -1,12 +1,24 @@ <% my( $cust_main ) = @_; my @invoicing_list = $cust_main->invoicing_list; + my $conf = new FS::Conf; + my $money_char = $conf->config('money_char') || '$'; %> Billing information (Bill now) <%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> +<% +( my $balance = $cust_main->balance ) + =~ s/^(\-?)(.*)$/$1<\/FONT>$money_char$2/; +%> + + + Balance due + <%= $balance %> + + Billing type @@ -159,7 +171,7 @@ if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format <%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %> -<% my $conf = new FS::Conf; if ( $conf->exists('voip-cust_cdr_spools') ) { %> +<% if ( $conf->exists('voip-cust_cdr_spools') ) { %> Spool CDRs <%= $cust_main->spool_cdr ? 'yes' : 'no' %> diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 742b35958..f06a4fbd2 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -4,11 +4,17 @@ %> <%= ntable("#cccccc") %><%= &ntable("#cccccc",2) %> + Customer number <%= $cust_main->custnum %> + + Status + <%= ucfirst($cust_main->status) %> + + <% my @agents = qsearch( 'agent', {} ); my $agent; @@ -50,10 +56,6 @@ <% } %> - - Order taker - <%= $cust_main->otaker %> - Referring Customer @@ -82,5 +84,10 @@ + + Order taker + <%= $cust_main->otaker %> + + diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index beb67f325..9cd1e284f 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -7,10 +7,6 @@ my $packages = get_packages($cust_main, $conf); %> - - Packages <% if ( $curuser->access_right('Order customer package') ) { %> @@ -54,30 +50,33 @@ Current packages <% if ( @$packages ) { %> - +<%= include('/elements/table-grid.html') %> + +<% my $bgcolor1 = '#eeeeee'; + my $bgcolor2 = '#ffffff'; + my $bgcolor = ''; +%> + - - - + + + <% foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { - my $rowspan = 0; - if ($pkg->{cancel}) { - $rowspan = 0; + if ( $bgcolor eq $bgcolor1 ) { + $bgcolor = $bgcolor2; } else { - foreach my $svcpart (@{$pkg->{svcparts}}) { - $rowspan += $svcpart->{count}; - $rowspan++ if ($svcpart->{count} < $svcpart->{quantity}); - } - } + $bgcolor = $bgcolor1; + } + %> - - + + + + + + + + + + + + + <% + } + + } + if ( $bgcolor eq $bgcolor1 ) { $bgcolor = $bgcolor2; } else { @@ -441,18 +484,24 @@ foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { } my $charge = exists($item->{'charge'}) - ? sprintf('$%.2f', $item->{'charge'}) + ? sprintf("$money_char\%.2f", $item->{'charge'}) : ''; + my $payment = exists($item->{'payment'}) - ? sprintf('- $%.2f', $item->{'payment'}) + ? sprintf("- $money_char\%.2f", $item->{'payment'}) : ''; - $payment ||= sprintf('- $%.2f', $item->{'void_payment'}) + + $payment ||= sprintf( "- $money_char\%.2f", + $item->{'void_payment'} + ) if exists($item->{'void_payment'}); + my $credit = exists($item->{'credit'}) - ? sprintf('- $%.2f', $item->{'credit'}) + ? sprintf("- $money_char\%.2f", $item->{'credit'}) : ''; + my $refund = exists($item->{'refund'}) - ? sprintf('$%.2f', $item->{'refund'}) + ? sprintf("$money_char\%.2f", $item->{'refund'}) : ''; my $target = exists($item->{'target'}) ? $item->{'target'} : ''; @@ -463,11 +512,11 @@ foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { $balance += $item->{'refund'} if exists $item->{'refund'}; $balance = sprintf("%.2f", $balance); $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp - ( my $showbalance = '$'. $balance ) =~ s/^\$\-/- \$/; + ( my $showbalance = $money_char. $balance ) =~ s/^\$\-/- \$/; %> - + >
PackageStatusServicesPackageStatusServices
> + <%=$pkg->{pkgnum}%>: <%=$pkg->{pkg}%> - <%=$pkg->{comment}%>
@@ -94,8 +93,8 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { <% } %>
> - + -<% - if ($rowspan == 0) { print qq!\n!; next; } + + +<% } #end display packages %>
+ <% sub myfreq { @@ -315,42 +314,51 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
+ - my $cnt = 0; + +<% foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { foreach my $service (@{$svcpart->{services}}) { - print '' if ($cnt > 0); %> - - + + + + + <% if ( $curuser->access_right('Unprovision customer service') ) { %> + + + + <% } %> + <% } %> - - -<% - $cnt++; - } - if ( $svcpart->{count} < $svcpart->{quantity} ) { - print '' if ($cnt > 0); - if ( $curuser->access_right('Provision customer service') ) { - print ''; - } else { - #print ''; - print ''; - } - } - } -} -#end display packages + <% if ( $curuser->access_right('Provision customer service') + && $svcpart->{count} < $svcpart->{quantity} + ) + { + %> + + + + + + <% } %> + +<% } %> + +
<%=svc_link($svcpart,$service)%><%=svc_label_link($svcpart,$service)%> - <% if ( $curuser->access_right('Unprovision customer service') ) { %> -
( <%=svc_unprovision_link($service)%> ) +
<%=svc_link($svcpart,$service)%><%=svc_label_link($svcpart,$service)%>
( <%=svc_unprovision_link($service)%> )
'. - svc_provision_link($pkg, $svcpart, $conf, $curuser). - '
 
+ <%= svc_provision_link($pkg, $svcpart, $conf, $curuser) %> +
+
+ <% } else { %>
<% } %> diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 482136fa1..aef5fb8f8 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -21,21 +21,21 @@ <% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> - Post check payment + Enter check payment <% } %> <% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> - Post cash payment + Enter cash payment <% } %> <% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> - Post Western Union payment + Enter Western Union payment <% } %> @@ -62,7 +62,7 @@ <% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { %> <%= $s++ ? ' | ' : '' %> - Post manual credit card payment + Post manual (offline) credit card payment <% } %> @@ -70,7 +70,7 @@ <% if ( $curuser->access_right('Post credit') ) { %> - Post credit + Enter credit
@@ -430,10 +430,53 @@ foreach my $cust_refund ($cust_main->cust_refund) { <% #display payment history -my %target; my $balance = 0; +my %target = (); +my $money_char = $conf->config('money_char') || '$'; + +my $years = $conf->config('payment_history-years') || 2; +my $older_than = time - $years * 31556736; #60*60*24*365.24 +my $hidden = 0; +my $seen = 0; +my $old_history = 0; + foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { + my $display; + if ( $item->{'date'} < $older_than ) { + $display = ' STYLE="display:none" '; + $hidden = 1; + } else { + + $display = ''; + + if ( $hidden && ! $seen++ ) { + ( my $balance_forward = $money_char. $balance ) =~ s/^\$\-/- \$/; + %> + +
+ <%= time2str("%D",$item->{'date'}) %> + + Starting balance on <%= time2str("%D",$item->{'date'}) %> + (show prior history) + <%= $balance_forward %>
<% unless ( !$target || $target{$target}++ ) { %> @@ -502,3 +551,20 @@ foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) {
+ + diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index 5c1d94ee1..93cb51f25 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -2,7 +2,7 @@ my( $cust_main ) = @_; my $conf = new FS::Conf; - my $num = 10; + my $num = $conf->config('cust_main-max_tickets') || 10; my @tickets = (); unless ( $conf->config('ticket_system-custom_priority_field') ) { @@ -31,24 +31,46 @@ Highest priority tickets (View all tickets for this customer) (New ticket for this customer) -<%= include("/elements/table.html") %> + +<%= include("/elements/table-grid.html") %> + +<% my $bgcolor1 = '#eeeeee'; + my $bgcolor2 = '#ffffff'; + my $bgcolor = ''; +%> + - # - Subject - Priority - Queue - Status + # + Subject + Priority + Queue + Status + <% foreach my $ticket ( @tickets ) { my $href = FS::TicketSystem->href_ticket($ticket->{id}); + if ( $bgcolor eq $bgcolor1 ) { + $bgcolor = $bgcolor2; + } else { + $bgcolor = $bgcolor1; + } %> + - ><%= $ticket->{id} %> - ><%= $ticket->{subject} %> - <%= $ticket->{content} || $ticket->{priority} %> - <%= $ticket->{name} %> - <%= $ticket->{status} %> + + ><%= $ticket->{id} %> + + ><%= $ticket->{subject} %> + + <%= $ticket->{content} || $ticket->{priority} %> + + <%= $ticket->{name} %> + + <%= $ticket->{status} %> + + <% } %> + -- cgit v1.2.1 From 3ce7691203a7737406bf2d4442f7fd84b81f847e Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 23 Aug 2006 22:25:39 +0000 Subject: Will things ever be the same again? It's the final masonize --- httemplate/view/cust_bill-logo.cgi | 31 +- httemplate/view/cust_bill-pdf.cgi | 35 +- httemplate/view/cust_bill-ps.cgi | 27 +- httemplate/view/cust_bill.cgi | 214 +++--- httemplate/view/cust_main.cgi | 152 ++-- httemplate/view/cust_main/billing.html | 168 +++-- httemplate/view/cust_main/contacts.html | 114 +-- httemplate/view/cust_main/misc.html | 89 +-- httemplate/view/cust_main/order_pkg.html | 33 +- httemplate/view/cust_main/packages.html | 864 +++++++++++----------- httemplate/view/cust_main/payment_history.html | 979 ++++++++++++------------- httemplate/view/cust_main/quick-charge.html | 13 +- httemplate/view/cust_main/tickets.html | 99 +-- httemplate/view/cust_pkg.cgi | 327 +++++---- httemplate/view/elements/svc_Common.html | 156 ++-- httemplate/view/svc_acct.cgi | 397 +++++----- httemplate/view/svc_broadband.cgi | 186 ++--- httemplate/view/svc_domain.cgi | 134 ++-- httemplate/view/svc_external.cgi | 78 +- httemplate/view/svc_forward.cgi | 165 ++--- httemplate/view/svc_phone.cgi | 2 +- httemplate/view/svc_www.cgi | 143 ++-- 22 files changed, 2237 insertions(+), 2169 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_bill-logo.cgi b/httemplate/view/cust_bill-logo.cgi index 235485f6b..fd6a81a75 100755 --- a/httemplate/view/cust_bill-logo.cgi +++ b/httemplate/view/cust_bill-logo.cgi @@ -1,15 +1,16 @@ -<% - -my $conf = new FS::Conf; - -my($query) = $cgi->keywords; -$query =~ /^([^\.\/]*)$/; -my $templatename = $1; -if ( $templatename && $conf->exists("logo_$templatename.png") ) { - $templatename = "_$templatename"; -} else { - $templatename = ''; -} - -http_header('Content-Type' => 'image/png' ); -%><%= $conf->config_binary("logo$templatename.png") %> +% +% +%my $conf = new FS::Conf; +% +%my($query) = $cgi->keywords; +%$query =~ /^([^\.\/]*)$/; +%my $templatename = $1; +%if ( $templatename && $conf->exists("logo_$templatename.png") ) { +% $templatename = "_$templatename"; +%} else { +% $templatename = ''; +%} +% +%http_header('Content-Type' => 'image/png' ); +% +<% $conf->config_binary("logo$templatename.png") %> diff --git a/httemplate/view/cust_bill-pdf.cgi b/httemplate/view/cust_bill-pdf.cgi index ce7ab0c5c..06bb965eb 100755 --- a/httemplate/view/cust_bill-pdf.cgi +++ b/httemplate/view/cust_bill-pdf.cgi @@ -1,17 +1,18 @@ -<% - -#untaint invnum -my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)(.pdf)?$/; -my $templatename = $2; -my $invnum = $3; - -my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); -die "Invoice #$invnum not found!" unless $cust_bill; - -my $pdf = $cust_bill->print_pdf( '', $templatename); - -http_header('Content-Type' => 'application/pdf' ); -http_header('Content-Length' => length($pdf) ); -http_header('Cache-control' => 'max-age=60' ); -%><%= $pdf %> +% +% +%#untaint invnum +%my($query) = $cgi->keywords; +%$query =~ /^((.+)-)?(\d+)(.pdf)?$/; +%my $templatename = $2; +%my $invnum = $3; +% +%my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +%die "Invoice #$invnum not found!" unless $cust_bill; +% +%my $pdf = $cust_bill->print_pdf( '', $templatename); +% +%http_header('Content-Type' => 'application/pdf' ); +%http_header('Content-Length' => length($pdf) ); +%http_header('Cache-control' => 'max-age=60' ); +% +<% $pdf %> diff --git a/httemplate/view/cust_bill-ps.cgi b/httemplate/view/cust_bill-ps.cgi index e730a822a..f838e1b17 100755 --- a/httemplate/view/cust_bill-ps.cgi +++ b/httemplate/view/cust_bill-ps.cgi @@ -1,13 +1,14 @@ -<% - -#untaint invnum -my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)$/; -my $templatename = $2; -my $invnum = $3; - -my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); -die "Invoice #$invnum not found!" unless $cust_bill; - -http_header('Content-Type' => 'application/postscript' ); -%><%= $cust_bill->print_ps( '', $templatename) %> +% +% +%#untaint invnum +%my($query) = $cgi->keywords; +%$query =~ /^((.+)-)?(\d+)$/; +%my $templatename = $2; +%my $invnum = $3; +% +%my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +%die "Invoice #$invnum not found!" unless $cust_bill; +% +%http_header('Content-Type' => 'application/postscript' ); +% +<% $cust_bill->print_ps( '', $templatename) %> diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 45e19d436..3772e8dd0 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -1,151 +1,155 @@ -<% - -#untaint invnum -my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)$/; -my $templatename = $2; -my $invnum = $3; - -my $conf = new FS::Conf; - -my @payby = grep /\w/, $conf->config('payby'); -#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) -@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) - unless @payby; -my %payby = map { $_=>1 } @payby; - -my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); -die "Invoice #$invnum not found!" unless $cust_bill; -my $custnum = $cust_bill->getfield('custnum'); - -#my $printed = $cust_bill->printed; - -my $link = $templatename ? "$templatename-$invnum" : $invnum; - -%> -<%= include("/elements/header.html",'Invoice View', menubar( +% +% +%#untaint invnum +%my($query) = $cgi->keywords; +%$query =~ /^((.+)-)?(\d+)$/; +%my $templatename = $2; +%my $invnum = $3; +% +%my $conf = new FS::Conf; +% +%my @payby = grep /\w/, $conf->config('payby'); +%#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) +%@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) +% unless @payby; +%my %payby = map { $_=>1 } @payby; +% +%my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +%die "Invoice #$invnum not found!" unless $cust_bill; +%my $custnum = $cust_bill->getfield('custnum'); +% +%#my $printed = $cust_bill->printed; +% +%my $link = $templatename ? "$templatename-$invnum" : $invnum; +% +% + +<% include("/elements/header.html",'Invoice View', menubar( "Main Menu" => $p, "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", )) %> +% if ( $cust_bill->owed > 0 +% && ( $payby{'BILL'} || $payby{'CASH'} || $payby{'WEST'} || $payby{'MCRD'} ) +% ) +% { +% my $s = 0; +% -<% if ( $cust_bill->owed > 0 - && ( $payby{'BILL'} || $payby{'CASH'} || $payby{'WEST'} || $payby{'MCRD'} ) - ) - { - my $s = 0; -%> Post +% if ( $payby{'BILL'} ) { - <% if ( $payby{'BILL'} ) { %> - - <%= $s++ ? ' | ' : '' %> - check - - <% } %> - - <% if ( $payby{'CASH'} ) { %> - - <%= $s++ ? ' | ' : '' %> - cash - - <% } %> - - <% if ( $payby{'WEST'} ) { %> - <%= $s++ ? ' | ' : '' %> - Western Union + <% $s++ ? ' | ' : '' %> + check +% } +% if ( $payby{'CASH'} ) { + - <% } %> + <% $s++ ? ' | ' : '' %> + cash +% } +% if ( $payby{'WEST'} ) { - <% if ( $payby{'MCRD'} ) { %> - <%= $s++ ? ' | ' : '' %> - manual credit card + <% $s++ ? ' | ' : '' %> + Western Union +% } +% if ( $payby{'MCRD'} ) { + - <% } %> + <% $s++ ? ' | ' : '' %> + manual credit card +% } + payment against this invoice
+% } -<% } %> -Re-print this invoice +Re-print this invoice +% if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { -<% if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { %> - | Re-email + | Re-email this invoice -<% } %> +% } +% if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { -<% if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { %> - | Re-fax + | Re-fax this invoice -<% } %> +% } +

+% if ( $conf->exists('invoice_latex') ) { -<% if ( $conf->exists('invoice_latex') ) { %> - View typeset invoice + View typeset invoice

-<% } %> +% } +% #false laziness with search/cust_bill_event.cgi +% unless ( $templatename ) { -<% #false laziness with search/cust_bill_event.cgi - unless ( $templatename ) { %> - <%= table() %> + <% table() %> Event Date Status +% foreach my $cust_bill_event ( +% sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event +% ) { +% +% my $status = $cust_bill_event->status; +% $status .= ': '. encode_entities($cust_bill_event->statustext) +% if $cust_bill_event->statustext; +% my $part_bill_event = $cust_bill_event->part_bill_event; +% - <% foreach my $cust_bill_event ( - sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event - ) { - - my $status = $cust_bill_event->status; - $status .= ': '. encode_entities($cust_bill_event->statustext) - if $cust_bill_event->statustext; - my $part_bill_event = $cust_bill_event->part_bill_event; - %> - <%= $part_bill_event->event %> - - <% if ( $part_bill_event->templatename ) { - my $alt_templatename = $part_bill_event->templatename; - my $alt_link = "$alt_templatename-$invnum"; - %> - ( view - | view + <% $part_bill_event->event %> +% if ( $part_bill_event->templatename ) { +% my $alt_templatename = $part_bill_event->templatename; +% my $alt_link = "$alt_templatename-$invnum"; +% + + ( view + | view typeset - | re-print - <% if ( grep { $_ ne 'POST' } - $cust_bill->cust_main->invoicing_list ) { %> - | re-email - <% } %> - - <% if ( $conf->exists('hylafax') - && length($cust_bill->cust_main->fax) ) { %> - | re-fax - <% } %> + | re-print +% if ( grep { $_ ne 'POST' } +% $cust_bill->cust_main->invoicing_list ) { + + | re-email +% } +% if ( $conf->exists('hylafax') +% && length($cust_bill->cust_main->fax) ) { + + | re-fax +% } + ) - <% } %> +% } + - <%= time2str("%a %b %e %T %Y", $cust_bill_event->_date) %> - <%= $status %> + <% time2str("%a %b %e %T %Y", $cust_bill_event->_date) %> + <% $status %> - <% } %> +% } +
+% } +% if ( $conf->exists('invoice_html') ) { + + <% join('', $cust_bill->print_html('', $templatename) ) %> +% } else { -<% } %> +
<% join('', $cust_bill->print_text('', $templatename) ) %>
+% } -<% if ( $conf->exists('invoice_html') ) { %> - <%= join('', $cust_bill->print_html('', $templatename) ) %> -<% } else { %> -
<%= join('', $cust_bill->print_text('', $templatename) ) %>
-<% } %> diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 8267fea51..e82a5196c 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,23 +1,25 @@ -<% +% +% +%my $conf = new FS::Conf; +% +%my $curuser = $FS::CurrentUser::CurrentUser; +% +%die "No customer specified (bad URL)!" unless $cgi->keywords; +%my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array +%$query =~ /^(\d+)$/; +%my $custnum = $1; +%my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +%die "Customer not found!" unless $cust_main; +% +% -my $conf = new FS::Conf; -my $curuser = $FS::CurrentUser::CurrentUser; +<% include("/elements/header.html","Customer View: ". $cust_main->name ) %> +% if ( $curuser->access_right('Edit customer') ) { -die "No customer specified (bad URL)!" unless $cgi->keywords; -my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array -$query =~ /^(\d+)$/; -my $custnum = $1; -my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); -die "Customer not found!" unless $cust_main; + Edit this customer | +% } -%> - -<%= include("/elements/header.html","Customer View: ". $cust_main->name ) %> - -<% if ( $curuser->access_right('Edit customer') ) { %> - Edit this customer | -<% } %> @@ -33,96 +35,100 @@ function areyousure(href, message) { +% if ( $curuser->access_right('Cancel customer') +% && $cust_main->ncancelled_pkgs +% ) { +% -<% if ( $curuser->access_right('Cancel customer') - && $cust_main->ncancelled_pkgs - ) { -%> Cancel this customer | -<% } %> - +% } +% if ( $conf->exists('deletecustomers') +% && $curuser->access_right('Delete customer') +% ) { +% -<% if ( $conf->exists('deletecustomers') - && $curuser->access_right('Delete customer') - ) { -%> - Delete this customer | -<% } %> + Delete this customer | +% } +% unless ( $conf->exists('disable_customer_referrals') ) { + Refer a new customer | + View this customer's referrals +% } -<% unless ( $conf->exists('disable_customer_referrals') ) { %> - Refer a new customer | - View this customer's referrals -<% } %>

+% +%my $signupurl = $conf->config('signupurl'); +%if ( $signupurl ) { +% + + This customer's signup URL: <% $signupurl %>?ref=<% $custnum %>

+% } -<% -my $signupurl = $conf->config('signupurl'); -if ( $signupurl ) { -%> - This customer's signup URL: <%= $signupurl %>?ref=<%= $custnum %>

-<% } %>
- <%= include('cust_main/contacts.html', $cust_main ) %> + <% include('cust_main/contacts.html', $cust_main ) %> - <%= include('cust_main/misc.html', $cust_main ) %> - <% if ( $conf->config('payby-default') ne 'HIDE' ) { %> + <% include('cust_main/misc.html', $cust_main ) %> +% if ( $conf->config('payby-default') ne 'HIDE' ) { +
- <%= include('cust_main/billing.html', $cust_main ) %> - <% } %> + <% include('cust_main/billing.html', $cust_main ) %> +% } +
+% +%if ( defined $cust_main->dbdef_table->column('comments') +% && $cust_main->comments =~ /[^\s\n\r]/ ) { +% -<% -if ( defined $cust_main->dbdef_table->column('comments') - && $cust_main->comments =~ /[^\s\n\r]/ ) { -%>
Comments -<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> +<% ntable("#cccccc") %><% ntable("#cccccc",2) %> -
<%= encode_entities($cust_main->comments) %>
+
<% encode_entities($cust_main->comments) %>
-<% } %> +% } +% if ( $conf->config('ticket_system') ) { -<% if ( $conf->config('ticket_system') ) { %>
- <%= include('cust_main/tickets.html', $cust_main ) %> -<% } %> + <% include('cust_main/tickets.html', $cust_main ) %> +% } +

-<%= include('cust_main/packages.html', $cust_main ) %> +<% include('cust_main/packages.html', $cust_main ) %> +% if ( $conf->config('payby-default') ne 'HIDE' ) { + + <% include('cust_main/payment_history.html', $cust_main ) %> +% } -<% if ( $conf->config('payby-default') ne 'HIDE' ) { %> - <%= include('cust_main/payment_history.html', $cust_main ) %> -<% } %> -<%= include('/elements/footer.html') %> +<% include('/elements/footer.html') %> diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 191d3092f..d1be8936f 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -1,182 +1,188 @@ -<% - my( $cust_main ) = @_; - my @invoicing_list = $cust_main->invoicing_list; - my $conf = new FS::Conf; - my $money_char = $conf->config('money_char') || '$'; -%> +% +% my( $cust_main ) = @_; +% my @invoicing_list = $cust_main->invoicing_list; +% my $conf = new FS::Conf; +% my $money_char = $conf->config('money_char') || '$'; +% + Billing information -(Bill now) -<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> +(Bill now) +<% ntable("#cccccc") %><% ntable("#cccccc",2) %> +% +%( my $balance = $cust_main->balance ) +% =~ s/^(\-?)(.*)$/$1<\/FONT>$money_char$2/; +% -<% -( my $balance = $cust_main->balance ) - =~ s/^(\-?)(.*)$/$1<\/FONT>$money_char$2/; -%> Balance due - <%= $balance %> + <% $balance %> Billing type +% if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) { -<% if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) { %> - Credit card <%= $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' %> + Credit card <% $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' %> Card number - <%= $cust_main->payinfo_masked %> - - -<% -#false laziness w/elements/select-month_year.html & edit/cust_main/billing.html -my( $mon, $year ); -my $date = $cust_main->paydate || '12-2037'; -if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format - ( $mon, $year ) = ( $2, $1 ); -} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { - ( $mon, $year ) = ( $1, $3 ); -} else { - warn "unrecognized expiration date format: $date"; - ( $mon, $year ) = ( '', '' ); -} -%> + <% $cust_main->payinfo_masked %> + +% +%#false laziness w/elements/select-month_year.html & edit/cust_main/billing.html +%my( $mon, $year ); +%my $date = $cust_main->paydate || '12-2037'; +%if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format +% ( $mon, $year ) = ( $2, $1 ); +%} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { +% ( $mon, $year ) = ( $1, $3 ); +%} else { +% warn "unrecognized expiration date format: $date"; +% ( $mon, $year ) = ( '', '' ); +%} +% + Expiration - <%= "$mon/$year" %> + <% "$mon/$year" %> +% if ( $cust_main->paystart_month ) { -<% if ( $cust_main->paystart_month ) { %> Start date - <%= $cust_main->paystart_month. '/'. $cust_main->paystart_year %> + <% $cust_main->paystart_month. '/'. $cust_main->paystart_year %> -<% } elsif ( $cust_main->payissue ) { %> +% } elsif ( $cust_main->payissue ) { + Issue # - <%= $cust_main->payissue %> + <% $cust_main->payissue %> -<% } %> +% } + Name on card - <%= $cust_main->payname %> + <% $cust_main->payname %> +% } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') { +% my( $account, $aba ) = split('@', $cust_main->payinfo ); +% -<% } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') { - my( $account, $aba ) = split('@', $cust_main->payinfo ); -%> - Electronic check <%= $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' %> + Electronic check <% $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' %> ABA/Routing code - <%= $aba %> + <% $aba %> Account number - <%= 'x'x(length($account)-2). substr($account,(length($account)-2)) %> + <% 'x'x(length($account)-2). substr($account,(length($account)-2)) %> Bank name - <%= $cust_main->payname %> + <% $cust_main->payname %> +% } elsif ( $cust_main->payby eq 'LECB' ) { +% $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/; +% my $payinfo = "$1-$2-$3"; +% -<% } elsif ( $cust_main->payby eq 'LECB' ) { - $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/; - my $payinfo = "$1-$2-$3"; -%> Phone bill billing Phone number - <%= $payinfo %> + <% $payinfo %> +% } elsif ( $cust_main->payby eq 'BILL' ) { -<% } elsif ( $cust_main->payby eq 'BILL' ) { %> Billing +% if ( $cust_main->payinfo ) { - <% if ( $cust_main->payinfo ) { %> P.O. - <%= $cust_main->payinfo %> + <% $cust_main->payinfo %> - <% } %> +% } + Attention - <%= $cust_main->payname %> + <% $cust_main->payname %> +% } elsif ( $cust_main->payby eq 'COMP' ) { -<% } elsif ( $cust_main->payby eq 'COMP' ) { %> Complimentary Authorized by - <%= $cust_main->payinfo %> - - -<% -#false laziness w/above etc. -my( $mon, $year ); -my $date = $cust_main->paydate || '12-2037'; -if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format - ( $mon, $year ) = ( $2, $1 ); -} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { - ( $mon, $year ) = ( $1, $3 ); -} else { - warn "unrecognized expiration date format: $date"; - ( $mon, $year ) = ( '', '' ); -} -%> + <% $cust_main->payinfo %> + +% +%#false laziness w/above etc. +%my( $mon, $year ); +%my $date = $cust_main->paydate || '12-2037'; +%if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format +% ( $mon, $year ) = ( $2, $1 ); +%} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { +% ( $mon, $year ) = ( $1, $3 ); +%} else { +% warn "unrecognized expiration date format: $date"; +% ( $mon, $year ) = ( '', '' ); +%} +% + Expiration - <%= "$mon/$year" %> + <% "$mon/$year" %> +% } -<% } %> Tax exempt - <%= $cust_main->tax ? 'yes' : 'no' %> + <% $cust_main->tax ? 'yes' : 'no' %> Postal invoices - <%= ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %> + <% ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %> FAX invoices - <%= ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %> + <% ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %> Email invoices - <%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %> + <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %> -<% if ( $conf->exists('voip-cust_cdr_spools') ) { %> +% if ( $conf->exists('voip-cust_cdr_spools') ) { + Spool CDRs - <%= $cust_main->spool_cdr ? 'yes' : 'no' %> + <% $cust_main->spool_cdr ? 'yes' : 'no' %> -<% } %> +% } + diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 48371550b..9c2b38f9a 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -1,58 +1,64 @@ -<% - my( $cust_main ) = @_; - my $conf = new FS::Conf; -%> +% +% my( $cust_main ) = @_; +% my $conf = new FS::Conf; +% + Billing address -<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> +<% ntable("#cccccc") %><% ntable("#cccccc",2) %> Contact name - <%= $cust_main->last. ', '. $cust_main->first %> + <% $cust_main->last. ', '. $cust_main->first %> -<% if ( $conf->exists('show_ss') ) { %> +% if ( $conf->exists('show_ss') ) { + SS# - <%= $cust_main->ss || ' ' %> -<% } %> + <% $cust_main->ss || ' ' %> +% } + Company - <%= $cust_main->company %> + <% $cust_main->company %> Address - <%= $cust_main->address1 %> + <% $cust_main->address1 %> -<% if ( $cust_main->address2 ) { %> +% if ( $cust_main->address2 ) { +   - <%= $cust_main->address2 %> + <% $cust_main->address2 %> -<% } %> +% } + City - <%= $cust_main->city %> + <% $cust_main->city %> State - <%= state_label($cust_main->state, $cust_main->country) %> + <% state_label($cust_main->state, $cust_main->country) %> Zip - <%= $cust_main->zip %> + <% $cust_main->zip %> Country - <%= code2country($cust_main->country) %> - -<% - my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ - ? 'Day Phone' - : FS::Msgcat::_gettext('daytime'); - my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/ - ? 'Night Phone' - : FS::Msgcat::_gettext('night'); -%> - - <%= $daytime_label %> + <% code2country($cust_main->country) %> + +% +% my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ +% ? 'Day Phone' +% : FS::Msgcat::_gettext('daytime'); +% my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/ +% ? 'Night Phone' +% : FS::Msgcat::_gettext('night'); +% + + + <% $daytime_label %> - <%= include('/elements/phonenumber.html', + <% include('/elements/phonenumber.html', $cust_main->daytime, 'callable'=>1 ) @@ -60,9 +66,9 @@ Billing address - <%= $night_label %> + <% $night_label %> - <%= include('/elements/phonenumber.html', + <% include('/elements/phonenumber.html', $cust_main->night, 'callable'=>1 ) @@ -72,54 +78,56 @@ Billing address Fax - <%= $cust_main->fax || ' ' %> + <% $cust_main->fax || ' ' %> +% if ( defined $cust_main->dbdef_table->column('ship_last') ) { +% my $pre = $cust_main->ship_last ? 'ship_' : ''; +% -<% if ( defined $cust_main->dbdef_table->column('ship_last') ) { - my $pre = $cust_main->ship_last ? 'ship_' : ''; -%>
Service address -<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> +<% ntable("#cccccc") %><% ntable("#cccccc",2) %> Contact name - <%= $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") %> + <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") %> Company - <%= $cust_main->get("${pre}company") %> + <% $cust_main->get("${pre}company") %> Address - <%= $cust_main->get("${pre}address1") %> + <% $cust_main->get("${pre}address1") %> -<% if ( $cust_main->get("${pre}address2") ) { %> +% if ( $cust_main->get("${pre}address2") ) { +   - <%= $cust_main->get("${pre}address2") %> + <% $cust_main->get("${pre}address2") %> -<% } %> +% } + City - <%= $cust_main->get("${pre}city") %> + <% $cust_main->get("${pre}city") %> State - <%= $cust_main->get("${pre}state") %> + <% $cust_main->get("${pre}state") %> Zip - <%= $cust_main->get("${pre}zip") %> + <% $cust_main->get("${pre}zip") %> Country - <%= code2country( $cust_main->get("${pre}country") ) %> + <% code2country( $cust_main->get("${pre}country") ) %> - <%= $daytime_label %> + <% $daytime_label %> - <%= include('/elements/phonenumber.html', + <% include('/elements/phonenumber.html', $cust_main->get("${pre}daytime"), 'callable'=>1 ) @@ -127,9 +135,9 @@ Service address - <%= $night_label %> + <% $night_label %> - <%= include('/elements/phonenumber.html', + <% include('/elements/phonenumber.html', $cust_main->get("${pre}night"), 'callable'=>1 ) @@ -139,9 +147,9 @@ Service address Fax - <%= $cust_main->get("${pre}fax") || ' ' %> + <% $cust_main->get("${pre}fax") || ' ' %> +% } -<% } %> diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index f06a4fbd2..fc033b970 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -1,76 +1,77 @@ -<% - my( $cust_main ) = @_; - my $conf = new FS::Conf; -%> +% +% my( $cust_main ) = @_; +% my $conf = new FS::Conf; +% + -<%= ntable("#cccccc") %><%= &ntable("#cccccc",2) %> +<% ntable("#cccccc") %><% &ntable("#cccccc",2) %> Customer number - <%= $cust_main->custnum %> + <% $cust_main->custnum %> Status - <%= ucfirst($cust_main->status) %> + <% ucfirst($cust_main->status) %> +% +% my @agents = qsearch( 'agent', {} ); +% my $agent; +% unless ( scalar(@agents) == 1 ) { +% $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); +% -<% - my @agents = qsearch( 'agent', {} ); - my $agent; - unless ( scalar(@agents) == 1 ) { - $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); -%> Agent - <%= $agent->agentnum %>: <%= $agent->agent %> + <% $agent->agentnum %>: <% $agent->agent %> +% +% } else { +% $agent = $agents[0]; +% } +% +% if ( $cust_main->agent_custid ) { +% -<% - } else { - $agent = $agents[0]; - } - - if ( $cust_main->agent_custid ) { -%> Agent customer ref# - <%= $cust_main->agent_custid %> + <% $cust_main->agent_custid %> +% +% } +% +% unless ( FS::part_referral->num_part_referral == 1 ) { +% my $referral = qsearchs('part_referral', { +% 'refnum' => $cust_main->refnum +% } ); +% -<% - } - - unless ( FS::part_referral->num_part_referral == 1 ) { - my $referral = qsearchs('part_referral', { - 'refnum' => $cust_main->refnum - } ); -%> Advertising source - <%= $referral->refnum %>: <%= $referral->referral%> + <% $referral->refnum %>: <% $referral->referral%> +% } -<% } %> Referring Customer +% +% my $referring_cust_main = ''; +% if ( $cust_main->referral_custnum +% && ( $referring_cust_main = +% qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) +% ) +% ) { +% + +<%$cust_main->referral_custnum %>: <% - my $referring_cust_main = ''; - if ( $cust_main->referral_custnum - && ( $referring_cust_main = - qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) - ) - ) { -%> - -<%=$cust_main->referral_custnum %>: -<%= ( $referring_cust_main->company ? $referring_cust_main->company. ' ('. $referring_cust_main->last. ', '. $referring_cust_main->first. @@ -78,15 +79,15 @@ : $referring_cust_main->last. ', '. $referring_cust_main->first ) %> +% } -<% } %> Order taker - <%= $cust_main->otaker %> + <% $cust_main->otaker %> diff --git a/httemplate/view/cust_main/order_pkg.html b/httemplate/view/cust_main/order_pkg.html index ac2d05df2..6edd18c05 100644 --- a/httemplate/view/cust_main/order_pkg.html +++ b/httemplate/view/cust_main/order_pkg.html @@ -1,6 +1,7 @@ -<% - my( $cust_main ) = @_; -%> +% +% my( $cust_main ) = @_; +% + - + - + diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 9cd1e284f..0278f22e9 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -1,567 +1,575 @@ -<% - my( $cust_main ) = @_; - my $conf = new FS::Conf; +% +% my( $cust_main ) = @_; +% my $conf = new FS::Conf; +% +% my $curuser = $FS::CurrentUser::CurrentUser; +% +% my $packages = get_packages($cust_main, $conf); +% - my $curuser = $FS::CurrentUser::CurrentUser; - - my $packages = get_packages($cust_main, $conf); -%> Packages +% if ( $curuser->access_right('Order customer package') ) { + + <% include('order_pkg.html', $cust_main ) %> +% } +% if ( $curuser->access_right('One-time charge') +% && $conf->config('payby-default') ne 'HIDE' +% ) { +% -<% if ( $curuser->access_right('Order customer package') ) { %> - <%= include('order_pkg.html', $cust_main ) %> -<% } %> + <% include('quick-charge.html', $cust_main ) %> +% } +% if ( $curuser->access_right('Bulk change customer packages') ) { -<% if ( $curuser->access_right('One-time charge') - && $conf->config('payby-default') ne 'HIDE' - ) { -%> - <%= include('quick-charge.html', $cust_main ) %> -<% } %> + Bulk order and cancel packages (preserves services) +% } -<% if ( $curuser->access_right('Bulk change customer packages') ) { %> - Bulk order and cancel packages (preserves services) -<% } %>

+% if ( @$packages ) { -<% if ( @$packages ) { %> Current packages -<% } %> - -<% if ( $cust_main->num_cancelled_pkgs ) { - if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me - || ( $conf->exists('hidecancelledpackages') - && ! $cgi->param('showcancelledpackages') - ) - ) - { - $cgi->param('showcancelledpackages', 1); -%> - ( show -<% } else { - $cgi->param('showcancelledpackages', 0); -%> - ( hide -<% } %> +% } +% if ( $cust_main->num_cancelled_pkgs ) { +% if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me +% || ( $conf->exists('hidecancelledpackages') +% && ! $cgi->param('showcancelledpackages') +% ) +% ) +% { +% $cgi->param('showcancelledpackages', 1); +% + + ( show +% } else { +% $cgi->param('showcancelledpackages', 0); +% + + ( hide +% } + cancelled packages ) -<% } %> +% } +% if ( @$packages ) { -<% if ( @$packages ) { %> -<%= include('/elements/table-grid.html') %> +<% include('/elements/table-grid.html') %> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; +% -<% my $bgcolor1 = '#eeeeee'; - my $bgcolor2 = '#ffffff'; - my $bgcolor = ''; -%> Package Status Services +% +%foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } +% +% + + + + + + <%$pkg->{pkgnum}%>: + <%$pkg->{pkg}%> - <%$pkg->{comment}%>
+ +% unless ( $pkg->{cancel} ) { +% if ( $curuser->access_right('Change customer package') ) { -<% -foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { + ( <%pkg_change_link($pkg)%> ) +% } +% if ( $curuser->access_right('Edit customer package dates') ) { - if ( $bgcolor eq $bgcolor1 ) { - $bgcolor = $bgcolor2; - } else { - $bgcolor = $bgcolor1; - } + ( <%pkg_dates_link($pkg)%> ) +% } +% if ( $curuser->access_right('Customize customer package') ) { -%> + ( <%pkg_customize_link($pkg,$cust_main->custnum)%> ) +% } +% } - - - - <%=$pkg->{pkgnum}%>: - <%=$pkg->{pkg}%> - <%=$pkg->{comment}%>
- - <% unless ( $pkg->{cancel} ) { %> - <% if ( $curuser->access_right('Change customer package') ) { %> - ( <%=pkg_change_link($pkg)%> ) - <% } %> - <% if ( $curuser->access_right('Edit customer package dates') ) { %> - ( <%=pkg_dates_link($pkg)%> ) - <% } %> - <% if ( $curuser->access_right('Customize customer package') ) { %> - ( <%=pkg_customize_link($pkg,$cust_main->custnum)%> ) - <% } %> - <% } %> - + - -<% - sub myfreq { - my $part_pkg = shift; - my $freq = $part_pkg->freq_pretty; - $freq =~ s/ / /g; - $freq; - } - - #this should use cust_pkg->status and cust_pkg->statuscolor eventually - - my $colspan = $conf->exists('cust_pkg-display_times') ? 8 : 4; - my $width = $conf->exists('cust_pkg-display_times') ? '38%' : '56%'; - - #false laziness w/edit/REAL_cust_pkg.cgi - my( $billed_or_prepaid, $last_bill_or_renewed, $next_bill_or_prepaid_until ); - unless ( $pkg->{'part_pkg'}->is_prepaid ) { - $billed_or_prepaid = 'billed'; - $last_bill_or_renewed = 'Last bill'; - $next_bill_or_prepaid_until = 'Next bill'; - } else { - $billed_or_prepaid = 'prepaid'; - $last_bill_or_renewed = 'Renewed'; - $next_bill_or_prepaid_until = 'Prepaid until'; - } - -%> - -<% if ( $pkg->{cancel} ) { %> +% +% sub myfreq { +% my $part_pkg = shift; +% my $freq = $part_pkg->freq_pretty; +% $freq =~ s/ / /g; +% $freq; +% } +% +% #this should use cust_pkg->status and cust_pkg->statuscolor eventually +% +% my $colspan = $conf->exists('cust_pkg-display_times') ? 8 : 4; +% my $width = $conf->exists('cust_pkg-display_times') ? '38%' : '56%'; +% +% #false laziness w/edit/REAL_cust_pkg.cgi +% my( $billed_or_prepaid, $last_bill_or_renewed, $next_bill_or_prepaid_until ); +% unless ( $pkg->{'part_pkg'}->is_prepaid ) { +% $billed_or_prepaid = 'billed'; +% $last_bill_or_renewed = 'Last bill'; +% $next_bill_or_prepaid_until = 'Next bill'; +% } else { +% $billed_or_prepaid = 'prepaid'; +% $last_bill_or_renewed = 'Renewed'; +% $next_bill_or_prepaid_until = 'Prepaid until'; +% } +% +% +% if ( $pkg->{cancel} ) { + - - <%= pkg_datestr($pkg,'cancel',$conf) %> + + <% pkg_datestr($pkg,'cancel',$conf) %> +% unless ( $pkg->{setup} ) { - <% unless ( $pkg->{setup} ) { %> - + +% } else { - <% } else { %> - - <%= pkg_datestr($pkg, 'setup',$conf) %> + + <% pkg_datestr($pkg, 'setup',$conf) %> +% if ( $pkg->{'last_bill'} ) { - <% if ( $pkg->{'last_bill'} ) { %> - - <%= pkg_datestr($pkg, 'last_bill',$conf) %> + + <% pkg_datestr($pkg, 'last_bill',$conf) %> - <% } %> +% } +% if ( $pkg->{'susp'} ) { - <% if ( $pkg->{'susp'} ) { %> - - <%= pkg_datestr($pkg, 'susp',$conf) %> + + <% pkg_datestr($pkg, 'susp',$conf) %> - <% } %> - - <% } %> - -<% } else { %> - - <% if ( $pkg->{susp} ) { %> +% } +% } +% } else { +% if ( $pkg->{susp} ) { + - - <%= pkg_datestr($pkg,'susp',$conf) %> + + <% pkg_datestr($pkg,'susp',$conf) %> +% unless ( $pkg->{setup} ) { - <% unless ( $pkg->{setup} ) { %> - + +% } else { - <% } else { %> - - <%= pkg_datestr($pkg, 'setup',$conf) %> + + <% pkg_datestr($pkg, 'setup',$conf) %> - - <% } %> +% } +% if ( $pkg->{'last_bill'} ) { - <% if ( $pkg->{'last_bill'} ) { %> - - <%= pkg_datestr($pkg, 'last_bill',$conf) %> + + <% pkg_datestr($pkg, 'last_bill',$conf) %> - <% } %> +% } + +% if ( $pkg->{'expire'} ) { - <% if ( $pkg->{'expire'} ) { %> - - <%= pkg_datestr($pkg, 'expire',$conf) %> + + <% pkg_datestr($pkg, 'expire',$conf) %> - <% } %> +% } + - +% } else { + +% unless ( $pkg->{setup} ) { + +% unless ( $pkg->{'freq'} ) { - <% } else { %> - - <% unless ( $pkg->{setup} ) { %> - - <% unless ( $pkg->{'freq'} ) { %> - + - +% } else { - <% } else { %> - + +% } +% } else { + +% unless ( $pkg->{freq} ) { - <% } %> - - <% } else { %> - - <% unless ( $pkg->{freq} ) { %> - + - - <%= pkg_datestr($pkg,'setup',$conf) %> + + <% pkg_datestr($pkg,'setup',$conf) %> +% } else { - <% } else { %> - + - - <%= pkg_datestr($pkg, 'setup',$conf) %> + + <% pkg_datestr($pkg, 'setup',$conf) %> +% } +% } +% if ( $pkg->{'last_bill'} ) { - <% } %> - - <% } %> - - <% if ( $pkg->{'last_bill'} ) { %> - - <%= pkg_datestr($pkg, 'last_bill',$conf) %> + + <% pkg_datestr($pkg, 'last_bill',$conf) %> - <% } %> +% } +% if ( $pkg->{'next_bill'} ) { - <% if ( $pkg->{'next_bill'} ) { %> - - <%= pkg_datestr($pkg, 'next_bill',$conf) %> + + <% pkg_datestr($pkg, 'next_bill',$conf) %> - <% } %> +% } +% if ( $pkg->{'expire'} ) { - <% if ( $pkg->{'expire'} ) { %> - - <%= pkg_datestr($pkg, 'expire',$conf) %> + + <% pkg_datestr($pkg, 'expire',$conf) %> - <% } %> +% } +% if ( $pkg->{freq} ) { - <% if ( $pkg->{freq} ) { %> - - <% } %> - - <% } %> +% } +% } +% } -<% } %>
Cancelled Cancelled 
>Never billed>Never billed
Setup Setup 
<%= $last_bill_or_renewed %> <% $last_bill_or_renewed %> 
Suspended Suspended 
Suspended Suspended 
>Never billed>Never billed
Setup Setup 
<%= $last_bill_or_renewed %> <% $last_bill_or_renewed %> 
Expires Expires 
> + > - <% if ( $curuser->access_right('Unsuspend customer package') ) { %> - ( <%= pkg_unsuspend_link($pkg) %> ) - <% } %> - <% if ( $curuser->access_right('Cancel customer package') ) { %> - ( <%= pkg_cancel_link($pkg) %> ) - <% } %> +% if ( $curuser->access_right('Unsuspend customer package') ) { + + ( <% pkg_unsuspend_link($pkg) %> ) +% } +% if ( $curuser->access_right('Cancel customer package') ) { + + ( <% pkg_cancel_link($pkg) %> ) +% } +
>Not yet billed (one-time charge)>Not yet billed (one-time charge)
> + > - <% if ( $curuser->access_right('Cancel customer package immediately') ) { %> - ( <%= pkg_cancel_link($pkg) %> ) - <% } %> +% if ( $curuser->access_right('Cancel customer package immediately') ) { + + ( <% pkg_cancel_link($pkg) %> ) +% } +
>Not yet billed (<%= $billed_or_prepaid %> <%= myfreq($pkg->{part_pkg}) %>)>Not yet billed (<% $billed_or_prepaid %> <% myfreq($pkg->{part_pkg}) %>)
>One-time charge>One-time charge
Billed Billed 
>Active, <%= $billed_or_prepaid %> <%= myfreq($pkg->{part_pkg}) %>>Active, <% $billed_or_prepaid %> <% myfreq($pkg->{part_pkg}) %>
Setup Setup 
<%= $last_bill_or_renewed %> <% $last_bill_or_renewed %> 
<%= $next_bill_or_prepaid_until %> <% $next_bill_or_prepaid_until %> 
Expires Expires 
> + > - <% if ( $curuser->access_right('Suspend customer package') ) { %> - ( <%= pkg_suspend_link($pkg) %> ) - <% } %> - <% if ( $curuser->access_right('Cancel customer package immediately') ) { %> - ( <%= pkg_cancel_link($pkg) %> ) - <% } %> - <% if ( $curuser->access_right('Cancel customer package later') ) { %> - ( <%= pkg_expire_link($pkg) %> ) - <% } %> +% if ( $curuser->access_right('Suspend customer package') ) { + + ( <% pkg_suspend_link($pkg) %> ) +% } +% if ( $curuser->access_right('Cancel customer package immediately') ) { + + ( <% pkg_cancel_link($pkg) %> ) +% } +% if ( $curuser->access_right('Cancel customer package later') ) { + + ( <% pkg_expire_link($pkg) %> ) +% } +
- + +% +% foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { +% foreach my $service (@{$svcpart->{services}}) { +% - -<% - foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { - foreach my $service (@{$svcpart->{services}}) { -%> - - + + +% if ( $curuser->access_right('Unprovision customer service') ) { - <% if ( $curuser->access_right('Unprovision customer service') ) { %> - + - <% } %> - - <% } %> +% } +% } +% if ( $curuser->access_right('Provision customer service') +% && $svcpart->{count} < $svcpart->{quantity} +% ) +% { +% - <% if ( $curuser->access_right('Provision customer service') - && $svcpart->{count} < $svcpart->{quantity} - ) - { - %> +% } +% } - <% } %> - -<% } %>
<%=svc_link($svcpart,$service)%><%=svc_label_link($svcpart,$service)%><%svc_link($svcpart,$service)%><%svc_label_link($svcpart,$service)%>
( <%=svc_unprovision_link($service)%> )( <%svc_unprovision_link($service)%> )
- <%= svc_provision_link($pkg, $svcpart, $conf, $curuser) %> + <% svc_provision_link($pkg, $svcpart, $conf, $curuser) %>
+% } #end display packages +% -<% } #end display packages -%> +% } else { -<% } else { %>
-<% } %> - -<% -#subroutines - -sub get_packages { - my $cust_main = shift or return undef; - my $conf = shift; - - my @packages = (); - my $method; - if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me - || ( $conf->exists('hidecancelledpackages') - && ! $cgi->param('showcancelledpackages') ) - ) - { - $method = 'ncancelled_pkgs'; - } else { - $method = 'all_pkgs'; - } - - foreach my $cust_pkg ( $cust_main->$method() ) { - - my $part_pkg = $cust_pkg->part_pkg; - - my %pkg = (); - - #to get back to the original object... should use it in the first place!! - $pkg{cust_pkg} = $cust_pkg; - $pkg{part_pkg} = $part_pkg; - - $pkg{pkgnum} = $cust_pkg->pkgnum; - $pkg{pkg} = $part_pkg->pkg; - $pkg{pkgpart} = $part_pkg->pkgpart; - $pkg{comment} = $part_pkg->getfield('comment'); - $pkg{freq} = $part_pkg->freq; - $pkg{setup} = $cust_pkg->getfield('setup'); - $pkg{last_bill} = $cust_pkg->getfield('last_bill'); - $pkg{next_bill} = $cust_pkg->getfield('bill'); - $pkg{susp} = $cust_pkg->getfield('susp'); - $pkg{expire} = $cust_pkg->getfield('expire'); - $pkg{cancel} = $cust_pkg->getfield('cancel'); - - - my %svcparts = map { - $_->svcpart => { - $_->part_svc->hash, - 'quantity' => $_->quantity, - 'count' => $cust_pkg->num_cust_svc($_->svcpart), - #'services' => [], - }; - } $part_pkg->pkg_svc; - - foreach my $cust_svc ( $cust_pkg->cust_svc ) { - #warn "svcnum ". $cust_svc->svcnum. " / svcpart ". $cust_svc->svcpart. "\n"; - my $svc = { - 'svcnum' => $cust_svc->svcnum, - 'label' => ($cust_svc->label)[1], - }; - - #false laziness with above, to catch extraneous services. whole - #damn thing should be OO... - my $svcpart = ( $svcparts{$cust_svc->svcpart} ||= { - $cust_svc->part_svc->hash, - 'quantity' => 0, - 'count' => $cust_pkg->num_cust_svc($cust_svc->svcpart), - #'services' => [], - } ); - - push @{$svcpart->{services}}, $svc; - - } - - $pkg{svcparts} = [ values %svcparts ]; - - push @packages, \%pkg; - - } - - return \@packages; - -} - -sub svc_link { - - my ($svcpart, $svc) = (shift,shift) or return ''; - return qq!$svcpart->{svc}!; - -} - -sub svc_label_link { - - my ($svcpart, $svc) = (shift,shift) or return ''; - return qq!$svc->{label}!; - -} - -sub svc_provision_link { - my ($pkg, $svcpart, $conf, $curuser) = @_; - ( my $svc_nbsp = $svcpart->{svc} ) =~ s/\s+/ /g; - my $num_left = $svcpart->{quantity} - $svcpart->{count}; - my $pkgnum_svcpart = "pkgnum$pkg->{pkgnum}-svcpart$svcpart->{svcpart}"; - - my $url; - if ( $svcpart->{svcdb} eq 'svc_external' - && $conf->exists('svc_external-skip_manual') - ) { - $url = "${p}edit/process/$svcpart->{svcdb}.cgi?". - "pkgnum=$pkg->{pkgnum}&". - "svcpart=$svcpart->{svcpart}"; - } else { - $url = "${p}edit/$svcpart->{svcdb}.cgi?$pkgnum_svcpart"; - } - - my $link = qq!!. - "Provision $svc_nbsp ($num_left)"; - if ( $conf->exists('legacy_link') - && $curuser->access_right('View/link unlinked services') - ) - { - $link .= '
'. - qq!!. - "Link to legacy $svc_nbsp ($num_left)"; - } - $link; -} - -sub svc_unprovision_link { - my $svc = shift or return ''; - qq!Unprovision!; -} - -# This should be generalized to use config options to determine order. -sub pkgsort_pkgnum_cancel { - if ($a->{cancel} and $b->{cancel}) { - return ($a->{pkgnum} <=> $b->{pkgnum}); - } elsif ($a->{cancel} or $b->{cancel}) { - return (-1) if ($b->{cancel}); - return (1) if ($a->{cancel}); - return (0); - } else { - return($a->{pkgnum} <=> $b->{pkgnum}); - } -} - -sub pkg_datestr { - my($pkg, $field, $conf) = @_ or return ''; - return ' ' unless $pkg->{$field}; - my $format = '%b'. - ' %o,'. - ' %Y'; - #$format .= ' %l:%M:%S%P %z' - $format .= ' %l'. - ':'. - '%M'. - ' %P' - if $conf->exists('cust_pkg-display_times'); - ( my $strip = time2str($format, $pkg->{$field}) ) =~ s/ (\d)/$1/g; - $strip; -} - -sub pkg_change_link { - my $pkg = shift or return ''; - return qq!!. - qq!Change package!; -} - -sub pkg_suspend_link { - my $pkg = shift or return ''; - return qq!Suspend!; -} - -sub pkg_unsuspend_link { - my $pkg = shift or return ''; - return qq!Unsuspend!; -} - -sub pkg_cancel_link { - my $pkg = shift or return ''; - qq!!. - qq!Cancel now!; -} - -sub pkg_expire_link { - my $pkg = shift or return ''; - qq!Cancel later!; -} - -sub pkg_dates_link { - my $pkg = shift or return ''; - qq!Edit dates!; -} - -sub pkg_customize_link { - my $pkg = shift or return ''; - my $custnum = shift; - qq!Customize!; -} - -%> +% } +% +%#subroutines +% +%sub get_packages { +% my $cust_main = shift or return undef; +% my $conf = shift; +% +% my @packages = (); +% my $method; +% if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me +% || ( $conf->exists('hidecancelledpackages') +% && ! $cgi->param('showcancelledpackages') ) +% ) +% { +% $method = 'ncancelled_pkgs'; +% } else { +% $method = 'all_pkgs'; +% } +% +% foreach my $cust_pkg ( $cust_main->$method() ) { +% +% my $part_pkg = $cust_pkg->part_pkg; +% +% my %pkg = (); +% +% #to get back to the original object... should use it in the first place!! +% $pkg{cust_pkg} = $cust_pkg; +% $pkg{part_pkg} = $part_pkg; +% +% $pkg{pkgnum} = $cust_pkg->pkgnum; +% $pkg{pkg} = $part_pkg->pkg; +% $pkg{pkgpart} = $part_pkg->pkgpart; +% $pkg{comment} = $part_pkg->getfield('comment'); +% $pkg{freq} = $part_pkg->freq; +% $pkg{setup} = $cust_pkg->getfield('setup'); +% $pkg{last_bill} = $cust_pkg->getfield('last_bill'); +% $pkg{next_bill} = $cust_pkg->getfield('bill'); +% $pkg{susp} = $cust_pkg->getfield('susp'); +% $pkg{expire} = $cust_pkg->getfield('expire'); +% $pkg{cancel} = $cust_pkg->getfield('cancel'); +% +% +% my %svcparts = map { +% $_->svcpart => { +% $_->part_svc->hash, +% 'quantity' => $_->quantity, +% 'count' => $cust_pkg->num_cust_svc($_->svcpart), +% #'services' => [], +% }; +% } $part_pkg->pkg_svc; +% +% foreach my $cust_svc ( $cust_pkg->cust_svc ) { +% #warn "svcnum ". $cust_svc->svcnum. " / svcpart ". $cust_svc->svcpart. "\n"; +% my $svc = { +% 'svcnum' => $cust_svc->svcnum, +% 'label' => ($cust_svc->label)[1], +% }; +% +% #false laziness with above, to catch extraneous services. whole +% #damn thing should be OO... +% my $svcpart = ( $svcparts{$cust_svc->svcpart} ||= { +% $cust_svc->part_svc->hash, +% 'quantity' => 0, +% 'count' => $cust_pkg->num_cust_svc($cust_svc->svcpart), +% #'services' => [], +% } ); +% +% push @{$svcpart->{services}}, $svc; +% +% } +% +% $pkg{svcparts} = [ values %svcparts ]; +% +% push @packages, \%pkg; +% +% } +% +% return \@packages; +% +%} +% +%sub svc_link { +% +% my ($svcpart, $svc) = (shift,shift) or return ''; +% return qq!$svcpart->{svc}!; +% +%} +% +%sub svc_label_link { +% +% my ($svcpart, $svc) = (shift,shift) or return ''; +% return qq!$svc->{label}!; +% +%} +% +%sub svc_provision_link { +% my ($pkg, $svcpart, $conf, $curuser) = @_; +% ( my $svc_nbsp = $svcpart->{svc} ) =~ s/\s+/ /g; +% my $num_left = $svcpart->{quantity} - $svcpart->{count}; +% my $pkgnum_svcpart = "pkgnum$pkg->{pkgnum}-svcpart$svcpart->{svcpart}"; +% +% my $url; +% if ( $svcpart->{svcdb} eq 'svc_external' +% && $conf->exists('svc_external-skip_manual') +% ) { +% $url = "${p}edit/process/$svcpart->{svcdb}.cgi?". +% "pkgnum=$pkg->{pkgnum}&". +% "svcpart=$svcpart->{svcpart}"; +% } else { +% $url = "${p}edit/$svcpart->{svcdb}.cgi?$pkgnum_svcpart"; +% } +% +% my $link = qq!!. +% "Provision $svc_nbsp ($num_left)"; +% if ( $conf->exists('legacy_link') +% && $curuser->access_right('View/link unlinked services') +% ) +% { +% $link .= '
'. +% qq!!. +% "Link to legacy $svc_nbsp ($num_left)"; +% } +% $link; +%} +% +%sub svc_unprovision_link { +% my $svc = shift or return ''; +% qq!Unprovision!; +%} +% +%# This should be generalized to use config options to determine order. +%sub pkgsort_pkgnum_cancel { +% if ($a->{cancel} and $b->{cancel}) { +% return ($a->{pkgnum} <=> $b->{pkgnum}); +% } elsif ($a->{cancel} or $b->{cancel}) { +% return (-1) if ($b->{cancel}); +% return (1) if ($a->{cancel}); +% return (0); +% } else { +% return($a->{pkgnum} <=> $b->{pkgnum}); +% } +%} +% +%sub pkg_datestr { +% my($pkg, $field, $conf) = @_ or return ''; +% return ' ' unless $pkg->{$field}; +% my $format = '%b'. +% ' %o,'. +% ' %Y'; +% #$format .= ' %l:%M:%S%P %z' +% $format .= ' %l'. +% ':'. +% '%M'. +% ' %P' +% if $conf->exists('cust_pkg-display_times'); +% ( my $strip = time2str($format, $pkg->{$field}) ) =~ s/ (\d)/$1/g; +% $strip; +%} +% +%sub pkg_change_link { +% my $pkg = shift or return ''; +% return qq!!. +% qq!Change package!; +%} +% +%sub pkg_suspend_link { +% my $pkg = shift or return ''; +% return qq!Suspend!; +%} +% +%sub pkg_unsuspend_link { +% my $pkg = shift or return ''; +% return qq!Unsuspend!; +%} +% +%sub pkg_cancel_link { +% my $pkg = shift or return ''; +% qq!!. +% qq!Cancel now!; +%} +% +%sub pkg_expire_link { +% my $pkg = shift or return ''; +% qq!Cancel later!; +%} +% +%sub pkg_dates_link { +% my $pkg = shift or return ''; +% qq!Edit dates!; +%} +% +%sub pkg_customize_link { +% my $pkg = shift or return ''; +% my $custnum = shift; +% qq!Customize!; +%} +% +% + diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index aef5fb8f8..244635c9a 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -1,421 +1,416 @@ -<% - my( $cust_main ) = @_; - my $custnum = $cust_main->custnum; +% +% my( $cust_main ) = @_; +% my $custnum = $cust_main->custnum; +% +% my $conf = new FS::Conf; +% +% my $curuser = $FS::CurrentUser::CurrentUser; +% +% my @payby = grep /\w/, $conf->config('payby'); +% #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) +% @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) +% unless @payby; +% my %payby = map { $_=>1 } @payby; +% +% my $s = 0; +% +% - my $conf = new FS::Conf; - - my $curuser = $FS::CurrentUser::CurrentUser; - - my @payby = grep /\w/, $conf->config('payby'); - #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) - @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) - unless @payby; - my %payby = map { $_=>1 } @payby; - - my $s = 0; - -%>

Payment History
+% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { -<% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { %> - - <%= $s++ ? ' | ' : '' %> - Enter check payment - -<% } %> - -<% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { %> - - <%= $s++ ? ' | ' : '' %> - Enter cash payment -<% } %> + <% $s++ ? ' | ' : '' %> + Enter check payment +% } +% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { -<% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { %> - <%= $s++ ? ' | ' : '' %> - Enter Western Union payment + <% $s++ ? ' | ' : '' %> + Enter cash payment +% } +% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { -<% } %> -<% if ( ( $payby{'CARD'} || $payby{'DCRD'} ) - && $curuser->access_right('Process payment') - ) { -%> + <% $s++ ? ' | ' : '' %> + Enter Western Union payment +% } +% if ( ( $payby{'CARD'} || $payby{'DCRD'} ) +% && $curuser->access_right('Process payment') +% ) { +% - <%= $s++ ? ' | ' : '' %> - Process credit card payment -<% } %> + <% $s++ ? ' | ' : '' %> + Process credit card payment +% } +% if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) +% && $curuser->access_right('Process payment') +% ) { +% -<% if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) - && $curuser->access_right('Process payment') - ) { -%> - <%= $s++ ? ' | ' : '' %> - Process electronic check (ACH) payment + <% $s++ ? ' | ' : '' %> + Process electronic check (ACH) payment +% } +% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { -<% } %> -<% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { %> + <% $s++ ? ' | ' : '' %> + Post manual (offline) credit card payment +% } - <%= $s++ ? ' | ' : '' %> - Post manual (offline) credit card payment - -<% } %>
+% if ( $curuser->access_right('Post credit') ) { -<% if ( $curuser->access_right('Post credit') ) { %> - Enter credit + Enter credit
+% } +% +%#get payment history +%my @history = (); +% +%#invoices +%foreach my $cust_bill ($cust_main->cust_bill) { +% my $pre = ( $cust_bill->owed > 0 ) +% ? 'Open ' +% : ''; +% my $post = ( $cust_bill->owed > 0 ) ? '' : ''; +% my $invnum = $cust_bill->invnum; +% my $link = $curuser->access_right('View invoices') +% ? qq!! +% : ''; +% push @history, { +% 'date' => $cust_bill->_date, +% 'desc' => $link. $pre. +% "Invoice #$invnum (Balance \$". $cust_bill->owed. ')'. +% $post. ( $link ? '' : '' ), +% 'charge' => $cust_bill->charged, +% }; +%} +% +%#payments (some false laziness w/credits) +%foreach my $cust_pay ($cust_main->cust_pay) { +% +% my $payby = $cust_pay->payby; +% +% my $payinfo; +% if ( $payby eq 'CARD' ) { +% $payinfo = $cust_pay->payinfo_masked; +% } elsif ( $payby eq 'CHEK' && $cust_pay->payinfo =~ /^(\d+)\@(\d+)$/ ) { +% $payinfo = "ABA $2, Acct# $1"; +% } else { +% $payinfo = $cust_pay->payinfo; +% } +% my @cust_bill_pay = $cust_pay->cust_bill_pay; +% my @cust_pay_refund = $cust_pay->cust_pay_refund; +% +% my $target = "$payby$payinfo"; +% $payby =~ s/^BILL$/Check #/ if $payinfo; +% $payby =~ s/^CHEK$/Electronic check /; +% $payby =~ s/^PREP$/Prepaid card /; +% $payby =~ s/^CARD$/Credit card #/; +% $payby =~ s/^COMP$/Complimentary by /; +% $payby =~ s/^CASH$/Cash/; +% $payby =~ s/^WEST$/Western Union/; +% $payby =~ s/^MCRD$/Manual credit card/; +% $payby =~ s/^BILL$//; +% my $info = $payby ? " ($payby$payinfo)" : ''; +% +% my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' ); +% if ( scalar(@cust_bill_pay) == 0 +% && scalar(@cust_pay_refund) == 0 ) { +% #completely unapplied +% $pre = 'Unapplied '; +% $post = ''; +% $apply = qq! (apply)!; +% +% } elsif ( scalar(@cust_bill_pay) == 1 +% && scalar(@cust_pay_refund) == 0 +% && $cust_pay->unapplied == 0 ) { +% #applied to one invoice, the usual situation +% $desc = ' applied to Invoice #'. $cust_bill_pay[0]->invnum; +% } elsif ( scalar(@cust_bill_pay) == 0 +% && scalar(@cust_pay_refund) == 1 +% && $cust_pay->unapplied == 0 ) { +% #applied to one refund +% $desc = ' refunded on '. time2str("%D", $cust_pay_refund[0]->_date); +% } else { +% #complicated +% $desc = '
'; +% foreach my $app ( sort { $a->_date <=> $b->_date } +% ( @cust_bill_pay, @cust_pay_refund ) ) { +% if ( $app->isa('FS::cust_bill_pay') ) { +% $desc .= '  '. +% '$'. $app->amount. +% ' applied to Invoice #'. $app->invnum. +% '
'; +% #' on '. time2str("%D", $cust_bill_pay->_date). +% } elsif ( $app->isa('FS::cust_pay_refund') ) { +% $desc .= '  '. +% '$'. $app->amount. +% ' refunded on '. time2str("%D", $app->_date). +% '
'; +% } else { +% die "$app is not a FS::cust_bill_pay or FS::cust_pay_refund"; +% } +% } +% if ( $cust_pay->unapplied > 0 ) { +% $desc .= '  '. +% '$'. +% $cust_pay->unapplied. ' unapplied'. +% qq! (apply)!. +% '
'; +% } +% } +% +% my $refund = ''; +% my $refund_days = $conf->config('card_refund-days') || 120; +% if ( $cust_pay->closed !~ /^Y/i +% && $cust_pay->payby =~ /^(CARD|CHEK)$/ +% && time-$cust_pay->_date < $refund_days*86400 +% && $cust_pay->unrefunded > 0 +% && $curuser->access_right('Refund payment') +% ) { +% $refund = qq! (refund)!; +% } +% +% my $void = ''; +% if ( $cust_pay->closed !~ /^Y/i +% && ( ( $cust_pay->payby eq 'CARD' +% && $curuser->access_right('Credit card void') +% ) +% || ( $cust_pay->payby eq 'CHEK' +% && $curuser->access_right('Echeck void') +% ) +% || ( $cust_pay->payby !~ /^(CARD|CHEK)$/ +% && $curuser->access_right('Regular void') +% ) +% ) +% ) +% { +% $void = qq! (void)!; +% } +% +% my $delete = ''; +% if ( $cust_pay->closed !~ /^Y/i +% && $conf->exists('deletepayments') +% && $curuser->access_right('Delete payment') +% ) +% { +% $delete = qq! (delete)!; +% } +% +% my $unapply = ''; +% if ( $cust_pay->closed !~ /^Y/i +% && scalar(@cust_bill_pay) +% && $curuser->access_right('Unapply payment') +% ) +% { +% $unapply = qq! (unapply)!; +% } +% +% push @history, { +% 'date' => $cust_pay->_date, +% 'desc' => $pre. "Payment$post$info$desc". +% "$apply$refund$void$delete$unapply", +% 'payment' => $cust_pay->paid, +% 'target' => $target, +% }; +%} +% +%#voided payments +%foreach my $cust_pay_void ($cust_main->cust_pay_void) { +% +% my $payby = $cust_pay_void->payby; +% my $payinfo = $payby eq 'CARD' +% ? $cust_pay_void->payinfo_masked +% : $cust_pay_void->payinfo; +% +% $payby =~ s/^BILL$/Check #/ if $payinfo; +% $payby =~ s/^CHEK$/Electronic check /; +% $payby =~ s/^BILL$//; +% $payby =~ s/^(CARD|COMP)$/$1 /; +% my $info = $payby ? " ($payby$payinfo)" : ''; +% +% my $unvoid = ''; +% if ( $cust_pay_void->closed !~ /^Y/i +% && $curuser->access_right('Unvoid') +% ) +% { +% $unvoid = qq! (unvoid)!; +% } +% +% push @history, { +% 'date' => $cust_pay_void->_date, +% 'desc' => "Payment $info voided ". +% time2str("%D", $cust_pay_void->void_date). +% " by ". $cust_pay_void->otaker. ''. $unvoid, +% 'void_payment' => $cust_pay_void->paid, +% }; +% +%} +% +%#credits (some false laziness w/payments) +%foreach my $cust_credit ($cust_main->cust_credit) { +% +% my @cust_credit_bill = $cust_credit->cust_credit_bill; +% my @cust_credit_refund = $cust_credit->cust_credit_refund; +% +% my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' ); +% if ( scalar(@cust_credit_bill) == 0 +% && scalar(@cust_credit_refund) == 0 ) { +% #completely unapplied +% $pre = 'Unapplied '; +% $post = ''; +% $apply = qq! (apply)!; +% } elsif ( scalar(@cust_credit_bill) == 1 +% && scalar(@cust_credit_refund) == 0 +% && $cust_credit->credited == 0 ) { +% #applied to one invoice, the usual situation +% $desc = ' applied to Invoice #'. $cust_credit_bill[0]->invnum; +% } elsif ( scalar(@cust_credit_bill) == 0 +% && scalar(@cust_credit_refund) == 1 +% && $cust_credit->credited == 0 ) { +% #applied to one refund +% $desc = ' refunded on '. time2str("%D", $cust_credit_refund[0]->_date); +% } else { +% #complicated +% $desc = '
'; +% foreach my $app ( sort { $a->_date <=> $b->_date } +% ( @cust_credit_bill, @cust_credit_refund ) ) { +% if ( $app->isa('FS::cust_credit_bill') ) { +% $desc .= '  '. +% '$'. $app->amount. +% ' applied to Invoice #'. $app->invnum. +% '
'; +% #' on '. time2str("%D", $app->_date). +% } elsif ( $app->isa('FS::cust_credit_refund') ) { +% $desc .= '  '. +% '$'. $app->amount. +% ' refunded on '. time2str("%D", $app->_date). +% '
'; +% } else { +% die "$app is not a FS::cust_credit_bill or a FS::cust_credit_refund"; +% } +% } +% if ( $cust_credit->credited > 0 ) { +% $desc .= '  $'. +% $cust_credit->credited. ' unapplied'. +% qq! (apply)!. +% '
'; +% } +% } +%# +% my $delete = ''; +% if ( $cust_credit->closed !~ /^Y/i +% +% #s'pose deleting a credit isn't bad like deleting a payment +% # and this needs to be generally available until we have credit voiding.. +% #&& $conf->exists('deletecredits') +% +% && $curuser->access_right('Delete credit') +% ) +% { +% $delete = qq! (!. +% qq!delete)!; +% } +% +% my $unapply = ''; +% if ( $cust_credit->closed !~ /^Y/i +% && scalar(@cust_credit_bill) +% && $curuser->access_right('Unapply credit') +% ) +% { +% $unapply = qq! (!. +% qq!unapply)!; +% } +% +% push @history, { +% 'date' => $cust_credit->_date, +% 'desc' => $pre. "Credit$post by ". $cust_credit->otaker. +% ( $cust_credit->reason +% ? ' ('. $cust_credit->reason. ')' +% : '' +% ). +% "$desc$apply$delete$unapply", +% 'credit' => $cust_credit->amount, +% }; +% +%} +% +%#refunds +%foreach my $cust_refund ($cust_main->cust_refund) { +% +% my $payby = $cust_refund->payby; +% my $payinfo = $payby eq 'CARD' +% ? $cust_refund->payinfo_masked +% : $cust_refund->payinfo; +% +% $payby =~ s/^BILL$/Check #/ if $payinfo; +% $payby =~ s/^CHEK$/Electronic check /; +% $payby =~ s/^(CARD|COMP)$/$1 /; +% +% push @history, { +% 'date' => $cust_refund->_date, +% 'desc' => "Refund ($payby$payinfo) by ". $cust_refund->otaker, +% 'refund' => $cust_refund->refund, +% }; +% +%} +% +% + + +<% include("/elements/table-grid.html") %> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; +% -<% } %> - -<% -#get payment history -my @history = (); - -#invoices -foreach my $cust_bill ($cust_main->cust_bill) { - my $pre = ( $cust_bill->owed > 0 ) - ? 'Open ' - : ''; - my $post = ( $cust_bill->owed > 0 ) ? '' : ''; - my $invnum = $cust_bill->invnum; - my $link = $curuser->access_right('View invoices') - ? qq!! - : ''; - push @history, { - 'date' => $cust_bill->_date, - 'desc' => $link. $pre. - "Invoice #$invnum (Balance \$". $cust_bill->owed. ')'. - $post. ( $link ? '' : '' ), - 'charge' => $cust_bill->charged, - }; -} - -#payments (some false laziness w/credits) -foreach my $cust_pay ($cust_main->cust_pay) { - - my $payby = $cust_pay->payby; - - my $payinfo; - if ( $payby eq 'CARD' ) { - $payinfo = $cust_pay->payinfo_masked; - } elsif ( $payby eq 'CHEK' && $cust_pay->payinfo =~ /^(\d+)\@(\d+)$/ ) { - $payinfo = "ABA $2, Acct# $1"; - } else { - $payinfo = $cust_pay->payinfo; - } - my @cust_bill_pay = $cust_pay->cust_bill_pay; - my @cust_pay_refund = $cust_pay->cust_pay_refund; - - my $target = "$payby$payinfo"; - $payby =~ s/^BILL$/Check #/ if $payinfo; - $payby =~ s/^CHEK$/Electronic check /; - $payby =~ s/^PREP$/Prepaid card /; - $payby =~ s/^CARD$/Credit card #/; - $payby =~ s/^COMP$/Complimentary by /; - $payby =~ s/^CASH$/Cash/; - $payby =~ s/^WEST$/Western Union/; - $payby =~ s/^MCRD$/Manual credit card/; - $payby =~ s/^BILL$//; - my $info = $payby ? " ($payby$payinfo)" : ''; - - my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' ); - if ( scalar(@cust_bill_pay) == 0 - && scalar(@cust_pay_refund) == 0 ) { - #completely unapplied - $pre = 'Unapplied '; - $post = ''; - $apply = qq! (apply)!; - - } elsif ( scalar(@cust_bill_pay) == 1 - && scalar(@cust_pay_refund) == 0 - && $cust_pay->unapplied == 0 ) { - #applied to one invoice, the usual situation - $desc = ' applied to Invoice #'. $cust_bill_pay[0]->invnum; - } elsif ( scalar(@cust_bill_pay) == 0 - && scalar(@cust_pay_refund) == 1 - && $cust_pay->unapplied == 0 ) { - #applied to one refund - $desc = ' refunded on '. time2str("%D", $cust_pay_refund[0]->_date); - } else { - #complicated - $desc = '
'; - foreach my $app ( sort { $a->_date <=> $b->_date } - ( @cust_bill_pay, @cust_pay_refund ) ) { - if ( $app->isa('FS::cust_bill_pay') ) { - $desc .= '  '. - '$'. $app->amount. - ' applied to Invoice #'. $app->invnum. - '
'; - #' on '. time2str("%D", $cust_bill_pay->_date). - } elsif ( $app->isa('FS::cust_pay_refund') ) { - $desc .= '  '. - '$'. $app->amount. - ' refunded on '. time2str("%D", $app->_date). - '
'; - } else { - die "$app is not a FS::cust_bill_pay or FS::cust_pay_refund"; - } - } - if ( $cust_pay->unapplied > 0 ) { - $desc .= '  '. - '$'. - $cust_pay->unapplied. ' unapplied'. - qq! (apply)!. - '
'; - } - } - - my $refund = ''; - my $refund_days = $conf->config('card_refund-days') || 120; - if ( $cust_pay->closed !~ /^Y/i - && $cust_pay->payby =~ /^(CARD|CHEK)$/ - && time-$cust_pay->_date < $refund_days*86400 - && $cust_pay->unrefunded > 0 - && $curuser->access_right('Refund payment') - ) { - $refund = qq! (refund)!; - } - - my $void = ''; - if ( $cust_pay->closed !~ /^Y/i - && ( ( $cust_pay->payby eq 'CARD' - && $curuser->access_right('Credit card void') - ) - || ( $cust_pay->payby eq 'CHEK' - && $curuser->access_right('Echeck void') - ) - || ( $cust_pay->payby !~ /^(CARD|CHEK)$/ - && $curuser->access_right('Regular void') - ) - ) - ) - { - $void = qq! (void)!; - } - - my $delete = ''; - if ( $cust_pay->closed !~ /^Y/i - && $conf->exists('deletepayments') - && $curuser->access_right('Delete payment') - ) - { - $delete = qq! (delete)!; - } - - my $unapply = ''; - if ( $cust_pay->closed !~ /^Y/i - && scalar(@cust_bill_pay) - && $curuser->access_right('Unapply payment') - ) - { - $unapply = qq! (unapply)!; - } - - push @history, { - 'date' => $cust_pay->_date, - 'desc' => $pre. "Payment$post$info$desc". - "$apply$refund$void$delete$unapply", - 'payment' => $cust_pay->paid, - 'target' => $target, - }; -} - -#voided payments -foreach my $cust_pay_void ($cust_main->cust_pay_void) { - - my $payby = $cust_pay_void->payby; - my $payinfo = $payby eq 'CARD' - ? $cust_pay_void->payinfo_masked - : $cust_pay_void->payinfo; - - $payby =~ s/^BILL$/Check #/ if $payinfo; - $payby =~ s/^CHEK$/Electronic check /; - $payby =~ s/^BILL$//; - $payby =~ s/^(CARD|COMP)$/$1 /; - my $info = $payby ? " ($payby$payinfo)" : ''; - - my $unvoid = ''; - if ( $cust_pay_void->closed !~ /^Y/i - && $curuser->access_right('Unvoid') - ) - { - $unvoid = qq! (unvoid)!; - } - - push @history, { - 'date' => $cust_pay_void->_date, - 'desc' => "Payment $info voided ". - time2str("%D", $cust_pay_void->void_date). - " by ". $cust_pay_void->otaker. ''. $unvoid, - 'void_payment' => $cust_pay_void->paid, - }; - -} - -#credits (some false laziness w/payments) -foreach my $cust_credit ($cust_main->cust_credit) { - - my @cust_credit_bill = $cust_credit->cust_credit_bill; - my @cust_credit_refund = $cust_credit->cust_credit_refund; - - my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' ); - if ( scalar(@cust_credit_bill) == 0 - && scalar(@cust_credit_refund) == 0 ) { - #completely unapplied - $pre = 'Unapplied '; - $post = ''; - $apply = qq! (apply)!; - } elsif ( scalar(@cust_credit_bill) == 1 - && scalar(@cust_credit_refund) == 0 - && $cust_credit->credited == 0 ) { - #applied to one invoice, the usual situation - $desc = ' applied to Invoice #'. $cust_credit_bill[0]->invnum; - } elsif ( scalar(@cust_credit_bill) == 0 - && scalar(@cust_credit_refund) == 1 - && $cust_credit->credited == 0 ) { - #applied to one refund - $desc = ' refunded on '. time2str("%D", $cust_credit_refund[0]->_date); - } else { - #complicated - $desc = '
'; - foreach my $app ( sort { $a->_date <=> $b->_date } - ( @cust_credit_bill, @cust_credit_refund ) ) { - if ( $app->isa('FS::cust_credit_bill') ) { - $desc .= '  '. - '$'. $app->amount. - ' applied to Invoice #'. $app->invnum. - '
'; - #' on '. time2str("%D", $app->_date). - } elsif ( $app->isa('FS::cust_credit_refund') ) { - $desc .= '  '. - '$'. $app->amount. - ' refunded on '. time2str("%D", $app->_date). - '
'; - } else { - die "$app is not a FS::cust_credit_bill or a FS::cust_credit_refund"; - } - } - if ( $cust_credit->credited > 0 ) { - $desc .= '  $'. - $cust_credit->credited. ' unapplied'. - qq! (apply)!. - '
'; - } - } -# - my $delete = ''; - if ( $cust_credit->closed !~ /^Y/i - - #s'pose deleting a credit isn't bad like deleting a payment - # and this needs to be generally available until we have credit voiding.. - #&& $conf->exists('deletecredits') - - && $curuser->access_right('Delete credit') - ) - { - $delete = qq! (!. - qq!delete)!; - } - - my $unapply = ''; - if ( $cust_credit->closed !~ /^Y/i - && scalar(@cust_credit_bill) - && $curuser->access_right('Unapply credit') - ) - { - $unapply = qq! (!. - qq!unapply)!; - } - - push @history, { - 'date' => $cust_credit->_date, - 'desc' => $pre. "Credit$post by ". $cust_credit->otaker. - ( $cust_credit->reason - ? ' ('. $cust_credit->reason. ')' - : '' - ). - "$desc$apply$delete$unapply", - 'credit' => $cust_credit->amount, - }; - -} - -#refunds -foreach my $cust_refund ($cust_main->cust_refund) { - - my $payby = $cust_refund->payby; - my $payinfo = $payby eq 'CARD' - ? $cust_refund->payinfo_masked - : $cust_refund->payinfo; - - $payby =~ s/^BILL$/Check #/ if $payinfo; - $payby =~ s/^CHEK$/Electronic check /; - $payby =~ s/^(CARD|COMP)$/$1 /; - - push @history, { - 'date' => $cust_refund->_date, - 'desc' => "Refund ($payby$payinfo) by ". $cust_refund->otaker, - 'refund' => $cust_refund->refund, - }; - -} - -%> - -<%= include("/elements/table-grid.html") %> - -<% my $bgcolor1 = '#eeeeee'; - my $bgcolor2 = '#ffffff'; - my $bgcolor = ''; -%> Date @@ -426,41 +421,41 @@ foreach my $cust_refund ($cust_main->cust_refund) { Refund Balance +% +%#display payment history +% +%my $balance = 0; +%my %target = (); +%my $money_char = $conf->config('money_char') || '$'; +% +%my $years = $conf->config('payment_history-years') || 2; +%my $older_than = time - $years * 31556736; #60*60*24*365.24 +%my $hidden = 0; +%my $seen = 0; +%my $old_history = 0; +% +%foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { +% +% my $display; +% if ( $item->{'date'} < $older_than ) { +% $display = ' STYLE="display:none" '; +% $hidden = 1; +% } else { +% +% $display = ''; +% +% if ( $hidden && ! $seen++ ) { +% ( my $balance_forward = $money_char. $balance ) =~ s/^\$\-/- \$/; +% -<% -#display payment history - -my $balance = 0; -my %target = (); -my $money_char = $conf->config('money_char') || '$'; - -my $years = $conf->config('payment_history-years') || 2; -my $older_than = time - $years * 31556736; #60*60*24*365.24 -my $hidden = 0; -my $seen = 0; -my $old_history = 0; - -foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { - - my $display; - if ( $item->{'date'} < $older_than ) { - $display = ' STYLE="display:none" '; - $hidden = 1; - } else { - - $display = ''; - - if ( $hidden && ! $seen++ ) { - ( my $balance_forward = $money_char. $balance ) =~ s/^\$\-/- \$/; - %> - <%= time2str("%D",$item->{'date'}) %> + <% time2str("%D",$item->{'date'}) %> - Starting balance on <%= time2str("%D",$item->{'date'}) %> + Starting balance on <% time2str("%D",$item->{'date'}) %> (show prior history) @@ -468,86 +463,90 @@ foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { - <%= $balance_forward %> + <% $balance_forward %> +% +% } +% +% } +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } +% +% my $charge = exists($item->{'charge'}) +% ? sprintf("$money_char\%.2f", $item->{'charge'}) +% : ''; +% +% my $payment = exists($item->{'payment'}) +% ? sprintf("- $money_char\%.2f", $item->{'payment'}) +% : ''; +% +% $payment ||= sprintf( "- $money_char\%.2f", +% $item->{'void_payment'} +% ) +% if exists($item->{'void_payment'}); +% +% my $credit = exists($item->{'credit'}) +% ? sprintf("- $money_char\%.2f", $item->{'credit'}) +% : ''; +% +% my $refund = exists($item->{'refund'}) +% ? sprintf("$money_char\%.2f", $item->{'refund'}) +% : ''; +% +% my $target = exists($item->{'target'}) ? $item->{'target'} : ''; +% +% $balance += $item->{'charge'} if exists $item->{'charge'}; +% $balance -= $item->{'payment'} if exists $item->{'payment'}; +% $balance -= $item->{'credit'} if exists $item->{'credit'}; +% $balance += $item->{'refund'} if exists $item->{'refund'}; +% $balance = sprintf("%.2f", $balance); +% $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp +% ( my $showbalance = $money_char. $balance ) =~ s/^\$\-/- \$/; +% +% + + + > + +% unless ( !$target || $target{$target}++ ) { + + +% } + + <% time2str("%D",$item->{'date'}) %> +% if ( $target && $target{$target} == 1 ) { - <% - } - - } - - if ( $bgcolor eq $bgcolor1 ) { - $bgcolor = $bgcolor2; - } else { - $bgcolor = $bgcolor1; - } - - my $charge = exists($item->{'charge'}) - ? sprintf("$money_char\%.2f", $item->{'charge'}) - : ''; - - my $payment = exists($item->{'payment'}) - ? sprintf("- $money_char\%.2f", $item->{'payment'}) - : ''; - - $payment ||= sprintf( "- $money_char\%.2f", - $item->{'void_payment'} - ) - if exists($item->{'void_payment'}); - - my $credit = exists($item->{'credit'}) - ? sprintf("- $money_char\%.2f", $item->{'credit'}) - : ''; - - my $refund = exists($item->{'refund'}) - ? sprintf("$money_char\%.2f", $item->{'refund'}) - : ''; - - my $target = exists($item->{'target'}) ? $item->{'target'} : ''; - - $balance += $item->{'charge'} if exists $item->{'charge'}; - $balance -= $item->{'payment'} if exists $item->{'payment'}; - $balance -= $item->{'credit'} if exists $item->{'credit'}; - $balance += $item->{'refund'} if exists $item->{'refund'}; - $balance = sprintf("%.2f", $balance); - $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp - ( my $showbalance = $money_char. $balance ) =~ s/^\$\-/- \$/; - -%> - - > - - <% unless ( !$target || $target{$target}++ ) { %> - - <% } %> - <%= time2str("%D",$item->{'date'}) %> - <% if ( $target && $target{$target} == 1 ) { %> - <% } %> +% } +
- - <%= $item->{'desc'} %> + + <% $item->{'desc'} %> - - <%= $charge %> + + <% $charge %> - - <%= $payment %> + + <% $payment %> - - <%= $credit %> + + <% $credit %> - - <%= $refund %> + + <% $refund %> - - <%= $showbalance %> + + <% $showbalance %> +% } -<% } %> @@ -559,7 +558,7 @@ function show_history () { var balance_forward_row = document.getElementById('balance_forward_row'); balance_forward_row.style.display = 'none'; - for ( var i = 0; i < <%= $old_history %>; i++ ) { + for ( var i = 0; i < <% $old_history %>; i++ ) { var oldRow = document.getElementById('old_history'+i); oldRow.style.display = ''; } diff --git a/httemplate/view/cust_main/quick-charge.html b/httemplate/view/cust_main/quick-charge.html index 2fe3d5f3d..be8b9d838 100644 --- a/httemplate/view/cust_main/quick-charge.html +++ b/httemplate/view/cust_main/quick-charge.html @@ -1,16 +1,17 @@ -<% - my( $cust_main ) = @_; -%> +% +% my( $cust_main ) = @_; +% - - + + + Description: Amount: -<%= include('/elements/select-taxclass.html') %> +<% include('/elements/select-taxclass.html') %> diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index 93cb51f25..65cdcbfa7 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -1,43 +1,44 @@ -<% - my( $cust_main ) = @_; +% +% my( $cust_main ) = @_; +% +% my $conf = new FS::Conf; +% my $num = $conf->config('cust_main-max_tickets') || 10; +% +% my @tickets = (); +% unless ( $conf->config('ticket_system-custom_priority_field') ) { +% +% @tickets = +% @{ FS::TicketSystem->customer_tickets($cust_main->custnum, $num) }; +% +% } else { +% +% foreach my $priority ( +% $conf->config('ticket_system-custom_priority_field-values'), '' +% ) { +% last if scalar(@tickets) >= $num; +% push @tickets, +% @{ FS::TicketSystem->customer_tickets( $cust_main->custnum, +% $num - scalar(@tickets), +% $priority, +% ) +% }; +% } +% +% } +% +% - my $conf = new FS::Conf; - my $num = $conf->config('cust_main-max_tickets') || 10; - - my @tickets = (); - unless ( $conf->config('ticket_system-custom_priority_field') ) { - - @tickets = - @{ FS::TicketSystem->customer_tickets($cust_main->custnum, $num) }; - - } else { - - foreach my $priority ( - $conf->config('ticket_system-custom_priority_field-values'), '' - ) { - last if scalar(@tickets) >= $num; - push @tickets, - @{ FS::TicketSystem->customer_tickets( $cust_main->custnum, - $num - scalar(@tickets), - $priority, - ) - }; - } - - } - -%> Highest priority tickets -(View all tickets for this customer) -(New ticket for this customer) +(View all tickets for this customer) +(New ticket for this customer) -<%= include("/elements/table-grid.html") %> +<% include("/elements/table-grid.html") %> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; +% -<% my $bgcolor1 = '#eeeeee'; - my $bgcolor2 = '#ffffff'; - my $bgcolor = ''; -%> # @@ -46,31 +47,31 @@ Highest priority tickets Queue Status +% foreach my $ticket ( @tickets ) { +% my $href = FS::TicketSystem->href_ticket($ticket->{id}); +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } +% -<% foreach my $ticket ( @tickets ) { - my $href = FS::TicketSystem->href_ticket($ticket->{id}); - if ( $bgcolor eq $bgcolor1 ) { - $bgcolor = $bgcolor2; - } else { - $bgcolor = $bgcolor1; - } -%> - ><%= $ticket->{id} %> + ><% $ticket->{id} %> - ><%= $ticket->{subject} %> + ><% $ticket->{subject} %> - <%= $ticket->{content} || $ticket->{priority} %> + <% $ticket->{content} || $ticket->{priority} %> - <%= $ticket->{name} %> + <% $ticket->{name} %> - <%= $ticket->{status} %> + <% $ticket->{status} %> +% } -<% } %> diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index a20149ae2..78b42f127 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -1,165 +1,166 @@ -<% +% +% +%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 +% +% -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 - -%> diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 0f103e3e0..35434632e 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -1,116 +1,116 @@ -<% - - # options example... - # - # 'table' => 'svc_something' - # - # 'labels' => { - # 'column' => 'Label', - # }, - # - # listref - each item is a literal column name (or method) or (notyet) coderef - # if not specified all columns (except for the primary key) will be viewable - # 'fields' => [ - # ] - - my(%opt) = @_; - - my $table = $opt{'table'}; - - my $fields = $opt{'fields'} - #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ]; - || [ grep { $_ ne 'svcnum' } fields($table) ]; - - my($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - my $svcnum = $1; - my $svc_x = qsearchs( $opt{'table'}, { 'svcnum' => $svcnum } ) - or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n"; - - my $cust_svc = $svc_x->cust_svc; - my($label, $value, $svcdb) = $cust_svc->label; - - my $pkgnum = $cust_svc->pkgnum; - - my($cust_pkg, $custnum); - if ($pkgnum) { - $cust_pkg = $cust_svc->cust_pkg; - $custnum = $cust_pkg->custnum; - } else { - $cust_pkg = ''; - $custnum = ''; - } - -%> - -<% if ( $custnum ) { %> - - <%= include("/elements/header.html","View $label: $value", menubar( +% +% +% # options example... +% # +% # 'table' => 'svc_something' +% # +% # 'labels' => { +% # 'column' => 'Label', +% # }, +% # +% # listref - each item is a literal column name (or method) or (notyet) coderef +% # if not specified all columns (except for the primary key) will be viewable +% # 'fields' => [ +% # ] +% +% my(%opt) = @_; +% +% my $table = $opt{'table'}; +% +% my $fields = $opt{'fields'} +% #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ]; +% || [ grep { $_ ne 'svcnum' } fields($table) ]; +% +% my($query) = $cgi->keywords; +% $query =~ /^(\d+)$/; +% my $svcnum = $1; +% my $svc_x = qsearchs( $opt{'table'}, { 'svcnum' => $svcnum } ) +% or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n"; +% +% my $cust_svc = $svc_x->cust_svc; +% my($label, $value, $svcdb) = $cust_svc->label; +% +% my $pkgnum = $cust_svc->pkgnum; +% +% my($cust_pkg, $custnum); +% if ($pkgnum) { +% $cust_pkg = $cust_svc->cust_pkg; +% $custnum = $cust_pkg->custnum; +% } else { +% $cust_pkg = ''; +% $custnum = ''; +% } +% +% +% if ( $custnum ) { + + + <% include("/elements/header.html","View $label: $value", menubar( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", )) %> - <%= include( '/elements/small_custview.html', $custnum, '', 1 ) %> + <% include( '/elements/small_custview.html', $custnum, '', 1 ) %>
+% } else { -<% } else { %> - <%= include("/elements/header.html","View $label: $value", menubar( + <% include("/elements/header.html","View $label: $value", menubar( "Cancel this (unaudited) $label" => "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" )) %> +% } -<% } %> -Service #<%= $svcnum %> -| Edit this <%= $label %> +Service #<% $svcnum %> +| Edit this <% $label %>
-<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> - -<% foreach my $f ( @$fields ) { +<% ntable("#cccccc") %><% ntable("#cccccc",2) %> +% foreach my $f ( @$fields ) { +% +% my( $field, $type); +% if ( ref($f) ) { +% $field = $f->{'field'}, +% $type = $f->{'type'} || 'text', +% } else { +% $field = $f; +% $type = 'text'; +% } +% - my( $field, $type); - if ( ref($f) ) { - $field = $f->{'field'}, - $type = $f->{'type'} || 'text', - } else { - $field = $f; - $type = 'text'; - } -%> - <%= ( $opt{labels} && exists $opt{labels}->{$field} ) + <% ( $opt{labels} && exists $opt{labels}->{$field} ) ? $opt{labels}->{$field} : $field %> +% +% #eventually more options for , etc. fields - %> - <%= $svc_x->$field %> + <% $svc_x->$field %> +% } +% foreach (sort { $a cmp $b } $svc_x->virtual_fields) { -<% } %> + <% $svc_x->pvf($_)->widget('HTML', 'view', $svc_x->getfield($_)) %> +% } -<% foreach (sort { $a cmp $b } $svc_x->virtual_fields) { %> - <%= $svc_x->pvf($_)->widget('HTML', 'view', $svc_x->getfield($_)) %> -<% } %>
-<%= joblisting({'svcnum'=>$svcnum}, 1) %> +<% joblisting({'svcnum'=>$svcnum}, 1) %> -<%= include('/elements/footer.html') %> +<% include('/elements/footer.html') %> diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index f4f39084c..9c2fbc94d 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,51 +1,51 @@ -<% - -my $conf = new FS::Conf; - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); -die "Unknown svcnum" unless $svc_acct; - -#false laziness w/all svc_*.cgi -my $cust_svc = qsearchs( 'cust_svc' , { 'svcnum' => $svcnum } ); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum); -if ($pkgnum) { - $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); - $custnum = $cust_pkg->custnum; -} else { - $cust_pkg = ''; - $custnum = ''; -} -#eofalse - -my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); -die "Unknown svcpart" unless $part_svc; -my $svc = $part_svc->svc; - -die 'Empty domsvc for svc_acct.svcnum '. $svc_acct->svcnum - unless $svc_acct->domsvc; -my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } ); -die 'Unknown domain (domsvc '. $svc_acct->domsvc. - ' for svc_acct.svcnum '. $svc_acct->svcnum. ')' - unless $svc_domain; -my $domain = $svc_domain->domain; - -%> - -<% if ( $custnum ) { %> - - <%= include("/elements/header.html","View $svc account", menubar( +% +% +%my $conf = new FS::Conf; +% +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/; +%my $svcnum = $1; +%my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +%die "Unknown svcnum" unless $svc_acct; +% +%#false laziness w/all svc_*.cgi +%my $cust_svc = qsearchs( 'cust_svc' , { 'svcnum' => $svcnum } ); +%my $pkgnum = $cust_svc->getfield('pkgnum'); +%my($cust_pkg, $custnum); +%if ($pkgnum) { +% $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); +% $custnum = $cust_pkg->custnum; +%} else { +% $cust_pkg = ''; +% $custnum = ''; +%} +%#eofalse +% +%my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); +%die "Unknown svcpart" unless $part_svc; +%my $svc = $part_svc->svc; +% +%die 'Empty domsvc for svc_acct.svcnum '. $svc_acct->svcnum +% unless $svc_acct->domsvc; +%my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } ); +%die 'Unknown domain (domsvc '. $svc_acct->domsvc. +% ' for svc_acct.svcnum '. $svc_acct->svcnum. ')' +% unless $svc_domain; +%my $domain = $svc_domain->domain; +% +% +% if ( $custnum ) { + + + <% include("/elements/header.html","View $svc account", menubar( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", "Main menu" => $p, )) %> - <%= include( '/elements/small_custview.html', $custnum, '', 1 ) %> + <% include( '/elements/small_custview.html', $custnum, '', 1 ) %>
+% } else { -<% } else { %> - <%= include("/elements/header.html",'Account View', menubar( + <% include("/elements/header.html",'Account View', menubar( "Cancel this (unaudited) account" => "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')", "Main menu" => $p, )) %> +% } +% if ( $part_svc->part_export_usage ) { +% +% my $last_bill; +% my %plandata; +% if ( $cust_pkg ) { +% #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really +% #belong in plan data +% %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } +% split("\n", $cust_pkg->part_pkg->plandata ); +% +% $last_bill = $cust_pkg->last_bill; +% } else { +% $last_bill = 0; +% %plandata = (); +% } +% +% my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time ); +% my $hour = int($seconds/3600); +% my $min = int( ($seconds%3600) / 60 ); +% my $sec = $seconds%60; +% +% my $input = $svc_acct->attribute_since_sqlradacct( +% $last_bill, time, 'AcctInputOctets' +% ) / 1048576; +% my $output = $svc_acct->attribute_since_sqlradacct( +% $last_bill, time, 'AcctOutputOctets' +% ) / 1048576; +% +% -<% } %> - -<% if ( $part_svc->part_export_usage ) { - - my $last_bill; - my %plandata; - if ( $cust_pkg ) { - #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really - #belong in plan data - %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); } - split("\n", $cust_pkg->part_pkg->plandata ); - - $last_bill = $cust_pkg->last_bill; - } else { - $last_bill = 0; - %plandata = (); - } - - my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time ); - my $hour = int($seconds/3600); - my $min = int( ($seconds%3600) / 60 ); - my $sec = $seconds%60; - - my $input = $svc_acct->attribute_since_sqlradacct( - $last_bill, time, 'AcctInputOctets' - ) / 1048576; - my $output = $svc_acct->attribute_since_sqlradacct( - $last_bill, time, 'AcctOutputOctets' - ) / 1048576; - -%> RADIUS session information
- <%= ntable('#cccccc',2) %> + <% ntable('#cccccc',2) %> +% if ( $seconds ) { + + Online <% $hour %>h <% $min %>m <% $sec %>s +% } else { - <% if ( $seconds ) { %> - Online <%= $hour %>h <%= $min %>m <%= $sec %>s - <% } else { %> Has not logged on - <% } %> +% } +% if ( $cust_pkg ) { + + since last bill (<% time2str('%a %b %o %Y', $last_bill) %>) +% if ( length($plandata{recur_included_hours}) ) { + + - <% $plandata{recur_included_hours} %> total hours in plan +% } - <% if ( $cust_pkg ) { %> - since last bill (<%= time2str('%a %b %o %Y', $last_bill) %>) - <% if ( length($plandata{recur_included_hours}) ) { %> - - <%= $plandata{recur_included_hours} %> total hours in plan - <% } %>
- <% } else { %> +% } else { + (no billing cycle available for unaudited account)
- <% } %> +% } - Upload: <%= sprintf("%.3f", $input) %> megabytes
- Download: <%= sprintf("%.3f", $output) %> megabytes
- <% my $href = qq!
megabytes
+ Download: <% sprintf("%.3f", $output) %> megabytes
+% my $href = qq!
this billing cycle - | <%= $href %>;begin=<%= time-15552000 %>">past six months - | <%= $href %>">all sessions + <% $href %>;begin=<% $last_bill %>">this billing cycle + | <% $href %>;begin=<% time-15552000 %>">past six months + | <% $href %>">all sessions
+% } -<% } %> - - - - -<% #print qq!
Send account information!; %> - -<% - my @part_svc = (); - if ( $pkgnum ) { - @part_svc = grep { $_->svcdb eq 'svc_acct' - && $_->svcpart != $part_svc->svcpart } - $cust_pkg->available_part_svc; - } else { - @part_svc = qsearch('part_svc', { - svcdb => 'svc_acct', - disabled => '', - svcpart => { op=>'!=', value=>$part_svc->svcpart }, - } ); - } -%> + + + +% #print qq!
Send account information!; +% +% my @part_svc = (); +% if ( $pkgnum ) { +% @part_svc = grep { $_->svcdb eq 'svc_acct' +% && $_->svcpart != $part_svc->svcpart } +% $cust_pkg->available_part_svc; +% } else { +% @part_svc = qsearch('part_svc', { +% svcdb => 'svc_acct', +% disabled => '', +% svcpart => { op=>'!=', value=>$part_svc->svcpart }, +% } ); +% } +% + + +Service #<% $svcnum %> +| Edit this service +% if ( @part_svc ) { -Service #<%= $svcnum %> -| Edit this service - -<% if ( @part_svc ) { %> | -<% } %> +% } + -<%= &ntable("#cccccc") %><%= &ntable("#cccccc",2) %> +<% &ntable("#cccccc") %><% &ntable("#cccccc",2) %> Service - <%= $part_svc->svc %> + <% $part_svc->svc %> Username - <%= $svc_acct->username %> + <% $svc_acct->username %> Domain - <%= $domain %> + <% $domain %> Password +% my $password = $svc_acct->_password; +% if ( $password =~ /^\*\w+\* (.*)$/ ) { +% $password = $1; +% - <% my $password = $svc_acct->_password; %> - <% if ( $password =~ /^\*\w+\* (.*)$/ ) { - $password = $1; - %> (login disabled) - <% } %> +% } +% if ( $conf->exists('showpasswords') ) { + +
<% encode_entities($password) %>
+% } else { - <% if ( $conf->exists('showpasswords') ) { %> -
<%= encode_entities($password) %>
- <% } else { %> (hidden) - <% } %> +% } + -<% $password = ''; %> +% $password = ''; +% if ( $conf->exists('security_phrase') ) { +% my $sec_phrase = $svc_acct->sec_phrase; +% -<% if ( $conf->exists('security_phrase') ) { - my $sec_phrase = $svc_acct->sec_phrase; -%> Security phrase - <%= $svc_acct->sec_phrase %> + <% $svc_acct->sec_phrase %> -<% } %> +% } +% if ( $svc_acct->popnum ) { +% my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); +% -<% if ( $svc_acct->popnum ) { - my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); -%> Access number - <%= $svc_acct_pop->text %> + <% $svc_acct_pop->text %> -<% } %> +% } +% if ($svc_acct->uid ne '') { -<% if ($svc_acct->uid ne '') { %> UID - <%= $svc_acct->uid %> + <% $svc_acct->uid %> -<% } %> +% } +% if ($svc_acct->gid ne '') { -<% if ($svc_acct->gid ne '') { %> GID - <%= $svc_acct->gid %> + <% $svc_acct->gid %> -<% } %> +% } +% if ($svc_acct->finger ne '') { -<% if ($svc_acct->finger ne '') { %> GECOS - <%= $svc_acct->finger %> + <% $svc_acct->finger %> -<% } %> +% } +% if ($svc_acct->dir ne '') { -<% if ($svc_acct->dir ne '') { %> Home directory - <%= $svc_acct->dir %> + <% $svc_acct->dir %> -<% } %> +% } +% if ($svc_acct->shell ne '') { -<% if ($svc_acct->shell ne '') { %> Shell - <%= $svc_acct->shell %> + <% $svc_acct->shell %> -<% } %> +% } +% if ($svc_acct->quota ne '') { -<% if ($svc_acct->quota ne '') { %> Quota - <%= $svc_acct->quota %> + <% $svc_acct->quota %> -<% } %> +% } +% if ($svc_acct->slipip) { -<% if ($svc_acct->slipip) { %> IP address - <%= ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' ) + <% ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' ) ? "(Dynamic)" : $svc_acct->slipip %> -<% } %> +% } +% foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) { +% $attribute =~ /^radius_(.*)$/; +% my $pattribute = $FS::raddb::attrib{$1}; +% -<% foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) { - $attribute =~ /^radius_(.*)$/; - my $pattribute = $FS::raddb::attrib{$1}; -%> - Radius (reply) <%= $pattribute %> - <%= $svc_acct->getfield($attribute) %> + Radius (reply) <% $pattribute %> + <% $svc_acct->getfield($attribute) %> -<% } %> +% } +% foreach my $attribute ( grep /^rc_/, $svc_acct->fields ) { +% $attribute =~ /^rc_(.*)$/; +% my $pattribute = $FS::raddb::attrib{$1}; +% -<% foreach my $attribute ( grep /^rc_/, $svc_acct->fields ) { - $attribute =~ /^rc_(.*)$/; - my $pattribute = $FS::raddb::attrib{$1}; -%> - Radius (check) <%= $pattribute %> - <%= $svc_acct->getfield($attribute) %> + Radius (check) <% $pattribute %> + <% $svc_acct->getfield($attribute) %> -<% } %> +% } + RADIUS groups - <%= join('
', $svc_acct->radius_groups) %> + <% join('
', $svc_acct->radius_groups) %> +% if ( $svc_acct->seconds =~ /^\d+$/ ) { -<% if ( $svc_acct->seconds =~ /^\d+$/ ) { %> Prepaid time - <%= duration_exact($svc_acct->seconds) %> + <% duration_exact($svc_acct->seconds) %> -<% } %> +% } +% +%# Can this be abstracted further? Maybe a library function like +%# widget('HTML', 'view', $svc_acct) ? It would definitely make UI +%# style management easier. +% +% foreach (sort { $a cmp $b } $svc_acct->virtual_fields) { -<% -# Can this be abstracted further? Maybe a library function like -# widget('HTML', 'view', $svc_acct) ? It would definitely make UI -# style management easier. -%> + <% $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)) %> +% } -<% foreach (sort { $a cmp $b } $svc_acct->virtual_fields) { %> - <%= $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)) %> -<% } %>

-<%= join("
", $conf->config('svc_acct-notes') ) %> +<% join("
", $conf->config('svc_acct-notes') ) %>

-<%= joblisting({'svcnum'=>$svcnum}, 1) %> +<% joblisting({'svcnum'=>$svcnum}, 1) %> diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index 263fd70f5..1800541f0 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -1,50 +1,51 @@ -<% - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_broadband = qsearchs( 'svc_broadband', { 'svcnum' => $svcnum } ) - or die "svc_broadband: Unknown svcnum $svcnum"; - -#false laziness w/all svc_*.cgi -my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum); -if ($pkgnum) { - $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); - $custnum = $cust_pkg->custnum; -} else { - $cust_pkg = ''; - $custnum = ''; -} -#eofalse - -my $addr_block = $svc_broadband->addr_block; -my $router = $addr_block->router; - -if (not $router) { die "Could not lookup router for svc_broadband (svcnum $svcnum)" }; - -my ( - $routername, - $routernum, - $speed_down, - $speed_up, - $ip_addr, - $ip_gateway, - $ip_netmask, - ) = ( - $router->getfield('routername'), - $router->getfield('routernum'), - $svc_broadband->getfield('speed_down'), - $svc_broadband->getfield('speed_up'), - $svc_broadband->getfield('ip_addr'), - $addr_block->ip_gateway, - $addr_block->NetAddr->mask, - ); -%> +% +% +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/; +%my $svcnum = $1; +%my $svc_broadband = qsearchs( 'svc_broadband', { 'svcnum' => $svcnum } ) +% or die "svc_broadband: Unknown svcnum $svcnum"; +% +%#false laziness w/all svc_*.cgi +%my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); +%my $pkgnum = $cust_svc->getfield('pkgnum'); +%my($cust_pkg, $custnum); +%if ($pkgnum) { +% $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); +% $custnum = $cust_pkg->custnum; +%} else { +% $cust_pkg = ''; +% $custnum = ''; +%} +%#eofalse +% +%my $addr_block = $svc_broadband->addr_block; +%my $router = $addr_block->router; +% +%if (not $router) { die "Could not lookup router for svc_broadband (svcnum $svcnum)" }; +% +%my ( +% $routername, +% $routernum, +% $speed_down, +% $speed_up, +% $ip_addr, +% $ip_gateway, +% $ip_netmask, +% ) = ( +% $router->getfield('routername'), +% $router->getfield('routernum'), +% $svc_broadband->getfield('speed_down'), +% $svc_broadband->getfield('speed_up'), +% $svc_broadband->getfield('ip_addr'), +% $addr_block->ip_gateway, +% $addr_block->NetAddr->mask, +% ); +% + -<%=include("/elements/header.html",'Broadband Service View', menubar( +<%include("/elements/header.html",'Broadband Service View', menubar( ( ( $custnum ) ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", ) @@ -55,101 +56,108 @@ my ( )) %> -Edit this information +Edit this information
-<%=ntable("#cccccc")%> +<%ntable("#cccccc")%> - <%=ntable("#cccccc",2)%> + <%ntable("#cccccc",2)%> Service number - <%=$svcnum%> + <%$svcnum%> Router - <%=$routernum%>: <%=$routername%> + <%$routernum%>: <%$routername%> Download Speed - <%=$speed_down%> + <%$speed_down%> Upload Speed - <%=$speed_up%> + <%$speed_up%> IP Address - <%=$ip_addr%> + <%$ip_addr%> IP Netmask - <%=$ip_netmask%> + <%$ip_netmask%> IP Gateway - <%=$ip_gateway%> + <%$ip_gateway%> +% +%foreach (sort { $a cmp $b } $svc_broadband->virtual_fields) { +% print $svc_broadband->pvf($_)->widget('HTML', 'view', +% $svc_broadband->getfield($_)), "\n"; +%} +% +% -<% -foreach (sort { $a cmp $b } $svc_broadband->virtual_fields) { - print $svc_broadband->pvf($_)->widget('HTML', 'view', - $svc_broadband->getfield($_)), "\n"; -} - -%>
-<%=ntable("#cccccc", 2)%> -<% - my $sb_router = qsearchs('router', { svcnum => $svcnum }); - if ($sb_router) { - %> - Router associated: <%=$sb_router->routername%> - +<%ntable("#cccccc", 2)%> +% +% my $sb_router = qsearchs('router', { svcnum => $svcnum }); +% if ($sb_router) { +% + + Router associated: <%$sb_router->routername%> + (details)
- <% my @sb_addr_block; - if (@sb_addr_block = $sb_router->addr_block) { - %> +% my @sb_addr_block; +% if (@sb_addr_block = $sb_router->addr_block) { +% + Address space - + (edit)
- <% print ntable("#cccccc", 1); - foreach (@sb_addr_block) { %> +% print ntable("#cccccc", 1); +% foreach (@sb_addr_block) { + - <%=$_->ip_gateway%>/<%=$_->ip_netmask%> + <%$_->ip_gateway%>/<%$_->ip_netmask%> - <% } %> +% } + - <% } else { %> +% } else { + No address space allocated. - <% } %> +% } +
- <% - } else { -%> +% +% } else { +% + -
- + + Add router named - +
+% +%} +% -<% -} -%>
-<%=joblisting({'svcnum'=>$svcnum}, 1)%> +<%joblisting({'svcnum'=>$svcnum}, 1)%> diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index f39663094..44390bf8b 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -1,38 +1,39 @@ -<% +% +% +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/; +%my $svcnum = $1; +%my $svc_domain = qsearchs('svc_domain',{'svcnum'=>$svcnum}); +%die "Unknown svcnum" unless $svc_domain; +% +%my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +%my $pkgnum = $cust_svc->getfield('pkgnum'); +%my($cust_pkg, $custnum); +%if ($pkgnum) { +% $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +% $custnum=$cust_pkg->getfield('custnum'); +%} else { +% $cust_pkg = ''; +% $custnum = ''; +%} +% +%my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); +%die "Unknown svcpart" unless $part_svc; +% +%my $email = ''; +%if ($svc_domain->catchall) { +% my $svc_acct = qsearchs('svc_acct',{'svcnum'=> $svc_domain->catchall } ); +% die "Unknown svcpart" unless $svc_acct; +% $email = $svc_acct->email; +%} +% +%my $domain = $svc_domain->domain; +% +% -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_domain = qsearchs('svc_domain',{'svcnum'=>$svcnum}); -die "Unknown svcnum" unless $svc_domain; -my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum); -if ($pkgnum) { - $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); - $custnum=$cust_pkg->getfield('custnum'); -} else { - $cust_pkg = ''; - $custnum = ''; -} - -my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); -die "Unknown svcpart" unless $part_svc; - -my $email = ''; -if ($svc_domain->catchall) { - my $svc_acct = qsearchs('svc_acct',{'svcnum'=> $svc_domain->catchall } ); - die "Unknown svcpart" unless $svc_acct; - $email = $svc_acct->email; -} - -my $domain = $svc_domain->domain; - -%> - -<%= include("/elements/header.html",'Domain View', menubar( +<% include("/elements/header.html",'Domain View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", ) @@ -42,12 +43,12 @@ my $domain = $svc_domain->domain; "Main menu" => $p, )) %> -Service #<%= $svcnum %> -
Service: <%= $part_svc->svc %> -
Domain name: <%= $domain %> -
Catch all email (change): -<%= $email ? "$email" : "(none)" %> -

View whois information. +Service #<% $svcnum %> +
Service: <% $part_svc->svc %> +
Domain name: <% $domain %> +
Catch all email (change): +<% $email ? "$email" : "(none)" %> +

View whois information.

+% my @records; if ( @records = $svc_domain->domain_record ) { -<% my @records; if ( @records = $svc_domain->domain_record ) { %> - <%= ntable("",2) %> + <% ntable("",2) %> ZoneTypeData +% foreach my $domain_record ( @records ) { +% my $type = $domain_record->rectype eq '_mstr' +% ? "(slave)" +% : $domain_record->recaf. ' '. $domain_record->rectype; +% - <% foreach my $domain_record ( @records ) { - my $type = $domain_record->rectype eq '_mstr' - ? "(slave)" - : $domain_record->recaf. ' '. $domain_record->rectype; - %> - <%= $domain_record->reczone %> - <%= $type %> - <%= $domain_record->recdata %> + <% $domain_record->reczone %> + <% $type %> + <% $domain_record->recdata %> +% unless ( $domain_record->rectype eq 'SOA' ) { + + (delete) +% } - <% unless ( $domain_record->rectype eq 'SOA' ) { %> - (delete) - <% } %> - <% } %> +% } + -<% } %> +% } +
-
- + + IN


or

-
- + + +% if ( @records ) { + Delete all records and +% } -<% if ( @records ) { %> Delete all records and <% } %> Slave from nameserver IP - +
-

<%= joblisting({'svcnum'=>$svcnum}, 1) %> +

<% joblisting({'svcnum'=>$svcnum}, 1) %> diff --git a/httemplate/view/svc_external.cgi b/httemplate/view/svc_external.cgi index 7816d88dc..06302bd8f 100644 --- a/httemplate/view/svc_external.cgi +++ b/httemplate/view/svc_external.cgi @@ -1,30 +1,31 @@ -<% - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_external = qsearchs( 'svc_external', { 'svcnum' => $svcnum } ) - or die "svc_external: Unknown svcnum $svcnum"; - -my $conf = new FS::Conf; - -#false laziness w/all svc_*.cgi -my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum); -if ($pkgnum) { - $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); - $custnum = $cust_pkg->custnum; -} else { - $cust_pkg = ''; - $custnum = ''; -} -#eofalse - - -%> - -<%= include("/elements/header.html",'External Service View', menubar( +% +% +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/; +%my $svcnum = $1; +%my $svc_external = qsearchs( 'svc_external', { 'svcnum' => $svcnum } ) +% or die "svc_external: Unknown svcnum $svcnum"; +% +%my $conf = new FS::Conf; +% +%#false laziness w/all svc_*.cgi +%my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); +%my $pkgnum = $cust_svc->getfield('pkgnum'); +%my($cust_pkg, $custnum); +%if ($pkgnum) { +% $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); +% $custnum = $cust_pkg->custnum; +%} else { +% $cust_pkg = ''; +% $custnum = ''; +%} +%#eofalse +% +% +% + + +<% include("/elements/header.html",'External Service View', menubar( ( ( $custnum ) ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", ) @@ -34,20 +35,21 @@ if ($pkgnum) { "Main menu" => $p, )) %> -Edit this information
-<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> +Edit this information
+<% ntable("#cccccc") %><% ntable("#cccccc",2) %> Service number - <%= $svcnum %> -<%= FS::Msgcat::_gettext('svc_external-id') || 'External ID' %> - <%= $conf->config('svc_external-display_type') eq 'artera_turbo' ? sprintf('%010d', $svc_external->id) : $svc_external->id %> -<%= FS::Msgcat::_gettext('svc_external-title') || 'Title' %> - <%= $svc_external->title %> + <% $svcnum %> +<% FS::Msgcat::_gettext('svc_external-id') || 'External ID' %> + <% $conf->config('svc_external-display_type') eq 'artera_turbo' ? sprintf('%010d', $svc_external->id) : $svc_external->id %> +<% FS::Msgcat::_gettext('svc_external-title') || 'Title' %> + <% $svc_external->title %> +% foreach (sort { $a cmp $b } $svc_external->virtual_fields) { + + <% $svc_external->pvf($_)->widget('HTML', 'view', $svc_external->getfield($_)) %> +% } -<% foreach (sort { $a cmp $b } $svc_external->virtual_fields) { %> - <%= $svc_external->pvf($_)->widget('HTML', 'view', $svc_external->getfield($_)) %> -<% } %> -
<%= joblisting({'svcnum'=>$svcnum}, 1) %> +
<% joblisting({'svcnum'=>$svcnum}, 1) %> diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index 52360bcc2..fcc0bc96f 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -1,84 +1,85 @@ -<% +% +% +%my $conf = new FS::Conf; +% +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/; +%my $svcnum = $1; +%my $svc_forward = qsearchs('svc_forward',{'svcnum'=>$svcnum}); +%die "Unknown svcnum" unless $svc_forward; +% +%my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +%my $pkgnum = $cust_svc->getfield('pkgnum'); +%my($cust_pkg, $custnum); +%if ($pkgnum) { +% $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +% $custnum=$cust_pkg->getfield('custnum'); +%} else { +% $cust_pkg = ''; +% $custnum = ''; +%} +% +%my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) +% or die "Unkonwn svcpart"; +% +%print header('Mail Forward View', menubar( +% ( ( $pkgnum || $custnum ) +% ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", +% ) +% : ( "Cancel this (unaudited) mail forward" => +% "${p}misc/cancel-unaudited.cgi?$svcnum" ) +% ), +% "Main menu" => $p, +%)); +% +%my($srcsvc,$dstsvc,$dst) = ( +% $svc_forward->srcsvc, +% $svc_forward->dstsvc, +% $svc_forward->dst, +%); +%my $src = $svc_forward->dbdef_table->column('src') ? $svc_forward->src : ''; +% +%my $svc = $part_svc->svc; +% +%my $source; +%if ($srcsvc) { +% my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$srcsvc}) +% or die "Corrupted database: no svc_acct.svcnum matching srcsvc $srcsvc"; +% $source = $svc_acct->email; +%} else { +% $source = $src; +%} +% +%my $destination; +%if ($dstsvc) { +% my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$dstsvc}) +% or die "Corrupted database: no svc_acct.svcnum matching dstsvc $dstsvc"; +% $destination = $svc_acct->email; +%} else { +% $destination = $dst; +%} +% +%print qq!Edit this information!. +% ntable("#cccccc",2). +% 'Service number'. +% qq!$svcnum!. +% 'Service'. +% qq!$svc!. +% qq!Email to!. +% qq!$source!. +% qq!Forwards to !. +% qq!$destination!; +% +%foreach (sort { $a cmp $b } $svc_forward->virtual_fields) { +% print $svc_forward->pvf($_)->widget('HTML', 'view', $svc_forward->getfield($_)), +% "\n"; +%} +% +%print qq! !. +% '
'. joblisting({'svcnum'=>$svcnum}, 1). +% '' +%; +% +% -my $conf = new FS::Conf; - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_forward = qsearchs('svc_forward',{'svcnum'=>$svcnum}); -die "Unknown svcnum" unless $svc_forward; - -my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum); -if ($pkgnum) { - $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); - $custnum=$cust_pkg->getfield('custnum'); -} else { - $cust_pkg = ''; - $custnum = ''; -} - -my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) - or die "Unkonwn svcpart"; - -print header('Mail Forward View', menubar( - ( ( $pkgnum || $custnum ) - ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - : ( "Cancel this (unaudited) mail forward" => - "${p}misc/cancel-unaudited.cgi?$svcnum" ) - ), - "Main menu" => $p, -)); - -my($srcsvc,$dstsvc,$dst) = ( - $svc_forward->srcsvc, - $svc_forward->dstsvc, - $svc_forward->dst, -); -my $src = $svc_forward->dbdef_table->column('src') ? $svc_forward->src : ''; - -my $svc = $part_svc->svc; - -my $source; -if ($srcsvc) { - my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$srcsvc}) - or die "Corrupted database: no svc_acct.svcnum matching srcsvc $srcsvc"; - $source = $svc_acct->email; -} else { - $source = $src; -} - -my $destination; -if ($dstsvc) { - my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$dstsvc}) - or die "Corrupted database: no svc_acct.svcnum matching dstsvc $dstsvc"; - $destination = $svc_acct->email; -} else { - $destination = $dst; -} - -print qq!Edit this information!. - ntable("#cccccc",2). - 'Service number'. - qq!$svcnum!. - 'Service'. - qq!$svc!. - qq!Email to!. - qq!$source!. - qq!Forwards to !. - qq!$destination!; - -foreach (sort { $a cmp $b } $svc_forward->virtual_fields) { - print $svc_forward->pvf($_)->widget('HTML', 'view', $svc_forward->getfield($_)), - "\n"; -} - -print qq! !. - '
'. joblisting({'svcnum'=>$svcnum}, 1). - '' -; - -%> diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi index 8de7cc8e7..732f3cd79 100644 --- a/httemplate/view/svc_phone.cgi +++ b/httemplate/view/svc_phone.cgi @@ -1,4 +1,4 @@ -<%= include('elements/svc_Common.html', +<% include('elements/svc_Common.html', 'table' => 'svc_phone', 'fields' => [qw( countrycode phonenum )], #pin 'labels' => { diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index 6c8cd6a0b..f2be5c717 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -1,73 +1,74 @@ -<% +% +% +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/; +%my $svcnum = $1; +%my $svc_www = qsearchs( 'svc_www', { 'svcnum' => $svcnum } ) +% or die "svc_www: Unknown svcnum $svcnum"; +% +%#false laziness w/all svc_*.cgi +%my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); +%my $pkgnum = $cust_svc->getfield('pkgnum'); +%my($cust_pkg, $custnum); +%if ($pkgnum) { +% $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); +% $custnum = $cust_pkg->custnum; +%} else { +% $cust_pkg = ''; +% $custnum = ''; +%} +%#eofalse +% +%my $usersvc = $svc_www->usersvc; +%my $svc_acct = ''; +%my $email = ''; +%if ( $usersvc ) { +% $svc_acct = qsearchs('svc_acct', { 'svcnum' => $usersvc } ) +% or die "svc_www: Unknown usersvc $usersvc"; +% $email = $svc_acct->email; +%} +% +%my $domain_record = qsearchs('domain_record', { 'recnum' => $svc_www->recnum } ) +% or die "svc_www: Unknown recnum ". $svc_www->recnum; +% +%my $www = $domain_record->zone; +% +%print header('Website View', menubar( +% ( ( $custnum ) +% ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", +% ) +% : ( "Cancel this (unaudited) website" => +% "${p}misc/cancel-unaudited.cgi?$svcnum" ) +% ), +% "Main menu" => $p, +%)). +% qq!Edit this information
!. +% ntable("#cccccc"). ''. ntable("#cccccc",2). +% qq!Service number!. +% qq!$svcnum!. +% qq!Website name!. +% qq!$www!. +% qq!Account!. +% qq!!; +% +%if ( $usersvc ) { +% print qq!$email!; +%} else { +% print '
(none)
'; +%} +% +%print ''; +% +%foreach (sort { $a cmp $b } $svc_www->virtual_fields) { +% print $svc_www->pvf($_)->widget('HTML', 'view', $svc_www->getfield($_)), +% "\n"; +%} +% +% +%print ''. +% '
'. joblisting({'svcnum'=>$svcnum}, 1). +% '' +%; +% -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_www = qsearchs( 'svc_www', { 'svcnum' => $svcnum } ) - or die "svc_www: Unknown svcnum $svcnum"; - -#false laziness w/all svc_*.cgi -my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum); -if ($pkgnum) { - $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); - $custnum = $cust_pkg->custnum; -} else { - $cust_pkg = ''; - $custnum = ''; -} -#eofalse - -my $usersvc = $svc_www->usersvc; -my $svc_acct = ''; -my $email = ''; -if ( $usersvc ) { - $svc_acct = qsearchs('svc_acct', { 'svcnum' => $usersvc } ) - or die "svc_www: Unknown usersvc $usersvc"; - $email = $svc_acct->email; -} - -my $domain_record = qsearchs('domain_record', { 'recnum' => $svc_www->recnum } ) - or die "svc_www: Unknown recnum ". $svc_www->recnum; - -my $www = $domain_record->zone; - -print header('Website View', menubar( - ( ( $custnum ) - ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - : ( "Cancel this (unaudited) website" => - "${p}misc/cancel-unaudited.cgi?$svcnum" ) - ), - "Main menu" => $p, -)). - qq!Edit this information
!. - ntable("#cccccc"). ''. ntable("#cccccc",2). - qq!Service number!. - qq!$svcnum!. - qq!Website name!. - qq!$www!. - qq!Account!. - qq!!; - -if ( $usersvc ) { - print qq!$email!; -} else { - print '
(none)
'; -} - -print ''; - -foreach (sort { $a cmp $b } $svc_www->virtual_fields) { - print $svc_www->pvf($_)->widget('HTML', 'view', $svc_www->getfield($_)), - "\n"; -} - - -print ''. - '
'. joblisting({'svcnum'=>$svcnum}, 1). - '' -; -%> -- cgit v1.2.1 From d2062945973d28e65b942f37bbbd9a5ab4f4172c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 15 Sep 2006 19:15:34 +0000 Subject: add link to customer tax exemptions to customer view page --- httemplate/view/cust_main/payment_history.html | 49 ++++++++++++++------------ 1 file changed, 27 insertions(+), 22 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 244635c9a..a922cfc0a 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -1,25 +1,9 @@ -% -% my( $cust_main ) = @_; -% my $custnum = $cust_main->custnum; -% -% my $conf = new FS::Conf; -% -% my $curuser = $FS::CurrentUser::CurrentUser; -% -% my @payby = grep /\w/, $conf->config('payby'); -% #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) -% @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) -% unless @payby; -% my %payby = map { $_=>1 } @payby; -% -% my $s = 0; -% -%

Payment History
-% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { +% my $s = 0; +% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { <% $s++ ? ' | ' : '' %> Enter check payment @@ -61,16 +45,20 @@ Post manual (offline) credit card payment % } -
-% if ( $curuser->access_right('Post credit') ) { - +% if ( $curuser->access_right('Post credit') ) { Enter credit +
+% } +% if ( $curuser->access_right('View customer tax exemptions') ) { + View tax exemptions
% } -% + + + %#get payment history %my @history = (); % @@ -567,3 +555,20 @@ function show_history () { +<%init> + +my( $cust_main ) = @_; +my $custnum = $cust_main->custnum; + +my $conf = new FS::Conf; + +my $curuser = $FS::CurrentUser::CurrentUser; + +my @payby = grep /\w/, $conf->config('payby'); +#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) +@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) + unless @payby; +my %payby = map { $_=>1 } @payby; + + + -- cgit v1.2.1 From b9659e5372a344fbc027720939625de1fd99645d Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 15 Sep 2006 19:16:37 +0000 Subject: add link to customer tax exemptions to customer view page --- httemplate/view/cust_main/payment_history.html | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index a922cfc0a..4e4cd154f 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -1,46 +1,36 @@ - -

Payment History
% my $s = 0; % if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { - <% $s++ ? ' | ' : '' %> Enter check payment % } -% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { - +% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { <% $s++ ? ' | ' : '' %> Enter cash payment % } -% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { - +% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { <% $s++ ? ' | ' : '' %> Enter Western Union payment % } + % if ( ( $payby{'CARD'} || $payby{'DCRD'} ) % && $curuser->access_right('Process payment') % ) { -% - - <% $s++ ? ' | ' : '' %> Process credit card payment % } + % if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) % && $curuser->access_right('Process payment') % ) { -% - - <% $s++ ? ' | ' : '' %> Process electronic check (ACH) payment % } -% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { - +% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { <% $s++ ? ' | ' : '' %> Post manual (offline) credit card payment % } @@ -57,8 +47,6 @@
% } - - %#get payment history %my @history = (); % @@ -571,4 +559,3 @@ my @payby = grep /\w/, $conf->config('payby'); my %payby = map { $_=>1 } @payby; - -- cgit v1.2.1 From 30c3ff2acf90e1386fae00759078899c859faf36 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 3 Oct 2006 22:44:28 +0000 Subject: Enhanced customer notes --- httemplate/view/cust_main.cgi | 28 ++++++++++++++ httemplate/view/cust_main/notes.html | 74 ++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100755 httemplate/view/cust_main/notes.html (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index e82a5196c..6b2277756 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -116,6 +116,34 @@ Comments % } +

+% my $notecount = scalar($cust_main->notes()); +% if ($conf->exists('cust_main-use_notes') || $notecount) { + +Notes
+% if ( $curuser->access_right('Add customer note') && +% $conf->exists('cust_main-use_notes') +% ) { + + Add customer note + +% } + +
+ +% if ($notecount) { + + + +% } else { + +
+% } +% } + + % if ( $conf->config('ticket_system') ) {
diff --git a/httemplate/view/cust_main/notes.html b/httemplate/view/cust_main/notes.html new file mode 100755 index 000000000..c1a33b020 --- /dev/null +++ b/httemplate/view/cust_main/notes.html @@ -0,0 +1,74 @@ +% +% my $conf = new FS::Conf; +% +% $cgi->param('custnum') =~ /^(\d+)$/ +% or die "No customer specified (bad URL)!"; +% my $custnum = $1; +% +% my $cust_main = qsearchs('cust_main', {'custnum' => $custnum} ); +% die "Custimer not found!" unless $cust_main; +% +% my (@notes) = $cust_main->notes(); +% if ( scalar(@notes) ) { + + + + + +%#<% include('/elements/table-grid.html') %> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; +% +% foreach my $note (@notes) { +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } +% +% + + + <% note_datestr($note,$conf,$bgcolor) %> + + + + +% } #end display notes + +
+  <%$note->otaker%>  + +  <%$note->comments%> +
+% } else { + +
+% } +% +%#subroutines +% +%sub note_datestr { +% my($note, $conf, $bgcolor) = @_ or return ''; +% my $format=qq{%b}. +% qq{ %o,}. +% qq{ %Y }; +% $format .= qq{ %l}. +% qq{:}. +% qq{%M}. +% qq{ %P } +% if $conf->exists('cust_main_note-display_times'); +% ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g; +% $strip; +% } +% + -- cgit v1.2.1 From 3050434f62122e73d748dac26a5e70193b444c0a Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 4 Oct 2006 21:22:08 +0000 Subject: DoB --- httemplate/view/cust_main/misc.html | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index fc033b970..b0fab0300 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -1,6 +1,7 @@ % % my( $cust_main ) = @_; % my $conf = new FS::Conf; +% my $date_format = ($conf->config('date_format') || "%m/%d/%Y"); % @@ -90,5 +91,10 @@ <% $cust_main->otaker %> + + Date of Birth + <% $cust_main->birthdate ? time2str($date_format, $cust_main->birthdate) : '' %> + + -- cgit v1.2.1 From 17fa39cf364f9876d41c033f63ef0b4f6f8b1bb7 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 9 Oct 2006 00:26:27 +0000 Subject: clean up the customer view a tiny bit --- httemplate/view/cust_main.cgi | 9 +++------ httemplate/view/cust_main/tickets.html | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 6b2277756..96acf15eb 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -102,8 +102,7 @@ var confirm_cancel = '
Tickets +
-Highest priority tickets (View all tickets for this customer) (New ticket for this customer) -- cgit v1.2.1 From 9186ed8ab4b2b25e91efe6d0dcabeaef191a2709 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 9 Oct 2006 00:30:58 +0000 Subject: have the new style notes be the default --- httemplate/view/cust_main.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 96acf15eb..70d424065 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -117,11 +117,11 @@ Comments % }

% my $notecount = scalar($cust_main->notes()); -% if ($conf->exists('cust_main-use_notes') || $notecount) { +% if ( ! $conf->exists('cust_main-disable_notes') || $notecount) { Notes
% if ( $curuser->access_right('Add customer note') && -% $conf->exists('cust_main-use_notes') +% ! $conf->exists('cust_main-disable_notes') % ) { Add customer note -- cgit v1.2.1 From 7c0ec6fb521584a93a93e456dbb923870f059308 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 16 Oct 2006 17:10:46 +0000 Subject: add a conf checkbox to turn DOB on --- httemplate/view/cust_main/misc.html | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index b0fab0300..b6c028e16 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -91,10 +91,14 @@ <% $cust_main->otaker %> - - Date of Birth - <% $cust_main->birthdate ? time2str($date_format, $cust_main->birthdate) : '' %> - +<% if ( $conf->exists('cust_main-enable_birthdate') ) { + + + Date of Birth + <% $cust_main->birthdate ? time2str($date_format, $cust_main->birthdate) : '' %> + + +<% } %> -- cgit v1.2.1 From 5f916c133ea7b29af6d8d82e0e323d7ad0b4662a Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 16 Oct 2006 17:13:51 +0000 Subject: its not my monday morning --- httemplate/view/cust_main/misc.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index b6c028e16..fdc5ba4ea 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -91,14 +91,14 @@ <% $cust_main->otaker %> -<% if ( $conf->exists('cust_main-enable_birthdate') ) { +% if ( $conf->exists('cust_main-enable_birthdate') ) { Date of Birth <% $cust_main->birthdate ? time2str($date_format, $cust_main->birthdate) : '' %> -<% } %> +% } -- cgit v1.2.1 From 52281cbeaf8d4e02345eca3c1aa0500133823558 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 18 Oct 2006 23:07:08 +0000 Subject: suspension and cancellation reasons --- httemplate/view/cust_main/packages.html | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 0278f22e9..1d65ea7f7 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -539,7 +539,7 @@ Current packages % %sub pkg_suspend_link { % my $pkg = shift or return ''; -% return qq!Suspend!; +% qq!Suspend!; %} % %sub pkg_unsuspend_link { @@ -549,14 +549,13 @@ Current packages % %sub pkg_cancel_link { % my $pkg = shift or return ''; -% qq!!. -% qq!Cancel now!; +% +% qq!Cancel now!; %} % %sub pkg_expire_link { % my $pkg = shift or return ''; -% qq!Cancel later!; +% qq!Cancel later!; %} % %sub pkg_dates_link { -- cgit v1.2.1 From 1043b612a287f6ccc6bbe32357483019d390f840 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 23 Oct 2006 01:47:03 +0000 Subject: fix regression from table re-layout: don't display provision links for cancelled packages --- httemplate/view/cust_main/packages.html | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 1d65ea7f7..8fff7be4f 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -327,35 +327,38 @@ Current packages -% + % foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { + % foreach my $service (@{$svcpart->{services}}) { -% -% if ( $curuser->access_right('Unprovision customer service') ) { + +% if ( $curuser->access_right('Unprovision customer service') ) { -% } -% } -% if ( $curuser->access_right('Provision customer service') -% && $svcpart->{count} < $svcpart->{quantity} -% ) -% { -% +% } +% } + +% if ( ! $pkg->{'cancel'} +% && $curuser->access_right('Provision customer service') +% && $svcpart->{count} < $svcpart->{quantity} +% ) { -% } + +% } + % } -- cgit v1.2.1 From df4a30e2813c3be288747cd2a5fa2fa3ed15a248 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 24 Oct 2006 18:26:38 +0000 Subject: add customer signup date --- httemplate/view/cust_main/misc.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index fdc5ba4ea..414ef44a8 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -91,6 +91,11 @@ + + + + + % if ( $conf->exists('cust_main-enable_birthdate') ) { -- cgit v1.2.1 From 40b1272a7b98f8a3d2f5252c2997c77de4526ef1 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 25 Oct 2006 03:12:10 +0000 Subject: no usersvc svc_www tweak --- httemplate/view/svc_www.cgi | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index f2be5c717..f499a3fb5 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -20,6 +20,9 @@ %} %#eofalse % +%my $part_svc=qsearchs('part_svc',{'svcpart'=>$cust_svc->svcpart}) +% or die "svc_www: Unknown svcpart" . $cust_svc->svcpart; + %my $usersvc = $svc_www->usersvc; %my $svc_acct = ''; %my $email = ''; @@ -48,17 +51,20 @@ % qq!!. % qq!!. % qq!!. -% qq!!. -% qq!!. +% qq!!; +%if ( $part_svc->part_svc_column('usersvc')->columnflag ne 'F' +% || $part_svc->part_svc_column('usersvc')->columnvalue !~ /^\s*$/) { +% print qq!!. % qq!'; +% print ''; +%} % %foreach (sort { $a cmp $b } $svc_www->virtual_fields) { % print $svc_www->pvf($_)->widget('HTML', 'view', $svc_www->getfield($_)), -- cgit v1.2.1 From c053960cd96e874d11d355ed4ccc15eed896298a Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 25 Oct 2006 18:10:05 +0000 Subject: show reasons --- httemplate/view/cust_main/packages.html | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 8fff7be4f..f93a0764b 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -136,6 +136,11 @@ Current packages <% pkg_datestr($pkg,'cancel',$conf) %> + + + % unless ( $pkg->{setup} ) { @@ -172,6 +177,11 @@ Current packages <% pkg_datestr($pkg,'susp',$conf) %> + + + % unless ( $pkg->{setup} ) { @@ -413,6 +423,7 @@ Current packages % $pkg{susp} = $cust_pkg->getfield('susp'); % $pkg{expire} = $cust_pkg->getfield('expire'); % $pkg{cancel} = $cust_pkg->getfield('cancel'); +% $pkg{reason} = $cust_pkg->last_reason->reason if $cust_pkg->last_reason; % % % my %svcparts = map { -- cgit v1.2.1 From 576c6b48428aa95e0fd80db011fe73c0b728c88b Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 27 Oct 2006 17:01:31 +0000 Subject: editable notes --- httemplate/view/cust_main/notes.html | 41 +++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/notes.html b/httemplate/view/cust_main/notes.html index c1a33b020..75bf30e41 100755 --- a/httemplate/view/cust_main/notes.html +++ b/httemplate/view/cust_main/notes.html @@ -1,5 +1,6 @@ % % my $conf = new FS::Conf; +% my $curuser = $FS::CurrentUser::CurrentUser; % % $cgi->param('custnum') =~ /^(\d+)$/ % or die "No customer specified (bad URL)!"; @@ -20,6 +21,11 @@ body { background: #e8e8e8 } + + + + +
<%svc_link($svcpart,$service)%> <%svc_label_link($svcpart,$service)%>
( <%svc_unprovision_link($service)%> )
<% svc_provision_link($pkg, $svcpart, $conf, $curuser) %>
<% $cust_main->otaker %>
Signup Date<% $cust_main->signupdate ? time2str($date_format, $cust_main->signupdate) : '' %>
Service number$svcnum
Website name$www
Account$www
Account!; % -%if ( $usersvc ) { -% print qq!$email!; -%} else { -% print '(none)'; -%} +% if ( $usersvc ) { +% print qq!$email!; +% } else { +% print '(none)'; +% } % -%print '
Cancelled 
+ <% $pkg->{reason} %> +
Suspended 
+ <% $pkg->{reason} %> +
%#<% include('/elements/table-grid.html') %> @@ -35,12 +41,27 @@ body { background: #e8e8e8 } % $bgcolor = $bgcolor1; % } % +% my $pop = popurl(3); +% my $notenum = $note->notenum; +% my $clickjs = qq!onclick="overlib( OLiframeContent('${pop}edit/! . +% qq!cust_main_note.cgi?custnum=$custnum&! . +% qq!notenum=$notenum', 616, ! . +% qq!386, 'cust_main_note_popup' ), CAPTION, 'Edit customer ! . +% qq!note', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, ! . +% qq!CLOSECLICK, FRAME, top); return false;"!; % +% my ($el, $eel); +% if ($curuser->access_right('Edit customer note') ) { +% $el = qq!!; +% $eel = qq!!; +% }else{ +% $el = $eel = ''; +% } - <% note_datestr($note,$conf,$bgcolor) %> + <% note_datestr($note,$conf,$bgcolor, $el, $eel) %> }. -% qq{}. -% qq{}; -% $format .= qq{}. -% qq{}. -% qq{}. -% qq{} +% my($note, $conf, $bgcolor, $el, $eel) = @_ or return ''; +% my $format=qq{}. +% qq{}. +% qq{}; +% $format .= qq{}. +% qq{}. +% qq{}. +% qq{} % if $conf->exists('cust_main_note-display_times'); % ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g; % $strip; -- cgit v1.2.1 From 942b10d6477c70fa2f23c909c9bb0ee19eb9b959 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 5 Nov 2006 15:55:53 +0000 Subject: fix but with no "show prior history" showing up when everything is hidden --- httemplate/view/cust_main/payment_history.html | 54 +++++++++++++++----------- 1 file changed, 32 insertions(+), 22 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 4e4cd154f..4f46ace6d 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -400,6 +400,31 @@ % %#display payment history % +%sub balance_forward_row { +% my( $b, $date ) = @_; +% my $conf = new FS::Conf; +% my $money_char = $conf->config('money_char') || '$'; +% ( my $balance_forward = $money_char. $b ) =~ s/^\$\-/- \$/; + + + + + + + + + + + + + +%} +% %my $balance = 0; %my %target = (); %my $money_char = $conf->config('money_char') || '$'; @@ -409,9 +434,12 @@ %my $hidden = 0; %my $seen = 0; %my $old_history = 0; +%my $lastdate = 0; % %foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { % +% $lastdate = $item->{'date'}; +% % my $display; % if ( $item->{'date'} < $older_than ) { % $display = ' STYLE="display:none" '; @@ -421,28 +449,7 @@ % $display = ''; % % if ( $hidden && ! $seen++ ) { -% ( my $balance_forward = $money_char. $balance ) =~ s/^\$\-/- \$/; -% - - - - - - - - - - - - - - -% +% balance_forward_row($balance, $item->{'date'}); % } % % } @@ -523,6 +530,9 @@ % } +%if ( scalar(@history) && $hidden && ! $seen++ ) { +% balance_forward_row($balance, $lastdate); +%}
-  <%$note->otaker%>  + <% $el %>  <%$note->otaker%>  <% $eel %>  <%$note->comments%> @@ -58,14 +79,14 @@ body { background: #e8e8e8 } %#subroutines % %sub note_datestr { -% my($note, $conf, $bgcolor) = @_ or return ''; -% my $format=qq{%b %o, %Y  %l:%M %P $el%b$eel$el %o,$eel$el %Y $eel$el %l$eel$el:$eel$el%M$eel$el %P $eel
+ <% time2str("%D",$date) %> + + Starting balance on <% time2str("%D",$date) %> + (show prior history) + <% $balance_forward %>
- <% time2str("%D",$item->{'date'}) %> - - Starting balance on <% time2str("%D",$item->{'date'}) %> - (show prior history) - <% $balance_forward %>
-- cgit v1.2.1 From 7c1d5f4ce778b4ab56301a042076e7c1dce46152 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 16 Nov 2006 06:20:38 +0000 Subject: switch birthdate to DateTime --- httemplate/view/cust_main/misc.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 414ef44a8..121c0522a 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -97,10 +97,15 @@ % if ( $conf->exists('cust_main-enable_birthdate') ) { +% eval "use DateTime;"; +% die $@ if $@; +% my $dt = DateTime->from_epoch(epoch => $cust_main->birthdate, +% time_zone=>'floating', +% ); Date of Birth - <% $cust_main->birthdate ? time2str($date_format, $cust_main->birthdate) : '' %> + <% $cust_main->birthdate ? $dt->strftime($date_format) : '' %> % } -- cgit v1.2.1 From ae3253689aba4912b7308167cad11f10ebb2658a Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 25 Nov 2006 21:04:54 +0000 Subject: chill FF wrt POSTDATA --- httemplate/view/cust_main.cgi | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 70d424065..fa3de92f0 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -136,6 +136,12 @@ Comments

[iframe not supported]

+% }else{ # make firefox happy wrt POSTDATA + + + % } % } -- cgit v1.2.1 From 88a07a3c2aac1fff33bd1f400ee5c0672ce716a0 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 26 Nov 2006 23:06:37 +0000 Subject: more ajaxy customer notes --- httemplate/view/cust_main.cgi | 2 +- httemplate/view/cust_main/notes.html | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index fa3de92f0..3c66df1a7 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -138,7 +138,7 @@ Comments % }else{ # make firefox happy wrt POSTDATA - diff --git a/httemplate/view/cust_main/notes.html b/httemplate/view/cust_main/notes.html index 75bf30e41..f10eccf57 100755 --- a/httemplate/view/cust_main/notes.html +++ b/httemplate/view/cust_main/notes.html @@ -9,8 +9,6 @@ % my $cust_main = qsearchs('cust_main', {'custnum' => $custnum} ); % die "Custimer not found!" unless $cust_main; % -% my (@notes) = $cust_main->notes(); -% if ( scalar(@notes) ) { +% my (@notes) = $cust_main->notes(); +% if ( scalar(@notes) ) { + @@ -28,7 +29,6 @@ body { background: #e8e8e8 } -%#<% include('/elements/table-grid.html') %> % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = ''; @@ -71,9 +71,7 @@ body { background: #e8e8e8 } % } #end display notes
-% } else { -
% } % %#subroutines -- cgit v1.2.1 From dbb388836b7951a3db49deda05a1ff9ba5125c17 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 30 Nov 2006 02:27:57 +0000 Subject: prepaid download/upload tracking --- httemplate/view/cust_main/packages.html | 34 ++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index f93a0764b..0a386f265 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -343,17 +343,31 @@ Current packages % foreach my $service (@{$svcpart->{services}}) { - <%svc_link($svcpart,$service)%> + <%svc_link($svcpart,$service)%> <%svc_label_link($svcpart,$service)%> -% if ( $curuser->access_right('Unprovision customer service') ) { - - ( <%svc_unprovision_link($service)%> ) - + -% } +% if ( $curuser->access_right('Recharge customer service') +% && ($svcpart->{'svcdb'} eq 'svc_acct') +% && ($service->{seconds} ne '' +% || $service->{upbytes} ne '' +% || $service->{downbytes} ne '' +% || $service->{totalbytes} ne '' ) +% ) { + ( <%svc_recharge_link($service)%> ) +% } + + + + +% if ( $curuser->access_right('Unprovision customer service') ) { + ( <%svc_unprovision_link($service)%> ) +% } + + % } % if ( ! $pkg->{'cancel'} @@ -371,7 +385,6 @@ Current packages % } - % } #end display packages @@ -440,6 +453,7 @@ Current packages % my $svc = { % 'svcnum' => $cust_svc->svcnum, % 'label' => ($cust_svc->label)[1], +% $cust_svc->svc_x->hash, % }; % % #false laziness with above, to catch extraneous services. whole @@ -516,6 +530,12 @@ Current packages % qq!'Permanently unprovision and delete this service?')">Unprovision!; %} % +%sub svc_recharge_link { +% my $svc = shift or return ''; +% +% qq!Recharge!; +%} +% %# This should be generalized to use config options to determine order. %sub pkgsort_pkgnum_cancel { % if ($a->{cancel} and $b->{cancel}) { -- cgit v1.2.1 From bc392247350c4a124c8835f18dd19154ac343e9d Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 5 Dec 2006 02:37:14 +0000 Subject: editable service usage --- httemplate/view/svc_acct.cgi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'httemplate/view') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 9c2fbc94d..7fbefa14b 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -284,6 +284,21 @@ Service #<% $svcnum %> % } +% my %ulabel = ( seconds => 'Seconds', +% upbytes => 'Upload bytes', +% downbytes => 'Download bytes', +% totalbytes => 'Total bytes', +% ); +% foreach my $uf ( keys %ulabel ) { +% my $tf = $uf . "_threshold"; +% if ( $svc_acct->$tf ne '' ) { + + <% $ulabel{$uf} %> remaining + <% $svc_acct->$uf %> + + +% } +% } % foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) { % $attribute =~ /^radius_(.*)$/; % my $pattribute = $FS::raddb::attrib{$1}; -- cgit v1.2.1 From d8c39492e9192d9c66858d21c6c69b069968eec7 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 8 Dec 2006 13:36:07 +0000 Subject: some javascript validation magic to give one-time charges better UI --- httemplate/view/cust_main/quick-charge.html | 68 ++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 7 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/quick-charge.html b/httemplate/view/cust_main/quick-charge.html index be8b9d838..06ffd75e6 100644 --- a/httemplate/view/cust_main/quick-charge.html +++ b/httemplate/view/cust_main/quick-charge.html @@ -1,19 +1,73 @@ -% -% my( $cust_main ) = @_; -% + + + -Description: +Description: -Amount: +Amount: <% include('/elements/select-taxclass.html') %> - + +<%init> + +my( $cust_main ) = @_; + + -- cgit v1.2.1 From dcdf657e77ec7b46dc69e19a849a9c133123db7c Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 14 Dec 2006 06:00:46 +0000 Subject: encryption fixes from huntsberg & jayce --- httemplate/view/cust_main/billing.html | 8 ++++++-- httemplate/view/cust_main/payment_history.html | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index d1be8936f..1f80dc5bc 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -7,7 +7,11 @@ Billing information -(Bill now) +% # If we can't see the unencrypted card, then bill now is an exercise in frustration +%if ( ! $cust_main->is_encrypted($cust_main->payinfo) ) { + (Bill now) +% } + <% ntable("#cccccc") %><% ntable("#cccccc",2) %> % %( my $balance = $cust_main->balance ) @@ -31,7 +35,7 @@ Billing information Card number - <% $cust_main->payinfo_masked %> + <% $cust_main->paymask %> % %#false laziness w/elements/select-month_year.html & edit/cust_main/billing.html diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 4f46ace6d..57d11b9e8 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -18,6 +18,7 @@ % if ( ( $payby{'CARD'} || $payby{'DCRD'} ) % && $curuser->access_right('Process payment') +% && ! $cust_main->is_encrypted($cust_main->payinfo) % ) { <% $s++ ? ' | ' : '' %> Process credit card payment @@ -25,6 +26,7 @@ % if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) % && $curuser->access_right('Process payment') +% && ! $cust_main->is_encrypted($cust_main->payinfo) % ) { <% $s++ ? ' | ' : '' %> Process electronic check (ACH) payment @@ -76,7 +78,7 @@ % % my $payinfo; % if ( $payby eq 'CARD' ) { -% $payinfo = $cust_pay->payinfo_masked; +% $payinfo = $cust_pay->paymask; % } elsif ( $payby eq 'CHEK' && $cust_pay->payinfo =~ /^(\d+)\@(\d+)$/ ) { % $payinfo = "ABA $2, Acct# $1"; % } else { -- cgit v1.2.1 From 02b9c53fb85b0a87d959e140dc30ae21cccb0902 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 15 Dec 2006 05:29:48 +0000 Subject: move use statements to handler.pl, do not show 1/1/70 for new birthdates, and improve error handling --- httemplate/view/cust_main/misc.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 121c0522a..9528db243 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -97,15 +97,13 @@ % if ( $conf->exists('cust_main-enable_birthdate') ) { -% eval "use DateTime;"; -% die $@ if $@; % my $dt = DateTime->from_epoch(epoch => $cust_main->birthdate, % time_zone=>'floating', % ); Date of Birth - <% $cust_main->birthdate ? $dt->strftime($date_format) : '' %> + <% $cust_main->birthdate ne '' ? $dt->strftime($date_format) : '' %> % } -- cgit v1.2.1 From 4a54e68baa0fe7c4171d57c3eb0e1579aa21ae77 Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 23 Dec 2006 05:37:47 +0000 Subject: inital prizm support --- httemplate/view/svc_broadband.cgi | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'httemplate/view') diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index 1800541f0..010439e90 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -33,6 +33,12 @@ % $ip_addr, % $ip_gateway, % $ip_netmask, +% $mac_addr, +% $latitude, +% $longitude, +% $altitude, +% $vlan_profile, +% $auth_key, % ) = ( % $router->getfield('routername'), % $router->getfield('routernum'), @@ -41,6 +47,12 @@ % $svc_broadband->getfield('ip_addr'), % $addr_block->ip_gateway, % $addr_block->NetAddr->mask, +% $svc_broadband->mac_addr, +% $svc_broadband->latitude, +% $svc_broadband->longitude, +% $svc_broadband->altitude, +% $svc_broadband->vlan_profile, +% $svc_broadband->auth_key, % ); % @@ -90,6 +102,30 @@ IP Gateway <%$ip_gateway%> + + MAC Address + <%$mac_addr%> + + + Latitude + <%$latitude%> + + + Longitude + <%$longitude%> + + + Altitude + <%$altitude%> + + + VLAN Profile + <%$vlan_profile%> + + + Authentication Key + <%$auth_key%> + % %foreach (sort { $a cmp $b } $svc_broadband->virtual_fields) { -- cgit v1.2.1 From da757c2af713bedd8706e30ac002658b0c97ce28 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 24 Dec 2006 01:28:38 +0000 Subject: fix more paymask regressions: allow editing records with existing expired cards, fix masking just-entered values when erroring out, fix echeck entry inserting as empty routing code and "xxEK" account number, remove old/deprecated/unused payinfo_maksed subs and calls --- httemplate/view/cust_main/payment_history.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 57d11b9e8..a23ca9ac7 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -229,7 +229,7 @@ % % my $payby = $cust_pay_void->payby; % my $payinfo = $payby eq 'CARD' -% ? $cust_pay_void->payinfo_masked +% ? $cust_pay_void->paymask % : $cust_pay_void->payinfo; % % $payby =~ s/^BILL$/Check #/ if $payinfo; @@ -365,7 +365,7 @@ % % my $payby = $cust_refund->payby; % my $payinfo = $payby eq 'CARD' -% ? $cust_refund->payinfo_masked +% ? $cust_refund->paymask % : $cust_refund->payinfo; % % $payby =~ s/^BILL$/Check #/ if $payinfo; -- cgit v1.2.1 From 14ee9d25605ce139bad4655987575508c06f7f7e Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 27 Dec 2006 01:35:59 +0000 Subject: show county on customer view --- httemplate/view/cust_main/contacts.html | 139 ++++++++++---------------------- 1 file changed, 42 insertions(+), 97 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 9c2b38f9a..51b72da9a 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -1,122 +1,47 @@ -% -% my( $cust_main ) = @_; -% my $conf = new FS::Conf; -% +% my %which = ( +% '' => 'Billing', +% 'ship_' => 'Service', +% ); +% foreach my $which ( '', 'ship_' ) { +% my $pre = $cust_main->get("${which}last") ? $which : ''; - -Billing address -<% ntable("#cccccc") %><% ntable("#cccccc",2) %> - - Contact name - - <% $cust_main->last. ', '. $cust_main->first %> - -% if ( $conf->exists('show_ss') ) { - - SS# - <% $cust_main->ss || ' ' %> -% } - - - - Company - <% $cust_main->company %> - - - Address - <% $cust_main->address1 %> - -% if ( $cust_main->address2 ) { - - -   - <% $cust_main->address2 %> - -% } - - - City - <% $cust_main->city %> - State - <% state_label($cust_main->state, $cust_main->country) %> - Zip - <% $cust_main->zip %> - - - Country - <% code2country($cust_main->country) %> - -% -% my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ -% ? 'Day Phone' -% : FS::Msgcat::_gettext('daytime'); -% my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/ -% ? 'Night Phone' -% : FS::Msgcat::_gettext('night'); -% - - - <% $daytime_label %> - - <% include('/elements/phonenumber.html', - $cust_main->daytime, - 'callable'=>1 - ) - %> - - - - <% $night_label %> - - <% include('/elements/phonenumber.html', - $cust_main->night, - 'callable'=>1 - ) - %> - - - - Fax - - <% $cust_main->fax || ' ' %> - - - -% if ( defined $cust_main->dbdef_table->column('ship_last') ) { -% my $pre = $cust_main->ship_last ? 'ship_' : ''; -% - - -
-Service address +<% $which{$which} %> address <% ntable("#cccccc") %><% ntable("#cccccc",2) %> Contact name <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") %> +% if ( $which eq '' && $conf->exists('show_ss') ) { + SS# + <% $cust_main->ss || ' ' %> +% } Company - <% $cust_main->get("${pre}company") %> + <% $cust_main->get("${pre}company") %> Address - <% $cust_main->get("${pre}address1") %> + <% $cust_main->get("${pre}address1") %> % if ( $cust_main->get("${pre}address2") ) {   - <% $cust_main->get("${pre}address2") %> + <% $cust_main->get("${pre}address2") %> % } City <% $cust_main->get("${pre}city") %> +% if ( $cust_main->county ) { + County + <% $cust_main->county %> +% } State - <% $cust_main->get("${pre}state") %> + <% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) %> Zip <% $cust_main->get("${pre}zip") %> @@ -126,7 +51,7 @@ Service address <% $daytime_label %> - + <% include('/elements/phonenumber.html', $cust_main->get("${pre}daytime"), 'callable'=>1 @@ -136,7 +61,7 @@ Service address <% $night_label %> - + <% include('/elements/phonenumber.html', $cust_main->get("${pre}night"), 'callable'=>1 @@ -146,10 +71,30 @@ Service address Fax - + <% $cust_main->get("${pre}fax") || ' ' %> +% if ( $which ne 'ship_' ) { +
+% } % } +<%once> + +my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ + ? 'Day Phone' + : FS::Msgcat::_gettext('daytime'); +my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/ + ? 'Night Phone' + : FS::Msgcat::_gettext('night'); + + +<%init> + +my( $cust_main ) = @_; +my $conf = new FS::Conf; + + + -- cgit v1.2.1 From 633c48448d9468690b7ad77eb6ff7c660a286658 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 29 Dec 2006 08:51:34 +0000 Subject: service refactor! --- httemplate/view/cust_main/packages.html | 367 +++++++++++++------------------ httemplate/view/elements/svc_Common.html | 18 +- 2 files changed, 162 insertions(+), 223 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 0a386f265..841605028 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -1,11 +1,9 @@ -% % my( $cust_main ) = @_; % my $conf = new FS::Conf; % % my $curuser = $FS::CurrentUser::CurrentUser; % % my $packages = get_packages($cust_main, $conf); -% Packages @@ -58,44 +56,42 @@ Current packages % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = ''; -% - Package Status Services + +%foreach my $cust_pkg (@$packages) { % -%foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { +% my $part_pkg = $cust_pkg->part_pkg; % % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; % } else { % $bgcolor = $bgcolor1; % } -% -% - + - <%$pkg->{pkgnum}%>: - <%$pkg->{pkg}%> - <%$pkg->{comment}%>
+ <% $cust_pkg->pkgnum %>: + <% $part_pkg->pkg %> - <% $part_pkg->comment %>
-% unless ( $pkg->{cancel} ) { +% unless ( $cust_pkg->get('cancel') ) { % if ( $curuser->access_right('Change customer package') ) { - ( <%pkg_change_link($pkg)%> ) + ( <%pkg_change_link($cust_pkg)%> ) % } % if ( $curuser->access_right('Edit customer package dates') ) { - ( <%pkg_dates_link($pkg)%> ) + ( <%pkg_dates_link($cust_pkg)%> ) % } % if ( $curuser->access_right('Customize customer package') ) { - ( <%pkg_customize_link($pkg,$cust_main->custnum)%> ) + ( <%pkg_customize_link($cust_pkg,$cust_main->custnum)%> ) % } % } @@ -118,7 +114,7 @@ Current packages % % #false laziness w/edit/REAL_cust_pkg.cgi % my( $billed_or_prepaid, $last_bill_or_renewed, $next_bill_or_prepaid_until ); -% unless ( $pkg->{'part_pkg'}->is_prepaid ) { +% unless ( $part_pkg->is_prepaid ) { % $billed_or_prepaid = 'billed'; % $last_bill_or_renewed = 'Last bill'; % $next_bill_or_prepaid_until = 'Next bill'; @@ -129,19 +125,19 @@ Current packages % } % % -% if ( $pkg->{cancel} ) { +% if ( $cust_pkg->get('cancel') ) { Cancelled  - <% pkg_datestr($pkg,'cancel',$conf) %> + <% pkg_datestr($cust_pkg, 'cancel', $conf) %> - <% $pkg->{reason} %> + <% $cust_pkg->last_reason ? $cust_pkg->last_reason->reason : '' %> -% unless ( $pkg->{setup} ) { +% unless ( $cust_pkg->get('setup') ) { @@ -152,37 +148,37 @@ Current packages Setup  - <% pkg_datestr($pkg, 'setup',$conf) %> + <% pkg_datestr($cust_pkg, 'setup', $conf) %> -% if ( $pkg->{'last_bill'} ) { +% if ( $cust_pkg->get('last_bill') ) { <% $last_bill_or_renewed %>  - <% pkg_datestr($pkg, 'last_bill',$conf) %> + <% pkg_datestr($cust_pkg, 'last_bill',$conf) %> % } -% if ( $pkg->{'susp'} ) { +% if ( $cust_pkg->get('susp') ) { Suspended  - <% pkg_datestr($pkg, 'susp',$conf) %> + <% pkg_datestr($cust_pkg, 'susp', $conf) %> % } % } % } else { -% if ( $pkg->{susp} ) { +% if ( $cust_pkg->get('susp') ) { Suspended  - <% pkg_datestr($pkg,'susp',$conf) %> + <% pkg_datestr($cust_pkg, 'susp', $conf) %> - <% $pkg->{reason} %> + <% $cust_pkg->last_reason ? $cust_pkg->last_reason->reason : '' %> -% unless ( $pkg->{setup} ) { +% unless ( $cust_pkg->get('setup') ) { @@ -193,24 +189,24 @@ Current packages Setup  - <% pkg_datestr($pkg, 'setup',$conf) %> + <% pkg_datestr($cust_pkg, 'setup', $conf) %> % } -% if ( $pkg->{'last_bill'} ) { +% if ( $cust_pkg->get('last_bill') ) { <% $last_bill_or_renewed %>  - <% pkg_datestr($pkg, 'last_bill',$conf) %> + <% pkg_datestr($cust_pkg, 'last_bill', $conf) %> % } -% if ( $pkg->{'expire'} ) { +% if ( $cust_pkg->get('expire') ) { Expires  - <% pkg_datestr($pkg, 'expire',$conf) %> + <% pkg_datestr($cust_pkg, 'expire', $conf) %> % } @@ -220,11 +216,11 @@ Current packages % if ( $curuser->access_right('Unsuspend customer package') ) { - ( <% pkg_unsuspend_link($pkg) %> ) + ( <% pkg_unsuspend_link($cust_pkg) %> ) % } % if ( $curuser->access_right('Cancel customer package') ) { - ( <% pkg_cancel_link($pkg) %> ) + ( <% pkg_cancel_link($cust_pkg) %> ) % } @@ -232,9 +228,9 @@ Current packages % } else { -% unless ( $pkg->{setup} ) { +% unless ( $cust_pkg->get('setup') ) { -% unless ( $pkg->{'freq'} ) { +% unless ( $part_pkg->freq ) { @@ -246,7 +242,7 @@ Current packages % if ( $curuser->access_right('Cancel customer package immediately') ) { - ( <% pkg_cancel_link($pkg) %> ) + ( <% pkg_cancel_link($cust_pkg) %> ) % } @@ -256,12 +252,12 @@ Current packages - >Not yet billed (<% $billed_or_prepaid %> <% myfreq($pkg->{part_pkg}) %>) + >Not yet billed (<% $billed_or_prepaid %> <% myfreq($part_pkg) %>) % } % } else { -% unless ( $pkg->{freq} ) { +% unless ( $part_pkg->freq ) { @@ -270,58 +266,58 @@ Current packages Billed  - <% pkg_datestr($pkg,'setup',$conf) %> + <% pkg_datestr($cust_pkg, 'setup', $conf) %> % } else { - >Active, <% $billed_or_prepaid %> <% myfreq($pkg->{part_pkg}) %> + >Active, <% $billed_or_prepaid %> <% myfreq($part_pkg) %> Setup  - <% pkg_datestr($pkg, 'setup',$conf) %> + <% pkg_datestr($cust_pkg, 'setup', $conf) %> % } % } -% if ( $pkg->{'last_bill'} ) { +% if ( $cust_pkg->get('last_bill') ) { <% $last_bill_or_renewed %>  - <% pkg_datestr($pkg, 'last_bill',$conf) %> + <% pkg_datestr($cust_pkg, 'last_bill', $conf) %> % } -% if ( $pkg->{'next_bill'} ) { +% if ( $cust_pkg->get('bill') ) { #next bill <% $next_bill_or_prepaid_until %>  - <% pkg_datestr($pkg, 'next_bill',$conf) %> + <% pkg_datestr($cust_pkg, 'bill', $conf) %> % } -% if ( $pkg->{'expire'} ) { +% if ( $cust_pkg->get('expire') ) { Expires  - <% pkg_datestr($pkg, 'expire',$conf) %> + <% pkg_datestr($cust_pkg, 'expire', $conf) %> % } -% if ( $pkg->{freq} ) { +% if ( $part_pkg->freq ) { > % if ( $curuser->access_right('Suspend customer package') ) { - ( <% pkg_suspend_link($pkg) %> ) + ( <% pkg_suspend_link($cust_pkg) %> ) % } % if ( $curuser->access_right('Cancel customer package immediately') ) { - ( <% pkg_cancel_link($pkg) %> ) + ( <% pkg_cancel_link($cust_pkg) %> ) % } % if ( $curuser->access_right('Cancel customer package later') ) { - ( <% pkg_expire_link($pkg) %> ) + ( <% pkg_expire_link($cust_pkg) %> ) % } @@ -338,46 +334,49 @@ Current packages -% foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { +% #foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { +% foreach my $part_svc ( $cust_pkg->part_svc ) { -% foreach my $service (@{$svcpart->{services}}) { +% #foreach my $service (@{$svcpart->{services}}) { +% foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) { - - + + - - + % } -% if ( ! $pkg->{'cancel'} +% if ( ! $cust_pkg->get('cancel') % && $curuser->access_right('Provision customer service') -% && $svcpart->{count} < $svcpart->{quantity} +% && $part_svc->num_avail % ) { @@ -414,104 +413,33 @@ Current packages % } else { % $method = 'all_pkgs'; % } -% -% foreach my $cust_pkg ( $cust_main->$method() ) { -% -% my $part_pkg = $cust_pkg->part_pkg; -% -% my %pkg = (); -% -% #to get back to the original object... should use it in the first place!! -% $pkg{cust_pkg} = $cust_pkg; -% $pkg{part_pkg} = $part_pkg; -% -% $pkg{pkgnum} = $cust_pkg->pkgnum; -% $pkg{pkg} = $part_pkg->pkg; -% $pkg{pkgpart} = $part_pkg->pkgpart; -% $pkg{comment} = $part_pkg->getfield('comment'); -% $pkg{freq} = $part_pkg->freq; -% $pkg{setup} = $cust_pkg->getfield('setup'); -% $pkg{last_bill} = $cust_pkg->getfield('last_bill'); -% $pkg{next_bill} = $cust_pkg->getfield('bill'); -% $pkg{susp} = $cust_pkg->getfield('susp'); -% $pkg{expire} = $cust_pkg->getfield('expire'); -% $pkg{cancel} = $cust_pkg->getfield('cancel'); -% $pkg{reason} = $cust_pkg->last_reason->reason if $cust_pkg->last_reason; -% -% -% my %svcparts = map { -% $_->svcpart => { -% $_->part_svc->hash, -% 'quantity' => $_->quantity, -% 'count' => $cust_pkg->num_cust_svc($_->svcpart), -% #'services' => [], -% }; -% } $part_pkg->pkg_svc; -% -% foreach my $cust_svc ( $cust_pkg->cust_svc ) { -% #warn "svcnum ". $cust_svc->svcnum. " / svcpart ". $cust_svc->svcpart. "\n"; -% my $svc = { -% 'svcnum' => $cust_svc->svcnum, -% 'label' => ($cust_svc->label)[1], -% $cust_svc->svc_x->hash, -% }; -% -% #false laziness with above, to catch extraneous services. whole -% #damn thing should be OO... -% my $svcpart = ( $svcparts{$cust_svc->svcpart} ||= { -% $cust_svc->part_svc->hash, -% 'quantity' => 0, -% 'count' => $cust_pkg->num_cust_svc($cust_svc->svcpart), -% #'services' => [], -% } ); -% -% push @{$svcpart->{services}}, $svc; -% -% } -% -% $pkg{svcparts} = [ values %svcparts ]; -% -% push @packages, \%pkg; -% -% } -% -% return \@packages; % +% [ $cust_main->$method() ]; %} -% -%sub svc_link { -% -% my ($svcpart, $svc) = (shift,shift) or return ''; -% return qq!$svcpart->{svc}!; -% -%} -% -%sub svc_label_link { -% -% my ($svcpart, $svc) = (shift,shift) or return ''; -% return qq!$svc->{label}!; -% -%} -% +% %sub svc_provision_link { -% my ($pkg, $svcpart, $conf, $curuser) = @_; -% ( my $svc_nbsp = $svcpart->{svc} ) =~ s/\s+/ /g; -% my $num_left = $svcpart->{quantity} - $svcpart->{count}; -% my $pkgnum_svcpart = "pkgnum$pkg->{pkgnum}-svcpart$svcpart->{svcpart}"; -% +% my ($cust_pkg, $part_svc, $conf, $curuser) = @_; +% ( my $svc_nbsp = $part_svc->svc ) =~ s/\s+/ /g; +% my $num_avail = $part_svc->num_avail; +% my $pkgnum_svcpart = "pkgnum=". $cust_pkg->pkgnum. ';'. +% "svcpart=". $part_svc->svcpart; % my $url; -% if ( $svcpart->{svcdb} eq 'svc_external' +% if ( $part_svc->svcdb eq 'svc_external' #could be generalized % && $conf->exists('svc_external-skip_manual') % ) { -% $url = "${p}edit/process/$svcpart->{svcdb}.cgi?". -% "pkgnum=$pkg->{pkgnum}&". -% "svcpart=$svcpart->{svcpart}"; +% $url = "${p}edit/process/". $part_svc->svcdb. ".cgi?$pkgnum_svcpart"; % } else { -% $url = "${p}edit/$svcpart->{svcdb}.cgi?$pkgnum_svcpart"; +% $url = FS::UI::Web::svc_url( +% 'm' => $m, +% 'action' => 'edit', +% 'part_svc' => $part_svc, +% 'query' => $pkgnum_svcpart, +% ); +% #$url = "${p}edit/$svcpart->{svcdb}.cgi?$pkgnum_svcpart"; % } % % my $link = qq!!. -% "Provision $svc_nbsp ($num_left)"; +% "Provision $svc_nbsp ($num_avail)"; % if ( $conf->exists('legacy_link') % && $curuser->access_right('View/link unlinked services') % ) @@ -519,39 +447,20 @@ Current packages % $link .= '
'. % qq!!. -% "Link to legacy $svc_nbsp ($num_left)"; +% "Link to legacy $svc_nbsp ($num_avail)"; % } % $link; %} % %sub svc_unprovision_link { -% my $svc = shift or return ''; -% qq!Unprovision!; -%} -% -%sub svc_recharge_link { -% my $svc = shift or return ''; -% -% qq!Recharge!; -%} -% -%# This should be generalized to use config options to determine order. -%sub pkgsort_pkgnum_cancel { -% if ($a->{cancel} and $b->{cancel}) { -% return ($a->{pkgnum} <=> $b->{pkgnum}); -% } elsif ($a->{cancel} or $b->{cancel}) { -% return (-1) if ($b->{cancel}); -% return (1) if ($a->{cancel}); -% return (0); -% } else { -% return($a->{pkgnum} <=> $b->{pkgnum}); -% } +% my $cust_svc = shift or return ''; +% qq!Unprovision!; %} % %sub pkg_datestr { -% my($pkg, $field, $conf) = @_ or return ''; -% return ' ' unless $pkg->{$field}; +% my($cust_pkg, $field, $conf) = @_ or return ''; +% return ' ' unless $cust_pkg->get($field); % my $format = ''. % ''. % ''; @@ -561,48 +470,68 @@ Current packages % ''. % '' % if $conf->exists('cust_pkg-display_times'); -% ( my $strip = time2str($format, $pkg->{$field}) ) =~ s/ (\d)/$1/g; +% my $strip = time2str($format, $cust_pkg->get($field) ); +% $strip =~ s/ (\d)/$1/g; % $strip; %} % -%sub pkg_change_link { -% my $pkg = shift or return ''; -% return qq!!. -% qq!Change package!; +%sub pkg_change_link { pkg_link('misc/change_pkg', 'Change package', @_ ); } +%sub pkg_suspend_link { pkg_link('misc/susp_pkg', 'Suspend', @_ ); } +%sub pkg_unsuspend_link { pkg_link('misc/unsusp_pkg', 'Unsuspend', @_ ); } +%sub pkg_expire_link { pkg_link('misc/expire_pkg', 'Cancel later', @_ ); } +%sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', 'Edit dates', @_ ); } +% +%sub pkg_cancel_link { pkg_popup_link( 'misc/cancel_pkg.html?method=cancel', +% 'Cancel now', +% 'Cancel', +% @_ +% ); +% } +%sub pkg_expire_link { pkg_popup_link( 'misc/cancel_pkg.html?method=expire', +% 'Cancel later', +% 'Expire', #"Cancel package $num later" +% @_ +% ); +% } +% +%sub svc_recharge_link { svc_popup_link( 'misc/recharge_svc.html', +% 'Recharge', +% 'Recharge', +% @_ +% ); +% } +% +%sub pkg_link { +% my($action, $label, $cust_pkg) = @_; +% return '' unless $cust_pkg; +% qq!$label!; %} % -%sub pkg_suspend_link { -% my $pkg = shift or return ''; -% qq!Suspend!; +%sub pkg_popup_link { +% my($action, $label, $actionlabel, $cust_pkg) = @_; +% $action .= '&pkgnum='. $cust_pkg->pkgnum; +% $actionlabel .= ' package '. $cust_pkg->pkgnum; +% popup_link($action, $label, $actionlabel); %} % -%sub pkg_unsuspend_link { -% my $pkg = shift or return ''; -% return qq!Unsuspend!; +%sub svc_popup_link { +% my($action, $label, $actionlabel, $cust_svc) = @_; +% $action .= '?svcnum='. $cust_svc->svcnum; +% $actionlabel .= ' service '. $cust_svc->svcnum; +% popup_link($action, $label, $actionlabel); %} % -%sub pkg_cancel_link { -% my $pkg = shift or return ''; -% -% qq!Cancel now!; -%} -% -%sub pkg_expire_link { -% my $pkg = shift or return ''; -% qq!Cancel later!; -%} -% -%sub pkg_dates_link { -% my $pkg = shift or return ''; -% qq!Edit dates!; +%sub popup_link { +% my($action, $label, $actionlabel) = @_; +% qq!$label!; %} % %sub pkg_customize_link { -% my $pkg = shift or return ''; -% my $custnum = shift; -% qq!Customize!; +% my $cust_pkg = shift or return ''; +% my $custnum = $cust_pkg->custnum; +% qq!Customize!; %} -% -% - diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 35434632e..7b8df3a74 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -12,6 +12,9 @@ % # if not specified all columns (except for the primary key) will be viewable % # 'fields' => [ % # ] +% # +% # # defaults to "edit/$table.cgi?", will have svcnum appended +% # 'edit_url' => % % my(%opt) = @_; % @@ -21,9 +24,15 @@ % #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ]; % || [ grep { $_ ne 'svcnum' } fields($table) ]; % -% my($query) = $cgi->keywords; -% $query =~ /^(\d+)$/; -% my $svcnum = $1; +% my $svcnum; +% if ( $cgi->param('svcnum') ) { +% $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum"; +% $svcnum = $1; +% } else { +% my($query) = $cgi->keywords; +% $query =~ /^(\d+)$/ or die "no svcnum"; +% $svcnum = $1; +% } % my $svc_x = qsearchs( $opt{'table'}, { 'svcnum' => $svcnum } ) % or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n"; % @@ -69,7 +78,8 @@ Service #<% $svcnum %> -| Edit this <% $label %> +% my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?'; +| Edit this <% $label %>
<% ntable("#cccccc") %> -% if ( $cust_main->county ) { +% if ( $cust_main->get("${pre}county" ) { - + % } -- cgit v1.2.1 From 7861a60dd0b96ebd171e6f77f3a70a6f4aea0344 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 10 Jan 2007 08:48:43 +0000 Subject: nothing could have ever gone wrong with so simple a change. oh noooo --- httemplate/view/cust_main/contacts.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index a764b4541..8f8a9eb42 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -36,7 +36,7 @@ -% if ( $cust_main->get("${pre}county" ) { +% if ( $cust_main->get("${pre}county" ) ) { % } -- cgit v1.2.1 From 5dcbdb568e7aadabf49b8821a7d50f508a675a7d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 10 Jan 2007 08:50:14 +0000 Subject: you have got to be kidding me. --- httemplate/view/cust_main/contacts.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 8f8a9eb42..3b86533a6 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -38,7 +38,7 @@ % if ( $cust_main->get("${pre}county" ) ) { - + % } -- cgit v1.2.1 From 2a863bbb144830dfb8fca4afb3af76a84a647c76 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 12 Jan 2007 02:04:50 +0000 Subject: one-time charge enhancements --- httemplate/view/cust_main/packages.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 37f3ec4bb..6ec92ef0d 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -16,7 +16,8 @@ % ) { % - <% include('quick-charge.html', $cust_main ) %> + <% popup_link('edit/quick-charge.html?custnum='. $cust_main->custnum, 'One-time charge', 'One-time charge', 684) %> +
% } % if ( $curuser->access_right('Bulk change customer packages') ) { @@ -518,19 +519,19 @@ Current packages % my($action, $label, $actionlabel, $cust_pkg) = @_; % $action .= '&pkgnum='. $cust_pkg->pkgnum; % $actionlabel .= ' package '. $cust_pkg->pkgnum; -% popup_link($action, $label, $actionlabel); +% popup_link($action, $label, $actionlabel, 392); %} % %sub svc_popup_link { % my($action, $label, $actionlabel, $cust_svc) = @_; % $action .= '?svcnum='. $cust_svc->svcnum; % $actionlabel .= ' service '. $cust_svc->svcnum; -% popup_link($action, $label, $actionlabel); +% popup_link($action, $label, $actionlabel, 392); %} % %sub popup_link { -% my($action, $label, $actionlabel) = @_; -% qq!$label!; +% my($action, $label, $actionlabel, $width) = @_; +% qq!$label!; %} % %sub pkg_customize_link { -- cgit v1.2.1 From 52dbc041b5ba187cc2a503e5ad2d800b1a2e5a1f Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 12 Jan 2007 23:27:09 +0000 Subject: added svc_broadband description which is appended to Site Name in prizm export --- httemplate/view/svc_broadband.cgi | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'httemplate/view') diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index 010439e90..cfece5cb4 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -39,6 +39,7 @@ % $altitude, % $vlan_profile, % $auth_key, +% $description, % ) = ( % $router->getfield('routername'), % $router->getfield('routernum'), @@ -53,6 +54,7 @@ % $svc_broadband->altitude, % $svc_broadband->vlan_profile, % $svc_broadband->auth_key, +% $svc_broadband->description, % ); % @@ -78,6 +80,10 @@
+ + + + -- cgit v1.2.1 From dea2573bee84deb5e22196dda7580edaf0c27a42 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 17 Jan 2007 15:50:20 +0000 Subject: fix suspend link --- httemplate/view/cust_main/packages.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 6ec92ef0d..d8071e63a 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -478,7 +478,7 @@ Current packages % %sub pkg_change_link { pkg_link('misc/change_pkg', 'Change package', @_ ); } % -%sub pkg_suspend_link { pkg_popup_link( 'misc/cancel_pkg/html?method=suspend', +%sub pkg_suspend_link { pkg_popup_link( 'misc/cancel_pkg.html?method=suspend', % 'Suspend', % 'Suspend', % @_ -- cgit v1.2.1 From be10e7a1421c13eec4b1bb3676eaf5c84344e601 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 17 Jan 2007 23:27:18 +0000 Subject: link to customer from manual payment screen (ticket 1414) --- httemplate/view/elements/svc_Common.html | 7 +++---- httemplate/view/svc_acct.cgi | 8 +++----- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 7b8df3a74..92eef2dad 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -54,11 +54,10 @@ % if ( $custnum ) { - <% include("/elements/header.html","View $label: $value", menubar( - "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - )) %> + <% include("/elements/header.html","View $label: $value") %> - <% include( '/elements/small_custview.html', $custnum, '', 1 ) %> + <% include( '/elements/small_custview.html', $custnum, '', 1, + "${p}view/cust_main.cgi") %>
% } else { diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 7fbefa14b..2bacbcaff 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -37,12 +37,10 @@ % if ( $custnum ) { - <% include("/elements/header.html","View $svc account", menubar( - "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - "Main menu" => $p, - )) %> + <% include("/elements/header.html","View $svc account") %> - <% include( '/elements/small_custview.html', $custnum, '', 1 ) %> + <% include( '/elements/small_custview.html', $custnum, '', 1, + "${p}view/cust_main.cgi") %>
% } else { -- cgit v1.2.1 From 0c81ee14be99875c8f9f9e34a442a23543333611 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 22 Jan 2007 11:39:46 +0000 Subject: fix elements/ links here too --- httemplate/view/cust_main.cgi | 8 ++++---- httemplate/view/cust_main/notes.html | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 3c66df1a7..101fe2cff 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -22,10 +22,10 @@ - - - - + + + + - - - + + + +
<%svc_link($svcpart,$service)%><%svc_label_link($svcpart,$service)%><% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %><% FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc) %>
- -% if ( $curuser->access_right('Recharge customer service') -% && ($svcpart->{'svcdb'} eq 'svc_acct') -% && ($service->{seconds} ne '' -% || $service->{upbytes} ne '' -% || $service->{downbytes} ne '' -% || $service->{totalbytes} ne '' ) +
+ +% if ( $curuser->access_right('Recharge customer service') +% && $cust_svc->svcdb eq 'svc_acct' +% && ( $cust_svc->svc_x->seconds ne '' +% || $cust_svc->svc_x->upbytes ne '' +% || $cust_svc->svc_x->downbytes ne '' +% || $cust_svc->svc_x->totalbytes ne '' +% ) % ) { - ( <%svc_recharge_link($service)%> ) -% } + ( <%svc_recharge_link($cust_svc)%> ) +% } -% if ( $curuser->access_right('Unprovision customer service') ) { - ( <%svc_unprovision_link($service)%> ) -% } +% if ( $curuser->access_right('Unprovision customer service') ) { + ( <%svc_unprovision_link($cust_svc)%> ) +% }
- <% svc_provision_link($pkg, $svcpart, $conf, $curuser) %> + <% svc_provision_link($cust_pkg, $part_svc, $conf, $curuser) %>
%b %o, %Y%M %P
<% ntable("#cccccc",2) %> -- cgit v1.2.1 From ffcad49ae9b3b54094f8282bec67759399b57c95 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 2 Jan 2007 20:25:59 +0000 Subject: missing from svc patch, oops! --- httemplate/view/svc_Common.html | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 httemplate/view/svc_Common.html (limited to 'httemplate/view') diff --git a/httemplate/view/svc_Common.html b/httemplate/view/svc_Common.html new file mode 100644 index 000000000..bb3a6dd33 --- /dev/null +++ b/httemplate/view/svc_Common.html @@ -0,0 +1,29 @@ +<%init> + +# false laziness w/edit/svc_Common.html + +$cgi->param('svcdb') =~ /^(svc_\w+)$/ or die "unparsable svcdb"; +my $table = $1; +require "FS/$table.pm"; + +my %opt; +if ( UNIVERSAL::can("FS::$table", 'table_info') ) { + $opt{'name'} = "FS::$table"->table_info->{'name'}; + + my $fields = "FS::$table"->table_info->{'fields'}; + my %labels = map { $_ => ( ref($fields->{$_}) + ? $fields->{$_}{'label'} + : $fields->{$_} + ); + } + keys %$fields; + $opt{'labels'} = \%labels; +} + + +<% include('elements/svc_Common.html', + 'table' => $table, + 'edit_url' => $p."edit/svc_Common.html?svcdb=$table;svcnum=", + %opt, + ) +%> -- cgit v1.2.1 From 932fec53db68a930566e01b55cef887a4700d019 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 2 Jan 2007 20:29:43 +0000 Subject: fix popup target links --- httemplate/view/cust_main/packages.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 841605028..5a9f47d9c 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -504,7 +504,7 @@ Current packages %sub pkg_link { % my($action, $label, $cust_pkg) = @_; % return '' unless $cust_pkg; -% qq!$label!; +% qq!$label!; %} % %sub pkg_popup_link { -- cgit v1.2.1 From d03713862ac9f098841dca79df26da544ae062db Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 3 Jan 2007 19:47:53 +0000 Subject: fix suspend link --- httemplate/view/cust_main/packages.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 5a9f47d9c..37f3ec4bb 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -476,7 +476,14 @@ Current packages %} % %sub pkg_change_link { pkg_link('misc/change_pkg', 'Change package', @_ ); } -%sub pkg_suspend_link { pkg_link('misc/susp_pkg', 'Suspend', @_ ); } +% +%sub pkg_suspend_link { pkg_popup_link( 'misc/cancel_pkg/html?method=suspend', +% 'Suspend', +% 'Suspend', +% @_ +% ); +% } +% %sub pkg_unsuspend_link { pkg_link('misc/unsusp_pkg', 'Unsuspend', @_ ); } %sub pkg_expire_link { pkg_link('misc/expire_pkg', 'Cancel later', @_ ); } %sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', 'Edit dates', @_ ); } -- cgit v1.2.1 From b89c7f126690704c8d1558dba06d5fabd7470528 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 8 Jan 2007 17:36:53 +0000 Subject: refund deletion --- httemplate/view/cust_main/payment_history.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index a23ca9ac7..43c55e8c9 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -372,9 +372,23 @@ % $payby =~ s/^CHEK$/Electronic check /; % $payby =~ s/^(CARD|COMP)$/$1 /; % +% my $delete = ''; +% if ( $cust_refund->closed !~ /^Y/i +% && $conf->exists('deleterefunds') +% && $curuser->access_right('Delete refund') +% ) +% { +% $delete = qq! (delete)!; +% } +% % push @history, { % 'date' => $cust_refund->_date, -% 'desc' => "Refund ($payby$payinfo) by ". $cust_refund->otaker, +% 'desc' => "Refund ($payby$payinfo) by ". $cust_refund->otaker. "
". +% $delete, % 'refund' => $cust_refund->refund, % }; % -- cgit v1.2.1 From 6c28b9f6445e9ca8f3f84aaf8f3e61be47c15515 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 10 Jan 2007 07:48:19 +0000 Subject: fix ship_county display bug --- httemplate/view/cust_main/contacts.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 51b72da9a..a764b4541 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -36,9 +36,9 @@
City <% $cust_main->get("${pre}city") %>County<% $cust_main->county %><% $cust_main->get->("${pre}county") %>State <% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) %>
City <% $cust_main->get("${pre}city") %>County <% $cust_main->get->("${pre}county") %><% $cust_main->get("${pre}city") %>County<% $cust_main->get->("${pre}county") %><% $cust_main->get("${pre}county") %>State <% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) %>Service number <%$svcnum%>
Description<%$description%>
Router <%$routernum%>: <%$routername%>
-- cgit v1.2.1 From d15c3f4bcdeaf94b1a286691ec670d7c32dbd3d3 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 22 Jan 2007 11:41:02 +0000 Subject: closing tags helps alot --- httemplate/view/cust_main.cgi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 101fe2cff..20e8201e6 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -22,10 +22,10 @@ - - - - + + + + + % my @records; if ( @records = $svc_domain->domain_record ) { - <% ntable("",2) %> - + <% include('/elements/table-grid.html') %> + +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = $bgcolor2; + + + + + + + % foreach my $domain_record ( @records ) { % my $type = $domain_record->rectype eq '_mstr' % ? "(slave)" % : $domain_record->recaf. ' '. $domain_record->rectype; -% - - - + + + + + + +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } - % }
ZoneTypeData
ZoneTypeData
<% $domain_record->reczone %><% $type %><% $domain_record->recdata %> -% unless ( $domain_record->rectype eq 'SOA' ) { +
<% $domain_record->reczone %><% $type %><% $domain_record->recdata %> +% unless ( $domain_record->rectype eq 'SOA' ) { (delete) % } +
-- cgit v1.2.1 From 89cb729e71c400307f47eef8e9e0b295db2dfca0 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 31 Jan 2007 04:26:44 +0000 Subject: minor UI work on one-time charges w/taxclasses --- httemplate/view/cust_main/packages.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index d8071e63a..9c58f13f0 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -16,7 +16,7 @@ % ) { % - <% popup_link('edit/quick-charge.html?custnum='. $cust_main->custnum, 'One-time charge', 'One-time charge', 684) %> + <% popup_link('edit/quick-charge.html?custnum='. $cust_main->custnum, 'One-time charge', 'One-time charge', 545) %>
% } % if ( $curuser->access_right('Bulk change customer packages') ) { -- cgit v1.2.1 From 7ba67eedde17e00f1a8e753790d3386a81cc759a Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 1 Feb 2007 03:08:39 +0000 Subject: oops. perhaps it should --- httemplate/view/cust_main/packages.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 9c58f13f0..3e4332d71 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -350,7 +350,7 @@ Current packages % if ( $curuser->access_right('Recharge customer service') -% && $cust_svc->svcdb eq 'svc_acct' +% && $part_svc->svcdb eq 'svc_acct' % && ( $cust_svc->svc_x->seconds ne '' % || $cust_svc->svc_x->upbytes ne '' % || $cust_svc->svc_x->downbytes ne '' -- cgit v1.2.1 From 5d9a5e54a74950b0e62264abcd53e77607f04b48 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 4 Feb 2007 01:47:51 +0000 Subject: add link to some batched payment info to customer view --- httemplate/view/cust_main/payment_history.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 43c55e8c9..b2d98cc55 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -49,6 +49,17 @@
% } +% if ( $conf->exists('batch-enable') +% #&& $curuser->access_right('View customer tax exemptions') +% ) { + View batched payments: +% foreach my $status (qw( Queued In-transit Complete All )) { + <% $status %> + <% $status ne 'All' ? '|' : '' %> +% } +
+% } + %#get payment history %my @history = (); % @@ -584,4 +595,11 @@ my @payby = grep /\w/, $conf->config('payby'); unless @payby; my %payby = map { $_=>1 } @payby; +my %status = ( + 'Queued' => 'O', #Open + 'In-transit' => 'I', + 'Complete' => 'R', #Resolved + 'All' => '', +); + -- cgit v1.2.1 From 17856ff5c299e4db21da28116f2666655c03f2c7 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Feb 2007 12:51:05 +0000 Subject: C is for Cookie^WControl --- httemplate/view/cust_bill-logo.cgi | 34 ++++--- httemplate/view/cust_bill-pdf.cgi | 44 ++++---- httemplate/view/cust_bill-ps.cgi | 36 ++++--- httemplate/view/cust_bill.cgi | 68 +++++++------ httemplate/view/cust_main.cgi | 46 +++++---- httemplate/view/cust_main/contacts.html | 2 +- httemplate/view/cust_pkg.cgi | 166 ------------------------------- httemplate/view/elements/svc_Common.html | 84 +++++++++------- httemplate/view/svc_Common.html | 12 +-- httemplate/view/svc_acct.cgi | 94 +++++++++-------- httemplate/view/svc_broadband.cgi | 134 +++++++++++++------------ httemplate/view/svc_domain.cgi | 82 ++++++++------- httemplate/view/svc_external.cgi | 65 ++++++------ httemplate/view/svc_forward.cgi | 15 ++- httemplate/view/svc_www.cgi | 16 ++- 15 files changed, 419 insertions(+), 479 deletions(-) delete mode 100755 httemplate/view/cust_pkg.cgi (limited to 'httemplate/view') diff --git a/httemplate/view/cust_bill-logo.cgi b/httemplate/view/cust_bill-logo.cgi index fd6a81a75..e2f810c3f 100755 --- a/httemplate/view/cust_bill-logo.cgi +++ b/httemplate/view/cust_bill-logo.cgi @@ -1,16 +1,20 @@ -% -% -%my $conf = new FS::Conf; -% -%my($query) = $cgi->keywords; -%$query =~ /^([^\.\/]*)$/; -%my $templatename = $1; -%if ( $templatename && $conf->exists("logo_$templatename.png") ) { -% $templatename = "_$templatename"; -%} else { -% $templatename = ''; -%} -% -%http_header('Content-Type' => 'image/png' ); -% <% $conf->config_binary("logo$templatename.png") %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); + +my $conf = new FS::Conf; + +my($query) = $cgi->keywords; +$query =~ /^([^\.\/]*)$/; +my $templatename = $1; +if ( $templatename && $conf->exists("logo_$templatename.png") ) { + $templatename = "_$templatename"; +} else { + $templatename = ''; +} + +http_header('Content-Type' => 'image/png' ); + + diff --git a/httemplate/view/cust_bill-pdf.cgi b/httemplate/view/cust_bill-pdf.cgi index 06bb965eb..f09e1b74d 100755 --- a/httemplate/view/cust_bill-pdf.cgi +++ b/httemplate/view/cust_bill-pdf.cgi @@ -1,18 +1,28 @@ -% -% -%#untaint invnum -%my($query) = $cgi->keywords; -%$query =~ /^((.+)-)?(\d+)(.pdf)?$/; -%my $templatename = $2; -%my $invnum = $3; -% -%my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); -%die "Invoice #$invnum not found!" unless $cust_bill; -% -%my $pdf = $cust_bill->print_pdf( '', $templatename); -% -%http_header('Content-Type' => 'application/pdf' ); -%http_header('Content-Length' => length($pdf) ); -%http_header('Cache-control' => 'max-age=60' ); -% <% $pdf %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); + +#untaint invnum +my($query) = $cgi->keywords; +$query =~ /^((.+)-)?(\d+)(.pdf)?$/; +my $templatename = $2; +my $invnum = $3; + +my $cust_bill = qsearchs({ + 'select' => 'cust_bill.*', + 'table' => 'cust_bill', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'invnum' => $invnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +}); +die "Invoice #$invnum not found!" unless $cust_bill; + +my $pdf = $cust_bill->print_pdf( '', $templatename); + +http_header('Content-Type' => 'application/pdf' ); +http_header('Content-Length' => length($pdf) ); +http_header('Cache-control' => 'max-age=60' ); + + diff --git a/httemplate/view/cust_bill-ps.cgi b/httemplate/view/cust_bill-ps.cgi index f838e1b17..5313dbf02 100755 --- a/httemplate/view/cust_bill-ps.cgi +++ b/httemplate/view/cust_bill-ps.cgi @@ -1,14 +1,24 @@ -% -% -%#untaint invnum -%my($query) = $cgi->keywords; -%$query =~ /^((.+)-)?(\d+)$/; -%my $templatename = $2; -%my $invnum = $3; -% -%my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); -%die "Invoice #$invnum not found!" unless $cust_bill; -% -%http_header('Content-Type' => 'application/postscript' ); -% <% $cust_bill->print_ps( '', $templatename) %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); + +#untaint invnum +my($query) = $cgi->keywords; +$query =~ /^((.+)-)?(\d+)$/; +my $templatename = $2; +my $invnum = $3; + +my $cust_bill = qsearchs({ + 'select' => 'cust_bill.*', + 'table' => 'cust_bill', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'invnum' => $invnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +}); +die "Invoice #$invnum not found!" unless $cust_bill; + +http_header('Content-Type' => 'application/postscript' ); + + diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 3772e8dd0..42e1e6177 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -1,40 +1,14 @@ -% -% -%#untaint invnum -%my($query) = $cgi->keywords; -%$query =~ /^((.+)-)?(\d+)$/; -%my $templatename = $2; -%my $invnum = $3; -% -%my $conf = new FS::Conf; -% -%my @payby = grep /\w/, $conf->config('payby'); -%#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) -%@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) -% unless @payby; -%my %payby = map { $_=>1 } @payby; -% -%my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); -%die "Invoice #$invnum not found!" unless $cust_bill; -%my $custnum = $cust_bill->getfield('custnum'); -% -%#my $printed = $cust_bill->printed; -% -%my $link = $templatename ? "$templatename-$invnum" : $invnum; -% -% - <% include("/elements/header.html",'Invoice View', menubar( "Main Menu" => $p, "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", )) %> + + % if ( $cust_bill->owed > 0 % && ( $payby{'BILL'} || $payby{'CASH'} || $payby{'WEST'} || $payby{'MCRD'} ) % ) % { % my $s = 0; -% - Post % if ( $payby{'BILL'} ) { @@ -151,5 +125,41 @@
<% join('', $cust_bill->print_text('', $templatename) ) %>
% } +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); + +#untaint invnum +my($query) = $cgi->keywords; +$query =~ /^((.+)-)?(\d+)$/; +my $templatename = $2; +my $invnum = $3; + +my $conf = new FS::Conf; + +my @payby = grep /\w/, $conf->config('payby'); +#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) +@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) + unless @payby; +my %payby = map { $_=>1 } @payby; + +my $cust_bill = qsearchs({ + 'select' => 'cust_bill.*', + 'table' => 'cust_bill', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'invnum' => $invnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +}); +die "Invoice #$invnum not found!" unless $cust_bill; + +my $custnum = $cust_bill->custnum; + +#my $printed = $cust_bill->printed; + +my $link = $templatename ? "$templatename-$invnum" : $invnum; + + + - diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 20e8201e6..850b48b27 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,27 +1,9 @@ -% -% -%my $conf = new FS::Conf; -% -%my $curuser = $FS::CurrentUser::CurrentUser; -% -%die "No customer specified (bad URL)!" unless $cgi->keywords; -%my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array -%$query =~ /^(\d+)$/; -%my $custnum = $1; -%my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); -%die "Customer not found!" unless $cust_main; -% -% - - <% include("/elements/header.html","Customer View: ". $cust_main->name ) %> -% if ( $curuser->access_right('Edit customer') ) { +% if ( $curuser->access_right('Edit customer') ) { Edit this customer | % } - - @@ -155,11 +137,35 @@ Comments

+ +% #XXX enable me# if ( $curuser->access_right('View customer packages') { <% include('cust_main/packages.html', $cust_main ) %> -% if ( $conf->config('payby-default') ne 'HIDE' ) { +% #} +% if ( $conf->config('payby-default') ne 'HIDE' ) { <% include('cust_main/payment_history.html', $cust_main ) %> % } <% include('/elements/footer.html') %> +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('View customer'); + +my $conf = new FS::Conf; + +die "No customer specified (bad URL)!" unless $cgi->keywords; +my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array +$query =~ /^(\d+)$/; +my $custnum = $1; +my $cust_main = qsearchs({ + 'table' => 'cust_main', + 'hashref' => {'custnum'=>$custnum}, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, +}); +die "Customer not found!" unless $cust_main; + + diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 3b86533a6..d5788c9a4 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -36,7 +36,7 @@ City <% $cust_main->get("${pre}city") %> -% if ( $cust_main->get("${pre}county" ) ) { +% if ( $cust_main->get("${pre}county") ) { County <% $cust_main->get("${pre}county") %> % } diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi deleted file mode 100755 index 78b42f127..000000000 --- a/httemplate/view/cust_pkg.cgi +++ /dev/null @@ -1,166 +0,0 @@ - -% -% -%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 -% -% - diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 92eef2dad..f5b65ac49 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -1,5 +1,3 @@ -% -% % # options example... % # % # 'table' => 'svc_something' @@ -16,40 +14,6 @@ % # # defaults to "edit/$table.cgi?", will have svcnum appended % # 'edit_url' => % -% my(%opt) = @_; -% -% my $table = $opt{'table'}; -% -% my $fields = $opt{'fields'} -% #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ]; -% || [ grep { $_ ne 'svcnum' } fields($table) ]; -% -% my $svcnum; -% if ( $cgi->param('svcnum') ) { -% $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum"; -% $svcnum = $1; -% } else { -% my($query) = $cgi->keywords; -% $query =~ /^(\d+)$/ or die "no svcnum"; -% $svcnum = $1; -% } -% my $svc_x = qsearchs( $opt{'table'}, { 'svcnum' => $svcnum } ) -% or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n"; -% -% my $cust_svc = $svc_x->cust_svc; -% my($label, $value, $svcdb) = $cust_svc->label; -% -% my $pkgnum = $cust_svc->pkgnum; -% -% my($cust_pkg, $custnum); -% if ($pkgnum) { -% $cust_pkg = $cust_svc->cust_pkg; -% $custnum = $cust_pkg->custnum; -% } else { -% $cust_pkg = ''; -% $custnum = ''; -% } -% % % if ( $custnum ) { @@ -123,3 +87,51 @@ Service #<% $svcnum %> <% joblisting({'svcnum'=>$svcnum}, 1) %> <% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View customer services') + || $FS::CurrentUser::CurrentUser->access_right('View customer'); #XXX remove me + +my(%opt) = @_; + +my $table = $opt{'table'}; + +my $fields = $opt{'fields'} + #|| [ grep { $_ ne 'svcnum' } dbdef->table($table)->columns ]; + || [ grep { $_ ne 'svcnum' } fields($table) ]; + +my $svcnum; +if ( $cgi->param('svcnum') ) { + $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum"; + $svcnum = $1; +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/ or die "no svcnum"; + $svcnum = $1; +} +my $svc_x = qsearchs({ + 'select' => $opt{'table'}.'.*', + 'table' => $opt{'table'}, + 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '. + ' LEFT JOIN cust_pkg USING ( pkgnum ) '. + ' LEFT JOIN cust_main USING ( custnum ) ', + 'hashref' => { 'svcnum' => $svcnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +}) or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n"; + +my $cust_svc = $svc_x->cust_svc; +my($label, $value, $svcdb) = $cust_svc->label; + +my $pkgnum = $cust_svc->pkgnum; + +my($cust_pkg, $custnum); +if ($pkgnum) { + $cust_pkg = $cust_svc->cust_pkg; + $custnum = $cust_pkg->custnum; +} else { + $cust_pkg = ''; + $custnum = ''; +} + + diff --git a/httemplate/view/svc_Common.html b/httemplate/view/svc_Common.html index bb3a6dd33..defbee974 100644 --- a/httemplate/view/svc_Common.html +++ b/httemplate/view/svc_Common.html @@ -1,3 +1,9 @@ +<% include('elements/svc_Common.html', + 'table' => $table, + 'edit_url' => $p."edit/svc_Common.html?svcdb=$table;svcnum=", + %opt, + ) +%> <%init> # false laziness w/edit/svc_Common.html @@ -21,9 +27,3 @@ if ( UNIVERSAL::can("FS::$table", 'table_info') ) { } -<% include('elements/svc_Common.html', - 'table' => $table, - 'edit_url' => $p."edit/svc_Common.html?svcdb=$table;svcnum=", - %opt, - ) -%> diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 2bacbcaff..86478681c 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,49 +1,11 @@ -% -% -%my $conf = new FS::Conf; -% -%my($query) = $cgi->keywords; -%$query =~ /^(\d+)$/; -%my $svcnum = $1; -%my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); -%die "Unknown svcnum" unless $svc_acct; -% -%#false laziness w/all svc_*.cgi -%my $cust_svc = qsearchs( 'cust_svc' , { 'svcnum' => $svcnum } ); -%my $pkgnum = $cust_svc->getfield('pkgnum'); -%my($cust_pkg, $custnum); -%if ($pkgnum) { -% $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); -% $custnum = $cust_pkg->custnum; -%} else { -% $cust_pkg = ''; -% $custnum = ''; -%} -%#eofalse -% -%my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); -%die "Unknown svcpart" unless $part_svc; -%my $svc = $part_svc->svc; -% -%die 'Empty domsvc for svc_acct.svcnum '. $svc_acct->svcnum -% unless $svc_acct->domsvc; -%my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } ); -%die 'Unknown domain (domsvc '. $svc_acct->domsvc. -% ' for svc_acct.svcnum '. $svc_acct->svcnum. ')' -% unless $svc_domain; -%my $domain = $svc_domain->domain; -% -% % if ( $custnum ) { - <% include("/elements/header.html","View $svc account") %> - <% include( '/elements/small_custview.html', $custnum, '', 1, "${p}view/cust_main.cgi") %>
-% } else { +% } else {