From c82d349f864e6bd9f96fd1156903bc1f7193a203 Mon Sep 17 00:00:00 2001 From: cvs2git Date: Mon, 27 Dec 2010 00:04:45 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'TORRUS_1_0_9'. --- httemplate/view/REAL_logo.cgi | 14 - httemplate/view/attachment.html | 16 - httemplate/view/bill_batch.cgi | 99 ----- httemplate/view/cust_bill-logo.cgi | 31 -- httemplate/view/cust_bill-pdf.cgi | 40 -- httemplate/view/cust_bill-ps.cgi | 35 -- httemplate/view/cust_bill.cgi | 152 ------- httemplate/view/cust_main.cgi | 324 -------------- httemplate/view/cust_main/attachments.html | 156 ------- httemplate/view/cust_main/billing.html | 266 ----------- httemplate/view/cust_main/change_history.html | 317 ------------- httemplate/view/cust_main/contacts.html | 122 ------ httemplate/view/cust_main/custom.html | 21 - httemplate/view/cust_main/locations.html | 87 ---- httemplate/view/cust_main/misc.html | 139 ------ httemplate/view/cust_main/notes.html | 166 ------- .../view/cust_main/one_time_charge_link.html | 91 ---- httemplate/view/cust_main/order_pkg_link.html | 16 - httemplate/view/cust_main/packages.html | 184 -------- httemplate/view/cust_main/packages/location.html | 66 --- httemplate/view/cust_main/packages/package.html | 264 ----------- httemplate/view/cust_main/packages/section.html | 95 ---- httemplate/view/cust_main/packages/services.html | 178 -------- httemplate/view/cust_main/packages/status.html | 488 --------------------- httemplate/view/cust_main/payment_history.html | 465 -------------------- .../payment_history/attempted_payment.html | 41 -- .../view/cust_main/payment_history/credit.html | 156 ------- .../view/cust_main/payment_history/invoice.html | 45 -- .../view/cust_main/payment_history/payment.html | 228 ---------- .../cust_main/payment_history/pending_payment.html | 61 --- .../view/cust_main/payment_history/refund.html | 50 --- .../view/cust_main/payment_history/statement.html | 34 -- .../cust_main/payment_history/voided_payment.html | 60 --- httemplate/view/cust_main/qual_link.html | 16 - httemplate/view/cust_main/tickets.html | 117 ----- httemplate/view/cust_pay.html | 186 -------- httemplate/view/cust_pay_void.html | 1 - httemplate/view/cust_refund.html | 142 ------ httemplate/view/cust_statement-pdf.cgi | 28 -- httemplate/view/cust_statement.html | 79 ---- httemplate/view/cust_svc.cgi | 23 - httemplate/view/elements/svc_Common.html | 185 -------- httemplate/view/elements/svc_export_settings.html | 34 -- httemplate/view/elements/tr.html | 9 - httemplate/view/image.cgi | 31 -- httemplate/view/logo.cgi | 47 -- httemplate/view/prospect_main.html | 109 ----- httemplate/view/qual.cgi | 65 --- httemplate/view/svc_Common.html | 31 -- httemplate/view/svc_acct.cgi | 147 ------- httemplate/view/svc_acct/basics.html | 136 ------ httemplate/view/svc_acct/cardfortress.html | 27 -- httemplate/view/svc_acct/change_svc.html | 21 - httemplate/view/svc_acct/change_svc_form.html | 23 - httemplate/view/svc_acct/communigate.html | 142 ------ httemplate/view/svc_acct/hosting.html | 38 -- httemplate/view/svc_acct/radius_usage.html | 77 ---- httemplate/view/svc_acct/usage.html | 27 -- httemplate/view/svc_broadband.cgi | 219 --------- httemplate/view/svc_cert.cgi | 205 --------- httemplate/view/svc_domain.cgi | 82 ---- httemplate/view/svc_domain/acct_defaults.html | 149 ------- httemplate/view/svc_domain/basics.html | 158 ------- httemplate/view/svc_domain/dns.html | 150 ------- httemplate/view/svc_dsl.cgi | 65 --- httemplate/view/svc_external.cgi | 65 --- httemplate/view/svc_forward.cgi | 124 ------ httemplate/view/svc_mailinglist.cgi | 71 --- httemplate/view/svc_pbx.cgi | 72 --- httemplate/view/svc_phone.cgi | 171 -------- httemplate/view/svc_www.cgi | 106 ----- 71 files changed, 7885 deletions(-) delete mode 100755 httemplate/view/REAL_logo.cgi delete mode 100644 httemplate/view/attachment.html delete mode 100644 httemplate/view/bill_batch.cgi delete mode 100755 httemplate/view/cust_bill-logo.cgi delete mode 100755 httemplate/view/cust_bill-pdf.cgi delete mode 100755 httemplate/view/cust_bill-ps.cgi delete mode 100755 httemplate/view/cust_bill.cgi delete mode 100755 httemplate/view/cust_main.cgi delete mode 100755 httemplate/view/cust_main/attachments.html delete mode 100644 httemplate/view/cust_main/billing.html delete mode 100644 httemplate/view/cust_main/change_history.html delete mode 100644 httemplate/view/cust_main/contacts.html delete mode 100644 httemplate/view/cust_main/custom.html delete mode 100755 httemplate/view/cust_main/locations.html delete mode 100644 httemplate/view/cust_main/misc.html delete mode 100755 httemplate/view/cust_main/notes.html delete mode 100644 httemplate/view/cust_main/one_time_charge_link.html delete mode 100644 httemplate/view/cust_main/order_pkg_link.html delete mode 100755 httemplate/view/cust_main/packages.html delete mode 100644 httemplate/view/cust_main/packages/location.html delete mode 100644 httemplate/view/cust_main/packages/package.html delete mode 100755 httemplate/view/cust_main/packages/section.html delete mode 100644 httemplate/view/cust_main/packages/services.html delete mode 100644 httemplate/view/cust_main/packages/status.html delete mode 100644 httemplate/view/cust_main/payment_history.html delete mode 100644 httemplate/view/cust_main/payment_history/attempted_payment.html delete mode 100644 httemplate/view/cust_main/payment_history/credit.html delete mode 100644 httemplate/view/cust_main/payment_history/invoice.html delete mode 100644 httemplate/view/cust_main/payment_history/payment.html delete mode 100644 httemplate/view/cust_main/payment_history/pending_payment.html delete mode 100644 httemplate/view/cust_main/payment_history/refund.html delete mode 100644 httemplate/view/cust_main/payment_history/statement.html delete mode 100644 httemplate/view/cust_main/payment_history/voided_payment.html delete mode 100644 httemplate/view/cust_main/qual_link.html delete mode 100644 httemplate/view/cust_main/tickets.html delete mode 100644 httemplate/view/cust_pay.html delete mode 100644 httemplate/view/cust_pay_void.html delete mode 100644 httemplate/view/cust_refund.html delete mode 100755 httemplate/view/cust_statement-pdf.cgi delete mode 100755 httemplate/view/cust_statement.html delete mode 100644 httemplate/view/cust_svc.cgi delete mode 100644 httemplate/view/elements/svc_Common.html delete mode 100644 httemplate/view/elements/svc_export_settings.html delete mode 100644 httemplate/view/elements/tr.html delete mode 100644 httemplate/view/image.cgi delete mode 100644 httemplate/view/logo.cgi delete mode 100644 httemplate/view/prospect_main.html delete mode 100644 httemplate/view/qual.cgi delete mode 100644 httemplate/view/svc_Common.html delete mode 100755 httemplate/view/svc_acct.cgi delete mode 100644 httemplate/view/svc_acct/basics.html delete mode 100644 httemplate/view/svc_acct/cardfortress.html delete mode 100644 httemplate/view/svc_acct/change_svc.html delete mode 100644 httemplate/view/svc_acct/change_svc_form.html delete mode 100644 httemplate/view/svc_acct/communigate.html delete mode 100644 httemplate/view/svc_acct/hosting.html delete mode 100644 httemplate/view/svc_acct/radius_usage.html delete mode 100644 httemplate/view/svc_acct/usage.html delete mode 100644 httemplate/view/svc_broadband.cgi delete mode 100644 httemplate/view/svc_cert.cgi delete mode 100755 httemplate/view/svc_domain.cgi delete mode 100644 httemplate/view/svc_domain/acct_defaults.html delete mode 100644 httemplate/view/svc_domain/basics.html delete mode 100644 httemplate/view/svc_domain/dns.html delete mode 100644 httemplate/view/svc_dsl.cgi delete mode 100644 httemplate/view/svc_external.cgi delete mode 100755 httemplate/view/svc_forward.cgi delete mode 100644 httemplate/view/svc_mailinglist.cgi delete mode 100644 httemplate/view/svc_pbx.cgi delete mode 100644 httemplate/view/svc_phone.cgi delete mode 100644 httemplate/view/svc_www.cgi (limited to 'httemplate/view') diff --git a/httemplate/view/REAL_logo.cgi b/httemplate/view/REAL_logo.cgi deleted file mode 100755 index c269c7d04..000000000 --- a/httemplate/view/REAL_logo.cgi +++ /dev/null @@ -1,14 +0,0 @@ -<% $conf->config_binary("logo.png", $agentnum) %> -<%init> - -my $conf = new FS::Conf; - -my $agentnum = ''; -my @agentnums = $FS::CurrentUser::CurrentUser->agentnums; -if ( scalar(@agentnums) == 1 ) { - $agentnum = $agentnums[0]; -} - -http_header('Content-Type' => 'image/png' ); - - diff --git a/httemplate/view/attachment.html b/httemplate/view/attachment.html deleted file mode 100644 index 5fc053967..000000000 --- a/httemplate/view/attachment.html +++ /dev/null @@ -1,16 +0,0 @@ -<% $attach->body %> -<%init> -my ($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $attachnum = $1 or die 'Invalid attachment number'; -$FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'access denied'; - -my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die "Attachment not found: $attachnum"; -die 'access denied' if $attach->disabled; - -$m->clear_buffer; -$r->content_type($attach->mime_type || 'text/plain'); -$r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename); - - - diff --git a/httemplate/view/bill_batch.cgi b/httemplate/view/bill_batch.cgi deleted file mode 100644 index 3fca6ebbe..000000000 --- a/httemplate/view/bill_batch.cgi +++ /dev/null @@ -1,99 +0,0 @@ -% if($magic eq 'print') { -<% include('/elements/header.html', "Download Batch") %> -
- -% $cgi->delete('magic'); -<% include('/elements/progress-init.html', - 'OneTrueForm', - [ 'batchnum' ], - $p.'misc/process/bill_batch-print.html', - {'url' => $cgi->self_url . ';magic=download'}, - '', -) %>
- -<% include('/elements/footer.html') %> -% } -% -% elsif($magic eq 'download') { -% $m->clear_buffer; -% $r->content_type('application/pdf'); -% $r->headers_out->add('Content-Disposition' => 'attachment;filename="invoice_batch_'.$batchnum.'.pdf"'); -<% $batch->pdf %> -% $batch->pdf(''); -% my $error = $batch->replace; -% warn "error deleting cached PDF: '$error'\n" if $error; -% } -% else { -<% include('/search/elements/search.html', - 'title' => $close ? - "Batch $batchnum closed." : - "Invoice Batch $batchnum", - 'name' => 'invoices', - 'query' => { 'table' => 'cust_bill_batch', - 'select' => join(', ', - 'cust_bill.*', - FS::UI::Web::cust_sql_fields(), - 'cust_main.custnum AS cust_main_custnum', - ), - 'hashref' => { }, - 'addl_from' => - 'LEFT JOIN cust_bill USING ( invnum ) '. - 'LEFT JOIN cust_main USING ( custnum )', - 'extra_sql' => '', - " WHERE batchnum = $batchnum", - }, - 'count_query' => "SELECT COUNT(*) FROM cust_bill_batch WHERE batchnum = $batchnum", - 'html_init' => $html_init, - 'header' => [ 'Invoice #', - 'Amount', - 'Date', - 'Customer', - ], - 'fields' => [ sub { shift->cust_bill->display_invnum }, - sub { sprintf($money_char.'%.2f', - shift->cust_bill->charged ) }, - sub { time2str('%b %d %Y', - shift->cust_bill->_date ) }, - sub { shift->cust_bill->cust_main->name }, - ], - 'align' => 'rrll', - 'links' => [ ($link) x 3, $clink, - ], - 'really_disable_download' => 1, -) %> -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); - -my $conf = new FS::Conf; -my $batch; -my $batchnum = $cgi->param('batchnum'); - -$batch = FS::bill_batch->by_key($batchnum); -die "Batch '$batchnum' not found!\n" if !$batch; - -my $magic = $cgi->param('magic'); -my $html_init = ''; - -my $close = $cgi->param('close'); -$batch->close if $close; - -if(!$magic) { - $cgi->param('magic' => 'print'); - $cgi->delete('close'); - $html_init = 'Download this batch
'; - if($batch->status eq 'O') { - $cgi->param('close' => 1); - $cgi->delete('magic'); - $html_init .= 'Close this batch
'; - } - $html_init .= '
'; -} - -my $link = [ "$p/view/cust_bill.cgi?", 'invnum' ]; -my $clink = [ "$p/view/cust_main.cgi?", 'custnum' ]; -my $money_char = $conf->config('money_char') || '$'; - - diff --git a/httemplate/view/cust_bill-logo.cgi b/httemplate/view/cust_bill-logo.cgi deleted file mode 100755 index ad2ff5430..000000000 --- a/httemplate/view/cust_bill-logo.cgi +++ /dev/null @@ -1,31 +0,0 @@ -<% $conf->config_binary("logo$templatename.png", $agentnum) %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices') - or $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $conf = new FS::Conf; - -my $templatename; -my $agentnum = ''; -if ( $cgi->param('invnum') ) { - $templatename = $cgi->param('template') || $cgi->param('templatename'); - my $cust_bill = qsearchs('cust_bill', { 'invnum' => $cgi->param('invnum') } ) - or die 'unknown invnum'; - $agentnum = $cust_bill->cust_main->agentnum; -} else { - my($query) = $cgi->keywords; - $query =~ /^([^\.\/]*)$/ or die 'illegal query'; - $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 deleted file mode 100755 index 51e47e00d..000000000 --- a/httemplate/view/cust_bill-pdf.cgi +++ /dev/null @@ -1,40 +0,0 @@ -<% $pdf %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); - -my( $invnum, $template, $notice_name ); -my($query) = $cgi->keywords; -if ( $query =~ /^((.+)-)?(\d+)(.pdf)?$/ ) { - $template = $2; - $invnum = $3; - $notice_name = 'Invoice'; -} else { - $invnum = $cgi->param('invnum'); - $invnum =~ s/\.pdf//i; - $template = $cgi->param('template'); - $notice_name = ( $cgi->param('notice_name') || 'Invoice' ); -} - -my %opt = ( - 'template' => $template, - 'notice_name' => $notice_name, -); - -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(\%opt); - -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 deleted file mode 100755 index 881491f69..000000000 --- a/httemplate/view/cust_bill-ps.cgi +++ /dev/null @@ -1,35 +0,0 @@ -<% $cust_bill->print_ps(\%opt) %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); - -my( $invnum, $template, $notice_name ); -my($query) = $cgi->keywords; -if ( $query =~ /^((.+)-)?(\d+)(.pdf)?$/ ) { - $template = $2; - $invnum = $3; - $notice_name = 'Invoice'; -} else { - $invnum = $cgi->param('invnum'); - $template = $cgi->param('template'); - $notice_name = ( $cgi->param('notice_name') || 'Invoice' ); -} - -my %opt = ( - 'template' => $template, - 'notice_name' => $notice_name, -); - -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 deleted file mode 100755 index 0928d04bc..000000000 --- a/httemplate/view/cust_bill.cgi +++ /dev/null @@ -1,152 +0,0 @@ -<% include("/elements/header.html",'Invoice View', menubar( - "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", -)) %> - -% if ( $conf->exists('deleteinvoices') -% && $curuser->access_right('Delete invoices' ) -% ) -% { - - - - Delete this invoice -

- -% } - -% if ( $cust_bill->owed > 0 -% && scalar( grep $payby{$_}, qw(BILL CASH WEST MCRD) ) -% && $curuser->access_right(['Post payment', 'Post check payment', 'Post cash payment']) -% && ! $conf->exists('pkg-balances') -% ) -% { -% my $s = 0; - - Post - -% if ( $payby{'BILL'} && $curuser->access_right(['Post payment', 'Post check payment']) ) { - <% $s++ ? ' | ' : '' %> - check -% } - -% if ( $payby{'CASH'} && $curuser->access_right(['Post payment', 'Post cash payment']) ) { - <% $s++ ? ' | ' : '' %> - cash -% } - -% if ( $payby{'WEST'} && $curuser->access_right(['Post payment']) ) { - <% $s++ ? ' | ' : '' %> - Western Union -% } - -% if ( $payby{'MCRD'} && $curuser->access_right(['Post payment']) ) { - <% $s++ ? ' | ' : '' %> - manual credit card -% } - - payment against this invoice

- -% } - -% if ( $curuser->access_right('Resend invoices') ) { - - Re-print this invoice - -% if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { - | Re-email this invoice -% } - -% if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { - | Re-fax this invoice -% } - -

- -% } - -% if ( $conf->exists('invoice_latex') ) { - - View typeset invoice PDF -

-% } - -% my $br = 0; -% if ( $cust_bill->num_cust_event ) { $br++; -( View invoice events ) -% } - -% if ( $cust_bill->num_cust_bill_event ) { $br++; -( View deprecated, old-style invoice events ) -% } - -<% $br ? '

