diff options
| author | Mark Wells <mark@freeside.biz> | 2012-09-29 16:36:46 -0700 |
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2012-09-29 16:36:46 -0700 |
| commit | 33beebf4cb42eba3e1dd868ad5e0af102de961da (patch) | |
| tree | 860712543dcc74ff2402a4ed8d73e8cd553e62d4 /httemplate/view | |
| parent | 7ac86daf67b0a95153b736d5811f9050363f6553 (diff) | |
update address standardization for cust_location changes
Diffstat (limited to 'httemplate/view')
39 files changed, 755 insertions, 303 deletions
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index a8b4ac15c..95ce60b1d 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -166,8 +166,6 @@ 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_bill_void.html b/httemplate/view/cust_bill_void.html new file mode 100755 index 000000000..2c526747b --- /dev/null +++ b/httemplate/view/cust_bill_void.html @@ -0,0 +1,79 @@ +<& /elements/header.html, mt('Voided Invoice'), menubar( + emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum", +) &> + +<SCRIPT TYPE="text/javascript"> +function areyousure(href, message) { + if (confirm(message) == true) + window.location.href = href; +} +</SCRIPT> +<% areyousure_link("${p}misc/unvoid-cust_bill_void.html?invnum=". $cust_bill_void->invnum, + emt('Are you sure you want to unvoid this invoice?'), + emt('Unvoid this invoice'), #tooltip + emt('Unvoid this invoice') #link + ) +%> +<BR><BR> + +% #voided PDFs? +% #if ( $conf->exists('invoice_latex') ) { +%# +%# <A HREF="<% $p %>view/cust_bill-pdf.cgi?<% $link %>"><% mt('View typeset invoice PDF') |h %></A> +%# <BR><BR> +% #} + +%#something very big and obvious showing its voided... +<DIV STYLE="color:#FF0000; font-size:1000%; font-weight:bold; z-index:100; + position: absolute; top: 300px; left: 130px; + zoom: 1; filter: alpha(opacity=25); opacity: 0.25; +">VOID</DIV> + +% if ( $conf->exists('invoice_html') ) { + <% join('', $cust_bill_void->print_html(\%opt) ) %> +% } else { + <PRE><% join('', $cust_bill_void->print_text(\%opt) ) %></PRE> +% } + +<& /elements/footer.html &> +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('View invoices'); + +my $invnum; +my($query) = $cgi->keywords; +if ( $query =~ /^(\d+)$/ ) { + $invnum = $1; +} else { + $invnum = $cgi->param('invnum'); +} + +my $conf = new FS::Conf; + +my %opt = ( + 'unsquelch_cdr' => $conf->exists('voip-cdr_email'), +); + +my $cust_bill_void = qsearchs({ + 'select' => 'cust_bill_void.*', + 'table' => 'cust_bill_void', + #'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'invnum' => $invnum }, + #'extra_sql' => ' AND '. $curuser->agentnums_sql, +}); +die "Voided invoice #$invnum not found!" unless $cust_bill_void; + +my $custnum = $cust_bill_void->custnum; +my $display_custnum = $cust_bill_void->cust_main->display_custnum; + +#my $link = "invnum=$invnum"; + +sub areyousure_link { + my ($url,$msg,$title,$label) = (shift,shift,shift,shift); + '<A HREF="javascript:areyousure(\''.$url.'\',\''.$msg.'\')" TITLE="'.$title.'">'.$label.'</A>'; +} + +</%init> diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 9ce55b0b9..ec3191971 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -46,10 +46,39 @@ function areyousure(href, message) { <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>"><% mt('Edit this customer') |h %></A> | % } -% if ( $curuser->access_right('Cancel customer') -% && $cust_main->ncancelled_pkgs +% if ( $curuser->access_right('Suspend customer') +% && scalar($cust_main->unsuspended_pkgs) % ) { + <& /elements/popup_link-cust_main.html, + { 'action' => $p. 'misc/suspend_cust.html', + 'label' => emt('Suspend this customer'), + 'actionlabel' => emt('Confirm Suspension'), + 'color' => '#ff9900', + 'cust_main' => $cust_main, + 'width' => 616, #make room for reasons + 'height' => 366, + } + &> | +% } +% if ( $curuser->access_right('Unsuspend customer') +% && scalar($cust_main->suspended_pkgs) +% ) { + <& /elements/popup_link-cust_main.html, + { 'action' => $p. 'misc/unsuspend_cust.html', + 'label' => emt('Unsuspend this customer'), + 'actionlabel' => emt('Confirm Unsuspension'), + #'color' => '#ff9900', + 'cust_main' => $cust_main, + #'width' => 616, #make room for reasons + #'height' => 366, + } + &> | +% } + +% if ( $curuser->access_right('Cancel customer') +% && scalar($cust_main->ncancelled_pkgs) +% ) { <& /elements/popup_link-cust_main.html, { 'action' => $p. 'misc/cancel_cust.html', 'label' => emt('Cancel this customer'), @@ -60,11 +89,9 @@ function areyousure(href, message) { 'height' => 366, } &> | - % } % if ( $curuser->access_right('Merge customer') ) { - <& /elements/popup_link-cust_main.html, { 'action' => $p. 'misc/merge_cust.html', 'label' => emt('Merge this customer'), @@ -74,7 +101,6 @@ function areyousure(href, message) { 'height' => 192, } &> | - % } % if ( $conf->exists('deletecustomers') @@ -277,7 +303,13 @@ function areyousure(href, message) { % } % if ( $view eq 'custom' ) { +% if ( $conf->config('cust_main-custom_link') ) { <& cust_main/custom.html, $cust_main &> +% } elsif ( $conf->config('cust_main-custom_content') ) { + <& cust_main/custom_content.html, $cust_main &> +% #} else { +% # warn "custom view without cust_main-custom_link or -custom_content?"; +% } % } </DIV> @@ -326,7 +358,8 @@ $views{emt('Payment History')} = 'payment_history' $views{emt('Change History')} = 'change_history' if $curuser->access_right('View customer history'); $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom' - if $conf->config('cust_main-custom_link'); + if $conf->config('cust_main-custom_link') + || $conf->config('cust_main-custom_content'); $views{emt('Jumbo')} = 'jumbo'; my %viewname = reverse %views; diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 522c6db86..5c46803d2 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -23,6 +23,14 @@ <TD BGCOLOR="#ffffff"><B><% $balance %></B></TD> </TR> +% if ( $conf->exists('cust_main-select-prorate_day') ) { +<TR> + <TD ALIGN="right"><% mt('Prorate day of month') |h %></TD> + <TD BGCOLOR="#ffffff"><% $cust_main->prorate_day %> + </TD> +</TR> +% } + % if ( $conf->exists('cust_main-select-billday') % && ($cust_main->payby eq 'CARD' || $cust_main->payby eq 'CHEK') ) { <TR> @@ -146,7 +154,7 @@ % if ( $cust_main->payinfo ) { <TR> - <TD ALIGN="right"<% mt('P.O.') |h %></TD> + <TD ALIGN="right"><% mt('P.O.') |h %></TD> <TD BGCOLOR="#ffffff"><% $cust_main->payinfo %></TD> </TR> % } @@ -189,15 +197,25 @@ % my $no = emt('no'); % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups'); -<TR> - <TD ALIGN="right"><% mt('Tax exempt') |h %><% @exempt_groups ? ' ('.emt('all taxes').')' : '' %></TD> - <TD BGCOLOR="#ffffff"><% $cust_main->tax ? $yes : $no %></TD> -</TR> + +% unless ( $conf->exists('cust_class-tax_exempt') +% || $conf->exists('tax-cust_exempt-groups-require_individual_nums') +% ) +% { + <TR> + <TD ALIGN="right"><% mt('Tax exempt') |h %><% @exempt_groups ? ' ('.emt('all taxes').')' : '' %></TD> + <TD BGCOLOR="#ffffff"><% $cust_main->tax ? $yes : $no %></TD> + </TR> +% } + % foreach my $exempt_group ( @exempt_groups ) { -<TR> - <TD ALIGN="right"><% mt('Tax exempt') |h %> (<% $exempt_group %> taxes)</TD> - <TD BGCOLOR="#ffffff"><% $cust_main->tax_exemption($exempt_group) ? $yes : $no %></TD> -</TR> +% my $cust_main_exemption = $cust_main->tax_exemption($exempt_group); + <TR> + <TD ALIGN="right"><% mt('Tax exempt') |h %> (<% $exempt_group %> taxes)</TD> + <TD BGCOLOR="#ffffff"><% $cust_main_exemption ? $yes : $no %> + <% $cust_main_exemption ? $cust_main_exemption->exempt_number : '' |h %> + </TD> + </TR> % } % if ( $conf->exists('enable_taxproducts') ) { @@ -207,21 +225,27 @@ </TR> % } <TR> - <TD ALIGN="right"><% mt('Postal invoices') |h %></TD> + <TD ALIGN="right"><% mt('Postal mail invoices') |h %></TD> <TD BGCOLOR="#ffffff"> <% ( grep { $_ eq 'POST' } @invoicing_list ) ? $yes : $no %> </TD> </TR> <TR> - <TD ALIGN="right"><% mt('FAX invoices') |h %></TD> + <TD ALIGN="right"><% mt('Fax invoices') |h %></TD> <TD BGCOLOR="#ffffff"> <% ( grep { $_ eq 'FAX' } @invoicing_list ) ? $yes : $no %> </TD> </TR> -% unless ( $conf->exists('cust-email-high-visibility')) { <TR> <TD ALIGN="right"><% mt('Email invoices') |h %></TD> <TD BGCOLOR="#ffffff"> + <% $cust_main->invoice_noemail ? $no : $yes %> + </TD> +</TR> +% unless ( $conf->exists('cust-email-high-visibility')) { +<TR> + <TD ALIGN="right"><% mt('Email address(es)') |h %></TD> + <TD BGCOLOR="#ffffff"> <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || $no %> </TD> </TR> diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index b3e52b556..d65af669a 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -1,122 +1,133 @@ -% my %which = ( -% '' => emt('Billing'), -% 'ship_' => emt('Service'), -% ); -% foreach my $which ( '', 'ship_' ) { -% my $pre = $cust_main->get("${which}last") ? $which : ''; - -<FONT CLASS="fsinnerbox-title"><% $which{$which} %> <% mt('address') |h %></FONT> +% my %addr_label = ('bill' => 'Billing address', 'ship' => 'Service address'); + +%# Locations (possibly break this out) +% my @which = ('bill', 'ship'); +% while (@which) { +% my $this = shift @which; +% my $method = $this.'_location'; +% my $location = $cust_main->$method; +<FONT CLASS="fsinnerbox-title"><% mt( $addr_label{$this} ) |h %> +% if ( $this eq 'ship' and +% $cust_main->bill_locationnum == $cust_main->ship_locationnum ) +% { + (<% mt('same as billing') %>) +% } +</FONT> <TABLE CLASS="fsinnerbox"> -<TR> - <TD ALIGN="right"><% mt('Contact name') |h %></TD> - <TD COLSPAN=5 BGCOLOR="#ffffff"> - <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") |h %> - </TD> -% if ( $which eq '' && $conf->exists('show_ss') ) { - <TD ALIGN="right"><% mt('SS#') |h %></TD> - <TD BGCOLOR="#ffffff"><% $cust_main->masked('ss') || ' ' %></TD> -% } -</TR> -% if ( $conf->exists('cust-email-high-visibility') && $which eq '') { +% if ( $this eq 'bill' ) { +% #billing contact fields + <TR> + <TD ALIGN="right"><% mt('Contact name') |h %></TD> + <TD COLSPAN=5 BGCOLOR="#ffffff"><% $cust_main->contact |h %></TD> +% if ( $conf->exists('show_ss') ) { + <TD ALIGN="right"><% mt('SS#') |h %></TD> + <TD BGCOLOR="#ffffff"><% $conf->exists('unmask_ss') + ? $cust_main->ss + : $cust_main->masked('ss') || ' ' %></TD> +% } + </TR> +% if ( $conf->exists('cust-email-high-visibility') ) { <TR> - <TD ALIGN="right"><% mt('Email invoices') |h %></TD> + <TD ALIGN="right"><% mt('Email address(es)') |h %></TD> <TD BGCOLOR="#ffff00"> - <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || $no %> + <% $cust_main->invoicing_list_emailonly_scalar || $no %> </TD> </TR> -% } - -% if ( $cust_main->get("${pre}company") ) { +% } +% if ( $cust_main->company ) { <TR> <TD ALIGN="right"><% mt('Company') |h %></TD> - <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}company") |h %></TD> + <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->company |h %></TD> </TR> -% } - +% } +% } # if $this eq 'bill' +% # now the actual address <TR> <TD ALIGN="right"><% mt('Address') |h %></TD> - <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address1") |h %></TD> + <TD COLSPAN=7 BGCOLOR="#ffffff"><% $location->address1 |h %></TD> </TR> -% if ( $cust_main->get("${pre}address2") ) { -% my $address2_label = -% ( $conf->exists('cust_main-require_address2') -% && ! ( $pre xor $cust_main->has_ship_address ) -% ) -% ? emt('Unit #') -% : ' '; +% if ( $location->get('address2') ) { +% my $address2_label = $conf->exists('cust_main-require_address2') +% ? emt('Unit #') +% : ' '; - <TR> - <TD ALIGN="right"><% $address2_label %></TD> - <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address2") |h %></TD> - </TR> +<TR> + <TD ALIGN="right"><% $address2_label %></TD> + <TD COLSPAN=7 BGCOLOR="#ffffff"><% $location->address2 |h %></TD> +</TR> % } <TR> <TD ALIGN="right"><% mt('City') |h %></TD> - <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}city") |h %></TD> -% if ( $cust_main->get("${pre}county") ) { + <TD BGCOLOR="#ffffff"><% $location->city |h %></TD> +% if ( $location->county ) { <TD ALIGN="right"><% mt('County') |h %></TD> - <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}county") |h %></TD> + <TD BGCOLOR="#ffffff"><% $location->county |h %></TD> % } <TD ALIGN="right"><% mt('State') |h %></TD> - <TD BGCOLOR="#ffffff"><% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) |h %></TD> + <TD BGCOLOR="#ffffff"><% state_label( $location->state, $location->country ) |h %></TD> <TD ALIGN="right"><% mt('Zip') |h %></TD> - <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}zip") %></TD> + <TD BGCOLOR="#ffffff"><% $location->zip %></TD> </TR> <TR> <TD ALIGN="right"><% mt('Country') |h %></TD> - <TD BGCOLOR="#ffffff"><% code2country( $cust_main->get("${pre}country") ) %></TD> + <TD BGCOLOR="#ffffff"><% code2country( $location->country ) %></TD> </TR> -% if ( $cust_main->get($pre.'latitude') && $cust_main->get($pre.'longitude') ) { - <& /elements/tr-coords.html, $cust_main->get($pre.'latitude'), - $cust_main->get($pre.'longitude'), +% if ( $location->latitude && $location->longitude ) { + <& /elements/tr-coords.html, $location->latitude, + $location->longitude, $cust_main->name_short, $cust_main->agentnum, &> % } + +% if ( $this eq 'bill' ) { +% # billing contact phone numbers +% foreach my $phone (qw(daytime night mobile)) { +% next if !$cust_main->get($phone); +<TR> + <TD ALIGN="right"><% $phone_label{$phone} %></TD> + <TD COLSPAN=3 BGCOLOR="#ffffff"> + <& /elements/phonenumber.html, + $cust_main->get($phone), + callable => 1, + calling_list_exempt => $cust_main->calling_list_exempt, + &> + </TD> +</TR> -% foreach my $phone (grep $cust_main->get($pre.$_), qw( daytime night mobile )){ - - <TR> - <TD ALIGN="right"><% $phone_label{$phone} %></TD> - <TD COLSPAN=3 BGCOLOR="#ffffff"> - <& /elements/phonenumber.html, - $cust_main->get($pre.$phone), - 'callable'=>1, - 'calling_list_exempt'=>$cust_main->calling_list_exempt, - &> - </TD> - </TR> - -% } +% } #foreach $phone +% if ( $cust_main->get('fax') ) { -% if ( $cust_main->get("${pre}fax") ) { <TR> <TD ALIGN="right"><% mt('Fax') |h %></TD> <TD COLSPAN=3 BGCOLOR="#ffffff"> - <% $cust_main->get("${pre}fax") || ' ' %> + <% $cust_main->get('fax') || ' ' %> </TD> </TR> -% } -% if ( $which eq '' && $conf->exists('show_stateid') ) { - <TR> +% } +% +% if ( $conf->exists('show_stateid') ) { + +<TR> <TD ALIGN="right"><% $stateid_label %></TD> <TD BGCOLOR="#ffffff"><% $cust_main->masked('stateid') || ' ' %></TD> <TD ALIGN="right"><% $stateid_state_label %></TD> <TD BGCOLOR="#ffffff"><% $cust_main->stateid_state || ' ' %></TD> </TR> -% } +% } +% } #if $this eq 'bill' </TABLE> -% if ( $which ne 'ship_' ) { +% if ( @which ) { <BR> % } -% } +% } #while @which <%once> my %phone_label = ( @@ -147,7 +158,7 @@ my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_st </%once> <%init> -my( $cust_main ) = @_; +my $cust_main = shift; my $conf = new FS::Conf; my @invoicing_list = $cust_main->invoicing_list; my $no = emt('no'); diff --git a/httemplate/view/cust_main/custom_content.html b/httemplate/view/cust_main/custom_content.html new file mode 100644 index 000000000..dd3d1f0d4 --- /dev/null +++ b/httemplate/view/cust_main/custom_content.html @@ -0,0 +1,31 @@ +% foreach my $item (@content) { +% +% if ( $item =~ /^\s*$/ ) { + <BR> +% next; +% } +% +% if ( $items{$item} ) { + <& "custom_content/$item.html", $cust_main &> +% } else { + Unknown item <% $item |h %><BR> +% } +% } +<%init> + +my($cust_main) = @_; + +my $conf = new FS::Conf; + +my @content = $conf->config('cust_main-custom_content'); + +my %items = map { $_=>1 } qw( + small_custview + birthdate + spouse_birthdate + svc_acct + svc_phone + svc_hardware +); + +</%init> diff --git a/httemplate/view/cust_main/custom_content/birthdate.html b/httemplate/view/cust_main/custom_content/birthdate.html new file mode 100644 index 000000000..1f16963af --- /dev/null +++ b/httemplate/view/cust_main/custom_content/birthdate.html @@ -0,0 +1,15 @@ +<TABLE CLASS="fsinnerbox"> + <& /elements/tr-td-label.html, 'label' => mt('Date of Birth') &> + <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD> +</TR> +</TABLE> +<%init> +my($cust_main) = @_; +my $conf = new FS::Conf; +my $date_format = ($conf->config('date_format') || "%m/%d/%Y"); +my $dt = $cust_main->birthdate ne '' + ? DateTime->from_epoch( 'epoch' => $cust_main->birthdate, + 'time_zone' =>'floating', + ) + : ''; +</%init> diff --git a/httemplate/view/cust_main/custom_content/small_custview.html b/httemplate/view/cust_main/custom_content/small_custview.html new file mode 100644 index 000000000..7c724c78f --- /dev/null +++ b/httemplate/view/cust_main/custom_content/small_custview.html @@ -0,0 +1,4 @@ +<& /elements/small_custview.html, $cust_main &> +<%init> +my($cust_main) = @_; +</%init> diff --git a/httemplate/view/cust_main/custom_content/spouse_birthdate.html b/httemplate/view/cust_main/custom_content/spouse_birthdate.html new file mode 100644 index 000000000..c78fd26a5 --- /dev/null +++ b/httemplate/view/cust_main/custom_content/spouse_birthdate.html @@ -0,0 +1,15 @@ +<TABLE CLASS="fsinnerbox"> + <& /elements/tr-td-label.html, 'label' => mt('Spouse Date of Birth') &> + <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD> +</TR> +</TABLE> +<%init> +my($cust_main) = @_; +my $conf = new FS::Conf; +my $date_format = ($conf->config('date_format') || "%m/%d/%Y"); +my $dt = $cust_main->spouse_birthdate ne '' + ? DateTime->from_epoch( 'epoch' => $cust_main->spouse_birthdate, + 'time_zone' =>'floating', + ) + : ''; +</%init> diff --git a/httemplate/view/cust_main/custom_content/svc_Common.html b/httemplate/view/cust_main/custom_content/svc_Common.html new file mode 100644 index 000000000..bddb8bf16 --- /dev/null +++ b/httemplate/view/cust_main/custom_content/svc_Common.html @@ -0,0 +1,40 @@ +% foreach my $cust_svc (@cust_svc) { +% my $svc_x = $cust_svc->svc_x; +<TABLE CLASS="fsinnerbox"> + <TR> + <TH COLSPAN=2><% $cust_svc->part_svc->svc |h %></TH> + </TR> +% foreach my $field ( grep $svc_x->$_(), @{ $opt{fields} } ) { + <& /elements/tr-td-label.html, 'label' => $labels{$field} &> + <TD BGCOLOR="#ffffff"><% $svc_x->$field() |h %></TD> + </TR> +% } +</TABLE> +% } +<%init> +my($cust_main, %opt) = @_; + +my $table = $opt{table}; +my @cust_svc = (); +foreach my $cust_pkg ( + grep $_->num_cust_svc( 'svcdb'=>$table ), + $cust_main->all_pkgs +) { + my @wtf = $cust_pkg->cust_svc( 'svcdb'=>$table ); + push @cust_svc, $cust_pkg->cust_svc( 'svcdb'=>$table ); +} + +my %labels; +if ( UNIVERSAL::can("FS::$table", 'table_info') ) { +# $opt{'name'} = "FS::$table"->table_info->{'name'}; + + my $fields = "FS::$table"->table_info->{'fields'}; + %labels = map { $_ => ( ref($fields->{$_}) + ? $fields->{$_}{'label'} + : $fields->{$_} + ); + } + keys %$fields; +} + +</%init> diff --git a/httemplate/view/cust_main/custom_content/svc_acct.html b/httemplate/view/cust_main/custom_content/svc_acct.html new file mode 100644 index 000000000..49b97986d --- /dev/null +++ b/httemplate/view/cust_main/custom_content/svc_acct.html @@ -0,0 +1,7 @@ +<& svc_Common.html, $cust_main, + 'table' => 'svc_acct', + 'fields' => [qw( username _password )], +&> +<%init> +my($cust_main) = @_; +</%init> diff --git a/httemplate/view/cust_main/custom_content/svc_hardware.html b/httemplate/view/cust_main/custom_content/svc_hardware.html new file mode 100644 index 000000000..f5d53a251 --- /dev/null +++ b/httemplate/view/cust_main/custom_content/svc_hardware.html @@ -0,0 +1,7 @@ +<& svc_Common.html, $cust_main, + 'table' => 'svc_hardware', + 'fields' => [qw( ip_addr hw_addr serial )], +&> +<%init> +my($cust_main) = @_; +</%init> diff --git a/httemplate/view/cust_main/custom_content/svc_phone.html b/httemplate/view/cust_main/custom_content/svc_phone.html new file mode 100644 index 000000000..46ec476bc --- /dev/null +++ b/httemplate/view/cust_main/custom_content/svc_phone.html @@ -0,0 +1,7 @@ +<& svc_Common.html, $cust_main, + 'table' => 'svc_phone', + 'fields' => [qw( phonenum )], +&> +<%init> +my($cust_main) = @_; +</%init> diff --git a/httemplate/view/cust_main/locations.html b/httemplate/view/cust_main/locations.html index 98c933645..b29d0ce4d 100755 --- a/httemplate/view/cust_main/locations.html +++ b/httemplate/view/cust_main/locations.html @@ -5,12 +5,17 @@ span.loclabel { background-color: #cccccc; border: 1px solid black } +table.location { + width: 100%; + padding: 1px; + border-spacing: 0px; +} </STYLE> % foreach my $locationnum (@sorted) { % my $packages = $packages_in{$locationnum}; % my $loc = $locations{$locationnum}; % next if $loc->disabled and scalar(@$packages) == 0; -<& /elements/table-grid.html &> +<TABLE CLASS="grid location"> <TR><TH COLSPAN=3 ALIGN="left" VALIGN="bottom" STYLE="padding-bottom: 0px; padding-left: 0px; @@ -18,10 +23,7 @@ STYLE="padding-bottom: 0px; border-bottom-color: black; border-bottom-width: 1px;"> <SPAN CLASS="loclabel"> -% if (! $locationnum) { -<% mt('Default service location:') |h %> -% } -% elsif ( $loc->disabled ) { +% if ( $loc->disabled ) { <FONT COLOR="#808080"><I> % } <% $loc->location_label %></SPAN> @@ -49,8 +51,7 @@ my %locations = map { $_->locationnum => $_ } qsearch({ 'order_by' => 'ORDER BY country, state, city, address1, locationnum', }); my @sections = keys %locations; -$locations{''} = $cust_main; -my %packages_in = map { $_ => [] } ('', @sections); +my %packages_in = map { $_ => [] } (@sections); my %active = (); # groups with non-canceled packages foreach my $cust_pkg ( @$all_packages ) { @@ -58,10 +59,13 @@ foreach my $cust_pkg ( @$all_packages ) { push @{ $packages_in{$key} }, $cust_pkg; $active{$key} = 1 if !$cust_pkg->getfield('cancel'); } +# prevent disabling these +$active{$cust_main->ship_locationnum} = 1; +$active{$cust_main->bill_locationnum} = 1; my @sorted = ( - '', - grep ( { $active{$_} } @sections), + $cust_main->ship_locationnum, + grep ( { $active{$_} && $_ != $cust_main->ship_locationnum } @sections), grep ( { !$active{$_} } @sections), ); diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 295328721..263c266e7 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -102,6 +102,26 @@ <TD BGCOLOR="#ffffff"><% $cust_main->signupdate ? time2str($date_format, $cust_main->signupdate) : '' %></TD> </TR> +% my $id_country = $conf->config('national_id-country'); +% if ( $id_country ) { +% if ( $id_country eq 'MY' ) { + <TR> +% my($old, $nric) = ( '', ''); +% if ( $cust_main->national_id =~ /^\d{6}\-\d{2}\-\d{4}$/ ) { + <TD ALIGN="right"><% mt('NRIC') |h %></TD> +% } else { # elsif ( $cust_main->national_id =~ /^\w\d{9}$/ ) { + <TD ALIGN="right"><% mt('Old IC/Passport') |h %></TD> +% #} else { +% # warn "unknown national_id format"; +%# <TD ALIGN="right"></TD> +% } + <TD BGCOLOR="#ffffff"><% $cust_main->national_id |h %></TD> + </TR> +% } else { +% warn "unknown national_id-country $id_country"; +% } +% } + % if ( $conf->exists('cust_main-enable_birthdate') ) { % my $dt = $cust_main->birthdate ne '' % ? DateTime->from_epoch( 'epoch' => $cust_main->birthdate, @@ -116,13 +136,41 @@ % } +% if ( $conf->exists('cust_main-enable_spouse_birthdate') ) { +% my $dt = $cust_main->spouse_birthdate ne '' +% ? DateTime->from_epoch( 'epoch' => $cust_main->spouse_birthdate, +% 'time_zone' =>'floating', +% ) +% : ''; + + <TR> + <TD ALIGN="right"><% mt('Spouse Date of Birth') |h %></TD> + <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD> + </TR> + +% } + +% if ( $conf->exists('cust_main-enable_anniversary_date') ) { +% my $dt = $cust_main->anniversary_date ne '' +% ? DateTime->from_epoch( 'epoch' => $cust_main->anniversary_date, +% 'time_zone' =>'floating', +% ) +% : ''; + + <TR> + <TD ALIGN="right"><% mt('Anniversary Date') |h %></TD> + <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD> + </TR> + +% } + % if ( $conf->exists('cust_main-require_censustract') ) { <TR> <TD ALIGN="right"> - <% mt('Census tract ([_1])', $cust_main->censusyear) |h %> + <% mt('Census tract ([_1])', $cust_main->ship_location->censusyear) |h %> </TD> - <TD BGCOLOR="#ffffff"><% $cust_main->censustract %></TD> + <TD BGCOLOR="#ffffff"><% $cust_main->ship_location->censustract %></TD> </TR> % } @@ -131,7 +179,7 @@ <TR> <TD ALIGN="right"><% mt('Tax district') |h %></TD> - <TD BGCOLOR="#ffffff"><% $cust_main->district %></TD> + <TD BGCOLOR="#ffffff"><% $cust_main->ship_location->district %></TD> </TR> % } 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 7bc5eef31..000000000 --- a/httemplate/view/cust_main/order_pkg_link.html +++ /dev/null @@ -1,22 +0,0 @@ -<& /elements/popup_link-cust_main.html, - 'action' => $p. 'misc/order_pkg.html', - 'label' => $opt{'label'} || emt('Order new package'), - 'actionlabel' => emt('Order new package'), - 'color' => '#333399', - 'cust_main' => $cust_main, - 'closetext' => emt('Close'), - 'width' => 960, #763, - 'height' => $height, - %optional, -&> -<%init> - -my($cust_main, %opt) = @_; - -my %optional = map { $_ => $opt{$_} } - grep $opt{$_}, - qw( lock_pkgpart lock_locationnum qualnum svcpart ); - -my $height = $opt{'lock_locationnum'} ? 336 : 576; - -</%init> diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index e16b2c1d4..7d7930634 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -7,7 +7,7 @@ % if ( $curuser->access_right('Order customer package') ) { <% $s++ ? ' | ' : '' %> - <& order_pkg_link.html, $cust_main &> + <& /elements/order_pkg_link.html, 'cust_main'=>$cust_main &> % } % if ( $curuser->access_right('One-time charge') diff --git a/httemplate/view/cust_main/packages/services.html b/httemplate/view/cust_main/packages/services.html index 5f458e635..c0a56d0f3 100644 --- a/httemplate/view/cust_main/packages/services.html +++ b/httemplate/view/cust_main/packages/services.html @@ -3,7 +3,7 @@ % ### <TD CLASS="inv" BGCOLOR="<% $bgcolor %>"> - <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%"> + <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH="100%"> <SCRIPT TYPE="text/javascript"> function clearhint_search_cust_svc(obj, str) { if (obj.value == str) obj.value = ''; diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html index 28df9da95..e9017745b 100644 --- a/httemplate/view/cust_main/packages/status.html +++ b/httemplate/view/cust_main/packages/status.html @@ -32,7 +32,20 @@ % } % -% } else { +% if ( $part_pkg->freq ) { #? + + <TR> + <TD COLSPAN=<%$colspan%>> + <FONT SIZE=-1> +% if ( $curuser->access_right('Un-cancel customer package') ) { + ( <% pkg_uncancel_link($cust_pkg) %> ) +% } + <FONT> + </TD> + </TR> +% } +% +% } else { % % if ( $cust_pkg->get('susp') ) { #status: suspended % my $cpr = $cust_pkg->last_cust_pkg_reason('susp'); @@ -56,9 +69,16 @@ <% pkg_status_row($cust_pkg, emt('Setup'), 'setup', %opt ) %> % } + <% pkg_status_row_if($cust_pkg, emt('Un-cancelled'), 'uncancel', %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) ) { +% if ( $cust_pkg->option('suspend_bill', 1) +% || ( $part_pkg->option('suspend_bill', 1) +% && ! $cust_pkg->option('no_suspend_bill',1) +% ) +% ) +% { <% pkg_status_row_if( $cust_pkg, emt('Next bill'), 'bill', %opt, curuser=>$curuser ) %> % } <% pkg_status_row_if( $cust_pkg, emt('Will resume'), 'resume', %opt, curuser=>$curuser ) %> @@ -99,6 +119,8 @@ ) %> + <% pkg_status_row_if($cust_pkg, emt('Un-cancelled'), 'uncancel', %opt ) %> + <TR> <TD COLSPAN=<%$colspan%>> <FONT SIZE=-1> @@ -118,6 +140,7 @@ <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> <% pkg_status_row_if($cust_pkg, emt('Start billing'), 'start_date', %opt) %> + <% pkg_status_row_if($cust_pkg, emt('Un-cancelled'), 'uncancel', %opt ) %> % } % @@ -133,6 +156,8 @@ <% pkg_status_row_discount( $cust_pkg, %opt, 'colspan'=>$colspan ) %> + <% pkg_status_row_if($cust_pkg, emt('Un-cancelled'), 'uncancel', %opt ) %> + % } else { % % my $num_cust_svc = $cust_pkg->num_cust_svc; @@ -166,6 +191,8 @@ <% pkg_status_row($cust_pkg, emt('Setup'), 'setup', %opt) %> + <% pkg_status_row_if($cust_pkg, emt('Un-cancelled'), 'uncancel', %opt ) %> + % } % % } @@ -467,6 +494,16 @@ sub pkg_cancel_link { ) } +sub pkg_uncancel_link { + include( '/elements/popup_link-cust_pkg.html', + 'action' => $p. 'misc/cancel_pkg.html?method=uncancel', + 'label' => emt('Un-cancel'), + 'actionlabel' => emt('Un-cancel'), + #'color' => #? + 'cust_pkg' => shift, + ) +} + sub pkg_expire_link { include( '/elements/popup_link-cust_pkg.html', 'action' => $p. 'misc/cancel_pkg.html?method=expire', diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index c7a7c8024..166addbf4 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -277,7 +277,9 @@ % ? sprintf("$money_char\%.2f", $item->{'charge'}) % : exists($item->{'charge_nobal'}) % ? sprintf("$money_char\%.2f", $item->{'charge_nobal'}) -% : ''; +% : exists($item->{'void_charge'}) +% ? sprintf("<DEL>$money_char\%.2f</DEL>", $item->{'void_charge'}) +% : ''; % % my $payment = exists($item->{'payment'}) % ? sprintf("- $money_char\%.2f", $item->{'payment'}) @@ -428,6 +430,15 @@ foreach my $cust_bill ($cust_main->cust_bill) { $num_cust_bill++; } +#voided invoices +foreach my $cust_bill_void ($cust_main->cust_bill_void) { + push @history, { + 'date' => $cust_bill_void->_date, + 'desc' => include('payment_history/voided_invoice.html', $cust_bill_void, %opt ), + 'void_charge' => $cust_bill_void->charged, + }; +} + #statements foreach my $cust_statement ($cust_main->cust_statement) { push @history, { @@ -491,7 +502,7 @@ foreach my $cust_credit ($cust_main->cust_credit) { foreach my $cust_refund ($cust_main->cust_refund) { push @history, { 'date' => $cust_refund->_date, - 'desc' => include('payment_history/refund.html', $cust_refund), + 'desc' => include('payment_history/refund.html', $cust_refund, %opt), 'refund' => $cust_refund->refund, }; diff --git a/httemplate/view/cust_main/payment_history/invoice.html b/httemplate/view/cust_main/payment_history/invoice.html index 3028f0f69..96a9f5456 100644 --- a/httemplate/view/cust_main/payment_history/invoice.html +++ b/httemplate/view/cust_main/payment_history/invoice.html @@ -1,4 +1,4 @@ -<% $link %><% $invoice %><% $link ? '</A>' : '' %><% $delete %><% $under %> +<% $link %><% $invoice %><% $link ? '</A>' : '' %><% "$void$delete$under" %> <%init> my( $cust_bill, %opt ) = @_; @@ -26,6 +26,18 @@ my $link = $curuser->access_right('View invoices') ? qq!<A HREF="${p}view/cust_bill.cgi?$invnum">! : ''; +my $void = ''; +if ( $cust_bill->closed !~ /^Y/i && $curuser->access_right('Void invoices') ) { + $void = + ' ('. include('/elements/popup_link.html', + 'label' => emt('void'), + 'action' => "${p}misc/void-cust_bill.html?;invnum=". + $cust_bill->invnum, + 'actionlabel' => emt('Void Invoice'), + ). + ')'; +} + my $delete = ''; $delete = areyousure_link("${p}misc/delete-cust_bill.html?$invnum", emt('Are you sure you want to delete this invoice?'), diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html index d7322a2d6..ff269bfaf 100644 --- a/httemplate/view/cust_main/payment_history/payment.html +++ b/httemplate/view/cust_main/payment_history/payment.html @@ -181,7 +181,7 @@ $void = areyousure_link("${p}misc/void-cust_pay.cgi?".$cust_pay->paynum, && $curuser->access_right('Echeck void') ) || ( $cust_pay->payby !~ /^(CARD|CHEK)$/ - && $curuser->access_right('Regular void') + && $curuser->access_right('Void payments') ) ) ); diff --git a/httemplate/view/cust_main/payment_history/voided_invoice.html b/httemplate/view/cust_main/payment_history/voided_invoice.html new file mode 100644 index 000000000..15393cbf5 --- /dev/null +++ b/httemplate/view/cust_main/payment_history/voided_invoice.html @@ -0,0 +1,57 @@ +<DEL><% $link %><% $invoice %><% $link ? '</A>' : '' %></DEL> +<I><% mt("voided [_1]", time2str($date_format, $cust_bill_void->void_date) ) |h %> +% my $void_user = $cust_bill_void->void_access_user; +% if ($void_user) { + by <% $void_user->username %></I> +% } +<% "$unvoid$delete$under" %> +<%init> + +my( $cust_bill_void, %opt ) = @_; + +my $date_format = $opt{'date_format'} || '%m/%d/%Y'; + +my $conf = new FS::Conf; + +my $curuser = $FS::CurrentUser::CurrentUser; + +my $invoice = emt("Invoice #[_1] (Balance [_2])",$cust_bill_void->display_invnum, $cust_bill_void->charged); + +my $under = ''; + +my $invnum = $cust_bill_void->invnum; + +my $link = $curuser->access_right('View invoices') + ? qq!<A HREF="${p}view/cust_bill_void.html?$invnum">! + : ''; + +my $unvoid = ''; +$unvoid = areyousure_link("${p}misc/unvoid-cust_bill_void.html?invnum=". $cust_bill_void->invnum, + emt('Are you sure you want to unvoid this invoice?'), + emt('Unvoid this invoice'), + emt('unvoid') + ) + if $cust_bill_void->closed !~ /^Y/ && $curuser->access_right('Unvoid invoices'); + +my $delete = ''; +$delete = areyousure_link("${p}misc/delete-cust_bill.html?$invnum", + emt('Are you sure you want to delete this invoice?'), + emt('Delete this invoice from the database completely'), + emt('delete') + ) + if ( $opt{'deleteinvoices'} && $curuser->access_right('Delete invoices') ); + +my $events = ''; +#1.9 +if ( $cust_bill_void->num_cust_event + && ( $curuser->access_right('Billing event reports') + || $curuser->access_right('View customer billing events') + ) + ) { + $under .= + qq!<BR><A HREF="${p}search/cust_event.html?invnum=$invnum">( !. + emt('View invoice events').' )</A>'; +} +$under = '<FONT SIZE="-1">'.$under.'</FONT>' if length($under); + +</%init> diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html index 2f038be41..88b5e0a84 100644 --- a/httemplate/view/cust_main/payment_history/voided_payment.html +++ b/httemplate/view/cust_main/payment_history/voided_payment.html @@ -31,6 +31,6 @@ $unvoid = areyousure_link("${p}misc/unvoid-cust_pay_void.cgi?".$cust_pay_void->p emt('Unvoid this payment from the database') . $unvoidmsg, emt('unvoid') ) - if ( $cust_pay_void->closed !~ /^Y/i && $curuser->access_right('Unvoid') ); + if ( $cust_pay_void->closed !~ /^Y/i && $curuser->access_right('Unvoid payments') ); </%init> diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index 194e90742..f076fcc92 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -1,164 +1,2 @@ -<FORM METHOD="GET" NAME="CreateTicketForm" STYLE="display:inline"> -<SCRIPT TYPE="text/javascript"> -function updateTicketLink() { - var link = document.getElementById('CreateTicketLink'); - var selector = document.getElementById('Queue') - link.href = "<% $new_base.'?'. - join(';', map( - { ($_ eq 'Queue') ? () : "$_=$new_param{$_}"} - keys %new_param),'Queue=') %>" + selector.options[selector.selectedIndex].value; -} -</SCRIPT> -<A NAME="tickets"><FONT CLASS="fsinnerbox-title">Tickets</FONT></A> -<A id="CreateTicketLink" HREF="<% $new_link %>"><% mt('Create new ticket') |h %></A> - <% mt('in queue') |h %> -%# fetch list of queues in which the user can create tickets -% my %queues = FS::TicketSystem->queues('', 'CreateTicket'); -% if( $conf->exists('ticket_system-force_default_queueid') ) { -<B><% $queues{$new_param{'Queue'}} %></B> -<INPUT TYPE="hidden" NAME="Queue" VALUE="<% $new_param{'Queue'} %>"> -% } -% else { -<SELECT NAME="Queue" id="Queue" onchange="updateTicketLink()"> -% foreach my $queueid ( sort { $queues{$a} cmp $queues{$b} } keys %queues ) { - <OPTION VALUE="<% $queueid %>" - <% $queueid == $new_param{'Queue'} ? 'SELECTED' : '' %> - ><% $queues{$queueid} |h %> -% } -</SELECT> -<SCRIPT DEFER TYPE="text/javascript">updateTicketLink();</SCRIPT> -% } -</FORM> - | -View -<A HREF="<% $open_link %>"><% mt($openlabel) |h %></A> | -<A HREF="<% $res_link %>"><% mt('resolved') |h %></A> -<BR> - -<& /elements/table-grid.html &> -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor = ''; - -<TR> - <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('#') |h %></TH> - <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Subject') |h %></TH> - <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH> - <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Queue') |h %></TH> - <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Owner') |h %></TH> - <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Due') |h %></TH> - <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Estimated Time') |h %></TH> - <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Priority') |h %></TH> -% if ( $ss_priority ) { - <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Customer Priority') |h %></TH> -% } -</TR> - -% foreach my $ticket ( @tickets ) { -% my $href = FS::TicketSystem->href_ticket($ticket->{id}); -% if ( $bgcolor eq $bgcolor1 ) { -% $bgcolor = $bgcolor2; -% } else { -% $bgcolor = $bgcolor1; -% } - - <TR> - - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <A HREF=<%$href%>><% $ticket->{id} %></A> - </TD> - - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <A HREF=<%$href%>><% $ticket->{subject} %></A> - </TD> - - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $ticket->{status} %> - </TD> - - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $ticket->{queue} %> - </TD> - - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $ticket->{owner} %> - </TD> - - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $date_formatter->($ticket->{due}) %> - </TD> - - <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $ticket->{timeestimated} %> - </TD> - - <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $ticket->{content} - ? $ticket->{content}.' ('.$ticket->{priority}.')' - : $ticket->{priority} - %> - </TD> - -% if ( $ss_priority ) { - <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $ticket->{"CF.{$ss_priority}"} %> - </TD> -% } - - </TR> - -% } - -</TABLE> - -<%init> -use Date::Format 'time2str'; -use Date::Parse 'str2time'; - -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 ); - -my $new_link = FS::TicketSystem->href_new_ticket( $cust_main ); - -my $ss_priority = FS::TicketSystem->selfservice_priority; -if ( $ss_priority ) { - my $dir = $conf->exists('ticket_system-priority_reverse') ? -1 : 1; - use sort 'stable'; - # sort in the following way: - @tickets = sort { - # within a severity level... - ( $a->{'content'} eq $b->{'content'} ) ? ( - # no-priority tickets sort last - ( - ($a->{'_selfservice_priority'} eq '') <=> - ($b->{'_selfservice_priority'} eq '') - ) || - # otherwise obey ticket_system-priority_reverse - ( $dir * - ($b->{'_selfservice_priority'} <=> $a->{'_selfservice_priority'}) - ) - ) : 0; # but don't rearrange between severity levels - } @tickets; -} - -my $format = $conf->config('date_format') || '%Y-%m-%d'; - -my $date_formatter = sub { - my $time = str2time($_[0], 'GMT'); - # exclude times within 24 hours of zero - ($time > 86400) ? time2str($format, $time) : ''; -}; - -</%init> +% my $cust_main = shift; +<& /elements/table-tickets.html, object => $cust_main &> diff --git a/httemplate/view/cust_main_statement-pdf.cgi b/httemplate/view/cust_main_statement-pdf.cgi index 7a0e19838..7c2c20799 100755 --- a/httemplate/view/cust_main_statement-pdf.cgi +++ b/httemplate/view/cust_main_statement-pdf.cgi @@ -23,13 +23,17 @@ my $cust_main = qsearchs({ 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, }); die "Customer #$custnum not found!" unless $cust_main; +my $cust_bill = ($cust_main->cust_bill)[-1] + or die "Customer #$custnum has no invoices!"; my $cust_statement = FS::cust_statement->new({ 'custnum' => $custnum, - 'statementnum' => 'ALL', #magic +# 'statementnum' => 'ALL', #magic + 'invnum' => $cust_bill->invnum, '_date' => time, }); + my $pdf = $cust_statement->print_pdf( '', $templatename ); http_header('Content-Type' => 'application/pdf' ); diff --git a/httemplate/view/cust_msg.html b/httemplate/view/cust_msg.html index ec584605d..67ceef799 100755 --- a/httemplate/view/cust_msg.html +++ b/httemplate/view/cust_msg.html @@ -22,7 +22,7 @@ function toggle_display(obj) { <INPUT type="radio" name="what_to_show" onchange="toggle_display(this)" value="body"> Body </FORM> </TR> -<TR><TD colspan=2 style="text-align:center"> +<TR><TD colspan=2 style="text-align:left"> <TEXTAREA id="content-header" style="font-family:monospace" readonly=1 cols=80 rows=20> <% encode_entities($cust_msg->header) %> diff --git a/httemplate/view/directions.html b/httemplate/view/directions.html index 599d049c2..f14a11a07 100644 --- a/httemplate/view/directions.html +++ b/httemplate/view/directions.html @@ -22,7 +22,6 @@ body { height: 100%; margin: 0px; padding: 0px } #map_canvas { height: 100%; - margin-right: 320px; } #directions_panel { diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 3130c73a0..04d2b2962 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -114,6 +114,10 @@ function areyousure(href) { % } +% if ( $conf->config('ticket_system') ) { +<& /elements/table-tickets.html, object => $cust_svc &> +% } + <% joblisting({'svcnum'=>$svcnum}, 1) %> <% include('/elements/footer.html') %> diff --git a/httemplate/view/elements/tr-svc_export_machine.html b/httemplate/view/elements/tr-svc_export_machine.html new file mode 100644 index 000000000..1ba8d74a1 --- /dev/null +++ b/httemplate/view/elements/tr-svc_export_machine.html @@ -0,0 +1,27 @@ +% foreach my $part_export (@part_export) { +% my $label = ( $part_export->exportname +% ? $part_export->exportname +% : $part_export->label +% ). +% ' hostname'; +% +% my $svc_export_machine = qsearchs('svc_export_machine', { +% 'svcnum' => $opt{svc}->svcnum, +% 'exportnum' => $part_export->exportnum, +% }); + + <& tr.html, + 'label' => $label, + 'value' => $svc_export_machine + ? $svc_export_machine->part_export_machine->machine + : '', + &> +% } +<%init> + +my %opt = @_; + +my @part_export = grep { $_->machine eq '_SVC_MACHINE' } + $opt{part_svc}->part_export; + +</%init> diff --git a/httemplate/view/prospect_main.html b/httemplate/view/prospect_main.html index 9e85348af..6c4595dbe 100644 --- a/httemplate/view/prospect_main.html +++ b/httemplate/view/prospect_main.html @@ -64,6 +64,38 @@ <BR> +% if ( $curuser->access_right('Generate quotation') ) { + <FONT CLASS="fsinnerbox-title"><% mt( 'Quotations' ) |h %></FONT> + <A HREF="<%$p%>edit/quotation.html?prospectnum=<% $prospectnum %>">New quotation</A> +% my @quotations = $prospect_main->quotation; +% if ( @quotations ) { + <& /elements/table-grid.html &> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; + <TR> + <TH CLASS="grid" BGCOLOR="#cccccc">#</TH> + <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH> + </TR> +% foreach my $quotation (@quotations) { +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } +% my $a = qq(<A HREF="$p/view/quotation.html?quotationnum=). #" +% $quotation->quotationnum. '">'; + <TR> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->quotationnum %></A></TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% time2str($date_format, $quotation->_date) |h %></A></TD> + </TR> +% } + </TABLE> +% } + <BR><BR> +% } + + % if ( $curuser->access_right('Qualify service') ) { <% include( '/elements/popup_link-prospect_main.html', 'action' => $p. 'misc/qual.html', @@ -80,6 +112,7 @@ <BR><BR> % } +<!-- <% ntable("#cccccc") %> <TR> @@ -87,6 +120,7 @@ </TR> </TABLE> +--> <%init> @@ -95,6 +129,10 @@ my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" unless $curuser->access_right('View prospect'); +my $conf = new FS::Conf; + +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + my $prospectnum; if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) { $prospectnum = $1; diff --git a/httemplate/view/qual.cgi b/httemplate/view/qual.cgi index 5c15ec0c3..56c2b61df 100644 --- a/httemplate/view/qual.cgi +++ b/httemplate/view/qual.cgi @@ -59,8 +59,10 @@ % $opt{'svcpart'} = $pkg_svc->svcpart if $pkg_svc; % } - <% include('/view/cust_main/order_pkg_link.html', - $cust_or_prospect, %opt) %> + <& /elements/order_pkg_link.html, + 'cust_main' => $cust_or_prospect, + %opt + &> % } elsif ($cust_or_prospect->prospectnum) { diff --git a/httemplate/view/quotation.html b/httemplate/view/quotation.html new file mode 100755 index 000000000..a88acf82b --- /dev/null +++ b/httemplate/view/quotation.html @@ -0,0 +1,91 @@ +<& /elements/header.html, mt('Quotation View'), $menubar &> + +%#XXX link to order... + +<%doc> + +XXX resending quotations + +% if ( $curuser->access_right('Resend invoices') ) { + + <A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Re-print this invoice') |h %></A> + +% if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { + | <A HREF="<% $p %>misc/send-invoice.cgi?method=email;<% $link %>"><% mt('Re-email this invoice') |h %></A> +% } + +% if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { + | <A HREF="<% $p %>misc/send-invoice.cgi?method=fax;<% $link %>"><% mt('Re-fax this invoice') |h %></A> +% } + + <BR><BR> + +% } + +</%doc> + +% if ( $curuser->access_right('Order customer package') ) { + <& /elements/order_pkg_link.html, + 'label' => emt('Add package'), + 'actionlabel' => emt('Add package'), + map { $_ => $quotation->$_ } qw( quotationnum custnum prospectnum ) + &> +% } + +% if ( $conf->exists('quotation_latex') ) { + | <A HREF="<% $p %>view/quotation-pdf.cgi?<% $link %>"><% mt('View typeset quotation PDF') |h %></A> + <BR><BR> +% } + +% if ( $conf->exists('quotation_html') ) { + <% join('', $quotation->print_html() ) %> +% } else { +% die "quotation_html config missing"; +% } +% #plaintext quotations? <PRE><% join('', $quotation->print_text() ) %></PRE> + +<& /elements/footer.html &> +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +#die "access denied" +# unless $curuser->access_right('View quotations'); + +my $quotationnum; +my($query) = $cgi->keywords; +if ( $query =~ /^(\d+)$/ ) { + $quotationnum = $1; +} else { + $quotationnum = $cgi->param('quotationnum'); +} + +my $conf = new FS::Conf; + +my $quotation = qsearchs({ + 'select' => 'quotation.*', + 'table' => 'quotation', + #'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'quotationnum' => $quotationnum }, + #'extra_sql' => ' AND '. $curuser->agentnums_sql, +}); +die "Quotation #$quotationnum not found!" unless $quotation; + +my $menubar; +if ( my $custnum = $quotation->custnum ) { + my $display_custnum = $quotation->cust_main->display_custnum; + $menubar = menubar( + emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum", + ); +} elsif ( my $prospectnum = $quotation->prospectnum ) { + $menubar = menubar( + emt("View this prospect (#[_1])",$prospectnum) => "${p}view/prospect_main.html?$prospectnum", + ); +} + +my $link = "quotationnum=$quotationnum"; +#$link .= ';template='. uri_escape($template) if $template; +#$link .= ';notice_name='. $notice_name if $notice_name; + + +</%init> diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 441e4945d..3ad21bb4d 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -47,6 +47,7 @@ <& svc_acct/basics.html, 'svc_acct' => $svc_acct, 'part_svc' => $part_svc, + 'cust_svc' => $cust_svc, %gopt, &> @@ -75,6 +76,11 @@ <& elements/svc_export_settings.html, $svc_acct &> +% if ( $conf->config('ticket_system') ) { +<& /elements/table-tickets.html, object => $cust_svc &> +% } + +<BR> <% joblisting({'svcnum'=>$svcnum}, 1) %> <& /elements/footer.html &> diff --git a/httemplate/view/svc_acct/basics.html b/httemplate/view/svc_acct/basics.html index 8f180b648..1cdf77615 100644 --- a/httemplate/view/svc_acct/basics.html +++ b/httemplate/view/svc_acct/basics.html @@ -1,6 +1,9 @@ <% &ntable("#cccccc") %><TR><TD><% &ntable("#cccccc",2) %> <& /view/elements/tr.html, label=>mt('Service'), value=>$part_svc->svc &> +% if ( $opt{cust_svc}->agent_svcid ) { + <& /view/elements/tr.html, label=>mt('Legacy ID'), value=>$opt{cust_svc}->agent_svcid &> +% } <& /view/elements/tr.html, label=>mt('Username'), value=>$svc_acct->username &> <& /view/elements/tr.html, label=>mt('Domain'), value=>$domain &> @@ -53,6 +56,11 @@ &> % } +<& /view/elements/tr-svc_export_machine.html, + 'svc' => $svc_acct, + 'part_svc' => $part_svc, +&> + % if ($svc_acct->uid ne '') { <& /view/elements/tr.html, label=>mt('UID'), value=>$svc_acct->uid &> % } diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 3938a3406..fcccd74b4 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -36,6 +36,10 @@ <% include('elements/svc_export_settings.html', $svc_domain) %> +% if ( $conf->config('ticket_system') ) { +<& /elements/table-tickets.html, object => $cust_svc &> +% } + <% joblisting({'svcnum'=>$svcnum}, 1) %> <% include('/elements/footer.html') %> diff --git a/httemplate/view/svc_external.cgi b/httemplate/view/svc_external.cgi index 77679d81c..72e553598 100644 --- a/httemplate/view/svc_external.cgi +++ b/httemplate/view/svc_external.cgi @@ -23,6 +23,11 @@ </TABLE></TD></TR></TABLE> + +% if ( $conf->config('ticket_system') ) { +<& /elements/table-tickets.html, object => $cust_svc &> +% } + <BR><% joblisting({'svcnum'=>$svcnum}, 1) %> <% include('/elements/footer.html') %> diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index 15b5ae56f..2cb78ebd5 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -53,6 +53,10 @@ <% include('elements/svc_export_settings.html', $svc_forward) %> +% if ( $conf->config('ticket_system') ) { +<& /elements/table-tickets.html, object => $cust_svc &> +% } + <% joblisting({'svcnum'=>$svcnum}, 1) %> <% include('/elements/footer.html') %> diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index 935d139e9..fbb02a00f 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -49,6 +49,10 @@ </TABLE> <BR> +% if ( $conf->config('ticket_system') ) { +<& /elements/table-tickets.html, object => $cust_svc &> +% } + <% joblisting({'svcnum'=>$svcnum}, 1) %> <% include('/elements/footer.html') %> |
