1 <& /elements/header-cust_main.html, view=>$view, cust_main=>$cust_main &>
7 % if ( $view eq 'basics' ) {
11 % if ( $conf->config('cust_main-external_links') ) {
12 <% $br++ ? ' | ' : '' %>
13 % my @links = split(/\n/, $conf->config('cust_main-external_links'));
14 % foreach my $link (@links) {
15 % $link =~ /^\s*(\S+)\s+(.*?)(\s*\(([^\)]*)\))?$/ or next;
16 % my($url, $label, $alt) = ($1, $2, $4);
17 <A HREF="<% $url.$custnum %>" ALT="<% $alt |h %>"><% $label |h %></A>
25 %my $signupurl = $conf->config('signupurl');
27 <% mt('This customer\'s signup URL:') |h %>
28 <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A>
35 <& cust_main/contacts.html, $cust_main &>
37 <& cust_main/misc.html, $cust_main &>
39 <TD VALIGN="top" STYLE="padding-left: 54px">
40 <& cust_main/billing.html, $cust_main &>
42 <& cust_main/cust_payby.html, $cust_main &>
47 <& cust_main/contacts_new.html, $cust_main &>
59 % if ( $view eq 'notes' ) {
60 <& cust_main/notes.html, 'cust_main' => $cust_main &>
69 % if ( $view eq 'tickets' ) {
71 % if ( $conf->config('ticket_system') ) {
72 <& cust_main/tickets.html, $cust_main &>
82 % if ( $view eq 'appointments' ) {
84 % if ( $conf->config('ticket_system')
85 % && $curuser->access_right('View appointments') ) {
86 <& cust_main/appointments.html, $cust_main &>
97 % if ( $view eq 'quotations' ) {
99 % if ( $curuser->access_right('Generate quotation') ) {
100 <& cust_main/quotations.html, $cust_main &>
110 % if ( $view eq 'packages' ) {
112 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
113 <& cust_main/packages.html, $cust_main &>
124 % if ( $view eq 'payment_history' ) {
126 <& cust_main/payment_history.html, $cust_main &>
136 % if ( $view eq 'change_history' ) {
137 <& cust_main/change_history.html, $cust_main &>
141 % if ( $view eq 'custom' ) {
142 % if ( $conf->config('cust_main-custom_link') ) {
143 <& cust_main/custom.html, $cust_main &>
144 % } elsif ( $conf->config('cust_main-custom_content') ) {
145 <& cust_main/custom_content.html, $cust_main &>
147 % # warn "custom view without cust_main-custom_link or -custom_content?";
151 <& /elements/footer-cust_main.html &>
154 my $curuser = $FS::CurrentUser::CurrentUser;
157 unless $curuser->access_right('View customer');
159 my $conf = new FS::Conf;
162 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
165 die "No customer specified (bad URL)!" unless $cgi->keywords;
166 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
169 $cgi->delete('keywords');
170 $cgi->param('custnum', $1);
173 my $cust_main = qsearchs( {
174 'table' => 'cust_main',
175 'hashref' => { 'custnum' => $custnum },
176 'extra_sql' => ' AND '. $curuser->agentnums_sql,
178 die "Customer not found!" unless $cust_main;
180 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
181 tie my %views, 'Tie::IxHash',
182 emt('Basics') => 'basics',
183 emt('Notes') => 'notes', #notes and files?
185 if ( $conf->config('ticket_system') ) {
186 $views{emt('Tickets')} = 'tickets';
187 $views{emt('Appointments')} = 'appointments'
188 if $curuser->access_right('View appointments');
190 $views{emt('Quotations')} = 'quotations';
191 $views{emt('Packages')} = 'packages';
192 $views{emt('Payment History')} = 'payment_history';
193 $views{emt('Change History')} = 'change_history'
194 if $curuser->access_right('View customer history');
195 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
196 if $conf->config('cust_main-custom_link')
197 || $conf->config('cust_main-custom_content');
199 my %viewname = reverse %views;
201 my $view = $cgi->param('show') || $curuser->default_customer_view;
203 if ($view eq 'last') {
204 # something took us away from the page and is now bouncing back
205 $view = get_page_pref('last_view', $custnum);
207 # remember which view is open so we _can_ bounce back
208 set_page_pref('last_view', $custnum, $view);
211 $view = 'basics' if $view eq 'jumbo';