X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main.cgi;h=322f0674e933ac9962ee7ca06b2f74bae5a56aa4;hb=8d4abaa99403699aa5b5f02e899d2ea33980f913;hp=a9d40fa275c523a07c0bee2a81e0787f125f6bed;hpb=b3daa2af67efdfa3a2380db0b5a977455964e751;p=freeside.git diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index a9d40fa27..322f0674e 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -3,7 +3,6 @@ my $conf = new FS::Conf; -#false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so my %uiview = (); my %uiadd = (); foreach my $part_svc ( qsearch('part_svc',{}) ) { @@ -15,6 +14,16 @@ print header("Customer View", menubar( 'Main Menu' => popurl(2) )); +%> + + + +<% + die "No customer specified (bad URL)!" unless $cgi->keywords; my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array $query =~ /^(\d+)$/; @@ -22,10 +31,25 @@ my $custnum = $1; my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); die "Customer not found!" unless $cust_main; -print qq!Edit this customer!; -print qq! | Delete this customer! +print qq!Edit this customer!; + +%> + + + +<% + +print qq! | !. + 'Cancel this customer' + if $cust_main->ncancelled_pkgs; + +print qq! | !. + 'Delete this customer' if $conf->exists('deletecustomers'); unless ( $conf->exists('disable_customer_referrals') ) { @@ -46,610 +70,800 @@ print "This customer's signup URL: ". "$signupurl?ref=$custnum

"; } -print ''; - -print &itable(), ''; - -print ''; - - print "Billing address", &ntable("#cccccc"), "", - &ntable("#cccccc",2), - 'Contact name', - '', - $cust_main->last, ', ', $cust_main->first, - ''; -print 'SS#', - $cust_main->ss || ' ', '' - if $conf->exists('show_ss'); - -print '', - 'Company', - $cust_main->company, - '', - 'Address', - $cust_main->address1, - '', - ; - print ' ', - $cust_main->address2, '' - if $cust_main->address2; - print 'City', - $cust_main->city, - 'State', - $cust_main->state, - 'Zip', - $cust_main->zip, '', - 'Country', - $cust_main->country, - '', - ; - print 'Day Phone', - $cust_main->daytime || ' ', '', - 'Night Phone', - $cust_main->night || ' ', '', - 'Fax', - $cust_main->fax || ' ', '', - '', "" - ; - - if ( defined $cust_main->dbdef_table->column('ship_last') ) { - - my $pre = $cust_main->ship_last ? 'ship_' : ''; - - print "
Service address", &ntable("#cccccc"), "", - &ntable("#cccccc",2), - 'Contact name', - '', - $cust_main->get("${pre}last"), ', ', $cust_main->get("${pre}first"), - '', - 'Company', - $cust_main->get("${pre}company"), - '', - 'Address', - $cust_main->get("${pre}address1"), - '', - ; - print ' ', - $cust_main->get("${pre}address2"), '' - if $cust_main->get("${pre}address2"); - print 'City', - $cust_main->get("${pre}city"), - 'State', - $cust_main->get("${pre}state"), - 'Zip', - $cust_main->get("${pre}zip"), '', - 'Country', - $cust_main->get("${pre}country"), - '', - ; - print 'Day Phone', - '', - $cust_main->get("${pre}daytime") || ' ', '', - 'Night Phone'. - '', - $cust_main->get("${pre}night") || ' ', '', - 'Fax', - $cust_main->get("${pre}fax") || ' ', '', - '', "" - ; - - } - -print ''; - -print ''; +%> - print &ntable("#cccccc"), "", &ntable("#cccccc",2), - 'Customer number', - $custnum, '', - ; + +<%= &itable() %> + + + <%= 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 ) %> + <% } %> + + + - my @agents = qsearch( 'agent', {} ); - my $agent; - unless ( scalar(@agents) == 1 ) { - $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); - print 'Agent', - $agent->agentnum, ": ", $agent->agent, ''; +<% +if ( defined $cust_main->dbdef_table->column('comments') + && $cust_main->comments =~ /[^\s\n\r]/ ) { +%> +
+Comments +<%= ntable("#cccccc") %><%= ntable("#cccccc",2) %> + + +
<%= encode_entities($cust_main->comments) %>
+ + + +<% } %> + +<% if ( $conf->config('ticket_system') ) { %> +
+ <%= include('cust_main/tickets.html', $cust_main ) %> +<% } %> + +
+ +
+ +!. - '

'; - -print '
'. - qq!
!. - qq!!. - qq!Description:!. - qq! Amount:!. - qq! !; - -#false laziness w/ edit/part_pkg.cgi -if ( $conf->exists('enable_taxclasses') ) { - print ''; +my @agents = qsearch( 'agent', {} ); +my $agent; +unless ( scalar(@agents) == 1 ) { + $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); } else { - print ''; + $agent = $agents[0]; } -print qq!

!; +foreach my $part_pkg ( + qsearch( 'part_pkg', { 'disabled' => '' }, '', + ' AND 0 < ( SELECT COUNT(*) FROM type_pkgs '. + ' WHERE typenum = '. $agent->typenum. + ' AND type_pkgs.pkgpart = part_pkg.pkgpart )' + ) +) { +%> +