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?";
152 <& /elements/footer.html &>
155 my $curuser = $FS::CurrentUser::CurrentUser;
158 unless $curuser->access_right('View customer');
160 my $conf = new FS::Conf;
163 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
166 die "No customer specified (bad URL)!" unless $cgi->keywords;
167 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
170 $cgi->delete('keywords');
171 $cgi->param('custnum', $1);
174 my $cust_main = qsearchs( {
175 'table' => 'cust_main',
176 'hashref' => { 'custnum' => $custnum },
177 'extra_sql' => ' AND '. $curuser->agentnums_sql,
179 die "Customer not found!" unless $cust_main;
181 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
182 tie my %views, 'Tie::IxHash',
183 emt('Basics') => 'basics',
184 emt('Notes') => 'notes', #notes and files?
186 if ( $conf->config('ticket_system') ) {
187 $views{emt('Tickets')} = 'tickets';
188 $views{emt('Appointments')} = 'appointments'
189 if $curuser->access_right('View appointments');
191 $views{emt('Quotations')} = 'quotations';
192 $views{emt('Packages')} = 'packages';
193 $views{emt('Payment History')} = 'payment_history';
194 $views{emt('Change History')} = 'change_history'
195 if $curuser->access_right('View customer history');
196 $views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
197 if $conf->config('cust_main-custom_link')
198 || $conf->config('cust_main-custom_content');
200 my %viewname = reverse %views;
202 my $view = $cgi->param('show') || $curuser->default_customer_view;
204 if ($view eq 'last') {
205 # something took us away from the page and is now bouncing back
206 $view = get_page_pref('last_view', $custnum);
208 # remember which view is open so we _can_ bounce back
209 set_page_pref('last_view', $custnum, $view);
212 $view = 'basics' if $view eq 'jumbo';