' : '' %> - -% if ( $conf->exists('invoice_html') ) { - <% join('', $cust_bill->print_html(\%opt) ) %> -% } else { -
<% join('', $cust_bill->print_text(\%opt) ) %>
-% } - -<% include('/elements/footer.html') %> -<%init> - -my $curuser = $FS::CurrentUser::CurrentUser; - -die "access denied" - unless $curuser->access_right('View invoices'); - -my( $invnum, $template, $notice_name ); -my($query) = $cgi->keywords; -if ( $query =~ /^((.+)-)?(\d+)$/ ) { - $template = $2; - $invnum = $3; - $notice_name = 'Invoice'; -} else { - $invnum = $cgi->param('invnum'); - $template = $cgi->param('template'); - $notice_name = $cgi->param('notice_name'); -} - -my $conf = new FS::Conf; - -my %opt = ( - 'unsquelch_cdr' => $conf->exists('voip-cdr_email'), - 'template' => $template, - 'notice_name' => $notice_name, -); - -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 '. $curuser->agentnums_sql, -}); -die "Invoice #$invnum not found!" unless $cust_bill; - -my $custnum = $cust_bill->custnum; -my $display_custnum = $cust_bill->cust_main->display_custnum; - -#my $printed = $cust_bill->printed; - -my $link = "invnum=$invnum"; -$link .= ';template='. uri_escape($template) if $template; -$link .= ';notice_name='. $notice_name if $notice_name; - - diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi deleted file mode 100755 index e6db0a6c1..000000000 --- a/httemplate/view/cust_main.cgi +++ /dev/null @@ -1,324 +0,0 @@ -<% include('/elements/header.html', { - 'title' => $title, - 'nobr' => 1, - }) -%> -
-% my @part_tag = $cust_main->part_tag; -% if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) { - -% foreach my $part_tag ( @part_tag ) { - - - -% } -
- tagcolor) - ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"' - : '' - %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %> -
-% } - -<% include('/elements/menubar.html', - { 'newstyle' => 1, - 'selected' => $viewname{$view}, - 'url_base' => $cgi->url. "?custnum=$custnum;show=", - }, - %views, - ) -%> -
- -<% include('/elements/init_overlib.html') %> - - - -% if ( $view eq 'basics' || $view eq 'jumbo' ) { - -% if ( $curuser->access_right('Edit customer') ) { - Edit this customer | -% } - -% if ( $curuser->access_right('Cancel customer') -% && $cust_main->ncancelled_pkgs -% ) { - - <% include( '/elements/popup_link-cust_main.html', - { 'action' => $p. 'misc/cancel_cust.html', - 'label' => 'Cancel this customer', - 'actionlabel' => 'Confirm Cancellation', - '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') -% ) { - Delete this customer | -% } - -% unless ( $conf->exists('disable_customer_referrals') ) { - Refer a new customer | - View this customer's referrals -% } - -

- -% my $br = 0; -% if ( $curuser->access_right('Billing event reports') -% || $curuser->access_right('View customer billing events') -% ) { -% $br=1; - View billing events for this customer -% } - -% if ( $conf->config('cust_main-external_links') ) { - <% $br++ ? ' | ' : '' %> -% my @links = split(/\n/, $conf->config('menu-prepend_links')); -% foreach my $link (@links) { -% $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next; -% my($url, $label, $alt) = ($1, $2, $4); - <% $label |h %> -% } -% } - -% if ( $br ) { -

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

-% } - -%if ( $conf->exists('maestro-status_test') ) { - Test maestro status

-% } - - - - - - - -
- <% include('cust_main/contacts.html', $cust_main ) %> - - <% include('cust_main/misc.html', $cust_main ) %> -% if ( $conf->config('payby-default') ne 'HIDE' ) { - -
- <% include('cust_main/billing.html', $cust_main ) %> -% } - -
- -% } - -% if ( $view eq 'notes' || $view eq 'jumbo' ) { - -%if ( $cust_main->comments =~ /[^\s\n\r]/ ) { -
-Comments -<% ntable("#cccccc") %><% ntable("#cccccc",2) %> - - -
<% encode_entities($cust_main->comments) %>
- - - -

-% } - -% my $notecount = scalar($cust_main->notes(0)); -% if ( ! $conf->exists('cust_main-disable_notes') || $notecount) { - -% unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) { -
-
Notes
-% } - -% if ( $curuser->access_right('Add customer note') && -% ! $conf->exists('cust_main-disable_notes') -% ) { - - <% include( '/elements/popup_link-cust_main.html', - 'label' => 'Add customer note', - 'action' => $p. 'edit/cust_main_note.cgi', - 'actionlabel' => 'Enter customer note', - 'cust_main' => $cust_main, - 'width' => 616, - 'height' => 538, #575 - ) - %> - -% } - -
- -<% include('cust_main/notes.html', 'custnum' => $cust_main->custnum ) %> - -% } -
- -% if(! $conf->config('disable_cust_attachment') -% and $curuser->access_right('Add attachment')) { -<% include( '/elements/popup_link-cust_main.html', - 'label' => 'Attach file', - 'action' => $p.'edit/cust_main_attach.cgi', - 'actionlabel' => 'Upload file', - 'cust_main' => $cust_main, - 'width' => 480, - 'height' => 296, - ) -%> -% } -% if( $curuser->access_right('View attachments') ) { -<% include('cust_main/attachments.html', 'custnum' => $cust_main->custnum ) %> -% if ($cgi->param('show_deleted')) { -">(Show active attachments) -% } -% elsif($curuser->access_right('View deleted attachments')) { -">(Show deleted attachments) -% } -% } -
- -% } - -% if ( $view eq 'jumbo' ) { -

- Tickets
-% } - -% if ( $view eq 'tickets' || $view eq 'jumbo' ) { - -% if ( $conf->config('ticket_system') ) { - <% include('cust_main/tickets.html', $cust_main ) %> -% } -

- -% } - -% if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') { - - Packages
-% } - -% if ( $view eq 'packages' || $view eq 'jumbo' ) { - -% #XXX enable me# if ( $curuser->access_right('View customer packages') { -<% include('cust_main/packages.html', $cust_main ) %> -% #} - -% } - -% if ( $view eq 'jumbo' ) { -

- Payment History
-% } - -% if ( $view eq 'payment_history' || $view eq 'jumbo' ) { - -% if ( $conf->config('payby-default') ne 'HIDE' ) { - <% include('cust_main/payment_history.html', $cust_main ) %> -% } - -% } - -% if ( $view eq 'change_history' ) { # || $view eq 'jumbo' -<% include('cust_main/change_history.html', $cust_main ) %> -% } - -% if ( $view eq 'custom' ) { -<% include('cust_main/custom.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; - -my $custnum; -if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { - $custnum = $1; -} else { - die "No customer specified (bad URL)!" unless $cgi->keywords; - my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array - $query =~ /^(\d+)$/; - $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; - -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', - 'Notes' => 'notes', #notes and files? -; -$views{'Tickets'} = 'tickets' - if $conf->config('ticket_system'); -$views{'Packages'} = 'packages'; -$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; - -my $view = $cgi->param('show') || $curuser->default_customer_view; - - diff --git a/httemplate/view/cust_main/attachments.html b/httemplate/view/cust_main/attachments.html deleted file mode 100755 index bdd4f5917..000000000 --- a/httemplate/view/cust_main/attachments.html +++ /dev/null @@ -1,156 +0,0 @@ -% if ( scalar(@attachments) ) { - - <% include('/elements/init_overlib.html') %> - - <% include("/elements/table-grid.html") %> - - - Date -% if ( $conf->exists('cust_main_note-display_times') ) { - Time -% } - Person - Filename - Description - Type - Size - - - -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = ''; -% if($cgi->param('show_deleted')) { -% if ($curuser->access_right('View deleted attachments')) { -% @attachments = grep { $_->disabled } @attachments; -% } -% else { -% @attachments = (); -% } -% } -% else { -% @attachments = grep { not $_->disabled } @attachments; -% } -% -% foreach my $attach (@attachments) { -% -% if ( $bgcolor eq $bgcolor1 ) { -% $bgcolor = $bgcolor2; -% } else { -% $bgcolor = $bgcolor1; -% } -% -% my $pop = popurl(3); -% my $attachnum = $attach->attachnum; -% my $edit = ''; -% if($attach->disabled) { # then you can undelete it or purge it. -% if ($curuser->access_right('Undelete attachment')) { -% my $clickjs = popup('edit/process/cust_main_attach.cgi?'. -% "custnum=$custnum;attachnum=$attachnum;". -% "undelete=1", -% 'Undelete attachment'); -% $edit .= qq!  (undelete)!; -% } -% if ($curuser->access_right('Purge attachment')) { -% my $clickjs = popup('edit/process/cust_main_attach.cgi?'. -% "custnum=$custnum;attachnum=$attachnum;". -% "purge=1", -% 'Purge attachment', -% 'Permanently remove this file?'); -% $edit .= qq!  (purge)!; -% } -% } -% else { # you can download or edit it -% if ($curuser->access_right('Edit attachment') ) { -% my $clickjs = popup('edit/cust_main_attach.cgi?'. -% "custnum=$custnum;attachnum=$attachnum", -% 'Edit attachment properties'); -% $edit .= qq!  (edit)!; -% } -% if($curuser->access_right('Delete attachment') ) { -% my $clickjs = popup('edit/process/cust_main_attach.cgi?'. -% "custnum=$custnum;attachnum=$attachnum;delete=1", -% 'Delete attachment', -% 'Delete this file?'); -% $edit .= qq!  (delete)!; -% } -% if ($curuser->access_right('Download attachment') ) { -% $edit .= qq!  (download)!; -% } -% } - - - <% note_datestr($attach,$conf,$bgcolor) %> - -  <% $attach->usernum ? $attach->access_user->name : $attach->otaker %> - - -  <% $attach->filename %> - - -  <% $attach->title %> - -  <% $attach->mime_type %> - - -  <% size_units( $attach->size ) %> - - - <% $edit %> - - - -% } #end display notes - - - -% } -<%init> - -my $conf = new FS::Conf; -my $curuser = $FS::CurrentUser::CurrentUser; -die "access denied" if !$curuser->access_right('View attachments'); -my(%opt) = @_; - -my $custnum = $opt{'custnum'}; - -my $cust_main = qsearchs('cust_main', {'custnum' => $custnum} ); -die "Customer not found!" unless $cust_main; - -my (@attachments) = qsearch('cust_attachment', {'custnum' => $custnum}); - -#subroutines - -sub note_datestr { - my($note, $conf, $bgcolor) = @_ or return ''; - my $td = qq{}; - my $format = "$td%b %o, %Y"; - $format .= "$td%l:%M%P" - if $conf->exists('cust_main_note-display_times'); - ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g; - $strip; -} - -sub size_units { - my $bytes = shift; - return $bytes if $bytes < 1024; - return int($bytes / 1024)."K" if $bytes < 1048576; - return int($bytes / 1048576)."M"; -} - -sub popup { - my ($url, $label, $confirm) = @_; - my $onclick = - include('/elements/popup_link_onclick.html', - 'action' => popurl(2).$url, - 'actionlabel' => $label, - 'width' => 510, - 'height' => 315, - 'frame' => 'top', - ); - $onclick = qq!if(confirm('$confirm')) { $onclick }! if $confirm; - return qq!onclick="$onclick"!; -} - - - diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html deleted file mode 100644 index 014ddaba2..000000000 --- a/httemplate/view/cust_main/billing.html +++ /dev/null @@ -1,266 +0,0 @@ -Billing information -%# If we can't see the unencrypted card, then bill now is an exercise in -%# frustration (without some sort of job queue magic to send it to a secure -%# machine, anyway) -%if ( $FS::CurrentUser::CurrentUser->access_right('Bill customer now') -% && ! $cust_main->is_encrypted($cust_main->payinfo) -% ) { -%# (Bill now) - (<% include('/elements/bill.html', - custnum => $cust_main->custnum, - label => 'Bill now', - url => $p.'view/cust_main.cgi?'.$cust_main->custnum, - ) %>) -% } - -<% ntable("#cccccc") %><% ntable("#cccccc",2) %> - -%( my $balance = $cust_main->balance ) -% =~ s/^(\-?)(.*)$/$1<\/FONT>$money_char$2/; - - - Balance due - <% $balance %> - - - - Billing type - -% if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) { - - - Credit card <% $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' %> - - - - Card number - <% $cust_main->paymask %> - -% -%#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" %> - -% if ( $cust_main->paystart_month ) { - - - Start date - <% $cust_main->paystart_month. '/'. $cust_main->paystart_year %> - -% } elsif ( $cust_main->payissue ) { - - - Issue # - <% $cust_main->payissue %> - -% } - - - - Name on card - <% $cust_main->payname %> - -% } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') { -% my( $account, $aba ) = split('@', $cust_main->paymask ); - - - Electronic check <% $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' %> - - - - ABA/Routing code - <% $aba %> - - - Account number - <% $account %> - - - Account type - <% $cust_main->paytype %> - - - Bank name - <% $cust_main->payname %> - -% if ( $conf->exists('show_bankstate') ) { - - <% $paystate_label %> - <% $cust_main->paystate || '   ' %> - -% } -% } 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 %> - -% } elsif ( $cust_main->payby eq 'BILL' ) { - - - Billing - - -% if ( $cust_main->payinfo ) { - - - P.O. - <% $cust_main->payinfo %> - -% } - - - - Attention - <% $cust_main->payname |h %> - -% } 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 ) = ( '', '' ); -%} -% - - - Expiration - <% "$mon/$year" %> - -% } - -% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups'); - - Tax exempt<% @exempt_groups ? ' (all taxes)' : '' %> - <% $cust_main->tax ? 'yes' : 'no' %> - -% foreach my $exempt_group ( @exempt_groups ) { - - Tax exempt (<% $exempt_group %> taxes) - <% $cust_main->tax_exemption($exempt_group) ? 'yes' : 'no' %> - -% } - -% if ( $conf->exists('enable_taxproducts') ) { - - Tax location - <% $cust_main->geocode('cch') %> - -% } - - Postal invoices - - <% ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %> - - - - FAX invoices - - <% ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %> - - - - Email invoices - - <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %> - - - - Invoice terms - - <% $cust_main->invoice_terms || 'Default ('. ( $conf->config('invoice_default_terms') || 'Payable upon receipt' ). ')' %> - - - - Credit limit - - <% length($cust_main->credit_limit) ? - $money_char.sprintf("%.2f", $cust_main->credit_limit) : - 'Unlimited' %> - - - -% if ( $conf->exists('voip-cust_cdr_spools') ) { - - Spool CDRs - <% $cust_main->spool_cdr ? 'yes' : 'no' %> - -% } - -% if ( $conf->exists('voip-cust_cdr_squelch') ) { - - Print CDRs - <% $cust_main->squelch_cdr ? 'no' : 'yes' %> - -% } - -% if ( $conf->exists('voip-cust_email_csv_cdr') ) { - - Email CDRs as CSV - <% $cust_main->email_csv_cdr ? 'yes' : 'no' %> - -% } - -% if ( $show_term || $cust_main->cdr_termination_percentage ) { - - CDR termination settlement - <% $cust_main->cdr_termination_percentage %><% $cust_main->cdr_termination_percentage =~ /\d/ ? '%' : '' %> - -% } - - -<%once> - -my $paystate_label = FS::Msgcat::_gettext('paystate'); -$paystate_label = 'Bank state' if $paystate_label =~/^paystate$/; - - -<%init> - -my( $cust_main ) = @_; -my @invoicing_list = $cust_main->invoicing_list; -my $conf = new FS::Conf; -my $money_char = $conf->config('money_char') || '$'; - -#false laziness w/edit/cust_main/billing.html -my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1"; -my $term_sth = dbh->prepare($term_sql) or die dbh->errstr; -$term_sth->execute($cust_main->custnum) or die $term_sth->errstr; -my $show_term = $term_sth->fetchrow_arrayref->[0]; - - diff --git a/httemplate/view/cust_main/change_history.html b/httemplate/view/cust_main/change_history.html deleted file mode 100644 index 78ff67ca4..000000000 --- a/httemplate/view/cust_main/change_history.html +++ /dev/null @@ -1,317 +0,0 @@ -% if ( int( time - (keys %years)[0] * 31556736 ) > $start ) { - Show: -% my $chy = $cgi->param('change_history-years'); -% foreach my $y (keys %years) { -% if ( $y == $years ) { - <% $years{$y} %> -% } else { -% $cgi->param('change_history-years', $y); - <% $years{$y} %> -% } -% last if int( time - $y * 31556736 ) < $start; -% } -% $cgi->param('change_history-years', $chy); -% } - -<% include("/elements/table-grid.html") %> -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = ''; - - - User - Date - Time - Item - Action - Description - - -% foreach my $item ( sort { $a->history_date <=> $b->history_date -% #|| table order -% || $a->historynum <=> $b->historynum -% } -% @history -% ) -% { -% -% my $history_other = ''; -% my $act = $item->history_action; -% if ( $act =~ /^replace/ ) { -% my $pkey = $item->primary_key; -% my $date = $item->history_date; -% $history_other = qsearchs({ -% 'table' => $item->table, -% 'hashref' => { $pkey => $item->$pkey(), -% 'history_action' => $replace_other{$act}, -% 'historynum' => { 'op' => $replace_dir{$act}, -% 'value' => $item->historynum -% }, -% }, -% 'extra_sql' => " -% AND history_date $replace_direq{$act} $date -% AND ($date $replace_op{$act} $fuzz) $replace_direq{$act} history_date -% ORDER BY historynum $replace_ord{$act} LIMIT 1 -% ", -% }); -% } -% -% if ( $bgcolor eq $bgcolor1 ) { -% $bgcolor = $bgcolor2; -% } else { -% $bgcolor = $bgcolor1; -% } - - - -% my $otaker = $item->history_user; -% $otaker = 'auto billing' if $otaker eq 'fs_daily'; -% $otaker = 'customer self-service' if $otaker eq 'fs_selfservice'; -% $otaker = 'job queue' if $otaker eq 'fs_queue'; - <% $otaker %> - - -% my $d = time2str('%b %o, %Y', $item->history_date ); -% $d =~ s/ / /g; - <% $d %> - - -% my $t = time2str('%r', $item->history_date ); -% $t =~ s/ / /g; - <% $t %> - - -% my $label = $h_tables{$item->table}; -% $label = &{ $h_table_labelsub{$item->table} }( $item, $label ) -% if $h_table_labelsub{$item->table}; - <% $label %> - - - <% $action{$item->history_action} %> - - - <% join(', ', - map { my $value = ( $_ =~ /(^pay(info|cvv)|^ss|_password)$/ ) - ? 'N/A' - : $item->get($_); - $value = time2str($cust_pkg_date_format, $value) - if $item->table eq 'h_cust_pkg' - && $cust_pkg_date_fields{$_} - && $value; - - $value = substr($value, 0, 77).'...' if length($value) > 80; - $value = encode_entities($value); - "$_:$value"; - } - grep { $history_other - ? ( $item->get($_) ne $history_other->get($_) ) - : ( $item->get($_) =~ /\S/ ) - } - grep { ! /^(history|custnum$)/i } - $item->fields - ) - %> - - - -% } - - -<%once> - -# length-switching - -tie my %years, 'Tie::IxHash', - .5 => '6 months', - 1 => '1 year', - 2 => '2 years', - 5 => '5 years', - 39 => 'all history', -; - -# labeling history rows - -my %action = ( - 'insert' => 'Insert', #'Create', - 'replace_old' => 'Change from', - 'replace_new' => 'Change to', - 'delete' => 'Remove', -); - -# finding the other replace row - -my %replace_other = ( - 'replace_new' => 'replace_old', - 'replace_old' => 'replace_new', -); -my %replace_dir = ( - 'replace_new' => '<', - 'replace_old' => '>', -); -my %replace_direq = ( - 'replace_new' => '<=', - 'replace_old' => '>=', -); -my %replace_op = ( - 'replace_new' => '-', - 'replace_old' => '+', -); -my %replace_ord = ( - 'replace_new' => 'DESC', - 'replace_old' => 'ASC', -); - -my $fuzz = 5; #seems like a lot - -# which tables to search and what to call them - -tie my %tables, 'Tie::IxHash', - 'cust_main' => 'Customer', - 'cust_main_invoice' => 'Invoice destination', - 'cust_pkg' => 'Package', - #? or just svc_* ? 'cust_svc' => - 'svc_acct' => 'Account', - 'radius_usergroup' => 'RADIUS group', - 'svc_domain' => 'Domain', - 'svc_www' => 'Hosting', - 'svc_forward' => 'Mail forward', - 'svc_broadband' => 'Broadband', - 'svc_external' => 'External service', - 'svc_phone' => 'Phone', - 'phone_device' => 'Phone device', - #? it gets provisioned anyway 'phone_avail' => 'Phone', -; - -my $svc_join = 'JOIN cust_svc USING ( svcnum ) JOIN cust_pkg USING ( pkgnum )'; - -my %table_join = ( - 'svc_acct' => $svc_join, - 'radius_usergroup' => $svc_join, - 'svc_domain' => $svc_join, - 'svc_www' => $svc_join, - 'svc_forward' => $svc_join, - 'svc_broadband' => $svc_join, - 'svc_external' => $svc_join, - 'svc_phone' => $svc_join, - 'phone_device' => $svc_join, -); - -my %h_tables = map { ( "h_$_" => $tables{$_} ) } keys %tables; - -my %pkgpart = (); -my $pkg_labelsub = sub { - my($item, $label) = @_; - $pkgpart{$item->pkgpart} ||= $item->part_pkg->pkg; - $label. ': '. encode_entities($pkgpart{$item->pkgpart}). ''; -}; - -my $svc_labelsub = sub { - my($item, $label) = @_; - $label. ': '. encode_entities($item->label($item->history_date)). ''; -}; - -my %h_table_labelsub = ( - 'h_cust_pkg' => $pkg_labelsub, - 'h_svc_acct' => $svc_labelsub, - #'h_radius_usergroup' => - 'h_svc_domain' => $svc_labelsub, - 'h_svc_www' => $svc_labelsub, - 'h_svc_forward' => $svc_labelsub, - 'h_svc_broadband' => $svc_labelsub, - 'h_svc_external' => $svc_labelsub, - 'h_svc_phone' => $svc_labelsub, - #'h_phone_device' -); - -# cust_main -# cust_main_invoice - -# cust_pkg -# cust_pkg_option? -# cust_pkg_detail -# cust_pkg_reason? no - -#cust_svc -#cust_svc_option? -#svc_* -# svc_acct -# radius_usergroup -# acct_snarf? is this even used? it is now, for communigate RPOP -# svc_domain -# domain_record -# registrar -# svc_forward -# svc_www -# svc_broadband -# (virtual fields? eh... maybe when they're real) -# svc_external -# svc_phone -# phone_device -# phone_avail - -# future: - -# inventory_item (from services) -# pkg_referral? (changed?) - -#random others: - -# cust_location? -# cust_main-exemption?? (295.ca named tax exemptions) - - -<%init> - -my( $cust_main ) = @_; - -my $conf = new FS::Conf; - -my $curuser = $FS::CurrentUser::CurrentUser; - -die "access deined" - unless $curuser->access_right('View customer history'); - -my $cust_pkg_date_format = '%b %o, %Y'; -$cust_pkg_date_format .= '%l:%M:%S%P' - if $conf->exists('cust_pkg-display_times') - || $curuser->option('cust_pkg-display_times'); - -my %cust_pkg_date_fields = map { $_=>1 } qw( - start_date setup bill last_bill susp adjourn cancel expire contract_end - change_date -); - -# find out the beginning of this customer history, if possible -my $h_insert = qsearchs({ - 'table' => 'h_cust_main', - 'hashref' => { 'custnum' => $cust_main->custnum, - 'history_action' => 'insert', - }, - 'extra_sql' => 'ORDER BY historynum LIMIT 1', -}); -my $start = $h_insert ? $h_insert->history_date : 0; - -# retreive the history - -my @history = (); - -my $years = $conf->config('change_history-years') || .5; -if ( $cgi->param('change_history-years') =~ /^([\d\.]+)$/ ) { - $years = $1; -} -my $newer_than = int( time - $years * 31556736 ); #60*60*24*365.24 - -local($FS::Record::nowarn_classload) = 1; - -foreach my $table ( keys %tables ) { - my @items = qsearch({ - 'table' => "h_$table", - 'addl_from' => $table_join{$table}, - 'hashref' => { 'history_date' => { op=>'>=', value=>$newer_than }, }, - 'extra_sql' => ' AND custnum = '. $cust_main->custnum, - }); - push @history, @items; - -} - - diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html deleted file mode 100644 index e91af54e6..000000000 --- a/httemplate/view/cust_main/contacts.html +++ /dev/null @@ -1,122 +0,0 @@ -% my %which = ( -% '' => 'Billing', -% 'ship_' => 'Service', -% ); -% foreach my $which ( '', 'ship_' ) { -% my $pre = $cust_main->get("${which}last") ? $which : ''; - -<% $which{$which} %> address -<% ntable("#cccccc") %><% ntable("#cccccc",2) %> - - Contact name - - <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") |h %> - -% if ( $which eq '' && $conf->exists('show_ss') ) { - SS# - <% $cust_main->masked('ss') || ' ' %> -% } - - - Company - <% $cust_main->get("${pre}company") |h %> - - - Address - <% $cust_main->get("${pre}address1") |h %> - - -% if ( $cust_main->get("${pre}address2") ) { -% my $address2_label = -% ( $conf->exists('cust_main-require_address2') -% && ! ( $pre xor $cust_main->has_ship_address ) -% ) -% ? 'Unit #' -% : ' '; - - - <% $address2_label %> - <% $cust_main->get("${pre}address2") |h %> - - -% } - - - City - <% $cust_main->get("${pre}city") |h %> -% if ( $cust_main->get("${pre}county") ) { - County - <% $cust_main->get("${pre}county") |h %> -% } - State - <% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) |h %> - Zip - <% $cust_main->get("${pre}zip") %> - - - Country - <% code2country( $cust_main->get("${pre}country") ) %> - - - <% $daytime_label %> - - <% include('/elements/phonenumber.html', - $cust_main->get("${pre}daytime"), - 'callable'=>1 - ) - %> - - - - <% $night_label %> - - <% include('/elements/phonenumber.html', - $cust_main->get("${pre}night"), - 'callable'=>1 - ) - %> - - - - Fax - - <% $cust_main->get("${pre}fax") || ' ' %> - - -% if ( $which eq '' && $conf->exists('show_stateid') ) { - - <% $stateid_label %> - <% $cust_main->masked('stateid') || ' ' %> - <% $stateid_state_label %> - <% $cust_main->stateid_state || ' ' %> - -% } - -% 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'); -my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/ - ? 'Driver’s License' - : FS::Msgcat::_gettext('stateid'); -my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/ - ? 'Driver’s License State' - : FS::Msgcat::_gettext('stateid_state'); - - -<%init> - -my( $cust_main ) = @_; -my $conf = new FS::Conf; - - - diff --git a/httemplate/view/cust_main/custom.html b/httemplate/view/cust_main/custom.html deleted file mode 100644 index 8e2e07b75..000000000 --- a/httemplate/view/cust_main/custom.html +++ /dev/null @@ -1,21 +0,0 @@ - - -<%init> - -my( $cust_main ) = @_; - -my $proxyurl = $p.'/misc/custom_link_proxy.cgi?custnum='.$cust_main->custnum; - diff --git a/httemplate/view/cust_main/locations.html b/httemplate/view/cust_main/locations.html deleted file mode 100755 index ea6216ea9..000000000 --- a/httemplate/view/cust_main/locations.html +++ /dev/null @@ -1,87 +0,0 @@ - -% foreach my $locationnum (@sorted) { -% my $packages = $packages_in{$locationnum}; -% my $loc = $locations{$locationnum}; -% next if $loc->disabled and scalar(@$packages) == 0; -<% include('/elements/table-grid.html') %> - - -% if (! $locationnum) { -Default service location: -% } -% elsif ( $loc->disabled ) { - -% } -<% $loc->location_label %> - -% if ( $locationnum and !$loc->disabled ) { -<% edit_location_link($locationnum) %> -% } -% if ( $locationnum and !$loc->disabled and !$active{$locationnum} ) { - <% disable_location_link($locationnum) %> -% } - -% if (@$packages) { -<% include('packages/section.html', 'packages' => $packages ) %> -% } -
-% } #foreach $locationnum -<%init> -my %opt = @_; -my $cust_main = $opt{'cust_main'}; -my $all_packages = $opt{'packages'}; - -my %locations = map { $_->locationnum => $_ } qsearch({ - 'table' => 'cust_location', - 'hashref' => { 'custnum' => $cust_main->custnum }, - 'order_by' => 'ORDER BY country, state, city, address1, locationnum', - }); -my @sections = keys %locations; -$locations{''} = $cust_main; -my %packages_in = map { $_ => [] } ('', @sections); - -my %active = (); # groups with non-canceled packages -foreach my $cust_pkg ( @$all_packages ) { - my $key = $cust_pkg->locationnum; - push @{ $packages_in{$key} }, $cust_pkg; - $active{$key} = 1 if !$cust_pkg->getfield('cancel'); -} - -my @sorted = ( - '', - grep ( { $active{$_} } @sections), - grep ( { !$active{$_} } @sections), -); - -sub edit_location_link { - my $locationnum = shift; - include( '/elements/popup_link.html', - 'action' => $p. "edit/cust_location.cgi?locationnum=$locationnum", - 'label' => '(Edit location)', - 'actionlabel' => 'Edit', - ); -} - -sub disable_location_link { - my $locationnum = shift; - include( '/elements/popup_link.html', - 'action' => $p. "misc/disable-cust_location.cgi?locationnum=$locationnum", - 'label' => '(Disable location)', - 'actionlabel' => 'Disable', - ); -} - - - diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html deleted file mode 100644 index 6e90a0b4c..000000000 --- a/httemplate/view/cust_main/misc.html +++ /dev/null @@ -1,139 +0,0 @@ -<% ntable("#cccccc") %><% &ntable("#cccccc",2) %> - - - Customer number - <% $cust_main->display_custnum %> - - - - Status - <% ucfirst($cust_main->status) %> - - -% my @part_tag = $cust_main->part_tag; -% if ( $conf->config('cust_tag-location') =~ /^(cust_misc|)$/ && @part_tag ) { - - Tags - -% foreach my $part_tag ( @part_tag ) { - tagcolor) - ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"' - : '' %> - ><% $part_tag->tagname.': '. $part_tag->tagdesc |h %> -
-% } - - -% } - -%unless ( scalar(@agentnums) == 1 -% && !$curuser->access_right('View customers of all agents') ) { -% my $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); - - Agent - <% $agent->agentnum %>: <% $agent->agent %> - -% } - -% if ( $cust_main->agent_custid -% && ! $conf->exists('cust_main-default_agent_custid') ) { - - - Agent customer ref# - <% $cust_main->agent_custid %> - -% -% } - -% #if ( $cust_main->classnum ) { - - Class - <% $cust_main->classname || '(none)' %> - -% #} - -% unless ( FS::part_referral->num_part_referral == 1 ) { -% my $referral = qsearchs('part_referral', { -% 'refnum' => $cust_main->refnum -% } ); - - - Advertising source - <% $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 %>: -<% - ( $referring_cust_main->company - ? $referring_cust_main->company. ' ('. - $referring_cust_main->last. ', '. $referring_cust_main->first. - ')' - : $referring_cust_main->last. ', '. $referring_cust_main->first - ) -%> -% } - - - - - - - Order taker - <% $cust_main->otaker %> - - - - Signup Date - <% $cust_main->signupdate ? time2str($date_format, $cust_main->signupdate) : '' %> - - -% if ( $conf->exists('cust_main-enable_birthdate') ) { -% my $dt = $cust_main->birthdate ne '' -% ? DateTime->from_epoch( 'epoch' => $cust_main->birthdate, -% 'time_zone' =>'floating', -% ) -% : ''; - - - Date of Birth - <% $dt ? $dt->strftime($date_format) : '' %> - - -% } - -% if ( $conf->exists('cust_main-require_censustract') ) { - - - Census tract - <% $cust_main->censustract %> - - -% } - - -<%init> - -my( $cust_main ) = @_; -my $conf = new FS::Conf; -my $date_format = ($conf->config('date_format') || "%m/%d/%Y"); - -my $curuser = $FS::CurrentUser::CurrentUser; - -my @agentnums = $curuser->agentnums; - - diff --git a/httemplate/view/cust_main/notes.html b/httemplate/view/cust_main/notes.html deleted file mode 100755 index 237838029..000000000 --- a/httemplate/view/cust_main/notes.html +++ /dev/null @@ -1,166 +0,0 @@ -% if ( scalar(@notes) ) { - - - - <% include('/elements/init_overlib.html') %> - -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = ''; -% my $last_classnum = -1; -% my $skipheader = 0; -% my %classes = (); -% -% foreach my $note (@notes) { -% -% if ( $bgcolor eq $bgcolor1 ) { -% $bgcolor = $bgcolor2; -% } else { -% $bgcolor = $bgcolor1; -% } -% -% my $pop = popurl(3); -% my $notenum = $note->notenum; -% my $onclick = include( '/elements/popup_link_onclick.html', -% 'action' => popurl(2). -% 'edit/cust_main_note.cgi'. -% "?custnum=$custnum". -% ";notenum=$notenum", -% 'actionlabel' => 'Edit customer note', -% 'width' => 616, -% 'height' => 538, #575 -% 'frame' => 'top', -% ); -% my $clickjs = qq!onclick="$onclick"!; -% -% my $edit = ''; -% if ($curuser->access_right('Edit customer note') ) { -% $edit = qq! (edit)!; -% } -% -% if ( $last_classnum != $note->classnum && !$skipheader ) { -% my $tmp_classnum = $note->classnum ? $note->classnum : 0; -% $classes{$tmp_classnum} = $note->classname ne '' ? $note->classname -% : 'Other'; -% if ( $last_classnum != -1 ) { - - -% } -% my $display = ($tmp_classnum == 0 || !$conf->exists('note-classes') -% || $conf->config('note-classes') < 2) -% ? 'block' : 'none'; -
- <% include("/elements/table-grid.html") %> - - Date -% if ( $conf->exists('cust_main_note-display_times') ) { - Time -% } - Person -% if ($conf->exists('note-classes') && $conf->config('note-classes') == 1) { - Class -% } - Note -% if ($curuser->access_right('Edit customer note') ) { -   -% } - -% $skipheader = (!$conf->exists('note-classes') || $conf->config('note-classes') < 2); -% $last_classnum = $note->classnum; -% } - - - <% note_datestr($note,$conf,$bgcolor) %> - -  <% $note->usernum ? $note->access_user->name : $note->otaker %> - -% if ($conf->exists('note-classes') && $conf->config('note-classes') == 1) { - - <% $note->classname %> - -% } - - <% $note->comments | defang %> - -% if($edit) { - <% $edit %> -% } - - -% } #end display notes - - -
- -% if ( $conf->exists('note-classes') && $conf->config('note-classes') == 2 ) { -% my($classnum,$classname); -Show notes of class:   -% foreach my $classnum ( sort { $b <=> $a } (keys %classes) ) { - <% $classes{$classnum} %> -% } -
-% } - -% } -<%init> - -use HTML::Defang; - -my $conf = new FS::Conf; -my $curuser = $FS::CurrentUser::CurrentUser; - -my(%opt) = @_; - -my $custnum = $opt{'custnum'}; - -my $cust_main = qsearchs('cust_main', {'custnum' => $custnum} ); -die "Customer not found!" unless $cust_main; - -my (@notes) = $cust_main->notes($conf->exists('note-classes') && $conf->config('note-classes') == 2); - -#subroutines - -sub note_datestr { - my($note, $conf, $bgcolor) = @_ or return ''; - my $td = qq{}; - my $format = "$td%b %o, %Y"; - $format .= "$td%l:%M%P" - if $conf->exists('cust_main_note-display_times'); - ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g; - $strip; -} - - diff --git a/httemplate/view/cust_main/one_time_charge_link.html b/httemplate/view/cust_main/one_time_charge_link.html deleted file mode 100644 index b3defa294..000000000 --- a/httemplate/view/cust_main/one_time_charge_link.html +++ /dev/null @@ -1,91 +0,0 @@ - - -
- -<% include('/elements/popup_link.html', { - 'action' => $p.'edit/quick-charge.html?custnum='. $cust_main->custnum, - 'label' => 'One-time charge', - 'actionlabel' => 'One-time charge', - 'color' => '#333399', - 'width' => 763, - 'height' => 460, #more for more room for lines of add'l description? - }) -%> - -<%init> - -my($cust_main) = @_; - - diff --git a/httemplate/view/cust_main/order_pkg_link.html b/httemplate/view/cust_main/order_pkg_link.html deleted file mode 100644 index 30c86a757..000000000 --- a/httemplate/view/cust_main/order_pkg_link.html +++ /dev/null @@ -1,16 +0,0 @@ -<% include( '/elements/popup_link-cust_main.html', - 'action' => $p. 'misc/order_pkg.html', - 'label' => 'Order new package', - 'actionlabel' => 'Order new package', - 'color' => '#333399', - 'cust_main' => $cust_main, - 'closetext' => 'Close', - 'width' => 763, - 'height' => 538, - ) -%> -<%init> - -my($cust_main) = @_; - - diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html deleted file mode 100755 index 383c2a75e..000000000 --- a/httemplate/view/cust_main/packages.html +++ /dev/null @@ -1,184 +0,0 @@ -% my $s = 0; - -% if ( $curuser->access_right('Qualify service') ) { - <% $s++ ? ' | ' : '' %> - <% include('qual_link.html', $cust_main) %> -% } - -% if ( $curuser->access_right('Order customer package') ) { - <% $s++ ? ' | ' : '' %> - <% include('order_pkg_link.html', $cust_main) %> -% } - -% if ( $curuser->access_right('One-time charge') -% && $conf->config('payby-default') ne 'HIDE' -% ) { - <% $s++ ? ' | ' : '' %> - <% include('one_time_charge_link.html', $cust_main) %> -% } - -% if ( $curuser->access_right('Bulk change customer packages') ) { - <% $s++ ? ' | ' : '' %> - Bulk order and cancel packages (preserves services) -% } - -

- - - - - - - - -
- -% 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') -% ) -% ) -% { -% my $prev = $cgi->param('showcancelledpackages'); -% $cgi->param('showcancelledpackages', 1); - ( show -% $cgi->param('showcancelledpackages', $prev); -% } else { -% $cgi->param('showcancelledpackages', 0); - ( hide -% $cgi->param('showcancelledpackages', 1); -% } - - cancelled packages ) -% } -% if ( $num_old_packages ) { -% $cgi->param('showoldpackages', 1); - ( show old packages ) -% } elsif ( $cgi->param('showoldpackages') ) { -% $cgi->param('showoldpackages', 0); - ( hide old packages ) -% } - - - Package reports -% if ( $curuser->access_right('Qualify service') ) { - | View Qualifications -% } -
- Service reports: - accounts
- Usage reports: - CDRs -
-% if ( $conf->exists('cust_pkg-group_by_location') and $show_location ) { -<% include('locations.html', - 'cust_main' => $cust_main, - 'packages' => $packages, -) %> -% } -% else { -% # in this format, put all packages in one section -<% include('/elements/table-grid.html') %> -<% include('packages/section.html', - 'packages' => $packages, - 'show_location' => $show_location, -) %> -
-% } - - - -% if ( $cgi->param('fragment') =~ /^cust_pkg(\d+)$/ ) { - -% } - -<%init> - -my $cust_main = shift; -my %opt = @_; -my $conf = new FS::Conf; - -my $curuser = $FS::CurrentUser::CurrentUser; - -my( $packages, $num_old_packages ) = get_packages($cust_main, $conf); - - -my $show_location = $conf->exists('cust_pkg-always_show_location') - || (grep $_->locationnum, @$packages); # ? '1' : '0'; - -my $countrydefault = scalar($conf->config('countrydefault')) || 'US'; -#subroutines - -sub get_packages { - my $cust_main = shift or return undef; - my $conf = shift; - - 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'; - } - - my $cust_pkg_fields = - join(', ', map { "cust_pkg.$_ AS $_" } fields('cust_pkg') ); - - my $part_pkg_fields = - join(', ', map { "part_pkg.$_ AS part_pkg_$_" } fields('part_pkg') ); - - my $group_by = - join(', ', map "cust_pkg.$_", fields('cust_pkg') ). ', '. - join(', ', map "part_pkg.$_", fields('part_pkg') ); - - my $num_svcs = '( SELECT COUNT(*) FROM cust_svc '. - ' WHERE cust_svc.pkgnum = cust_pkg.pkgnum ) AS num_svcs'; - - my @packages = $cust_main->$method( { - 'select' => "$cust_pkg_fields, $part_pkg_fields, $num_svcs", - 'addl_from' => 'LEFT JOIN part_pkg USING ( pkgpart )', - } ); - my $num_old_packages = scalar(@packages); - - foreach my $cust_pkg ( @packages ) { - my %hash = $cust_pkg->hash; - my %part_pkg = map { /^part_pkg_(.+)$/ or die; ( $1 => $hash{$_} ); } - grep { /^part_pkg_/ } keys %hash; - $cust_pkg->{'_pkgpart'} = new FS::part_pkg \%part_pkg; - } - - unless ( $cgi->param('showoldpackages') ) { - my $years = $conf->config('cust_main-packages-years') || 2; - my $then = time - $years * 31556926; #60*60*24*365.2422 is close enough - - my %hide = ( 'cancelled' => 'cancel', - 'one-time charge' => 'setup', - ); - - @packages = - grep { !exists($hide{$_->status}) or $_->get($hide{$_->status}) > $then - or $_->num_svcs #don't hide packages w/services - } - @packages; - } - - $num_old_packages -= scalar(@packages); - - ( \@packages, $num_old_packages ); -} - - diff --git a/httemplate/view/cust_main/packages/location.html b/httemplate/view/cust_main/packages/location.html deleted file mode 100644 index 40a7de59f..000000000 --- a/httemplate/view/cust_main/packages/location.html +++ /dev/null @@ -1,66 +0,0 @@ - - -% unless ( $cust_pkg->locationnum ) { - (default service address)
-% } - - <% $loc->location_label( 'join_string' => '
', - 'double_space' => '   ', - 'escape_function' => \&encode_entities, - 'countrydefault' => $countrydefault, - ) - %> - -% unless ( $cust_pkg->locationnum ) { -
-% } - -% if ( ! $cust_pkg->get('cancel') -% && $FS::CurrentUser::CurrentUser->access_right('Change customer package') -% ) -% { - - ( <%pkg_change_location_link($cust_pkg)%> ) -% if ( $cust_pkg->locationnum ) { - ( <%edit_location_link($cust_pkg->locationnum)%> ) -% } - -% } - - -<%init> - -my $conf = new FS::Conf; -my %opt = @_; - -my $bgcolor = $opt{'bgcolor'}; -my $cust_pkg = $opt{'cust_pkg'}; -my $countrydefault = $opt{'countrydefault'} || 'US'; -my $statedefault = $opt{'statedefault'} - || ($countrydefault eq 'US' ? 'CA' : ''); - -my $loc = $cust_pkg->cust_location_or_main; - -sub pkg_change_location_link { - my $cust_pkg = shift; - my $pkgpart = $cust_pkg->pkgpart; - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;". - "address1=;address2=;city=;county=;state=$statedefault;". - "zip=;country=$countrydefault", - 'label' => 'Change location', - 'actionlabel' => 'Change', - 'cust_pkg' => $cust_pkg, - ); -} - -sub edit_location_link { - my $locationnum = shift; - include( '/elements/popup_link.html', - 'action' => $p. "edit/cust_location.cgi?locationnum=$locationnum", - 'label' => 'Edit location', - 'actionlabel' => 'Edit', - ); -} - - diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html deleted file mode 100644 index 8cae5fdba..000000000 --- a/httemplate/view/cust_main/packages/package.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - -% if ( $cust_pkg->quantity > 1 ) { - - - -% } - - - - - -% my $editi = $curuser->access_right('Edit customer package invoice details'); -% my $editc = $curuser->access_right('Edit customer package comments'); -% my @cust_pkg_detail = $cust_pkg->cust_pkg_detail; -% my @invoice_detail = grep { $_->detailtype eq 'I' } @cust_pkg_detail; -% my @comments = grep { $_->detailtype eq 'C' } @cust_pkg_detail; -% -% if ( scalar(@invoice_detail) || scalar(@comments) || $editi || $editc ) { -% -% my $editlink = $p. 'edit/cust_pkg_detail?pkgnum='. $cust_pkg->pkgnum. -% ';detailtype='; - - - -% if ( @invoice_detail ) { - - - -% foreach my $cust_pkg_detail ( @invoice_detail ) { - - - -% } -
- <% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><% $part_pkg->pkg |h %> - - - <% $part_pkg->custom_comment |h %> -
-       Quantity: - <% $cust_pkg->quantity %> -
- - -% unless ( $cust_pkg->get('cancel') ) { -% -% my $br = 0; -% if ( $curuser->access_right('Change customer package') ) { -% $br=1; - ( <%pkg_change_link($cust_pkg)%> ) -% } -% -% if ( $curuser->access_right('Edit customer package dates') ) { -% $br=1; - ( <%pkg_dates_link($cust_pkg)%> ) -% } -% -% 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; - ( <%pkg_discount_link($cust_pkg)%> ) -% } -% -% if ( $curuser->access_right('Customize customer package') ) { -% $br=1; - ( <%pkg_customize_link($cust_pkg,$part_pkg)%> ) -% } -% - <% $br ? '
' : '' %> -% } - -% if ( $cust_pkg->num_cust_event -% && ( $curuser->access_right('Billing event reports') -% || $curuser->access_right('View customer billing events') -% ) -% ) { - ( <%pkg_event_link($cust_pkg)%> ) -% } - -
-
- <% include('/elements/table-grid.html') %> -
- - Invoice details -% if ( $editi && ! $cust_pkg->get('cancel') ) { - (<% include('/elements/popup_link.html', { - 'action' => $editlink. 'I', - 'label' => 'edit', - 'actionlabel' => 'Edit invoice details', - 'color' => '#333399', - 'width' => 763, - }) - %>) -% } - -
 - <% $cust_pkg_detail->detail |h %>
- -% } else { - -% if ( $editi && ! $cust_pkg->get('cancel') ) { - - ( <% include('/elements/popup_link.html', { - 'action' => $editlink. 'I', - 'label' => 'Add invoice details', - 'actionlabel' => 'Add invoice details', - 'color' => '#333399', - 'width' => 763, - }) - %> ) - -% } - -% } - -% if ( @comments ) { - - <% include('/elements/table-grid.html') %> - - - - Comments -% if ( $editc ) { - (<% include('/elements/popup_link.html', { - 'action' => $editlink. 'C', - 'label' => 'edit', - 'actionlabel' => 'Edit comments', - 'color' => '#333399', - 'width' => 763, - }) - %>) -% } - - - -% foreach my $cust_pkg_detail ( @comments ) { - -  - <% $cust_pkg_detail->detail |h %> - -% } - - -% } else { - -% if ( $editc ) { - - ( <% include('/elements/popup_link.html', { - 'action' => $editlink. 'C', - 'label' => 'Add comments', - 'actionlabel' => 'Add comments', - 'color' => '#333399', - 'width' => 763, - }) - %> ) - -% } - -% } - - -% if ( $curuser->access_right('Change customer package') and -% !$cust_pkg->get('cancel') and -% !$opt{'show_location'}) { - - - ( <% pkg_change_location_link($cust_pkg) %> ) - - -% } -% } - - - - -<%init> - -my %opt = @_; - -my $bgcolor = $opt{'bgcolor'}; -my $cust_pkg = $opt{'cust_pkg'}; -my $part_pkg = $opt{'part_pkg'}; - -my $curuser = $FS::CurrentUser::CurrentUser; - -my $countrydefault = $opt{'countrydefault'} || 'US'; -my $statedefault = $opt{'statedefault'} - || ($countrydefault eq 'US' ? 'CA' : ''); - -#subroutines - -#false laziness w/status.html -sub pkg_link { - my($action, $label, $cust_pkg) = @_; - return '' unless $cust_pkg; - qq!$label!; -} - -sub pkg_change_link { - my $cust_pkg = shift; - my $locationnum = $cust_pkg->locationnum; - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p. "misc/change_pkg.cgi?locationnum=$locationnum", - 'label' => 'Change package', - 'actionlabel' => 'Change', - 'cust_pkg' => $cust_pkg, - ); -} - -sub pkg_change_location_link { - my $cust_pkg = shift; - my $pkgpart = $cust_pkg->pkgpart; - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;". - "address1=;address2=;city=;county=;state=$statedefault;". - "zip=;country=$countrydefault", - 'label' => 'Change location', - 'actionlabel' => 'Change', - 'cust_pkg' => $cust_pkg, - ); -} - -sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', 'Edit dates', @_ ); } - -sub pkg_discount_link { - my $cust_pkg = shift or return ''; - #my $part_pkg = shift; - #my $custnum = $cust_pkg->custnum; - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p.'edit/cust_pkg_discount.html', - 'label' => 'Discount', - 'actionlabel' => 'Discount', - 'cust_pkg' => $cust_pkg, - 'width' => 616, - ); -} - -sub pkg_customize_link { - my $cust_pkg = shift or return ''; - my $part_pkg = shift; - my $custnum = $cust_pkg->custnum; - qq!Customize!; -} - -sub pkg_event_link { - my($cust_pkg) = @_; - qq!!. - 'View package events'. - ''; -} - - diff --git a/httemplate/view/cust_main/packages/section.html b/httemplate/view/cust_main/packages/section.html deleted file mode 100755 index 45365a003..000000000 --- a/httemplate/view/cust_main/packages/section.html +++ /dev/null @@ -1,95 +0,0 @@ -% if ( @$packages ) { -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = ''; - - -% #my $width = $show_location ? 'WIDTH="25%"' : 'WIDTH="33%"'; - Package - Status -% if ( $show_location ) { - Location -% } - Services - - -% #$FS::cust_pkg::DEBUG = 2; -% foreach my $cust_pkg (@$packages) { -% -% if ( $bgcolor eq $bgcolor1 ) { -% $bgcolor = $bgcolor2; -% } else { -% $bgcolor = $bgcolor1; -% } -% -% my %iopt = ( -% 'bgcolor' => $bgcolor, -% 'cust_pkg' => $cust_pkg, -% 'part_pkg' => $cust_pkg->part_pkg, -% %conf_opt, -% ); -% - - - - <% include('package.html', %iopt) %> - <% include('status.html', %iopt) %> -% if ( $show_location ) { - <% include('location.html', %iopt) %> -% } - <% include('services.html', %iopt) %> - - -% } #foreach $cust_pkg -%# -% } #if @$packages -% else { -
-% } - -<%init> - -my %opt = @_; -my $conf = new FS::Conf; - -my $curuser = $FS::CurrentUser::CurrentUser; - -my $packages = $opt{'packages'}; -my $show_location = $opt{'show_location'}; - -# Sort order is hardcoded for now, can change this if needed. -@$packages = sort { - ( $a->getfield('cancel') <=> $b->getfield('cancel') ) or - ( $a->getfield('setup') <=> $b->getfield('setup') ) or - ( $a->getfield('pkgnum') <=> $b->getfield('pkgnum') ) -} @$packages; - -my $countrydefault = scalar($conf->config('countrydefault')) || 'US'; - -my %conf_opt = ( - #for services.html and status.html - 'cust_pkg-display_times' => ($conf->exists('cust_pkg-display_times') - || $curuser->option('cust_pkg-display_times')), - #for status.html - 'cust_pkg-show_autosuspend' => $conf->exists('cust_pkg-show_autosuspend'), - #for status.html pkg-balances - 'pkg-balances' => $conf->exists('pkg-balances'), - 'money_char' => ( $conf->config('money_char') || '$' ), - - #for location.html - 'countrydefault' => $countrydefault, - 'statedefault' => ( scalar($conf->config('statedefault')) - || ($countrydefault eq 'US' ? 'CA' : '') ), - #for services.html - 'svc_external-skip_manual' => $conf->exists('svc_external-skip_manual'), - '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'), - - # for packages.html Change location link - 'show_location' => $show_location, -); - - - diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html deleted file mode 100644 index 512efccc4..000000000 --- a/httemplate/view/cust_main/packages/services.html +++ /dev/null @@ -1,178 +0,0 @@ -% ### -% # Services -% ### - - - - - -% #foreach my $svcpart (sort {$a->{svcpart} <=> $b->{svcpart}} @{$pkg->{svcparts}}) { -% foreach my $part_svc ( $cust_pkg->part_svc ) { - -% if ( $opt{'cust_pkg-large_pkg_size'} > 0 and -% $opt{'cust_pkg-large_pkg_size'} <= $cust_pkg->num_svcs ) { -% # summarize - - - -% } -% else { -% foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) { - - - - - - - - - - - - - - - - -% } #foreach $cust_svc -% } - -% if ( ! $cust_pkg->get('cancel') -% && $curuser->access_right('Provision customer service') -% && $part_svc->num_avail -% ) { - - - - - -% } - -% } - -
-% my $href="${p}search/cust_pkg_svc.html?svcpart=".$part_svc->svcpart. -% ";pkgnum=".$cust_pkg->pkgnum; - <% $part_svc->svc %>  - (view all <% $cust_pkg->num_svcs %>) -% my $hint = $hints{$part_svc->svcdb}; -% if ( $hint ) { -
-
- - - -
-% } #$hint -
<% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %><% FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc) %><% FS::UI::Web::svc_export_links($m, $part_svc, $cust_svc) %>
- - <% $cust_svc->overlimit ? "Overlimit: ". time2str('%b %o %Y' . ($opt{'cust_pkg-display_times'} ? ' %l:%M %P' : ''), $cust_svc->overlimit) : '' %> -
- -% if ( $curuser->access_right('Recharge customer service') -% && $part_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($cust_svc)%> ) -% } - - -% my $ip_addr = $cust_svc->svc_x->ip_addr; - -% if ( $part_svc->svcdb eq 'svc_broadband' ) { - ( <% include('/elements/popup_link-ping.html', 'ip'=> $ip_addr ) %> ) - -% } - -% my $manage_link = $opt{'svc_broadband-manage_link'}; -% if ( $manage_link && $part_svc->svcdb eq 'svc_broadband' ) { -% my $svc_manage_link = eval(qq("$manage_link")); - Manage Device ) - -% } - -% if ( $curuser->access_right('Unprovision customer service') ) { - ( <%svc_unprovision_link($cust_svc)%> ) -% } - -% if ( $part_svc->svcdb eq 'svc_pbx' && $opt{'maestro-status_test'} ){ - Test maestro status ) -% } - -
- <% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %> -
- - -<%init> - -my %opt = @_; - -my $bgcolor = $opt{'bgcolor'}; -my $cust_pkg = $opt{'cust_pkg'}; -my $part_pkg = $opt{'part_pkg'}; -my $curuser = $FS::CurrentUser::CurrentUser; - -my $conf = new FS::Conf; - -sub svc_provision_link { - my ($cust_pkg, $part_svc, $opt, $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 ( $part_svc->svcdb eq 'svc_external' #could be generalized - && $opt->{'svc_external-skip_manual'} - ) { - $url = "${p}edit/process/". $part_svc->svcdb. ".cgi?$pkgnum_svcpart"; - } else { - $url = 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_avail)"; - if ( $opt->{'legacy_link'} - && $curuser->access_right('View/link unlinked services') - ) - { - $link .= '
'. - qq!!. - "Link to legacy $svc_nbsp ($num_avail)"; - } - $link; -} - -sub svc_unprovision_link { - my $cust_svc = shift or return ''; - qq!Unprovision!; -} - -my %hints = ( -svc_acct => '(user or email)', -svc_domain => '(domain)', -svc_broadband => '(ip or mac)', -svc_forward => '(email)', -svc_phone => '(phone)', -svc_pbx => '(phone)', -); - - diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html deleted file mode 100644 index f9198c2dc..000000000 --- a/httemplate/view/cust_main/packages/status.html +++ /dev/null @@ -1,488 +0,0 @@ - - - -%#this should use cust_pkg->status and cust_pkg->statuscolor eventually - -% if ( $cust_pkg->get('cancel') ) { #status: cancelled -% my $cpr = $cust_pkg->last_cust_pkg_reason('cancel'); - - <% pkg_status_row($cust_pkg, 'Cancelled', 'cancel', 'color'=>'FF0000', %opt ) %> - - <% pkg_status_row_colspan( $cust_pkg, - ( $cpr ? $cpr->reasontext. ' by '. $cpr->otaker : '' ), '', - 'align'=>'right', 'color'=>'ff0000', 'size'=>'-2', 'colspan'=>$colspan, - %opt - ) - %> - -% unless ( $cust_pkg->get('setup') ) { - - <% pkg_status_row_colspan( $cust_pkg, 'Never billed', '', 'colspan'=>$colspan, %opt, ) %> - -% } else { - - <% pkg_status_row( $cust_pkg, 'Setup', 'setup', %opt ) %> - <% 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_if( $cust_pkg, 'Suspended', 'susp', %opt, curuser=>$curuser ) %> - -% } -% -% } else { -% -% if ( $cust_pkg->get('susp') ) { #status: suspended -% my $cpr = $cust_pkg->last_cust_pkg_reason('susp'); - - <% pkg_status_row( $cust_pkg, 'Suspended', 'susp', 'color'=>'FF9900', %opt ) %> - - <% pkg_status_row_colspan( $cust_pkg, - ( $cpr ? $cpr->reasontext. ' by '. $cpr->otaker : '' ), '', - 'align'=>'right', 'color'=>'FF9900', 'size'=>'-2', 'colspan'=>$colspan, - %opt, - ) - %> - - <% pkg_status_row_noauto( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - - <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - -% unless ( $cust_pkg->get('setup') ) { - <% pkg_status_row_colspan( $cust_pkg, 'Never billed', '', 'colspan'=>$colspan, %opt ) %> -% } else { - <% pkg_status_row($cust_pkg, 'Setup', 'setup', %opt ) %> -% } - - <% pkg_status_row_changed( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - <% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill', %opt, curuser=>$curuser ) %> -% if ( $part_pkg->option('suspend_bill', 1) ) { - <% 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 ) %> - - - - - -% } else { #status: active -% -% unless ( $cust_pkg->get('setup') ) { #not setup -% -% unless ( $part_pkg->freq ) { - - <% pkg_status_row_colspan( $cust_pkg, 'Not yet billed (one-time charge)', '', 'colspan'=>$colspan, %opt ) %> - - <% pkg_status_row_noauto( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - - <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - - <% pkg_status_row_if( - $cust_pkg, - ( $part_pkg->freq ? 'Start billing' : 'Bill on' ), - 'start_date', - %opt - ) - %> - - - - - -% } else { - - <% pkg_status_row_colspan($cust_pkg, "Not yet billed ($billed_or_prepaid ". myfreq($part_pkg). ')', '', 'colspan'=>$colspan, %opt ) %> - - <% pkg_status_row_noauto( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - - <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - - <% pkg_status_row_if($cust_pkg, 'Start billing', 'start_date', %opt) %> - -% } -% -% } else { #setup -% -% unless ( $part_pkg->freq ) { - - <% pkg_status_row_colspan($cust_pkg, 'One-time charge', '', 'colspan'=>$colspan, %opt ) %> - - <% pkg_status_row($cust_pkg, 'Billed', 'setup', %opt) %> - - <% pkg_status_row_noauto( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - - <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - -% } else { -% -% if (scalar($cust_pkg->overlimit)) { - - <% pkg_status_row_colspan( $cust_pkg, - 'Overlimit', - $billed_or_prepaid. ' '. myfreq($part_pkg), - 'color'=>'FFD000', 'colspan'=>$colspan, - %opt - ) - %> - -% } else { - <% pkg_status_row_colspan( $cust_pkg, - 'Active', - $billed_or_prepaid. ' '. myfreq($part_pkg), - 'color'=>'00CC00', 'colspan'=>$colspan, - %opt - ) - %> -% } - - <% pkg_status_row_noauto( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - - <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> - - <% pkg_status_row($cust_pkg, 'Setup', 'setup', %opt) %> - -% } -% -% } -% -% if ( $opt{'cust_pkg-show_autosuspend'} ) { -% my $autosuspend = pkg_autosuspend_time( $cust_pkg ); -% $cust_pkg->set('autosuspend', $autosuspend) if $autosuspend; -% } - - <% 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_if( $cust_pkg, $next_bill_or_prepaid_until, 'bill', %opt, curuser=>$curuser ) %> - <% 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 ) { - - - - -% } -% -% } -% } - -
> - -% if ( $curuser->access_right('Unsuspend customer package') ) { - ( <% pkg_unsuspend_link($cust_pkg) %> ) -% } -% if ( $curuser->access_right('Cancel customer package immediately') ) { - ( <% pkg_cancel_link($cust_pkg) %> ) -% } - -
> - -% if ( $curuser->access_right('Cancel customer package immediately') ) { - ( <% pkg_cancel_link($cust_pkg) %> ) -% } - -
> - -% if ( $curuser->access_right('Suspend customer package') ) { - ( <% pkg_suspend_link($cust_pkg) %> ) -% } -% if ( $curuser->access_right('Suspend customer package later') ) { - ( <% pkg_adjourn_link($cust_pkg) %> ) -% } -% if ( $curuser->access_right('Delay suspension events') ) { - ( <% pkg_delay_link($cust_pkg) %> ) -% } -% if ( $curuser->access_right('Cancel customer package immediately') ) { - ( <% pkg_cancel_link($cust_pkg) %> ) -% } -% if ( $curuser->access_right('Cancel customer package later') ) { - ( <% pkg_expire_link($cust_pkg) %> ) -% } - - -
- -<%init> - -my %opt = @_; - -my $bgcolor = $opt{'bgcolor'}; -my $cust_pkg = $opt{'cust_pkg'}; -my $part_pkg = $opt{'part_pkg'}; -my $curuser = $FS::CurrentUser::CurrentUser; -my $colspan = $opt{'cust_pkg-display_times'} ? 8 : 4; -my $width = $opt{'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 ( $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'; -} - -#subroutines - -sub myfreq { - my $part_pkg = shift; - my $freq = $part_pkg->freq_pretty; - $freq =~ s/ / /g; - $freq; -} - -#false laziness w/package.html -sub pkg_link { - my($action, $label, $cust_pkg) = @_; - return '' unless $cust_pkg; - qq!$label!; -} - -sub pkg_status_row { - my( $cust_pkg, $title, $field, %opt ) = @_; - - my $color = $opt{'color'}; - - my $html = qq(); - $html .= qq() if length($color); - $html .= qq($title ); - $html .= qq() if length($color); - - if ( $opt{'pkg_balances'} && ! $cust_pkg->{_printed_balance}++ ) { #kludge - $html .= ' (Balance: '. $opt{'money_char'}. - $cust_pkg->cust_main->balance_pkgnum($cust_pkg->pkgnum). - ')'; - } - - $html .= qq(); - $html .= pkg_datestr($cust_pkg, $field, %opt). ''; - - $html; -} - -sub pkg_status_row_if { - my( $cust_pkg, $title, $field, %opt ) = @_; - - $title = '( '. pkg_unadjourn_link($cust_pkg). ' ) '. $title - if ( $field eq 'adjourn' && - $opt{curuser}->access_right('Suspend customer package later') - ); - - $title = '( '. pkg_unexpire_link($cust_pkg). ' ) '. $title - if ( $field eq 'expire' && - $opt{curuser}->access_right('Cancel customer package later') - ); - - $cust_pkg->get($field) ? pkg_status_row($cust_pkg, $title, $field, %opt) : ''; -} - -sub pkg_status_row_changed { - my( $cust_pkg, %opt ) = @_; - - return '' unless $cust_pkg->change_date; - - my $html = - pkg_status_row( $cust_pkg, 'Package changed', 'change_date', %opt ); - - my $old = $cust_pkg->old_cust_pkg; - if ( $old ) { - my $part_pkg = $old->part_pkg; - my $label = 'Changed from '. $cust_pkg->change_pkgnum. ': '. - $part_pkg->pkg_comment(nopartpkg => 1); - $html .= pkg_status_row_colspan( $cust_pkg, $label, '', - 'size' => '-1', - 'align' => 'right', - 'colspan' => $opt{'colspan'}, - #%opt, - ); - } - - $html; -} - -sub pkg_status_row_noauto { - my( $cust_pkg, %opt ) = @_; - my $part_pkg = $opt{'part_pkg'}; - return '' unless $cust_pkg->no_auto || $part_pkg->no_auto; - - #inefficient, should be passed in - my $cust_main = $cust_pkg->cust_main; - - return '' unless $cust_main->payby =~ /^(CARD|CHEK)$/; - my $what = lc(FS::payby->shortname($cust_main->payby)); - - pkg_status_row_colspan( $cust_pkg, "No automatic $what charge", '', - 'colspan' => $opt{'colspan'}, - #%opt, - ); -} - -sub pkg_status_row_discount { - my( $cust_pkg, %opt ) = @_; - - my $html; - - foreach my $cust_pkg_discount ( $cust_pkg->cust_pkg_discount_active ) { - - my $discount = $cust_pkg_discount->discount; - - my $label = 'Discount: '. $discount->description; - if ( $discount->months ) { - my $remaining = $discount->months - $cust_pkg_discount->months_used; - $remaining = sprintf('%.2f', $remaining) if $remaining =~ /\./; - $label .= " ($remaining months remaining)" - } - - $label .= ' ('. - 'remove discount)'; - - $html .= pkg_status_row_colspan( $cust_pkg, $label, '', - 'colspan' => $opt{'colspan'}, - #%opt, - ); - - } - - $html; -} - -sub pkg_status_row_colspan { - my($cust_pkg, $title, $addl, %opt) = @_; - - my $colspan = $opt{'colspan'}; - - my $align = $opt{'align'} ? 'ALIGN="'. $opt{'align'}.'"' : ''; - my $color = $opt{'color'} ? 'COLOR="#'.$opt{'color'}.'"' : ''; - my $size = $opt{'size'} ? 'SIZE="'. $opt{'size'}. '"' : ''; - - my $html = qq(); - $html .= qq() if length($color) || $size; - $html .= qq() if $color && !$size; - $html .= $title; - $html .= qq() if $color && !$size; - $html .= qq() if length($color) || $size; - $html .= ", $addl" if length($addl); - - if ( $opt{'pkg-balances'} && ! $cust_pkg->{_printed_balance}++ ) { #kludge - $html .= ' (Balance: '. $opt{'money_char'}. - $cust_pkg->cust_main->balance_pkgnum($cust_pkg->pkgnum). - ')'; - } - - $html .= qq(); - - $html; - -} - -sub pkg_datestr { - my($cust_pkg, $field, %opt) = @_ or return ''; - return ' ' unless $cust_pkg->get($field); - my $format = '%b'. - ' %o,'. - ' %Y'; - #$format .= ' %l:%M:%S%P %z' - $format .= ' %l'. - ':'. - '%M'. - ' %P' - if $opt{'cust_pkg-display_times'}; - my $strip = time2str($format, $cust_pkg->get($field) ); - $strip =~ s/ (\d)/$1/g; - $strip; -} - -sub pkg_suspend_link { - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p. 'misc/cancel_pkg.html?method=suspend', - 'label' => 'Suspend now', - 'actionlabel' => 'Suspend', - 'color' => '#FF9900', - 'cust_pkg' => shift, - ) -} - -sub pkg_adjourn_link { - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p. 'misc/cancel_pkg.html?method=adjourn', - 'label' => 'Suspend later', - 'actionlabel' => 'Adjourn', - 'color' => '#CC6600', - 'cust_pkg' => shift, - ) -} - -sub pkg_delay_link { - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p. 'misc/delay_susp_pkg.html', - 'label' => 'Delay suspend', - 'actionlabel' => 'Delay suspend for', - 'cust_pkg' => shift, - ) -} - -sub pkg_unsuspend_link { pkg_link('misc/unsusp_pkg', 'Unsuspend', @_ ); } -sub pkg_unadjourn_link { pkg_link('misc/unadjourn_pkg', 'Abort', @_ ); } -sub pkg_unexpire_link { pkg_link('misc/unexpire_pkg', 'Abort', @_ ); } - -sub pkg_cancel_link { - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p. 'misc/cancel_pkg.html?method=cancel', - 'label' => 'Cancel now', - 'actionlabel' => 'Cancel', - 'color' => '#ff0000', - 'cust_pkg' => shift, - ) -} - -sub pkg_expire_link { - include( '/elements/popup_link-cust_pkg.html', - 'action' => $p. 'misc/cancel_pkg.html?method=expire', - 'label' => 'Cancel later', - 'actionlabel' => 'Expire', #"Cancel package $num later" - 'color' => '#CC0000', - 'cust_pkg' => shift, - ) -} - -sub svc_recharge_link { - include( '/elements/popup_link-cust_svc.html', - 'action' => $p. 'misc/recharge_svc.html', - 'label' => 'Recharge', - 'actionlabel' => 'Recharge', - 'color' => '#333399', - 'cust_svc' => shift, - ) -} - -sub pkg_autosuspend_time { - my $cust_pkg = shift or return ''; - my $days = 7; - my $time = time; - my $pending_suspend = 0; - #this seems to be extremely inefficient... and is slowing down all customer - #views - while ( $days > 0 && - scalar( - grep { $_->part_event->action eq 'suspend' } - @{$cust_pkg->cust_main->due_cust_event( time => $time + 86400*$days, - testonly => 1, - ) } - ) - ) - { - $pending_suspend = 1; - $days--; - } - - $pending_suspend ? time + ($days + 1) * 86400 : ''; - -} - - diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html deleted file mode 100644 index 046899e5e..000000000 --- a/httemplate/view/cust_main/payment_history.html +++ /dev/null @@ -1,465 +0,0 @@ -%# payment links - -% my $s = 0; -% if ( $payby{'BILL'} && $curuser->access_right(['Post payment', 'Post check payment' ]) ) { - <% $s++ ? ' | ' : '' %> - <% include('/elements/popup_link-cust_main.html', - 'label' => 'Enter check payment', - 'action' => "${p}edit/cust_pay.cgi?popup=1;payby=BILL", - 'cust_main' => $cust_main, - 'actionlabel' => 'Enter check payment', - 'width' => 392, - #default# 'height' => 336, - ) - %> -% } - -% if ( $payby{'CASH'} && $curuser->access_right(['Post payment', 'Post cash payment']) ) { - <% $s++ ? ' | ' : '' %> - <% include('/elements/popup_link-cust_main.html', - 'label' => 'Enter cash payment', - 'action' => "${p}edit/cust_pay.cgi?popup=1;payby=CASH", - 'cust_main' => $cust_main, - 'actionlabel' => 'Enter cash payment', - 'width' => 392, - #default# 'height' => 336, - ) - %> -% } - -% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { - <% $s++ ? ' | ' : '' %> - Enter Western Union payment -% } - -% if ( ( $payby{'CARD'} || $payby{'DCRD'} ) -% && $curuser->access_right(['Process payment', 'Process credit card payment']) -% && ! $cust_main->is_encrypted($cust_main->payinfo) -% ) { - <% $s++ ? ' | ' : '' %> - Process credit card payment -% } - -% if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) -% && $curuser->access_right(['Process payment', 'Process Echeck payment']) -% && ! $cust_main->is_encrypted($cust_main->payinfo) -% ) { - <% $s++ ? ' | ' : '' %> - Process electronic check (ACH) payment -% } - -% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { - <% $s++ ? ' | ' : '' %> - Post manual (offline/POS) credit card payment -% } - -
- -%# credit link - -% if ( $curuser->access_right('Post credit') ) { - <% include('/elements/popup_link-cust_main.html', - 'label' => 'Enter credit', - 'action' => "${p}edit/cust_credit.cgi", - 'cust_main' => $cust_main, - 'actionlabel' => 'Enter credit', - 'width' => 616, #make room for reasons #540 default - #default# 'height' => 336, - ) - %> -
-% } - -%# refund links - -% $s = 0; -% if ( $payby{'BILL'} && $curuser->access_right(['Post refund', 'Post check refund']) ) { - <% $s++ ? ' | ' : '' %> - <% include('/elements/popup_link-cust_main.html', - 'label' => 'Enter check refund', - 'action' => "${p}edit/cust_refund.cgi?popup=1;payby=BILL", - 'cust_main' => $cust_main, - 'actionlabel' => 'Enter check refund', - 'width' => 392, - #default# 'height' => 336, - ) - %> -% } - -% if ( $payby{'CASH'} && $curuser->access_right(['Post refund', 'Post cash refund']) ) { - <% $s++ ? ' | ' : '' %> - <% include('/elements/popup_link-cust_main.html', - 'label' => 'Enter cash refund', - 'action' => "${p}edit/cust_refund.cgi?popup=1;payby=CASH", - 'cust_main' => $cust_main, - 'actionlabel' => 'Enter cash refund', - 'width' => 392, - #default# 'height' => 336, - ) - %> -% } - -%# someday, perhaps. very few gateways let you do unlinked refunds at all. -%# Authorize.net makes you sign a special form -%# -%# % if ( ( $payby{'CARD'} || $payby{'DCRD'} ) -%# % && $curuser->access_right('Process refund') -%# % && ! $cust_main->is_encrypted($cust_main->payinfo) -%# % ) { -%# <% $s++ ? ' | ' : '' %> -%# Process credit card refund -%# % } -%# -%# % if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) -%# % && $curuser->access_right('Process refund') -%# % && ! $cust_main->is_encrypted($cust_main->payinfo) -%# % ) { -%# <% $s++ ? ' | ' : '' %> -%# Process electronic check (ACH) refund -%# % } - -% if ( $payby{'MCRD'} && $curuser->access_right('Post refund') ) { - <% $s++ ? ' | ' : '' %> - Post manual (offline/POS) credit card refund -% } - -
- -%# tax exemption link - -% my $view_exemptions = $curuser->access_right('View customer tax exemptions'); -% my $add_adjustment = ( $conf->exists('enable_tax_adjustments') -% && $curuser->access_right('Add customer tax adjustment') -% ); -% if ( $view_exemptions || $add_adjustment ) { - -% if ( $view_exemptions ) { - View tax exemptions - <% $add_adjustment ? '|' : '' %> -% } - -% if ( $add_adjustment ) { - <% include('/elements/popup_link.html', { - 'action' => $p.'edit/cust_tax_adjustment.html?custnum='. $cust_main->custnum, - 'label' => 'Add tax adjustment', - 'actionlabel' => 'Add tax adjustment', - #'color' => '#333399', - #'width' => 763, - 'height' => 200, - }) - %> - | - View tax adjustments -% } - -
-% } - -%# batched payment links - -% if ( ( $conf->exists('batch-enable') || $conf->config('batch-enable_payby') ) -% && $curuser->access_right('View customer batched payments') -% ) -% { - View batched payments: -% foreach my $status (qw( Queued In-transit Complete All )) { - <% $status %> - <% $status ne 'All' ? '|' : '' %> -% } -
-% } - -%# pending payment links - -% if ( $curuser->access_right('View customer pending payments') -% && scalar($cust_main->cust_pay_pending) -% ) -% { - View pending payments
-% } - -%# and now the table - -<% include("/elements/table-grid.html") %> -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = ''; - - - Date - Description - Invoice - Payment - In-house
Credit
- Refund - Balance - - -%#display payment history - -%my $money_char = $conf->config('money_char') || '$'; -% -%sub balance_forward_row { -% my( $b, $date, $money_char ) = @_; -% ( my $balance_forward = $money_char. $b ) =~ s/^\$\-/- \$/; - - - - <% time2str($date_format, $date) %> - - - - Starting balance on <% time2str($date_format, $date) %> - (show prior history) - - - - - - - <% $balance_forward %> - - -%} -% -%my $balance = 0; -%my %target = (); -% -%my $years = $conf->config('payment_history-years') || 2; -%my $older_than = time - $years * 31556926; #60*60*24*365.2422 -%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" '; -% $hidden = 1; -% } else { -% -% $display = ''; -% -% if ( $hidden && ! $seen++ ) { -% balance_forward_row($balance, $item->{'date'}, $money_char); -% } -% -% } -% -% 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($date_format, $item->{'date'}) %> -% if ( $target && $target{$target} == 1 ) { - - -% } - -
- - - <% $item->{'desc'} %> - - - <% $charge %> - - - <% $payment %> - - - <% $credit %> - - - <% $refund %> - - - <% $showbalance %> - - -% } - -%if ( scalar(@history) && $hidden && ! $seen++ ) { -% balance_forward_row($balance, $lastdate, $money_char); -%} - - - - - -<%init> - -my( $cust_main ) = @_; -my $custnum = $cust_main->custnum; - -my $conf = new FS::Conf; -my $date_format = $conf->config('date_format') || '%m/%d/%Y'; - -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 %status = ( - 'Queued' => 'O', #Open - 'In-transit' => 'I', - 'Complete' => 'R', #Resolved - 'All' => '', -); - -#get payment history -my @history = (); - -my %opt = ( - ( map { $_ => scalar($conf->config($_)) } - qw( card_refund-days date_format ) - ), - ( map { $_ => $conf->exists($_) } - qw( deleteinvoices deletepayments deleterefunds pkg-balances ) - ) -); - -#invoices -foreach my $cust_bill ($cust_main->cust_bill) { - push @history, { - 'date' => $cust_bill->_date, - 'desc' => include('payment_history/invoice.html', $cust_bill, %opt ), - 'charge' => $cust_bill->charged, - }; -} - -#statements -foreach my $cust_statement ($cust_main->cust_statement) { - push @history, { - 'date' => $cust_statement->_date, - 'desc' => include('payment_history/statement.html', $cust_statement, %opt ), - #'charge' => $cust_bill->charged, - }; -} - -#payments (some false laziness w/credits) -foreach my $cust_pay ($cust_main->cust_pay) { - push @history, { - 'date' => $cust_pay->_date, - 'desc' => include('payment_history/payment.html', $cust_pay, %opt ), - 'payment' => $cust_pay->paid, - #'target' => $target, #XXX - }; -} - -#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, { - 'date' => $cust_pay_void->_date, - 'desc' => include('payment_history/voided_payment.html', $cust_pay_void, %opt ), - 'void_payment' => $cust_pay_void->paid, - }; - -} - -#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, { - 'date' => $cust_credit->_date, - 'desc' => include('payment_history/credit.html', $cust_credit, %opt ), - 'credit' => $cust_credit->amount, - }; - -} - -#refunds -foreach my $cust_refund ($cust_main->cust_refund) { - push @history, { - 'date' => $cust_refund->_date, - 'desc' => include('payment_history/refund.html', $cust_refund), - 'refund' => $cust_refund->refund, - }; - -} - - diff --git a/httemplate/view/cust_main/payment_history/attempted_payment.html b/httemplate/view/cust_main/payment_history/attempted_payment.html deleted file mode 100644 index 554aa737d..000000000 --- a/httemplate/view/cust_main/payment_history/attempted_payment.html +++ /dev/null @@ -1,41 +0,0 @@ -Payment attempt <% $info |h %> -<%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); - - diff --git a/httemplate/view/cust_main/payment_history/credit.html b/httemplate/view/cust_main/payment_history/credit.html deleted file mode 100644 index 75038cc56..000000000 --- a/httemplate/view/cust_main/payment_history/credit.html +++ /dev/null @@ -1,156 +0,0 @@ -<% $pre %>Credit<% $post %> -by <% $cust_credit->otaker %><% "$reason$desc$apply$delete$unapply" %> -<%init> - -my( $cust_credit, %opt ) = @_; - -my $date_format = $opt{'date_format'} || '%m/%d/%Y'; - -my $conf = new FS::Conf; -my $curuser = $FS::CurrentUser::CurrentUser; - -my @cust_credit_bill = $cust_credit->cust_credit_bill; -my @cust_credit_refund = $cust_credit->cust_credit_refund; - -my $desc = ''; -if ( $opt{'pkg-balances'} && $cust_credit->pkgnum ) { - my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_credit->pkgnum } ); - $desc .= ' for '. $cust_pkg->pkg_label_long; -} - -my %cust_credit_bill_width = ('width' => 392); -my %cust_credit_bill_height = (); -if ($conf->exists('cust_credit_bill_pkg-manual')) { - %cust_credit_bill_width = ('width' => 592); - %cust_credit_bill_height = ('height' => 436); -} - -my( $pre, $post, $apply, $ext ) = ( '', '', '', '' ); -if ( scalar(@cust_credit_bill) == 0 - && scalar(@cust_credit_refund) == 0 ) { - #completely unapplied - $pre = 'Unapplied '; - $post = ''; - if ( $curuser->access_right('Apply credit') ) { - if ( $cust_credit->cust_main->total_owed > 0 ) { - $apply = ' ('. - include( '/elements/popup_link.html', - 'label' => 'apply', - 'action' => "${p}edit/cust_credit_bill.cgi?". - $cust_credit->crednum, - 'actionlabel' => 'Apply credit', - %cust_credit_bill_width, - %cust_credit_bill_height, - ). - ')'; - } - if ( $cust_credit->cust_main->total_unapplied_refunds > 0 ) { - $apply.= ' ('. - include( '/elements/popup_link.html', - 'label' => 'apply to refund', - 'action' => "${p}edit/cust_credit_refund.cgi?". - $cust_credit->crednum, - 'actionlabel' => 'Apply credit to refund', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; - } - } -} elsif ( scalar(@cust_credit_bill) == 1 - && scalar(@cust_credit_refund) == 0 - && $cust_credit->credited == 0 ) { - #applied to one invoice, the usual situation - $desc .= ' '. $cust_credit_bill[0]->applied_to_invoice; -} elsif ( scalar(@cust_credit_bill) == 0 - && scalar(@cust_credit_refund) == 1 - && $cust_credit->credited == 0 ) { - #applied to one refund - $desc .= ' refunded on '. time2str($date_format, $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. - ' '. $app->applied_to_invoice. - '
'; - #' on '. time2str($date_format, $app->_date). - } elsif ( $app->isa('FS::cust_credit_refund') ) { - $desc .= '  '. - '$'. $app->amount. - ' refunded on '. time2str($date_format, $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'; - if ( $curuser->access_right('Apply credit') ) { - if ( $cust_credit->cust_main->total_owed > 0 ) { - $apply = ' ('. - include( '/elements/popup_link.html', - 'label' => 'apply', - 'action' => "${p}edit/cust_credit_bill.cgi?". - $cust_credit->crednum, - 'actionlabel' => 'Apply credit', - %cust_credit_bill_width, - %cust_credit_bill_height, - ). - ')'; - } - if ( $cust_credit->cust_main->total_unapplied_refunds > 0 ) { - $apply.= ' ('. - include( '/elements/popup_link.html', - 'label' => 'apply to refund', - 'action' => "${p}edit/cust_credit_refund.cgi?". - $cust_credit->crednum, - 'actionlabel' => 'Apply credit to refund', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; - } - } - $desc .= '
'; - } -} -# -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)!; -} - -my $reason = $cust_credit->reason - ? ' ('. $cust_credit->reason. ')' - : ''; - - - diff --git a/httemplate/view/cust_main/payment_history/invoice.html b/httemplate/view/cust_main/payment_history/invoice.html deleted file mode 100644 index c0d32df4d..000000000 --- a/httemplate/view/cust_main/payment_history/invoice.html +++ /dev/null @@ -1,45 +0,0 @@ -<% $link %><% $pre %>Invoice #<% $cust_bill->display_invnum %> -(Balance $ <% $cust_bill->owed %>)<% $post %><% $link ? '' : '' %><% $delete %><% $events %> -<%init> - -my( $cust_bill, %opt ) = @_; - -my $conf = new FS::Conf; - -my $curuser = $FS::CurrentUser::CurrentUser; - -my($pre, $post) = ('', ''); -if ( $cust_bill->owed > 0 ) { - $pre = 'Open '; - $post = ''; -} - -my $invnum = $cust_bill->invnum; - -my $link = $curuser->access_right('View invoices') - ? qq!! - : ''; - -my $delete = ''; -if ( $opt{'deleteinvoices'} && $curuser->access_right('Delete invoices') ) { - $delete = qq! (delete)!; -} - -my $events = ''; -#1.9 -if ( $cust_bill->num_cust_event - && ( $curuser->access_right('Billing event reports') - || $curuser->access_right('View customer billing events') - ) - ) { - $events = - qq!
( View invoice events )'; -} -# - - diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html deleted file mode 100644 index e745864b7..000000000 --- a/httemplate/view/cust_main/payment_history/payment.html +++ /dev/null @@ -1,228 +0,0 @@ -<% $pre %>Payment<% $post %> by <% $otaker %> -<% "$info$desc$view$apply$refund$void$delete$unapply" %> -<%init> - -my( $cust_pay, %opt ) = @_; - -my $date_format = $opt{'date_format'} || '%m/%d/%Y'; - -my $conf = new FS::Conf; -my $curuser = $FS::CurrentUser::CurrentUser; - -my $payby = $cust_pay->payby; - -my $payinfo; -if ( $payby eq 'CARD' ) { - $payinfo = $cust_pay->paymask; -} elsif ( $payby eq 'CHEK' ) { - my( $account, $aba ) = split('@', $cust_pay->paymask ); - $payinfo = "ABA $aba, Acct #$account"; -} 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 $desc = ''; -if ( $opt{'pkg-balances'} && $cust_pay->pkgnum ) { - my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } ); - $desc .= ' for '. $cust_pkg->pkg_label_long; -} - -my %cust_bill_pay_width = ('width' => 392); -my %cust_bill_pay_height = (); -if ($conf->exists('cust_bill_pay_pkg-manual')) { - %cust_bill_pay_width = ('width' => 592); - %cust_bill_pay_height = ('height' => 436); -} - -my( $pre, $post, $apply, $ext ) = ( '', '', '', '' ); -if ( scalar(@cust_bill_pay) == 0 - && scalar(@cust_pay_refund) == 0 ) { - #completely unapplied - $pre = 'Unapplied '; - $post = ''; - if ( $curuser->access_right('Apply payment') ) { - if ( $cust_pay->cust_main->total_owed > 0 ) { - $apply = ' ('. - include( '/elements/popup_link.html', - 'label' => 'apply', - 'action' => "${p}edit/cust_bill_pay.cgi?". - $cust_pay->paynum, - 'actionlabel' => 'Apply payment', - %cust_bill_pay_width, - %cust_bill_pay_height, - ). - ')'; - } - if ( $cust_pay->cust_main->total_unapplied_refunds > 0 ) { - $apply.= ' ('. - include( '/elements/popup_link.html', - 'label' => 'apply to refund', - 'action' => "${p}edit/cust_pay_refund.cgi?". - $cust_pay->paynum, - 'actionlabel' => 'Apply payment to refund', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; - } - } -} elsif ( scalar(@cust_bill_pay) == 1 - && scalar(@cust_pay_refund) == 0 - && $cust_pay->unapplied == 0 ) { - #applied to one invoice, the usual situation - $desc .= ' '. $cust_bill_pay[0]->applied_to_invoice; -} elsif ( scalar(@cust_bill_pay) == 0 - && scalar(@cust_pay_refund) == 1 - && $cust_pay->unapplied == 0 ) { - #applied to one refund - $desc .= ' refunded on '. time2str($date_format, $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. - ' '. $app->applied_to_invoice. - '
'; - #' on '. time2str($date_format, $cust_bill_pay->_date). - } elsif ( $app->isa('FS::cust_pay_refund') ) { - $desc .= '  '. - '$'. $app->amount. - ' refunded on '. time2str($date_format, $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'; - if ( $curuser->access_right('Apply payment') ) { - if ( $cust_pay->cust_main->total_owed > 0 ) { - $apply = ' ('. - include( '/elements/popup_link.html', - 'label' => 'apply', - 'action' => "${p}edit/cust_bill_pay.cgi?". - $cust_pay->paynum, - 'actionlabel' => 'Apply payment', - %cust_bill_pay_width, - %cust_bill_pay_height, - ). - ')'; - } - if ( $cust_pay->cust_main->total_unapplied_refunds > 0 ) { - $apply.= ' ('. - include( '/elements/popup_link.html', - 'label' => 'apply to refund', - 'action' => "${p}edit/cust_pay_refund.cgi?". - $cust_pay->paynum, - 'actionlabel' => 'Apply payment to refund', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; - } - } - $desc .= '
'; - } -} - -my $view = - ' ('. include('/elements/popup_link.html', - 'label' => 'view receipt', - 'action' => "${p}view/cust_pay.html?link=popup;paynum=". - $cust_pay->paynum, - 'actionlabel' => 'Payment Receipt', - ). - ')'; - -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(\@rights) -) { - $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 - && $opt{'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)!; -} - -my $otaker = $cust_pay->otaker; -$otaker = 'auto billing' if $otaker eq 'fs_daily'; -$otaker = 'customer self-service' if $otaker eq 'fs_selfservice'; - - diff --git a/httemplate/view/cust_main/payment_history/pending_payment.html b/httemplate/view/cust_main/payment_history/pending_payment.html deleted file mode 100644 index 40805b1aa..000000000 --- a/httemplate/view/cust_main/payment_history/pending_payment.html +++ /dev/null @@ -1,61 +0,0 @@ -Pending payment <% "$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', - ); -} - - diff --git a/httemplate/view/cust_main/payment_history/refund.html b/httemplate/view/cust_main/payment_history/refund.html deleted file mode 100644 index 4a48fea1e..000000000 --- a/httemplate/view/cust_main/payment_history/refund.html +++ /dev/null @@ -1,50 +0,0 @@ -<% $pre %>Refund<% $post %> -(<% $payby. $payinfo %>) -by <% $cust_refund->otaker %><% $view %><% $delete %> -<%init> - -my( $cust_refund, %opt ) = @_; - -my $curuser = $FS::CurrentUser::CurrentUser; - -my $payby = $cust_refund->payby; -my $payinfo = $payby eq 'CARD' - ? $cust_refund->paymask - : $cust_refund->payinfo; - -$payby =~ s/^BILL$/Check #/ if $payinfo; -$payby =~ s/^BILL$/Check/; -$payby =~ s/^CHEK$/Electronic check /; -$payby =~ s/^(CARD|COMP)$/$1 /; - -my($pre, $post) = ('', ''); -if ( $cust_refund->unapplied > 0 ) { - $pre = 'Unapplied '; - $post = ''; -} - -my $view = - ' ('. include('/elements/popup_link.html', - 'label' => 'view receipt', - 'action' => "${p}view/cust_refund.html?link=popup;". - 'refundnum='. $cust_refund->refundnum, - 'actionlabel' => 'Payment Receipt', - ). - ')'; - - -my $delete = ''; -if ( $cust_refund->closed !~ /^Y/i - && $opt{'deleterefunds'} - && $curuser->access_right('Delete refund') - ) -{ - $delete = qq! (delete)!; -} - - - diff --git a/httemplate/view/cust_main/payment_history/statement.html b/httemplate/view/cust_main/payment_history/statement.html deleted file mode 100644 index dedec9bda..000000000 --- a/httemplate/view/cust_main/payment_history/statement.html +++ /dev/null @@ -1,34 +0,0 @@ -<% $link %><% $pre %>Statement #<% $statementnum %> -%# (Balance $ <% $cust_statement->owed %>) -<% $post %><% $link ? '' : '' %><% $events %> -<%init> - -my( $cust_statement, %opt ) = @_; - -my $curuser = $FS::CurrentUser::CurrentUser; - -my($pre, $post) = ('', ''); -#if ( $cust_statement->owed > 0 ) { -# $pre = 'Open '; -# $post = ''; -#} - -my $statementnum = $cust_statement->statementnum; - -my $link = $curuser->access_right('View invoices') - ? qq!! - : ''; - -my $events = ''; - -#if ( $cust_statement->num_cust_event -# && ( $curuser->access_right('Billing event reports') -# || $curuser->access_right('View customer billing events') -# ) -# ) { -# $events = -# qq!
( View statement events )'; -#} - - diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html deleted file mode 100644 index 5d7f60cf5..000000000 --- a/httemplate/view/cust_main/payment_history/voided_payment.html +++ /dev/null @@ -1,60 +0,0 @@ -Payment <% $info %> by <% $cust_pay_void->otaker %> -voided <% time2str($date_format, $cust_pay_void->void_date) %> -% my $void_user = $cust_pay_void->void_access_user; -% if ($void_user) { - by <% $void_user->username %> -% } -<% $unvoid %> -<%init> - -my( $cust_pay_void, %opt ) = @_; - -my $date_format = $opt{'date_format'} || '%m/%d/%Y'; - -my $curuser = $FS::CurrentUser::CurrentUser; - -my $payby = $cust_pay_void->payby; - -my $payinfo; -if ( $payby eq 'CARD' ) { - $payinfo = $cust_pay_void->paymask; -} elsif ( $payby eq 'CHEK' ) { - my( $account, $aba ) = split('@', $cust_pay_void->paymask ); - $payinfo = "ABA $aba, Acct #$account"; -} else { - $payinfo = $cust_pay_void->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_void->pkgnum ) { - my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay_void->pkgnum } ); - $info .= ' for '. $cust_pkg->pkg_label_long; -} - -my $unvoid = ''; -if ( $cust_pay_void->closed !~ /^Y/i - && $curuser->access_right('Unvoid') - ) -{ - $unvoid = qq! (unvoid)!; -} - - diff --git a/httemplate/view/cust_main/qual_link.html b/httemplate/view/cust_main/qual_link.html deleted file mode 100644 index b8dfaf9b2..000000000 --- a/httemplate/view/cust_main/qual_link.html +++ /dev/null @@ -1,16 +0,0 @@ -<% include( '/elements/popup_link-cust_main.html', - 'action' => $p. 'misc/qual.html', - 'label' => 'New Qualification', - 'actionlabel' => 'New Qualification', - 'color' => '#333399', - 'cust_main' => $cust_main, - 'closetext' => 'Close', - 'width' => 763, - 'height' => 436, - ) -%> -<%init> - -my($cust_main) = @_; - - diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html deleted file mode 100644 index e90ae5276..000000000 --- a/httemplate/view/cust_main/tickets.html +++ /dev/null @@ -1,117 +0,0 @@ -
- -Create new ticket - in queue -% my %queues = FS::TicketSystem->queues(); -% if( $conf->exists('ticket_system-force_default_queueid') ) { -<% $queues{$new_param{'Queue'}} %> - -% } -% else { - - -% } -
-
- -(View <% $openlabel %> tickets for this customer) -(View resolved tickets for this customer) -

- -<% include("/elements/table-grid.html") %> -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = ''; - - - # - Subject - Status - Queue - Owner - Priority - - -% 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->{status} %> - - - - <% $ticket->{queue} %> - - - - <% $ticket->{owner} %> - - - - <% $ticket->{content} - ? $ticket->{content}.' ('.$ticket->{priority}.')' - : $ticket->{priority} - %> - - - - -% } - - - -<%init> - -my( $conf ) = new FS::Conf; -my( $cust_main ) = @_; -my( @tickets ) = $cust_main->tickets; - -my $open_link = FS::TicketSystem->href_customer_tickets($cust_main->custnum); -my $openlabel = join('/', FS::TicketSystem->statuses ); - -my $res_link = FS::TicketSystem->href_customer_tickets( - $cust_main->custnum, - { 'statuses' => [ 'resolved' ] } - ); - -my( $new_base, %new_param ) = FS::TicketSystem->href_params_new_ticket( - $cust_main, - join(', ', $cust_main->invoicing_list_emailonly ) ); - -my $new_link = FS::TicketSystem->href_new_ticket( - $cust_main, - join(', ', $cust_main->invoicing_list_emailonly ) - ); - - diff --git a/httemplate/view/cust_pay.html b/httemplate/view/cust_pay.html deleted file mode 100644 index 1408b3db2..000000000 --- a/httemplate/view/cust_pay.html +++ /dev/null @@ -1,186 +0,0 @@ -% if ( $link eq 'popup' ) { - - <% include('/elements/header-popup.html', "$thing Receipt" ) %> - -
- Print | - Re-email -

- -% } elsif ( $link eq 'print' ) { - - <% include('/elements/header-popup.html', "$thing Receipt" ) %> - -% #it would be nice if the menubar could be hidden for print, but better to -% # have it available than not, otherwise the user winds up at a dead end - <% menubar( - "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - %> -

-% } 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( - "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", - 'Print receipt' => $pr_link, - )) - %> - -% } - -% unless ($link =~ /^(popup|email)$/ ) { - <% include('/elements/small_custview.html', - $custnum, - scalar($conf->config('countrydefault')), - 1, #no balance - ) - %> -

-% } - -<% ntable("#cccccc", 2) %> - - - Payment# - <% $cust_pay->paynum %> - - - - Date - <% time2str"%a %b %o, %Y %r", $cust_pay->_date %> - - -% if ( $void ) { - - - Void Date - <% time2str"%a %b %o, %Y %r", $cust_pay->void_date %> - - -%# -%# Void reason -%# <% $cust_pay->reason %> -%# - -% } - - - Amount - <% $money_char. $cust_pay->paid %> - - - - Payment method - <% $cust_pay->payby_name %> #<% $cust_pay->paymask %> - - -% if ( $cust_pay->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay->paybatch ) { - - - Processor - <% $cust_pay->processor %> - - - - Authorization# - <% $cust_pay->authorization %> - - -% if ( $cust_pay->order_number ) { - - Order# - <% $cust_pay->order_number %> - -% } - -% } - -% if ( $conf->exists('pkg-balances') && $cust_pay->pkgnum ) { -% my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } ); - - For package - <% $cust_pkg->pkg_label_long %> - - -% } - - - -% if ( $link eq 'print' ) { - - - -% } elsif ( $link eq 'email' ) { - - - -% } -% if ( $link =~ /^(popup|print|email)$/ ) { - - -% } else { - <% include('/elements/footer.html') %> -% } - -<%init> - -my $curuser = $FS::CurrentUser::CurrentUser; - -die "access denied" - unless $curuser->access_right('View invoices') #remove this in 1.9 EVENTUALLY - || $curuser->access_right('View customer payments'); - -$cgi->param('paynum') =~ /^(\d+)$/ or die "no paynum"; -my $paynum = $1; - -my $link = ''; -if ( $cgi->param('link') =~ /^(\w+)$/ ) { - $link = $1; -} - -my $void = $cgi->param('void') ? 1 : 0; -my $thing = $void ? 'Voided Payment' : 'Payment'; -my $table = $void ? 'cust_pay_void' : 'cust_pay'; - -my $cust_pay = qsearchs({ - 'select' => "$table.*", - 'table' => $table, - 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', - 'hashref' => { 'paynum' => $paynum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -}); -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; - -my $conf = new FS::Conf; - -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; -} - - diff --git a/httemplate/view/cust_pay_void.html b/httemplate/view/cust_pay_void.html deleted file mode 100644 index 8c22170d6..000000000 --- a/httemplate/view/cust_pay_void.html +++ /dev/null @@ -1 +0,0 @@ -<% include('cust_pay.html', @_, 'void' => 1 ) %> diff --git a/httemplate/view/cust_refund.html b/httemplate/view/cust_refund.html deleted file mode 100644 index 138c8780d..000000000 --- a/httemplate/view/cust_refund.html +++ /dev/null @@ -1,142 +0,0 @@ -% if ( $link eq 'popup' ) { - - <% include('/elements/header-popup.html', "Refund Receipt" ) %> - -
Print

- -% } elsif ( $link eq 'print' ) { - - <% include('/elements/header-popup.html', "Refund Receipt" ) %> - -% #it would be nice if the menubar could be hidden for print, but better to -% # have it available than not, otherwise the user winds up at a dead end - <% menubar( - "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - %> -

- -% } else { - - <% include('/elements/header.html', "Refund Receipt", menubar( - "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", - 'Print receipt' => $pr_link, - )) - %> - -% } - -% unless ($link eq 'popup' ) { - <% include('/elements/small_custview.html', - $custnum, - scalar($conf->config('countrydefault')), - 1, #no balance - ) - %> -

-% } - -<% ntable("#cccccc", 2) %> - - - Refund# - <% $cust_refund->refundnum %> - - - - Date - <% time2str"%a %b %o, %Y %r", $cust_refund->_date %> - - - - Amount - <% $money_char. $cust_refund->refund %> - - - - Reason - <% $cust_refund->reason %> - - - - Refund method - <% $cust_refund->payby_name %><% $cust_refund->paymask ? ' #'.$cust_refund->paymask : '' %> - - -% if ( $cust_refund->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_refund->paybatch ) { - - - Processor - <% $cust_refund->processor %> - - - - Authorization# - <% $cust_refund->authorization %> - - -% if ( $cust_refund->order_number ) { - - Order# - <% $cust_refund->order_number %> - -% } - -% } - - - -% if ( $link eq 'print' ) { - - - -% } - -% if ( $link =~ /^(popup|print)$/ ) { - - -% } else { - <% include('/elements/footer.html') %> -% } - -<%init> - -my $curuser = $FS::CurrentUser::CurrentUser; - -die "access denied" - unless $curuser->access_right('View invoices') #remove this in 1.9 EVENTUALLY - || $curuser->access_right('View customer payments'); - #'View customer refunds' ??? - - -$cgi->param('refundnum') =~ /^(\d+)$/ or die "no refundnum"; -my $refundnum = $1; - -my $link = ''; -if ( $cgi->param('link') =~ /^(\w+)$/ ) { - $link = $1; -} - -my $cust_refund = qsearchs({ - 'select' => 'cust_refund.*', - 'table' => 'cust_refund', - 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', - 'hashref' => { 'refundnum' => $refundnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -}); -die "Refund #$refundnum not found!" unless $cust_refund; - -my $pr_link = "${p}view/cust_refund.html?link=print;refundnum=$refundnum"; - -my $custnum = $cust_refund->custnum; -my $display_custnum = $cust_refund->cust_main->display_custnum; - -my $conf = new FS::Conf; - -my $money_char = $conf->config('money_char') || '$'; - -tie my %payby, 'Tie::IxHash', FS::payby->payby2longname; - - diff --git a/httemplate/view/cust_statement-pdf.cgi b/httemplate/view/cust_statement-pdf.cgi deleted file mode 100755 index a1739e04c..000000000 --- a/httemplate/view/cust_statement-pdf.cgi +++ /dev/null @@ -1,28 +0,0 @@ -<% $pdf %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); - -#untaint statementnum -my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)(.pdf)?$/; -my $templatename = $2 || 'statement'; #XXX configure... via event?? eh.. -my $statementnum = $3; - -my $cust_statement = qsearchs({ - 'select' => 'cust_statement.*', - 'table' => 'cust_statement', - 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', - 'hashref' => { 'statementnum' => $statementnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -}); -die "Statement #$statementnum not found!" unless $cust_statement; - -my $pdf = $cust_statement->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_statement.html b/httemplate/view/cust_statement.html deleted file mode 100755 index 3e1345ed5..000000000 --- a/httemplate/view/cust_statement.html +++ /dev/null @@ -1,79 +0,0 @@ -<% include("/elements/header.html",'Statement View', menubar( - "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", -)) %> - -% if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) { - -%# Re-print this statement - -% if ( grep { $_ ne 'POST' } $cust_statement->cust_main->invoicing_list ) { -%# | - Re-email this statement -% } - -% if ( 0 ) { -% #if ( $conf->exists('hylafax') && length($cust_statement->cust_main->fax) ) { - | Re-fax this statement -% } - -

- -% } - - -% #if ( $conf->exists('invoice_latex') ) { -% if ( 0 ) { #broken??? - - View typeset statement -

