diff options
Diffstat (limited to 'httemplate/view')
22 files changed, 540 insertions, 79 deletions
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index ce8d96a..0928d04 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -26,7 +26,7 @@ % if ( $cust_bill->owed > 0 % && scalar( grep $payby{$_}, qw(BILL CASH WEST MCRD) ) -% && $curuser->access_right('Post payment') +% && $curuser->access_right(['Post payment', 'Post check payment', 'Post cash payment']) % && ! $conf->exists('pkg-balances') % ) % { @@ -34,22 +34,22 @@ Post -% if ( $payby{'BILL'} ) { +% if ( $payby{'BILL'} && $curuser->access_right(['Post payment', 'Post check payment']) ) { <% $s++ ? ' | ' : '' %> <A HREF="<% $p %>edit/cust_pay.cgi?payby=BILL;invnum=<% $invnum %>">check</A> % } -% if ( $payby{'CASH'} ) { +% if ( $payby{'CASH'} && $curuser->access_right(['Post payment', 'Post cash payment']) ) { <% $s++ ? ' | ' : '' %> <A HREF="<% $p %>edit/cust_pay.cgi?payby=CASH;invnum=<% $invnum %>">cash</A> % } -% if ( $payby{'WEST'} ) { +% if ( $payby{'WEST'} && $curuser->access_right(['Post payment']) ) { <% $s++ ? ' | ' : '' %> <A HREF="<% $p %>edit/cust_pay.cgi?payby=WEST;invnum=<% $invnum %>">Western Union</A> % } -% if ( $payby{'MCRD'} ) { +% if ( $payby{'MCRD'} && $curuser->access_right(['Post payment']) ) { <% $s++ ? ' | ' : '' %> <A HREF="<% $p %>edit/cust_pay.cgi?payby=MCRD;invnum=<% $invnum %>">manual credit card</A> % } @@ -117,13 +117,14 @@ if ( $query =~ /^((.+)-)?(\d+)$/ ) { $notice_name = $cgi->param('notice_name'); } +my $conf = new FS::Conf; + my %opt = ( - 'template' => $template, - 'notice_name' => $notice_name, + 'unsquelch_cdr' => $conf->exists('voip-cdr_email'), + 'template' => $template, + 'notice_name' => $notice_name, ); -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 )) diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index f6bef43..0f9c1e2 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% include('/elements/header.html', { - 'title' => "Customer: ". $cust_main->name, + 'title' => $title, 'nobr' => 1, }) %> @@ -57,12 +57,29 @@ function areyousure(href, message) { 'color' => '#ff0000', 'cust_main' => $cust_main, 'width' => 616, #make room for reasons + 'height' => 366, } ) %> | % } +% if ( $curuser->access_right('Merge customer') ) { + + <% include( '/elements/popup_link-cust_main.html', + { 'action' => $p. 'misc/merge_cust.html', + 'label' => 'Merge this customer', + 'actionlabel' => 'Merge customer', + #'color' => '#ff0000', + 'cust_main' => $cust_main, + 'width' => 480, + 'height' => 192, + } + ) + %> | + +% } + % if ( $conf->exists('deletecustomers') % && $curuser->access_right('Delete customer') % ) { @@ -233,6 +250,10 @@ Comments <% include('cust_main/change_history.html', $cust_main ) %> % } +% if ( $view eq 'custom' ) { +<% include('cust_main/custom.html', $cust_main ) %> +% } + </DIV> <% include('/elements/footer.html') %> <%init> @@ -261,6 +282,11 @@ my $cust_main = qsearchs( { }); die "Customer not found!" unless $cust_main; +my $title = $cust_main->name; +$title = '('. $cust_main->display_custnum. ") $title" + if $conf->exists('cust_main-title-display_custnum'); +$title = "Customer: $title"; + #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view) tie my %views, 'Tie::IxHash', 'Basics' => 'basics', @@ -273,6 +299,8 @@ $views{'Payment History'} = 'payment_history' unless $conf->config('payby-default' eq 'HIDE'); $views{'Change History'} = 'change_history' if $curuser->access_right('View customer history'); +$views{$conf->config('cust_main-custom_title') || 'Custom'} = 'custom' + if $conf->config('cust_main-custom_link'); $views{'Jumbo'} = 'jumbo'; my %viewname = reverse %views; diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 54c180b..014ddab 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -132,7 +132,7 @@ Billing information <TR> <TD ALIGN="right">Attention</TD> - <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD> + <TD BGCOLOR="#ffffff"><% $cust_main->payname |h %></TD> </TR> % } elsif ( $cust_main->payby eq 'COMP' ) { @@ -206,6 +206,14 @@ Billing information <% $cust_main->invoice_terms || 'Default ('. ( $conf->config('invoice_default_terms') || 'Payable upon receipt' ). ')' %> </TD> </TR> +<TR> + <TD ALIGN="right">Credit limit</TD> + <TD BGCOLOR="#ffffff"> + <% length($cust_main->credit_limit) ? + $money_char.sprintf("%.2f", $cust_main->credit_limit) : + 'Unlimited' %> + </TD> +</TR> % if ( $conf->exists('voip-cust_cdr_spools') ) { <TR> diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index e88c02e..e91af54 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -10,7 +10,7 @@ <TR> <TD ALIGN="right">Contact name</TD> <TD COLSPAN=5 BGCOLOR="#ffffff"> - <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") %> + <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") |h %> </TD> % if ( $which eq '' && $conf->exists('show_ss') ) { <TD ALIGN="right">SS#</TD> @@ -19,11 +19,11 @@ </TR> <TR> <TD ALIGN="right">Company</TD> - <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}company") %></TD> + <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}company") |h %></TD> </TR> <TR> <TD ALIGN="right">Address</TD> - <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address1") %></TD> + <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address1") |h %></TD> </TR> % if ( $cust_main->get("${pre}address2") ) { @@ -36,20 +36,20 @@ <TR> <TD ALIGN="right"><% $address2_label %></TD> - <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address2") %></TD> + <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address2") |h %></TD> </TR> % } <TR> <TD ALIGN="right">City</TD> - <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}city") %></TD> + <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}city") |h %></TD> % if ( $cust_main->get("${pre}county") ) { <TD ALIGN="right">County</TD> - <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}county") %></TD> + <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}county") |h %></TD> % } <TD ALIGN="right">State</TD> - <TD BGCOLOR="#ffffff"><% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) %></TD> + <TD BGCOLOR="#ffffff"><% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) |h %></TD> <TD ALIGN="right">Zip</TD> <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}zip") %></TD> </TR> diff --git a/httemplate/view/cust_main/custom.html b/httemplate/view/cust_main/custom.html new file mode 100644 index 0000000..8e2e07b --- /dev/null +++ b/httemplate/view/cust_main/custom.html @@ -0,0 +1,21 @@ +<IFRAME id="customframe" + src="<% $proxyurl %>" + onload="resizeFrame(this)" + frameborder=0 + marginheight="0px" + marginwidth="0px" + width="100%" + scrolling="no" +> +</IFRAME> +<SCRIPT TYPE="text/javascript"> +function resizeFrame(f) { + f.style.height = f.contentDocument.body.scrollHeight + 'px'; +} +</SCRIPT> +<%init> + +my( $cust_main ) = @_; + +my $proxyurl = $p.'/misc/custom_link_proxy.cgi?custnum='.$cust_main->custnum; +</%init> diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 811ac3c..660d0ef 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -57,7 +57,9 @@ Current packages <TD ALIGN="right"> <A HREF="<%$p%>search/report_cust_pkg.html?custnum=<% $cust_main->custnum %>">Package reports</A><BR> Service reports: - <A HREF="<%$p%>search/report_svc_acct.html?custnum=<% $cust_main->custnum %>">accounts</A> + <A HREF="<%$p%>search/report_svc_acct.html?custnum=<% $cust_main->custnum %>">accounts</A><BR> + Usage reports: + <A HREF="<%$p%>search/report_cdr.html?custnum=<% $cust_main->custnum %>">CDRs</A> </TD> </TR> @@ -161,6 +163,7 @@ my %conf_opt = ( 'legacy_link' => $conf->exists('legacy_link'), 'svc_broadband-manage_link' => scalar($conf->config('svc_broadband-manage_link')), 'maestro-status_test' => $conf->exists('maestro-status_test'), + 'cust_pkg-large_pkg_size' => $conf->config('cust_pkg-large_pkg_size'), ); #subroutines diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html index 3c486dd..3b58f9e 100644 --- a/httemplate/view/cust_main/packages/package.html +++ b/httemplate/view/cust_main/packages/package.html @@ -39,6 +39,7 @@ % if ( $curuser->access_right('Discount customer package') % && $part_pkg->can_discount % && ! scalar($cust_pkg->cust_pkg_discount_active) +% && ! scalar($cust_pkg->part_pkg->part_pkg_discount) % ) % { % $br=1; diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html index 6e30922..512efcc 100644 --- a/httemplate/view/cust_main/packages/services.html +++ b/httemplate/view/cust_main/packages/services.html @@ -4,12 +4,40 @@ <TD CLASS="inv" BGCOLOR="<% $bgcolor %>"> <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%"> + <SCRIPT TYPE="text/javascript"> +function clearhint_search_cust_svc(obj, str) { + if (obj.value == str) obj.value = ''; +} + </SCRIPT> % #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 $cust_svc ( @{ $part_svc->cust_pkg_svc } ) { +% if ( $opt{'cust_pkg-large_pkg_size'} > 0 and +% $opt{'cust_pkg-large_pkg_size'} <= $cust_pkg->num_svcs ) { +% # summarize + <TR> + <TD ALIGN="center" VALIGN="top"> +% my $href="${p}search/cust_pkg_svc.html?svcpart=".$part_svc->svcpart. +% ";pkgnum=".$cust_pkg->pkgnum; + <A HREF="<% $href %>"><% $part_svc->svc %></A> + <A HREF="<% $href %>"><B>(view all <% $cust_pkg->num_svcs %>)</B></A> +% my $hint = $hints{$part_svc->svcdb}; +% if ( $hint ) { + <BR> + <FORM name="svcpart<%$part_svc->svcpart%>_search" STYLE="display:inline" + ACTION="<%$p%>search/cust_pkg_svc.html" METHOD="GET"> + <INPUT TYPE="hidden" NAME="svcpart" VALUE="<%$part_svc->svcpart%>"> + <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%$cust_pkg->pkgnum%>"> + <INPUT TYPE="text" NAME="search_svc" + onfocus="clearhint_search_cust_svc(this, '<%$hint%>')" VALUE="<%$hint%>"> + <INPUT TYPE="submit" VALUE="Search"></FORM> +% } #$hint + </TD> + </TR> +% } +% else { +% foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) { <TR> <TD ALIGN="right" VALIGN="top"><% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %></TD> @@ -65,7 +93,8 @@ </TD> </TR> -% } +% } #foreach $cust_svc +% } % if ( ! $cust_pkg->get('cancel') % && $curuser->access_right('Provision customer service') @@ -137,4 +166,13 @@ sub svc_unprovision_link { qq!', 'Permanently unprovision and delete this service?')">Unprovision</A>!; } +my %hints = ( +svc_acct => '(user or email)', +svc_domain => '(domain)', +svc_broadband => '(ip or mac)', +svc_forward => '(email)', +svc_phone => '(phone)', +svc_pbx => '(phone)', +); + </%init> diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html index a686843..c05cd5a 100644 --- a/httemplate/view/cust_main/packages/status.html +++ b/httemplate/view/cust_main/packages/status.html @@ -54,8 +54,11 @@ <% pkg_status_row_changed( $cust_pkg, %opt, 'colspan'=>$colspan ) %> <% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill', %opt, curuser=>$curuser ) %> -% # pkg_status_row($cust_pkg, 'Next bill', 'bill', %opt) +% if ( $part_pkg->option('suspend_bill') ) { + <% pkg_status_row_if( $cust_pkg, 'Next bill', 'bill', %opt, curuser=>$curuser ) %> +% } <% pkg_status_row_if( $cust_pkg, 'Expires', 'expire', %opt, curuser=>$curuser ) %> + <% pkg_status_row_if( $cust_pkg, 'Contract ends', 'contract_end', %opt ) %> <TR> <TD COLSPAN=<%$colspan%>> @@ -167,6 +170,7 @@ <% pkg_status_row_if($cust_pkg, 'Will automatically suspend by', 'autosuspend', %opt) %> <% pkg_status_row_if( $cust_pkg, 'Will suspend on', 'adjourn', %opt, curuser=>$curuser ) %> <% pkg_status_row_if( $cust_pkg, 'Expires', 'expire', %opt, curuser=>$curuser ) %> + <% pkg_status_row_if( $cust_pkg, 'Contract ends', 'contract_end', %opt ) %> % if ( $part_pkg->freq ) { diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 0dc4c41..046899e 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -1,7 +1,7 @@ %# payment links % my $s = 0; -% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { +% if ( $payby{'BILL'} && $curuser->access_right(['Post payment', 'Post check payment' ]) ) { <% $s++ ? ' | ' : '' %> <% include('/elements/popup_link-cust_main.html', 'label' => 'Enter check payment', @@ -14,7 +14,7 @@ %> % } -% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { +% if ( $payby{'CASH'} && $curuser->access_right(['Post payment', 'Post cash payment']) ) { <% $s++ ? ' | ' : '' %> <% include('/elements/popup_link-cust_main.html', 'label' => 'Enter cash payment', @@ -33,7 +33,7 @@ % } % if ( ( $payby{'CARD'} || $payby{'DCRD'} ) -% && $curuser->access_right('Process payment') +% && $curuser->access_right(['Process payment', 'Process credit card payment']) % && ! $cust_main->is_encrypted($cust_main->payinfo) % ) { <% $s++ ? ' | ' : '' %> @@ -41,7 +41,7 @@ % } % if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) -% && $curuser->access_right('Process payment') +% && $curuser->access_right(['Process payment', 'Process Echeck payment']) % && ! $cust_main->is_encrypted($cust_main->payinfo) % ) { <% $s++ ? ' | ' : '' %> @@ -73,7 +73,7 @@ %# refund links % $s = 0; -% if ( $payby{'BILL'} && $curuser->access_right('Post refund') ) { +% if ( $payby{'BILL'} && $curuser->access_right(['Post refund', 'Post check refund']) ) { <% $s++ ? ' | ' : '' %> <% include('/elements/popup_link-cust_main.html', 'label' => 'Enter check refund', @@ -86,7 +86,7 @@ %> % } -% if ( $payby{'CASH'} && $curuser->access_right('Post refund') ) { +% if ( $payby{'CASH'} && $curuser->access_right(['Post refund', 'Post cash refund']) ) { <% $s++ ? ' | ' : '' %> <% include('/elements/popup_link-cust_main.html', 'label' => 'Enter cash refund', @@ -291,7 +291,7 @@ <TR <% $display ? $display.' ID="old_history'.$old_history++.'"' : ''%>> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <TD VALIGN="top" CLASS="grid" BGCOLOR="<% $bgcolor %>"> % unless ( !$target || $target{$target}++ ) { <A NAME="<% $target %>"> @@ -308,19 +308,19 @@ <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $item->{'desc'} %> </TD> - <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $charge %> </TD> - <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $payment %> </TD> - <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $credit %> </TD> - <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $refund %> </TD> - <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $showbalance %> </TD> </TR> @@ -412,6 +412,16 @@ foreach my $cust_pay ($cust_main->cust_pay) { }; } +#pending payments +foreach my $cust_pay_pending ($cust_main->cust_pay_pending) { + push @history, { + 'date' => $cust_pay_pending->_date, + 'desc' => include('payment_history/pending_payment.html', $cust_pay_pending, %opt ), + 'void_payment' => $cust_pay_pending->paid, + }; +} + + #voided payments foreach my $cust_pay_void ($cust_main->cust_pay_void) { push @history, { @@ -422,6 +432,16 @@ foreach my $cust_pay_void ($cust_main->cust_pay_void) { } +#declined payments +foreach my $cust_pay_pending ($cust_main->cust_pay_pending_attempt) { + push @history, { + 'date' => $cust_pay_pending->_date, + 'desc' => include('payment_history/attempted_payment.html', $cust_pay_pending, %opt ), + 'void_payment' => $cust_pay_pending->paid, #?? + #'target' => $target, #XXX + }; +} + #credits (some false laziness w/payments) foreach my $cust_credit ($cust_main->cust_credit) { push @history, { diff --git a/httemplate/view/cust_main/payment_history/attempted_payment.html b/httemplate/view/cust_main/payment_history/attempted_payment.html new file mode 100644 index 0000000..554aa73 --- /dev/null +++ b/httemplate/view/cust_main/payment_history/attempted_payment.html @@ -0,0 +1,41 @@ +<I>Payment attempt <% $info |h %></I> +<%init> + +my( $cust_pay_pending, %opt ) = @_; + +my $date_format = $opt{'date_format'} || '%m/%d/%Y'; + +my $curuser = $FS::CurrentUser::CurrentUser; + +my $payby = $cust_pay_pending->payby; + +my $payinfo; +if ( $payby eq 'CARD' ) { + $payinfo = $cust_pay_pending->paymask; +} elsif ( $payby eq 'CHEK' ) { + my( $account, $aba ) = split('@', $cust_pay_pending->paymask ); + $payinfo = "ABA $aba, Acct #$account"; +} else { + $payinfo = $cust_pay_pending->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)" : ''; + +if ( $opt{'pkg-balances'} && $cust_pay_pending->pkgnum ) { + my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum'=>$cust_pay_pending->pkgnum } ); + $info .= ' for '. $cust_pkg->pkg_label_long; +} + +$info .= ': '. $cust_pay_pending->statustext + if length($cust_pay_pending->statustext); + +</%init> diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html index 6ec9fdb..e745864 100644 --- a/httemplate/view/cust_main/payment_history/payment.html +++ b/httemplate/view/cust_main/payment_history/payment.html @@ -155,11 +155,14 @@ my $view = my $refund = ''; my $refund_days = $opt{'card_refund-days'} || 120; +my @rights = ('Refund payment'); +push @rights, 'Refund credit card payment' if $payby eq 'CARD'; +push @rights, 'Refund Echeck payment' if $payby eq 'CHEK'; 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') + && $curuser->access_right(\@rights) ) { $refund = qq! (<A HREF="${p}edit/cust_refund.cgi?payby=$1;!. qq!paynum=!. $cust_pay->paynum. '"'. diff --git a/httemplate/view/cust_main/payment_history/pending_payment.html b/httemplate/view/cust_main/payment_history/pending_payment.html new file mode 100644 index 0000000..40805b1 --- /dev/null +++ b/httemplate/view/cust_main/payment_history/pending_payment.html @@ -0,0 +1,61 @@ +<b><font size="+1" color="#FF0000">Pending payment </font></b> <% "$info $status ($link)" %> +<%init> + +my( $cust_pay_pending, %opt ) = @_; + +my $conf = new FS::Conf; + +my $curuser = $FS::CurrentUser::CurrentUser; + +my $payby = $cust_pay_pending->payby; + +my $payinfo; +if ( $payby eq 'CARD' ) { + $payinfo = $cust_pay_pending->paymask; +} elsif ( $payby eq 'CHEK' ) { + my( $account, $aba ) = split('@', $cust_pay_pending->paymask ); + $payinfo = "ABA $aba, Acct #$account"; +} else { + $payinfo = $cust_pay_pending->payinfo; +} + +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 %statusaction = ( + 'new' => 'delete', + 'pending' => 'complete', + 'captured' => 'capture', +); + +my $edit_pending = + $FS::CurrentUser::CurrentUser->access_right('Edit customer pending payments'); + +my $status = "Status: ".$cust_pay_pending->status; + +my $action = $statusaction{$cust_pay_pending->status}; + +my $link = ""; +if ( $action && $edit_pending ) { + $link = include('/elements/popup_link.html', + 'action' => $p. 'edit/cust_pay_pending.html'. + '?paypendingnum='. $cust_pay_pending->paypendingnum. + ";action=$action", + 'label' => $action, + 'color' => '#ff0000', + 'width' => 655, + 'height' => ( $action eq 'delete' ? 480 : 575 ), + 'actionlabel' => ucfirst($action). ' pending payment', + ); +} + +</%init> diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html index be68ff0..5d7f60c 100644 --- a/httemplate/view/cust_main/payment_history/voided_payment.html +++ b/httemplate/view/cust_main/payment_history/voided_payment.html @@ -1,6 +1,10 @@ -<DEL>Payment <% $info %></DEL> +<DEL>Payment <% $info %> by <% $cust_pay_void->otaker %></DEL> <I>voided <% time2str($date_format, $cust_pay_void->void_date) %> -by <% $cust_pay_void->otaker %></I><% $unvoid %> +% my $void_user = $cust_pay_void->void_access_user; +% if ($void_user) { + by <% $void_user->username %></I> +% } +<% $unvoid %> <%init> my( $cust_pay_void, %opt ) = @_; diff --git a/httemplate/view/cust_pay.html b/httemplate/view/cust_pay.html index 2f23d9e..1408b3d 100644 --- a/httemplate/view/cust_pay.html +++ b/httemplate/view/cust_pay.html @@ -2,7 +2,10 @@ <% include('/elements/header-popup.html', "$thing Receipt" ) %> - <CENTER><A HREF="javascript:self.parent.location = '<% $pr_link %>'">Print</A></CENTER><BR> + <div align="center"> + <A HREF="javascript:self.parent.location = '<% $pr_link %>'">Print</A> | + <A HREF="javascript:self.location = '<% $email_link %>'">Re-email</A> + </div><BR> % } elsif ( $link eq 'print' ) { @@ -15,7 +18,12 @@ ) %> <BR><BR> - +% } elsif ( $link eq 'email' ) { +% if ( $email_error ) { + <% include('/elements/header-popup.html', "Error re-emailing receipt: $email_error" ) %> +% } else { + <% include('/elements/header-popup.html', "Re-emailed receipt" ) %> +% } % } else { <% include('/elements/header.html', "$thing Receipt", menubar( @@ -26,7 +34,7 @@ % } -% unless ($link eq 'popup' ) { +% unless ($link =~ /^(popup|email)$/ ) { <% include('/elements/small_custview.html', $custnum, scalar($conf->config('countrydefault')), @@ -110,9 +118,14 @@ window.print(); </SCRIPT> -% } +% } elsif ( $link eq 'email' ) { -% if ( $link =~ /^(popup|print)$/ ) { + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + +% } +% if ( $link =~ /^(popup|print|email)$/ ) { </BODY> </HTML> % } else { @@ -149,6 +162,7 @@ my $cust_pay = qsearchs({ die "$thing #$paynum not found!" unless $cust_pay; my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void"; +my $email_link = "${p}view/cust_pay.html?link=email;paynum=$paynum;void=$void"; my $custnum = $cust_pay->custnum; my $display_custnum = $cust_pay->cust_main->display_custnum; @@ -159,4 +173,14 @@ my $money_char = $conf->config('money_char') || '$'; tie my %payby, 'Tie::IxHash', FS::payby->payby2longname; +my $email_error; + +if ( $link eq 'email' ) { + my $email_error = $cust_pay->send_receipt( + 'manual' => 1, + ); + + warn "can't send payment receipt/statement: $email_error" if $email_error; +} + </%init> diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 852640e..8a352f3 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -21,6 +21,13 @@ ) </%doc> +<SCRIPT> +function areyousure(href) { + if (confirm("Permanently delete this <% $label %>?") == true) + window.location.href = href; +} +</SCRIPT> + % if ( $custnum ) { <% include("/elements/header.html","View $label: $value") %> @@ -36,18 +43,13 @@ "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" )) %> - <SCRIPT> - function areyousure(href) { - if (confirm("Permanently delete this <% $label %>?") == true) - window.location.href = href; - } - </SCRIPT> - % } Service #<B><% $svcnum %></B> % my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?'; | <A HREF="<%$url%><%$svcnum%>">Edit this <% $label %></A> +| <A HREF="javascript:areyousure('<%$p.'misc/unprovision.cgi?'.$svcnum%>')"> +Unprovision this Service</A> <BR> <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %> diff --git a/httemplate/view/image.cgi b/httemplate/view/image.cgi new file mode 100644 index 0000000..153ec85 --- /dev/null +++ b/httemplate/view/image.cgi @@ -0,0 +1,31 @@ +<% $data %>\ +<%init> + +#die "access denied" +# unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $conf = new FS::Conf; + +my $type; +if ( $cgi->param('type') eq 'png' ) { + $type = 'png'; +} elsif ( $cgi->param('type') eq 'eps' ) { + $type = 'eps'; +} else { + die "unknown image type ". $cgi->param('type'); +} + +my $data; +if ( $cgi->param('prefname') =~ /^(\w+)$/ ) { + + my $prefname = $1; + my $curuser = $FS::CurrentUser::CurrentUser; + $data = decode_base64( $curuser->option("$prefname") ); + +} else { + die "no preview_session specified"; +} + +http_header('Content-Type' => 'image/png' ); + +</%init> diff --git a/httemplate/view/svc_acct/communigate.html b/httemplate/view/svc_acct/communigate.html index 0f090fd..179facf 100644 --- a/httemplate/view/svc_acct/communigate.html +++ b/httemplate/view/svc_acct/communigate.html @@ -32,6 +32,14 @@ <% include('/view/elements/tr.html', label=>'Add trailer to sent mail', value=>$svc_acct->cgp_addmailtrailer ? 'YES' : 'NO' ) %> +% my $archive_after = $svc_acct->cgp_archiveafter; +% $archive_after = +% $archive_after +% ? ( $archive_after / 86400 ). ' days' +% : ( $archive_after eq '0' ? 'Never' : 'default (730 days)' ); + <% include('/view/elements/tr.html', label=>'Archive messages after', + value=>$archive_after, ) %> + %# preferences <% include('/view/elements/tr.html', label=>'Message delete method', @@ -54,17 +62,16 @@ value=>$svc_acct->cgp_sendmdnmode ) %> %# vacation message -%#XXX finish me... do we need to search for specific rules -%# (and hide them?) need to see what CGP gives back after we've added a rule <% include('/elements/init_overlib.html') %> <TR> <TD ALIGN="right">Vacation message</TD> <TD BGCOLOR="#FFFFFF"> + <% $vacation_rule ? 'Active' : '' %> <% include('/elements/popup_link.html', 'action' => $p.'edit/cgp_rule-vacation.html?'. 'svcnum='. $svc_acct->svcnum, - 'label' => '(add)', #XXX (edit) + 'label' => $vacation_rule ? '(edit)' : '(add)', 'actionlabel' => 'Vacation message', 'width' => 600, 'height' => 300, @@ -75,15 +82,15 @@ </TR> %# redirect all mail -%#XXX finish me... <TR> <TD ALIGN="right">Redirect all mail</TD> <TD BGCOLOR="#FFFFFF"> + <% $redirect_rule ? 'Active' : '' %> <% include('/elements/popup_link.html', 'action' => $p.'edit/cgp_rule-redirect_all.html?'. 'svcnum='. $svc_acct->svcnum, - 'label' => '(add)', #XXX (edit) + 'label' => $redirect_rule ? '(edit)' : '(add)', 'actionlabel' => 'Redirect all mail', 'width' => 763, #'height' @@ -100,6 +107,13 @@ ) %> +%# RPOP + + <% include('/view/elements/tr.html', label=>'Remote POP accounts', + value=>$rpop_link, + ) + %> + <%init> my %opt = @_; @@ -109,7 +123,20 @@ my %opt = @_; my $svc_acct = $opt{'svc_acct'}; #my $part_svc = $opt{'part_svc'}; -my $rule_link = qq(<A HREF="${p}browse/cgp_rule.html?svcnum=). +my $rule_link = qq(<A HREF="${p}browse/cgp_rule.html?svcnum=). #"dum vim $svc_acct->svcnum. '">View/edit mail rules</A>'; +my $rpop_link = qq(<A HREF="${p}browse/acct_snarf.html?svcnum=). #"dee vim + $svc_acct->svcnum. '">View/edit remote POP accounts</A>'; + +my $vacation_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum, + 'name' => '#Vacation' + } + ); + +my $redirect_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum, + 'name' => '#Redirect' + } + ); + </%init> diff --git a/httemplate/view/svc_domain/acct_defaults.html b/httemplate/view/svc_domain/acct_defaults.html index 3a4e187..b561282 100644 --- a/httemplate/view/svc_domain/acct_defaults.html +++ b/httemplate/view/svc_domain/acct_defaults.html @@ -71,6 +71,14 @@ ) %> +% my $archive_after = $svc_domain->acct_def_cgp_archiveafter; +% $archive_after = +% $archive_after +% ? ( $archive_after / 86400 ). ' days' +% : ( $archive_after eq '0' ? 'Never' : 'default (730 days)' ); + <% include('/view/elements/tr.html', label=>'Archive messages after', + value=>$archive_after, ) %> + %# preferences <% include('/view/elements/tr.html', diff --git a/httemplate/view/svc_domain/dns.html b/httemplate/view/svc_domain/dns.html index 88a9bda..184286c 100644 --- a/httemplate/view/svc_domain/dns.html +++ b/httemplate/view/svc_domain/dns.html @@ -7,22 +7,30 @@ return confirm("Remove all records and slave from " + document.SlaveForm.recdata.value + "?"); } </SCRIPT> +<% include('/elements/init_overlib.html') %> -DNS records -% my @records; if ( @records = $svc_domain->domain_record ) { +<A NAME="dns"></A> +<div class="fscontainer"> +<div class="fsbox"> +<div class="fsbox-title"> + <span class="left">DNS Records</span> +</div> - <% include('/elements/table-grid.html') %> +<% include('/elements/table-grid.html') %> % my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = $bgcolor2; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = $bgcolor2; <tr> <th CLASS="grid" BGCOLOR="#cccccc">Zone</th> <th CLASS="grid" BGCOLOR="#cccccc">Type</th> <th CLASS="grid" BGCOLOR="#cccccc">Data</th> + <th CLASS="grid" BGCOLOR="#cccccc">TTL</th> + <th CLASS="grid" BGCOLOR="#cccccc"></th> </tr> +% my @records = $svc_domain->domain_record; % foreach my $domain_record ( @records ) { % my $type = $domain_record->rectype eq '_mstr' % ? "(slave)" @@ -32,13 +40,27 @@ DNS records <tr> <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->reczone %></td> <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $type %></td> - <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->recdata %> + <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->recdata %></td> + <td CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $domain_record->ttl %></td> + <td CLASS="grid" BGCOLOR="<% $bgcolor %>"> % unless ( $domain_record->rectype eq 'SOA' % || ! $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') % ) { +% my $edit_link = include('/elements/popup_link.html', +% 'label' => 'edit', +% 'action' => $p.'edit/domain_record.html?recnum='. +% $domain_record->recnum, +% 'actionlabel' => 'Edit nameservice record', +% 'width' => 655, +% 'height' => 176, +% #'color' => '#ff0000', +% ); % ( my $recdata = $domain_record->recdata ) =~ s/"/\\'\\'/g; - (<A HREF="javascript:areyousure('<%$p%>misc/delete-domain_record.cgi?<%$domain_record->recnum%>', 'Delete \'<% $domain_record->reczone %> <% $type %> <% $recdata %>\' ?' )">delete</A>) +% my $delete_url= "javascript:areyousure('${p}misc/delete-domain_record.cgi?". +% $domain_record->recnum. "', 'Delete ". +% $domain_record->reczone. " $type $recdata ?' )"; + <%$edit_link%> | <A HREF="<%$delete_url%>">delete</A> % } </td> </tr> @@ -52,23 +74,51 @@ DNS records % } - </table> -% } +% if ( ! @records ) { + + <FORM METHOD="POST" NAME="DefaultForm" ACTION="<%$p%>edit/process/svc_domain-defaultrecords.cgi"> + <tr> + <td class="grid" BGCOLOR="#ffffff" COLSPAN=5> + <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>"> + <INPUT TYPE="submit" VALUE="Add default records"> + </td> + </tr> + </FORM> + +% } % if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) { <FORM METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi"> - <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>"> - <INPUT TYPE="text" NAME="reczone"> - <INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> IN - <SELECT NAME="rectype"> -% foreach (qw( A NS CNAME MX PTR TXT) ) { - <OPTION VALUE="<%$_%>"><%$_%></OPTION> -% } - </SELECT> - <INPUT TYPE="text" NAME="recdata"> - <INPUT TYPE="submit" VALUE="Add record"> + <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>"> + <tr> + <td class="grid" bgcolor="<%$bgcolor%>"> + <INPUT TYPE="text" NAME="reczone"><BR> + <FONT SIZE="-1"><I>Zone</I></FONT> + </TD> + <TD class="grid" bgcolor="<%$bgcolor%>"> + <INPUT TYPE="hidden" NAME="recaf" VALUE="IN"> + <SELECT NAME="rectype"> +% foreach ( @{ FS::domain_record->rectypes } ) { + <OPTION VALUE="<%$_%>">IN <%$_%></OPTION> +% } + </SELECT><BR> + <FONT SIZE="-1"><I>Type</I></FONT> + </TD> + <TD class="grid" bgcolor="<%$bgcolor%>"> + <INPUT TYPE="text" NAME="recdata"><BR> + <FONT SIZE="-1"><I>Data</I></FONT> + </TD> + <TD class="grid" bgcolor="<%$bgcolor%>"> + <INPUT TYPE="text" NAME="ttl" size="6"><BR> + <FONT SIZE="-1"><I>TTL</I></FONT> + </TD> + <TD class="grid" bgcolor="<%$bgcolor%>" VALIGN="top"> + <INPUT TYPE="submit" VALUE="Add record"> + </TD> + </TR> </FORM> + <BR> <FORM NAME="SlaveForm" METHOD="POST" ACTION="<%$p%>edit/process/domain_record.cgi"> <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>"> Or @@ -83,9 +133,14 @@ DNS records <INPUT TYPE="text" NAME="recdata"> <INPUT TYPE="submit" VALUE="Slave domain" onClick="return slave_areyousure()"> </FORM> + <BR><BR> % } +</table> + +</div> +</div> <%init> my($svc_domain, %opt) = @_; diff --git a/httemplate/view/svc_pbx.cgi b/httemplate/view/svc_pbx.cgi new file mode 100644 index 0000000..79cafed --- /dev/null +++ b/httemplate/view/svc_pbx.cgi @@ -0,0 +1,72 @@ +<% include('elements/svc_Common.html', + 'table' => 'svc_pbx', + 'edit_url' => $p."edit/svc_Common.html?svcdb=svc_pbx;svcnum=", + 'labels' => \%labels, + 'html_foot' => $html_foot, + ) +%> +<%init> + +my $fields = FS::svc_pbx->table_info->{'fields'}; +my %labels = map { $_ => ( ref($fields->{$_}) + ? $fields->{$_}{'label'} + : $fields->{$_} + ); + } + keys %$fields; + +my $html_foot = sub { + my $svc_pbx = shift; + + ## + # CDR links + ## + + tie my %what, 'Tie::IxHash', + 'pending' => 'NULL', + 'billed' => 'done', + ; + + #matching as per package def cdr_svc_method + my $cust_pkg = $svc_pbx->cust_svc->cust_pkg; + return '' unless $cust_pkg; + + my @voip_pkgs = + grep { $_->plan eq 'voip_cdr' } $cust_pkg->part_pkg->self_and_bill_linked; + if ( scalar(@voip_pkgs) > 1 ) { + warn "multiple voip_cdr packages bundled\n"; + return ''; + } elsif ( !@voip_pkgs ) { + warn "no voip_cdr packages\n"; + } + my $voip_pkg = @voip_pkgs[0]; + + my $cdr_svc_method = $voip_pkg->option('cdr_svc_method') + || 'svc_phone.phonenum'; + return '' unless $cdr_svc_method =~ /^svc_pbx\.(\w+)$/; + my $field = $1; + + my $search; + if ( $field eq 'title' ) { + $search = 'charged_party='. uri_escape($svc_pbx->title); + } elsif ( $field eq 'svcnum' ) { + $search = 'svcnum='. $svc_pbx->svcnum; + } else { + warn "unknown cdr_svc_method svc_pbx.$field"; + return ''; + } + + my @links = map { + qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;$search;freesidestatus=$what{$_}">). + "View $_ CDRs</A>"; + } keys(%what); + + ### + # concatenate & return + ### + + join(' | ', @links ). '<BR>'; + +}; + +</%init> diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi index 75591c7..27d270c 100644 --- a/httemplate/view/svc_phone.cgi +++ b/httemplate/view/svc_phone.cgi @@ -120,19 +120,28 @@ my $html_foot = sub { 'billed' => 'done', ; - #XXX src & charged party (& default prefix) as per voip_cdr.pm - #XXX handle toll free too - my $number = $svc_phone->phonenum; $number = $svc_phone->countrycode. $number unless $svc_phone->countrycode eq '1'; + #src & charged party as per voip_cdr.pm + my $search; + my $cust_pkg = $svc_phone->cust_svc->cust_pkg; + if ( $cust_pkg && $cust_pkg->part_pkg->option('disable_src') ) { + $search = "charged_party=$number"; + } else { + $search = "charged_party_or_src=$number"; + } + + #XXX default prefix as per voip_cdr.pm + #XXX handle toll free too + #my @links = map { # qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">). # "View $_ CDRs</A>"; #} keys(%what); my @links = map { - qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;charged_party=$number;freesidestatus=$what{$_}">). + qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;$search;freesidestatus=$what{$_}">). "View $_ CDRs</A>"; } keys(%what); |