-% } - -% #if ( $cust_statement->num_cust_event ) { -% if ( 0 ) { -( View statement events )

-% } - -% if ( $conf->exists('invoice_html') ) { - - <% join('', $cust_statement->print_html('', $templatename) ) %> -% } else { - -
<% join('', $cust_statement->print_text('', $templatename) ) %>
-% } - -<% include('/elements/footer.html') %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); - -#untaint statement -my($query) = $cgi->keywords; -$query =~ /^((.+)-)?(\d+)$/; -my $templatename = $2 || 'statement'; #XXX configure... via event?? eh.. -my $statementnum = $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_statement = qsearchs({ - 'select' => 'cust_statement.*', - 'table' => 'cust_statement', - 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', - 'hashref' => { 'statementnum' => $statementnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -}); -die "Statement #$statementnum not found!" unless $cust_statement; - -my $custnum = $cust_statement->custnum; -my $display_custnum = $cust_statement->cust_main->display_custnum; - -my $link = "statementnum=$statementnum"; -$link .= ';template='. uri_escape($templatename) if $templatename; - - diff --git a/httemplate/view/cust_svc.cgi b/httemplate/view/cust_svc.cgi deleted file mode 100644 index 8ccfce3ff..000000000 --- a/httemplate/view/cust_svc.cgi +++ /dev/null @@ -1,23 +0,0 @@ -<% $cgi->redirect(popurl(1)."$svcdb.cgi?". $svcnum ) %> -<%init> - -#needed here? we're just redirecting. i guess it could reveal the svcdb of a -#svcnum... oooooo scary. not. -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); - -#some false laziness w/svc_*.cgi - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); -die "Unknown svcnum" unless $cust_svc; - -my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); -die "Unknown svcpart" unless $part_svc; - -my $svcdb = $part_svc->svcdb; - - - diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html deleted file mode 100644 index de49b50d2..000000000 --- a/httemplate/view/elements/svc_Common.html +++ /dev/null @@ -1,185 +0,0 @@ -<%doc> - -#Example: - - include( 'elements/svc_Common.html, - - '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' => [ - ] - - # defaults to "edit/$table.cgi?", will have svcnum appended - 'edit_url' => - - #at the very bottom (well, as low as you can go from here) - 'html_foot' => '', - - ) - - - - -% if ( $custnum ) { - - <% include("/elements/header.html","View $label: $value") %> - - <% include( '/elements/small_custview.html', $custnum, '', 1, - "${p}view/cust_main.cgi") %> -
- -% } else { - - <% include("/elements/header.html","View $label: $value", menubar( - "Cancel this (unaudited) $label" => - "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" - )) %> - -% } - -Service #<% $svcnum %> -% my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?'; -| Edit this <% $label %> - -| -Unprovision this Service -
- -<% ntable("#cccccc") %><% ntable("#cccccc",2) %> - -% foreach my $f ( @$fields ) { -% -% my($field, $type, $value, $hack_strict_refs); -% if ( ref($f) ) { -% $field = $f->{'field'}; -% $hack_strict_refs = \&{ $f->{'value'} } if $f->{'value'}; -% $value = $f->{'value'} ? &$hack_strict_refs($svc_x) : $svc_x->$field; -% $type = $f->{'type'} || 'text'; -% } else { -% $field = $f; -% $value = $svc_x->$field; -% $type = 'text'; -% } -% -% my $columndef = $part_svc->part_svc_column($field); -% unless ($columndef->columnflag eq 'F' && !length($columndef->columnvalue)) { - - - - <% ( $opt{labels} && exists $opt{labels}->{$field} ) - ? $opt{labels}->{$field} - : $field - %> - - -% $value = time2str($date_format,$value) if ( $type eq 'date' && $value ); -% $value = time2str("$date_format %H:%M",$value) if ( $type eq 'datetime' && $value ); -% $value = $value eq 'Y' ? 'Yes' : 'No' if ( $type eq 'checkbox' ); -% #eventually more options for - - -% foreach my $opt_part_svc ( @part_svc ) { - - -% } - - - - -% } - -<%init> - -my %opt = @_; -my @part_svc = @{ $opt{'part_svc'} }; - - diff --git a/httemplate/view/svc_acct/change_svc_form.html b/httemplate/view/svc_acct/change_svc_form.html deleted file mode 100644 index 4f10922ba..000000000 --- a/httemplate/view/svc_acct/change_svc_form.html +++ /dev/null @@ -1,23 +0,0 @@ -% if ( @part_svc || $opt{'showall'} ) { - - -
- - -% } -<%init> - -my %opt = @_; -my @part_svc = @{ $opt{'part_svc'} }; -my $svcnum = $opt{'svcnum'}; -my $pkgnum = $opt{'pkgnum'}; - - diff --git a/httemplate/view/svc_acct/communigate.html b/httemplate/view/svc_acct/communigate.html deleted file mode 100644 index 179facfa0..000000000 --- a/httemplate/view/svc_acct/communigate.html +++ /dev/null @@ -1,142 +0,0 @@ -%# settings - - <% include('/view/elements/tr.html', label=>'Mailbox type', value=>$svc_acct->cgp_type) %> - - <% include('/view/elements/tr.html', label=>'Enabled services', - value=>$svc_acct->cgp_accessmodes ) %> - - <% include('/view/elements/tr.html', label=>'Mail storage limit', - value=>$svc_acct->quota ) %> - - <% include('/view/elements/tr.html', label=>'File storage limit', - value=>$svc_acct->file_quota ) %> - - <% include('/view/elements/tr.html', label=>'Number of files limit', - value=>$svc_acct->file_maxnum ) %> - - <% include('/view/elements/tr.html', label=>'File size limit', - value=>$svc_acct->file_maxsize ) %> - - <% include('/view/elements/tr.html', label=>'Password recovery', - value=>$svc_acct->password_recover ? 'YES' : 'NO' ) %> - - <% include('/view/elements/tr.html', label=>'Allowed mail rules', - value=>$svc_acct->cgp_rulesallowed || 'default (No)') %> - - <% include('/view/elements/tr.html', label=>'RPOP modifications', - value=>$svc_acct->cgp_rpopallowed ? 'YES' : 'NO' ) %> - - <% include('/view/elements/tr.html', label=>'Accepts mail to "all"', - value=>$svc_acct->cgp_mailtoall ? 'YES' : 'NO' ) %> - - <% 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', - value=>$svc_acct->cgp_deletemode ) %> - - <% include('/view/elements/tr.html', label=>'On logout remove trash', - value=>$svc_acct->cgp_emptytrash ) %> - - <% include('/view/elements/tr.html', label=>'Language', - value=>$svc_acct->cgp_language || 'default (English)' ) %> - <% include('/view/elements/tr.html', label=>'Time zone', - value=>$svc_acct->cgp_timezone || 'default (HostOS)' ) %> - <% include('/view/elements/tr.html', label=>'Layout', - value=>$svc_acct->cgp_skinname || 'default (***)' ) %> - - <% include('/view/elements/tr.html', label=>'Pronto style', - value=>$svc_acct->cgp_prontoskinname ) %> - - <% include('/view/elements/tr.html', label=>'Send read receipts', - value=>$svc_acct->cgp_sendmdnmode ) %> - -%# vacation message - <% include('/elements/init_overlib.html') %> - - - Vacation message - - <% $vacation_rule ? 'Active' : '' %> - <% include('/elements/popup_link.html', - 'action' => $p.'edit/cgp_rule-vacation.html?'. - 'svcnum='. $svc_acct->svcnum, - 'label' => $vacation_rule ? '(edit)' : '(add)', - 'actionlabel' => 'Vacation message', - 'width' => 600, - 'height' => 300, - #'color' - ) - %> - - - -%# redirect all mail - - - Redirect all mail - - <% $redirect_rule ? 'Active' : '' %> - <% include('/elements/popup_link.html', - 'action' => $p.'edit/cgp_rule-redirect_all.html?'. - 'svcnum='. $svc_acct->svcnum, - 'label' => $redirect_rule ? '(edit)' : '(add)', - 'actionlabel' => 'Redirect all mail', - 'width' => 763, - #'height' - #'color' - ) - %> - - - -%# mail rules - - <% include('/view/elements/tr.html', label=>'Mail rules', - value=>$rule_link, - ) - %> - -%# RPOP - - <% include('/view/elements/tr.html', label=>'Remote POP accounts', - value=>$rpop_link, - ) - %> - -<%init> - -my %opt = @_; - -#my $conf = new FS::Conf; - -my $svc_acct = $opt{'svc_acct'}; -#my $part_svc = $opt{'part_svc'}; - -my $rule_link = qq(svcnum. '">View/edit mail rules'; - -my $rpop_link = qq(svcnum. '">View/edit remote POP accounts'; - -my $vacation_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum, - 'name' => '#Vacation' - } - ); - -my $redirect_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum, - 'name' => '#Redirect' - } - ); - - diff --git a/httemplate/view/svc_acct/hosting.html b/httemplate/view/svc_acct/hosting.html deleted file mode 100644 index 1d83603b7..000000000 --- a/httemplate/view/svc_acct/hosting.html +++ /dev/null @@ -1,38 +0,0 @@ -% if ( @svc_www || $opt{'showall'} ) { - Hosting - <% &ntable("#cccccc") %><% &ntable("#cccccc",2) %> -% foreach my $svc_www (@svc_www) { -% my($label, $value) = $svc_www->cust_svc->label; -% my $link = $p. 'view/svc_www.cgi?'. $svc_www->svcnum; - - - <% "$label: $value" %> - - -% } - -

-% } -<%init> - -my %opt = @_; - -#false laziness w/view_svc_acct.cgi and a zillion other places -my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. - ' LEFT JOIN cust_pkg USING ( pkgnum ) '. - ' LEFT JOIN cust_main USING ( custnum ) '; - -my @svc_www = qsearch({ - 'select' => 'svc_www.*', - 'table' => 'svc_www', - 'addl_from' => $addl_from, - 'hashref' => { 'usersvc' => $opt{'svcnum'} }, - #XXX shit outta luck if you somehow got them linked across agents - # maybe we should show but not link to them? kinda makes sense... - # (maybe a specific ACL for this situation???) - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql( - 'null_right' => 'View/link unlinked services' - ), -}); - - diff --git a/httemplate/view/svc_acct/radius_usage.html b/httemplate/view/svc_acct/radius_usage.html deleted file mode 100644 index e2253a34a..000000000 --- a/httemplate/view/svc_acct/radius_usage.html +++ /dev/null @@ -1,77 +0,0 @@ -% 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) %> - -% 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 -% } - -
-% } else { - - (no billing cycle available for unaudited account)
-% } - - - Upload: <% sprintf("%.3f", $input) %> megabytes
- Download: <% sprintf("%.3f", $output) %> megabytes
- Last Login: <% $svc_acct->last_login_text %>
-% my $href = qq!this billing cycle - | <% $href %>;begin=<% time-15552000 %>">past six months - | <% $href %>">all sessions - -
-% } -<%init> - -my %opt = @_; - -my $svc_acct = $opt{'svc_acct'}; -my $part_svc = $opt{'part_svc'}; -my $cust_pkg = $opt{'cust_pkg'}; - - diff --git a/httemplate/view/svc_acct/usage.html b/httemplate/view/svc_acct/usage.html deleted file mode 100644 index 9758d8332..000000000 --- a/httemplate/view/svc_acct/usage.html +++ /dev/null @@ -1,27 +0,0 @@ -% my %ulabel = ( seconds => 'Time', -% upbytes => 'Upload bytes', -% downbytes => 'Download bytes', -% totalbytes => 'Total bytes', -% ); -% foreach my $uf ( keys %ulabel ) { -% my $tf = $uf . "_threshold"; -% if ( $svc_acct->$uf ne '' ) { -% my $v = $uf eq 'seconds' -% #? (($svc_acct->$uf < 0 ? '-' : ''). duration_exact($svc_acct->$uf) ) -% ? ($svc_acct->$uf < 0 ? '-' : ''). -% int(abs($svc_acct->$uf)/3600). "hr ". -% sprintf("%02d",(abs($svc_acct->$uf)%3600)/60). "min" -% : FS::UI::bytecount::display_bytecount($svc_acct->$uf); - - <% $ulabel{$uf} %> remaining - <% $v %> - - -% } -% } -<%init> - -my %opt = @_; -my $svc_acct = $opt{'svc_acct'}; - - diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi deleted file mode 100644 index f552e9bc7..000000000 --- a/httemplate/view/svc_broadband.cgi +++ /dev/null @@ -1,219 +0,0 @@ -<%include("/elements/header.html",'Broadband Service View', menubar( - ( ( $custnum ) - ? ( "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - : ( "Cancel this (unaudited) website" => - "${p}misc/cancel-unaudited.cgi?$svcnum" ) - ) -)) -%> - -<% include('/elements/init_overlib.html') %> - -Edit this information -
-<%ntable("#cccccc")%> - - - <%ntable("#cccccc",2)%> - - Service number - <%$svcnum%> - - - Description - <%$description%> - - -% if ( $router ) { - - Router - <%$router->routernum%>: <%$router->routername%> - -% } - - - Download Speed - <%$speed_down%> - - - Upload Speed - <%$speed_up%> - - -% if ( $ip_addr ) { - - IP Address - - <%$ip_addr%> - (<% include('/elements/popup_link-ping.html', 'ip'=>$ip_addr ) %>) - - - - IP Netmask - <%$addr_block->NetAddr->mask%> - - - IP Gateway - <%$addr_block->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) { -% 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%> - - (details) - -
-% my @sb_addr_block; -% if (@sb_addr_block = $sb_router->addr_block) { -% - - Address space - - (edit) - -
-% print ntable("#cccccc", 1); -% foreach (@sb_addr_block) { - - - <%$_->ip_gateway%>/<%$_->ip_netmask%> - -% } - - -% } else { - - No address space allocated. -% } - -
-% -% } else { -% - - - - -Add router named - - -
-% -%} -% - - -
-<%joblisting({'svcnum'=>$svcnum}, 1)%> - -<% include('/elements/footer.html') %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_broadband = qsearchs({ - 'select' => 'svc_broadband.*', - 'table' => 'svc_broadband', - '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( - 'null_right' => 'View/link unlinked services' - ), -}) 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, $display_custnum); -if ($pkgnum) { - $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); - $custnum = $cust_pkg->custnum; - $display_custnum = $cust_pkg->cust_main->display_custnum; -} else { - $cust_pkg = ''; - $custnum = ''; -} -#eofalse - -my $addr_block = $svc_broadband->addr_block; -my $router = $addr_block->router if $addr_block; - -#if (not $router) { die "Could not lookup router for svc_broadband (svcnum $svcnum)" }; - -my ( - $speed_down, - $speed_up, - $ip_addr, - $mac_addr, - $latitude, - $longitude, - $altitude, - $vlan_profile, - $auth_key, - $description, - ) = ( - $svc_broadband->getfield('speed_down'), - $svc_broadband->getfield('speed_up'), - $svc_broadband->getfield('ip_addr'), - $svc_broadband->mac_addr, - $svc_broadband->latitude, - $svc_broadband->longitude, - $svc_broadband->altitude, - $svc_broadband->vlan_profile, - $svc_broadband->auth_key, - $svc_broadband->description, - ); - - diff --git a/httemplate/view/svc_cert.cgi b/httemplate/view/svc_cert.cgi deleted file mode 100644 index 0cd66b422..000000000 --- a/httemplate/view/svc_cert.cgi +++ /dev/null @@ -1,205 +0,0 @@ -<% include('elements/svc_Common.html', - 'table' => 'svc_cert', - 'labels' => \%labels, - #'html_foot' => $html_foot, - 'fields' => \@fields, - ) -%> -<%init> - -my $fields = FS::svc_cert->table_info->{'fields'}; -my %labels = map { $_ => ( ref($fields->{$_}) - ? $fields->{$_}{'label'} - : $fields->{$_} - ); - } - keys %$fields; - -my @fields = ( - { field=>'privatekey', - value=> sub { - my $svc_cert = shift; - if ( $svc_cert->privatekey && $svc_cert->check_privatekey ) { - 'Verification OK'; - } elsif ( $svc_cert->privatekey ) { - 'Verification error'; - } else { - '(none)'; - } - }, - }, - qw( common_name organization organization_unit city state country cert_contact - ), - { 'field'=>'csr', - 'value'=> sub { - my $svc_cert = shift; - if ( $svc_cert->csr ) { - - my $out = ''; - - my %hash = $svc_cert->check_csr; - - $out .= include('/elements/table-grid.html'). #''. - ''; - - my $col = $svc_cert->subj_col; - - foreach my $key (keys %hash) { - $out .= "". - ""; - } - - $out .= '
'. - 'Requested by
". $labels{$col->{$key}}. "". $hash{$key}. "
'; - - $out .= - '
'. $svc_cert->csr.
-          '
'; - - $out; - - } elsif ( $svc_cert->common_name ) { - my $svcnum = $svc_cert->svcnum; - qq(Generate); - } else { - ''; - } - }, - }, - { 'field'=>'certificate', - 'value'=> sub { - my $svc_cert = shift; - if ( $svc_cert->certificate ) { - - my %hash = $svc_cert->check_certificate; - - tie my %w, 'Tie::IxHash', - 'subject' => 'Issued to', - 'issuer' => 'Issued by', - ; - - my $out = '
'; - - foreach my $w ( keys %w ) { - - $out .= include('/elements/table-grid.html'). #''. - ''; - - my $col = $svc_cert->subj_col; - - my $subj = $hash{$w}; - foreach my $key (keys %$col) { #( keys %$subj ) { - $out .= "". - ""; - } - - $out .= '
'. - $w{$w}. '
". $labels{$col->{$key}}. "". $subj->{$key}. "
'; - } - $out .= '
'; - - $out .= ''. - ''. - "". - ''. - "". - '
Serial number$hash{serial}
Valid$hash{notBefore} - $hash{notAfter}
'; - - my $svcnum = $svc_cert->svcnum; - - if ( $hash{'selfsigned'} ) { - $out .= qq(
Re-generate self-signed). - '   '. - include('/elements/popup_link.html', { - 'action' => $p."edit/svc_cert/import_certificate.html". - "?svcnum=$svcnum", - 'label' => 'Import issued certificate', #link - 'actionlabel' => 'Import issued certificate', #title - #opt - 'width' => '544', - 'height' => '368', - #'color' => '#ff0000', - }). - '
'; - } - - $out .= '
'.
-                $svc_cert->certificate.
-                '
';
-
-        $out;
-      } elsif ( $svc_cert->csr ) {
-        my $svcnum = $svc_cert->svcnum;
-        qq(Generate self-signed);
-      } else {
-        '';
-      }
-    },
-  },
-  { 'field'=>'cacert',
-    'value'=> sub {
-      my $svc_cert = shift;
-      if ( $svc_cert->cacert ) {
-
-        my %hash = $svc_cert->check_cacert;
-
-        tie my %w, 'Tie::IxHash',
-          'subject' => 'Issued to',
-          'issuer'  => 'Issued by',
-        ;
-
-        my $out = '
'; - - foreach my $w ( keys %w ) { - - $out .= include('/elements/table-grid.html'). #''. - ''; - - my $col = $svc_cert->subj_col; - - my $subj = $hash{$w}; - foreach my $key (keys %$col) { #( keys %$subj ) { - $out .= "". - ""; - } - - $out .= '
'. - $w{$w}. '
". $labels{$col->{$key}}. "". $subj->{$key}. "
'; - } - $out .= '
'; - - $out .= ''. - ''. - "". - ''. - "". - '
Serial number$hash{serial}
Valid$hash{notBefore} - $hash{notAfter}
'; - - $out .= '
'.
-                $svc_cert->certificate.
-                '
';
-
-        $out;
-
-      } else {
-
-        my $svcnum = $svc_cert->svcnum;
-
-        include('/elements/popup_link.html', {
-          'action'      => $p."edit/svc_cert/import_cacert.html".
-                           "?svcnum=$svcnum",
-          'label'       => 'Import certificate authority chain',#link
-          'actionlabel' => 'Import certificate authority chain',#title
-          #opt
-          'width'       => '544',
-          'height'      => '368',
-          #'color'       => '#ff0000',
-        }). ' (optional)'.
-        '
'; - - } - }, - }, -); - - diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi deleted file mode 100755 index 3938a3406..000000000 --- a/httemplate/view/svc_domain.cgi +++ /dev/null @@ -1,82 +0,0 @@ -% if ( $custnum ) { - -%# <% include("/elements/header.html","View $svcdomain") %> - <% include("/elements/header.html","View domain") %> - <% include( '/elements/small_custview.html', $custnum, '', 1, - "${p}view/cust_main.cgi") %> -
- -% } else { - - <% include("/elements/header.html",'View domain', menubar( - "Cancel this (unaudited) domain" => - "javascript:areyousure('${p}misc/cancel-unaudited.cgi?$svcnum', 'Delete $domain and all records?')", - )) - %> - -% } - -<% include('/elements/error.html') %> - -<% include('svc_domain/basics.html', $svc_domain, - 'part_svc' => $part_svc, - 'custnum' => $custnum, - ) -%> -
- -<% include('svc_domain/acct_defaults.html', $svc_domain, - 'part_svc' => $part_svc, - ) -%> -
- -<% include('svc_domain/dns.html', $svc_domain ) %> -
- -<% include('elements/svc_export_settings.html', $svc_domain) %> - -<% joblisting({'svcnum'=>$svcnum}, 1) %> - -<% include('/elements/footer.html') %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); - -my $conf = new FS::Conf; - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_domain = qsearchs({ - 'select' => 'svc_domain.*', - 'table' => 'svc_domain', - '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( - 'null_right' => 'View/link unlinked services' - ), -}); -die "Unknown svcnum" unless $svc_domain; - -my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum, $display_custnum); -if ($pkgnum) { - $cust_pkg = qsearchs('cust_pkg', {'pkgnum'=>$pkgnum} ); - $custnum = $cust_pkg->custnum; - $display_custnum = $cust_pkg->cust_main->display_custnum; -} else { - $cust_pkg = ''; - $custnum = ''; -} - -my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); -die "Unknown svcpart" unless $part_svc; - -my $domain = $svc_domain->domain; - - diff --git a/httemplate/view/svc_domain/acct_defaults.html b/httemplate/view/svc_domain/acct_defaults.html deleted file mode 100644 index b5612827b..000000000 --- a/httemplate/view/svc_domain/acct_defaults.html +++ /dev/null @@ -1,149 +0,0 @@ -% if ( $communigate ) { - - Account defaults - <% &ntable("#cccccc") %><% &ntable("#cccccc",2) %> - -%# settings - - <% include('/view/elements/tr.html', - label=>'Password modification', - value=>$svc_domain->acct_def_password_selfchange ? 'YES' : 'NO', - ) - %> - - <% include('/view/elements/tr.html', - label=>'Password recovery', - value=>$svc_domain->acct_def_password_recover ? 'YES' : 'NO', - ) - %> - - <% include('/view/elements/tr.html', - label=>'Enabled services', - value=>$svc_domain->acct_def_cgp_accessmodes, - ) - %> - - <% include('/view/elements/tr.html', - label=>'Mail storage limit', - value=>$svc_domain->acct_def_quota, - ) - %> - - <% include('/view/elements/tr.html', - label=>'File storage limit', - value=>$svc_domain->acct_def_file_quota, - ) - %> - - <% include('/view/elements/tr.html', - label=>'Files limit', - value=>$svc_domain->acct_def_file_maxnum, - ) - %> - - <% include('/view/elements/tr.html', - label=>'File size limit', - value=>$svc_domain->acct_def_file_maxsize, - ) - %> - - <% include('/view/elements/tr.html', - label=>'Allowed mail rules', - value=>$svc_domain->acct_def_cgp_rulesallowed || 'default (No)', - ) - %> - - <% include('/view/elements/tr.html', - label=>'RPOP modifications', - value=>$svc_domain->acct_def_cgp_rpopallowed ? 'YES' : 'NO', - ) - %> - - <% include('/view/elements/tr.html', - label=>'Accepts mail to "all"', - value=>$svc_domain->acct_def_cgp_mailtoall ? 'YES' : 'NO', - ) - %> - - <% include('/view/elements/tr.html', - label=>'Add trailer to sent mail', - value=>$svc_domain->acct_def_cgp_addmailtrailer ? 'YES' : 'NO', - ) - %> - -% 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', - label=>'Message delete method', - value=>$svc_domain->acct_def_cgp_deletemode, - ) - %> - - <% include('/view/elements/tr.html', - label=>'On logout remove trash', - value=>$svc_domain->acct_def_cgp_emptytrash, - ) - %> - - <% include('/view/elements/tr.html', - label=>'Language', - value=>$svc_domain->acct_def_cgp_language || 'default (English)' - ) - %> - - <% include('/view/elements/tr.html', - label=>'Time zone', - value=>$svc_domain->acct_def_cgp_timezone || 'default (HostOS)' - ) - %> - - <% include('/view/elements/tr.html', - label=>'Layout', - value=>$svc_domain->acct_def_cgp_skinname || 'default (***)' - ) - %> - - <% include('/view/elements/tr.html', - label=>'Pronto style', - value=>$svc_domain->acct_def_cgp_prontoskinname - ) - %> - - <% include('/view/elements/tr.html', - label=>'Send read receipts', - value=>$svc_domain->acct_def_cgp_sendmdnmode - ) - %> - -%# mail -%#XXX rules, archive rule, spam foldering rule(s) - - - -% } -<%init> - -my($svc_domain, %opt) = @_; - -my $part_svc = $opt{'part_svc'}; - -my $communigate = scalar($part_svc->part_export('communigate_pro')); - # || scalar($part_svc->part_export('communigate_pro_singledomain')); - -my %rulesallowed = ( - -1 => 'default (No)', #No always the default? - 0 => 'No', - 1 => 'Filter Only', - 2 => 'All But Exec', - 3 => 'Any', -); - - diff --git a/httemplate/view/svc_domain/basics.html b/httemplate/view/svc_domain/basics.html deleted file mode 100644 index 71b7ca4eb..000000000 --- a/httemplate/view/svc_domain/basics.html +++ /dev/null @@ -1,158 +0,0 @@ -Service #<% $svcnum %> -% #if ( $conf->exists('svc_domain-edit_domain') ) { - | Edit this domain -% #} - -<% &ntable("#cccccc") %><% &ntable("#cccccc",2) %> - - - Service - <% $part_svc->svc %> - - - - Domain - - <% $domain %> - (view whois information) - - - -% if ($export) { - - Registration status - <% $status %> - -% if ( $FS::CurrentUser::CurrentUser->access_right('Manage domain registration') ) { -% if ( defined($ops{'register'}) ) { - Register at <% $registrar->{'name'} %>  -% } -% if ( defined($ops{'transfer'}) ) { - Transfer to <% $registrar->{'name'} %>  -% } -% if ( defined($ops{'renew'}) ) { - Renew at <% $registrar->{'name'} %>  -% } -% if ( defined($ops{'revoke'}) ) { - Revoke -% } -% } - - - -% } - -% if ( $communigate ) { - - - Administrator domain - -% if ( $svc_domain->parent_svcnum ) { -% #XXX agent-virt aware the link - <% $svc_domain->parent_svc_x->domain %> -% } else { - (none) -% } - - - - - Aliases - <% $svc_domain->cgp_aliases %> - - -% } - -% if ( $communigate && $svc_domain->max_accounts ) { - - Maximum number of Accounts - <% $svc_domain->max_accounts %> - -% } - - - Catch all email - <% $email ? "$email" : '(none)' %> -% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain catchall') ) { - (change) -% } - - - -% if ( $svc_domain->cgp_accessmodes ) { - - Enabled services - <% $svc_domain->cgp_accessmodes %> - -% } - -% if ( $svc_domain->cgp_certificatetype ) { - - PKI services - <% $svc_domain->cgp_certificatetype %> - -% } - -% if ( $svc_domain->trailer ) { - - Mail trailer -
<% $svc_domain->trailer |h %>
- -% } - -% if ( $communigate ) { -% my $rule_url = $p. 'browse/cgp_rule.html?svcnum='. $svc_domain->svcnum; - - Doimain mail rules - View/Edit domain mail rules - -% } - - - -<%init> - -my($svc_domain, %opt) = @_; -my $svcnum = $svc_domain->svcnum; -my $domain = $svc_domain->domain; -my $custnum = $opt{'custnum'}; -my $part_svc = $opt{'part_svc'}; - -my $communigate = scalar($part_svc->part_export('communigate_pro')); - # || scalar($part_svc->part_export('communigate_pro_singledomain')); - -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; -} - -# Find the first export that does domain registration -my @exports = grep $_->can('registrar'), $part_svc->part_export; -my $export = $exports[0]; -# If we have a domain registration export, get the registrar object -my $registrar; -my $status = 'Unknown'; -my %ops = (); -if ($export) { - $registrar = $export->registrar; - my $domstat = $export->get_status( $svc_domain ); - if (defined($domstat->{'message'})) { - $status = $domstat->{'message'}; - } elsif (defined($domstat->{'unregistered'})) { - $status = 'Not registered'; - $ops{'register'} = "Register"; - } elsif (defined($domstat->{'status'})) { - $status = $domstat->{'status'} . ' ' . $domstat->{'contact_email'} . ' ' . $domstat->{'last_update_time'}; - } elsif (defined($domstat->{'expdate'})) { - $status = "Expires " . $domstat->{'expdate'}; - $ops{'renew'} = "Renew"; - $ops{'revoke'} = "Revoke"; - } else { - $status = $domstat->{'reason'}; - $ops{'transfer'} = "Transfer"; - } -} - - diff --git a/httemplate/view/svc_domain/dns.html b/httemplate/view/svc_domain/dns.html deleted file mode 100644 index 184286c31..000000000 --- a/httemplate/view/svc_domain/dns.html +++ /dev/null @@ -1,150 +0,0 @@ - -<% include('/elements/init_overlib.html') %> - - -
-
-
- DNS Records -
- -<% include('/elements/table-grid.html') %> - -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = $bgcolor2; - - - Zone - Type - Data - TTL - - - -% my @records = $svc_domain->domain_record; -% 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->ttl %> - - -% 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; -% my $delete_url= "javascript:areyousure('${p}misc/delete-domain_record.cgi?". -% $domain_record->recnum. "', 'Delete ". -% $domain_record->reczone. " $type $recdata ?' )"; - <%$edit_link%> | delete -% } - - - - -% if ( $bgcolor eq $bgcolor1 ) { -% $bgcolor = $bgcolor2; -% } else { -% $bgcolor = $bgcolor1; -% } - -% } - -% if ( ! @records ) { - -
- - - - - - -
- -% } - -% if ( $FS::CurrentUser::CurrentUser->access_right('Edit domain nameservice') ) { -
- - - -
- Zone - - - -
- Type - - -
- Data - - -
- TTL - - - - - -
- -
-
- - Or -% if ( @records ) { - delete all records and -% } - slave from nameserver IP - - - - - - -
-

- -% } - - - -
-
-<%init> - -my($svc_domain, %opt) = @_; -my $svcnum = $svc_domain->svcnum; - - - diff --git a/httemplate/view/svc_dsl.cgi b/httemplate/view/svc_dsl.cgi deleted file mode 100644 index ade13501b..000000000 --- a/httemplate/view/svc_dsl.cgi +++ /dev/null @@ -1,65 +0,0 @@ -<% include('elements/svc_Common.html', - 'table' => 'svc_dsl', - 'labels' => \%labels, - 'fields' => \@fields, - 'svc_callback' => $svc_cb, - 'html_foot' => $html_foot, - ) -%> -<%init> - -# XXX: AJAX auto-pull - -my $fields = FS::svc_dsl->table_info->{'fields'}; -my %labels = map { $_ => ( ref($fields->{$_}) - ? $fields->{$_}{'label'} - : $fields->{$_} - ); - } keys %$fields; -my @fields = keys %$fields; - -my $footer; - -my $html_foot = sub { - return $footer; -}; - -my $svc_cb = sub { - my( $cgi,$svc_x, $part_svc,$cust_pkg, $fields1,$opt) = @_; - - my @exports = $part_svc->part_export_dsl_pull; - die "more than one DSL-pulling export attached to svcpart ".$part_svc->svcpart - if ( scalar(@exports) > 1 ); - - # if no DSL-pulling exports, then just display everything, which is the - # default behaviour implemented above - return if ( scalar(@exports) == 0 ); - - my $export = @exports[0]; - - @fields = ( 'phonenum', - { field => 'loop_type', - value => 'FS::part_export::'.$export->exporttype.'::loop_type_long' - }, - { field => 'desired_due_date', type => 'date', }, - { field => 'due_date', type => 'date', }, - { field => 'pushed', type => 'datetime', }, - { field => 'monitored', type => 'checkbox', }, - { field => 'last_pull', type => 'datetime', }, - 'first', - 'last', - 'company' ); - - my $status = ''; - if($export->exporttype eq 'ikano') { - push @fields, qw ( username password isp_chg isp_prev staticips ); - $status = "Ikano " . $svc_x->vendor_order_type . " order #" - . $svc_x->vendor_order_id . "   Status: " - . $svc_x->vendor_order_status; - } - # else add any other export-specific stuff here - - $footer = "$status"; - $footer .= "


Order Notes:
".$export->notes_html($svc_x); -}; - diff --git a/httemplate/view/svc_external.cgi b/httemplate/view/svc_external.cgi deleted file mode 100644 index 77679d81c..000000000 --- a/httemplate/view/svc_external.cgi +++ /dev/null @@ -1,65 +0,0 @@ -<% include("/elements/header.html",'External Service View', menubar( - ( ( $custnum ) - ? ( "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - : ( "Cancel this (unaudited) external service" => - "${p}misc/cancel-unaudited.cgi?$svcnum" ) - ), -)) %> - -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 %> -% foreach (sort { $a cmp $b } $svc_external->virtual_fields) { - - <% $svc_external->pvf($_)->widget('HTML', 'view', $svc_external->getfield($_)) %> -% } - - - -
<% joblisting({'svcnum'=>$svcnum}, 1) %> - -<% include('/elements/footer.html') %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_external = qsearchs({ - 'select' => 'svc_external.*', - 'table' => 'svc_external', - '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( - 'null_right' => 'View/link unlinked services' - ), -}) 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, $display_custnum); -if ($pkgnum) { - $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); - $custnum = $cust_pkg->custnum; - $display_custnum = $cust_pkg->cust_main->display_custnum; -} else { - $cust_pkg = ''; - $custnum = ''; -} -#eofalse - - diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi deleted file mode 100755 index 15b5ae56f..000000000 --- a/httemplate/view/svc_forward.cgi +++ /dev/null @@ -1,124 +0,0 @@ -% if ( $custnum ) { - - <% include("/elements/header.html","View mail forward") %> - <% include( '/elements/small_custview.html', $custnum, '', 1, - "${p}view/cust_main.cgi") %> -
- -% } else { - - <% include("/elements/header.html",'View mail forward', menubar( - "Cancel this (unaudited) mail forward" => - "javascript:areyousure('${p}misc/cancel-unaudited.cgi?$svcnum')", - )) - %> - - - -% } - -Edit this information - -<% ntable("#cccccc",2) %> - - - Service number - <% $svcnum %> - - - Service - <% $svc %> - - - Email to - <% $source %> - - - Forwards to - <% $destination %> - - -% foreach (sort { $a cmp $b } $svc_forward->virtual_fields) { - <% $svc_forward->pvf($_)->widget('HTML', 'view', $svc_forward->getfield($_)) %> -% } - - - -
- -<% include('elements/svc_export_settings.html', $svc_forward) %> - -<% joblisting({'svcnum'=>$svcnum}, 1) %> - -<% include('/elements/footer.html') %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); - -my $conf = new FS::Conf; - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_forward = qsearchs({ - 'select' => 'svc_forward.*', - 'table' => 'svc_forward', - '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( - 'null_right' => 'View/link unlinked services' - ), -}); -die "Unknown svcnum" unless $svc_forward; - -my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum, $display_custnum); -if ($pkgnum) { - $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); - $custnum=$cust_pkg->getfield('custnum'); - $display_custnum = $cust_pkg->cust_main->display_custnum; -} else { - $cust_pkg = ''; - $custnum = ''; -} - -my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) - or die "Unknown svcpart"; - -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; -} - - diff --git a/httemplate/view/svc_mailinglist.cgi b/httemplate/view/svc_mailinglist.cgi deleted file mode 100644 index f646a417d..000000000 --- a/httemplate/view/svc_mailinglist.cgi +++ /dev/null @@ -1,71 +0,0 @@ -<% include('elements/svc_Common.html', - 'table' => 'svc_mailinglist', - %opt, - ) -%> -<%init> - -my %opt = (); - -my $info = FS::svc_mailinglist->table_info; - -$opt{'name'} = $info->{'name'}; - -my $fields = $info->{'fields'}; -my %labels = map { $_ => ( ref($fields->{$_}) - ? $fields->{$_}{'label'} - : $fields->{$_} - ); - } - keys %$fields; - -#$opt{'fields'} = [ keys %$fields ]; -$opt{'fields'} = [ - 'username', - 'domain', - 'listname', - 'reply_to', - 'remove_from', - 'reject_auto', - 'remove_to_and_cc', -]; - -$opt{'labels'} = \%labels; - -$opt{'html_foot'} = sub { - my $svc_mailinglist = shift; - my $listnum = $svc_mailinglist->listnum; - - my $sql = 'SELECT COUNT(*) FROM mailinglistmember WHERE listnum = ?'; - my $sth = dbh->prepare($sql) or die dbh->errstr; - $sth->execute($listnum) or die $sth->errstr; - my $num = $sth->fetchrow_arrayref->[0]; - - my $add_url = $p."edit/mailinglistmember.html?listnum=$listnum"; - - my $add_link = include('/elements/init_overlib.html'). - include('/elements/popup_link.html', - 'action' => $add_url, - 'label' => 'add', - 'actionlabel' => 'Add list member', - 'width' => 392, - 'height' => 192, - ); - - ntable('#cccccc').''.ntable('#cccccc',2). qq[ - - List members - - $num members - ( view - | $add_link ) - - - - -

- ]. include('svc_export_settings.html', $svc_mailinglist); - -}; - - diff --git a/httemplate/view/svc_pbx.cgi b/httemplate/view/svc_pbx.cgi deleted file mode 100644 index 79cafed4d..000000000 --- a/httemplate/view/svc_pbx.cgi +++ /dev/null @@ -1,72 +0,0 @@ -<% 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(). - "View $_ CDRs"; - } keys(%what); - - ### - # concatenate & return - ### - - join(' | ', @links ). '
'; - -}; - - diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi deleted file mode 100644 index 94948a78b..000000000 --- a/httemplate/view/svc_phone.cgi +++ /dev/null @@ -1,171 +0,0 @@ -<% include('elements/svc_Common.html', - 'table' => 'svc_phone', - 'fields' => \@fields, - 'labels' => \%labels, - 'html_foot' => $html_foot, - ) -%> -<%init> - -my $conf = new FS::Conf; -my $countrydefault = $conf->config('countrydefault') || 'US'; - -my $fields = FS::svc_phone->table_info->{'fields'}; -my %labels = map { $_ => ( ref($fields->{$_}) - ? $fields->{$_}{'label'} - : $fields->{$_} - ); - } keys %$fields; - -my @fields = qw( countrycode phonenum ); -push @fields, 'domain' if $conf->exists('svc_phone-domain'); -push @fields, qw( pbx_title sip_password pin phone_name ); - -if ( $conf->exists('svc_phone-lnp') ) { -push @fields, 'lnp_status', - { field => 'portable', type => 'checkbox', }, - 'lrn', - { field => 'lnp_desired_due_date', type => 'date', }, - { field => 'lnp_due_date', type => 'date', }, - 'lnp_other_provider', - 'lnp_other_provider_account'; -} - -my $html_foot = sub { - my $svc_phone = shift; - - ### - # E911 Info - ### - - my $e911 = - 'E911 Information'. - &ntable("#cccccc"). ''. ntable("#cccccc",2). - 'Location'. - ''. - $svc_phone->location_label( 'join_string' => '
', - 'double_space' => '   ', - 'escape_function' => \&encode_entities, - 'countrydefault' => $countrydefault, - ). - ''. - ''. - '
' - ; - - ### - # Devices - ### - - my $devices = ''; - - my $sth = dbh->prepare("SELECT COUNT(*) FROM part_device") #WHERE disabled = '' OR disabled IS NULL;"); - or die dbh->errstr; - $sth->execute or die $sth->errstr; - my $num_part_device = $sth->fetchrow_arrayref->[0]; - - my @phone_device = $svc_phone->phone_device; - if ( @phone_device || $num_part_device ) { - my $svcnum = $svc_phone->svcnum; - $devices .= - qq[Devices (Add device)
]; - if ( @phone_device ) { - - $devices .= qq! - - !; - - - $devices .= - include('/elements/table-grid.html'). - ''. - 'Type'. - 'MAC Addr'. - ''. - ''. - ''; - my $bgcolor1 = '#eeeeee'; - my $bgcolor2 = '#ffffff'; - my $bgcolor = ''; - - foreach my $phone_device ( @phone_device ) { - - if ( $bgcolor eq $bgcolor1 ) { - $bgcolor = $bgcolor2; - } else { - $bgcolor = $bgcolor1; - } - my $td = qq(); - - my $devicenum = $phone_device->devicenum; - my $export_links = join( '
', @{ $phone_device->export_links } ); - - $devices .= ''. - $td. $phone_device->part_device->devicename. ''. - $td. $phone_device->mac_addr. ''. - $td. $export_links. ''. - "$td( ". - qq(edit | ). - qq(delete). - ' )'. - ''; - } - $devices .= '
'; - } - $devices .= '
'; - } - - ## - # CDR links - ## - - tie my %what, 'Tie::IxHash', - 'pending' => 'NULL', - 'billed' => 'done', - ; - - 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(). - # "View $_ CDRs"; - #} keys(%what); - my @links = map { - qq(). - "View $_ CDRs"; - } keys(%what); - - my @ilinks = ( qq(). - 'View incoming CDRs' ); - - ### - # concatenate & return - ### - - $e911. - $devices. - join(' | ', @links ). '
'. - join(' | ', @ilinks). '
'; - -}; - - diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi deleted file mode 100644 index 935d139e9..000000000 --- a/httemplate/view/svc_www.cgi +++ /dev/null @@ -1,106 +0,0 @@ -<% include("/elements/header.html", "Website View", menubar( - ( ( $custnum ) - ? ( "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - : ( "Cancel this (unaudited) website" => - "${p}misc/cancel-unaudited.cgi?$svcnum" ) - ), - )) -%> - -Edit this information
- -<% ntable("#cccccc", 2) %> - - - Service number - <% $svcnum %> - - - Website name - <% $www %> - - -% if ( $part_svc->part_svc_column('usersvc')->columnflag ne 'F' -% || $part_svc->part_svc_column('usersvc')->columnvalue !~ /^\s*$/) { - - - Account - -% if ( $usersvc ) { - <% $email %> -% } else { -
(none) -% } - - - -% } - - - Config lines -
<% join("\n", $svc_www->config) |h %>
- - -% foreach (sort { $a cmp $b } $svc_www->virtual_fields) { - <% $svc_www->pvf($_)->widget('HTML', 'view', $svc_www->getfield($_)) %> -% } - - - -
-<% joblisting({'svcnum'=>$svcnum}, 1) %> - -<% include('/elements/footer.html') %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_www = qsearchs({ - 'select' => 'svc_www.*', - 'table' => 'svc_www', - '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( - 'null_right' => 'View/link unlinked services' - ), -}) 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, $display_custnum); -if ($pkgnum) { - $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); - $custnum = $cust_pkg->custnum; - $display_custnum = $cust_pkg->cust_main->display_custnum; -} else { - $cust_pkg = ''; - $custnum = ''; -} -#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 = ''; -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; - - -- cgit v1.2.1