1 <style type="text/css">
4 margin: 0px 0px 18px 0px;
15 margin: 8px 8px 8px 0px;
16 /* margin: 0px 0px 8px 0px; */
21 border-top-left-radius:2px;
22 border-top-right-radius:2px;
24 #menu_ul a.current_show {
26 border-top: 1px solid #7e007f;
27 border-left: 1px solid #7e007f;
28 border-right: 1px solid #7e007f;
29 border-bottom: 1px solid #ffffff;
33 margin: 8px 8px 8px 0px;
34 /* margin: 0px 0px 8px 0px; */
39 border-top-left-radius:2px;
40 border-top-right-radius:2px;
51 border: 1px solid #7e007f;
66 background: transparent;
70 background: #fff8fb; /* ?? too pink? */
71 border-top-left-radius:0px;
72 border-top-right-radius:0px;
75 #menu_ul a.current_menu, #menu_ul a.hover {
79 <script src="<% $p %>elements/jquery.js"></script>
80 <script type="text/javascript">
81 $(document).ready(function() {
82 $('#menu_ul > li').hover(function(){
83 $('a:first', this).addClass('hover');
84 $('ul:first', this).show();
85 if ($('.current_menu:first', this).length == 0) {
86 $('img[src*="dropdown_arrow_white"]', this).show();
87 $('img[src*="dropdown_arrow_grey"]', this).hide();
90 $('ul:first', this).hide();
91 $('a:first', this).removeClass('hover');
92 if ($('.current_menu:first', this).length == 0) {
93 $('img[src*="dropdown_arrow_white"]', this).hide();
94 $('img[src*="dropdown_arrow_grey"]', this).show();
101 % foreach my $submenu (@processed_menu) {
103 <% shift @$submenu %>
105 % foreach my $link ( @$submenu ) {
115 my $cust_main = $opt{'cust_main'};
116 my $custnum = $cust_main->custnum;
117 my $curuser = $FS::CurrentUser::CurrentUser;
118 my $conf = FS::Conf->new;
120 my %payby = map { $_ => 1 } $conf->config('payby');
122 # nice declarative menu; should be a parameter to some kind of menu generator
129 label => 'Edit customer',
130 url => 'edit/cust_main.cgi?$custnum',
131 acl => 'Edit customer'
134 label => 'Edit contacts',
135 url => 'edit/cust_main-contacts.html?$custnum',
140 acl => 'Bill customer now',
141 content => sub { include( '/elements/bill.html',
142 label => emt('Bill now'),
143 url => $cgi->self_url,
144 custnum => shift->custnum,
150 popup => 'misc/suspend_cust.html?custnum=$custnum',
151 acl => 'Suspend customer',
152 condition => sub { shift->unsuspended_pkgs > 0 },
153 actionlabel => 'Confirm Suspension',
157 label => 'Unsuspend',
158 popup => 'misc/unsuspend_cust.html?custnum=$custnum',
159 acl => 'Unsuspend customer',
160 condition => sub { shift->suspended_pkgs > 0 },
161 actionlabel => 'Confirm Unsuspension',
165 popup => 'misc/suspend_cust.html?custnum=$custnum',
166 acl => 'Cancel customer',
167 condition => sub { shift->ncancelled_pkgs > 0 },
168 actionlabel => 'Confirm Cancellation',
173 popup => 'misc/merge_cust.html?custnum=$custnum',
174 acl => 'Merge customer',
175 actionlabel => 'Merge customer',
180 label => 'Refer a new customer',
181 url => 'edit/cust_main.cgi?referral_custnum=$custnum',
182 confexists => '!disable_customer_referrals',
184 # should have a separator here
186 label => 'View this customer\'s referrals',
187 url => 'search/cust_main.cgi?referral_custnum=$custnum',
188 confexists => '!disable_customer_referrals',
190 FS::cust_main->count('referral_custnum = ?', shift->custnum) > 0
194 label => 'View billing events',
195 url => 'search/cust_event.html?custnum=$custnum',
196 acl => [ 'Billing event reports',
197 'View customer billing events' ],
200 label => 'Email a notice to this customer',
202 my $cust_main = shift;
203 my $agentnum = $cust_main->agentnum;
204 'misc/email-customers.html?table=cust_main;search_hash='.
205 'agent_virt_agentnum='.$agentnum.';custnum=$custnum';
207 condition => sub { shift->invoicing_list_emailonly },
217 popup => 'edit/cust_main_note.cgi?custnum=$custnum',
218 actionlabel => 'Add note',
219 confexists => '!cust_main-disable_notes',
220 acl => 'Add customer note',
225 label => 'Attach file',
226 popup => 'edit/cust_main_attach.cgi?custnum=$custnum',
227 actionlabel => 'Upload file',
228 confexists => '!disable_cust_attachment',
229 acl => 'Add attachment',
238 confexists => 'ticket_system'
243 label => 'Appointments',
244 show => 'appointments',
245 confexists => 'ticket_system',
246 acl => 'View appointments',
251 label => 'Quotations',
252 show => 'quotations',
255 label => 'Add quotation',
256 url => 'edit/quotation.html?custnum=$custnum',
257 acl => 'Generate quotation',
266 label => 'New qualification',
267 popup => 'misc/qual.html?custnum=$custnum',
268 actionlabel => 'New qualification',
272 acl => 'Qualify service',
275 label => 'Order new package',
276 popup => 'misc/order_pkg.html?custnum=$custnum',
277 actionlabel => 'Order new package',
281 acl => 'Order customer package',
284 # it's just a popup, but there's some freaky CCH tax stuff in it
285 label => 'One-time charge',
287 include( '/elements/one_time_charge_link.html',
288 custnum => shift->custnum,
291 acl => 'One-time charge',
294 label => 'Move services between packages',
295 popup => 'edit/bulk-cust_svc-pkgnum.html?custnum=$custnum',
296 actionlabel => 'Move services',
299 acl => 'Bulk move customer services',
302 label => 'Bulk order and cancel packages',
303 url => 'edit/cust_pkg.cgi?$custnum',
304 acl => 'Bulk change customer packages',
308 label => 'Package reports',
309 url => 'search/report_cust_pkg?custnum=$custnum',
312 label => 'View qualifications',
313 url => 'search/qual.cgi?custnum=$custnum',
314 acl => 'Qualify service',
317 label => 'View accounts',
318 url => 'search/report_svc_acct.html?custnum=$custnum',
321 label => 'View CDRs',
322 url => 'search/report_cdr.html?custnum=$custnum',
327 label => 'Payment History',
328 show => 'payment_history',
330 # manual payment entry via edit/cust_pay
332 label => 'Enter check payment',
333 popup => 'edit/cust_pay.cgi?popup=1;payby=BILL;custnum=$custnum',
334 actionlabel => 'Enter check payment',
337 acl => [ 'Post payment', 'Post check payment' ],
338 condition => sub { $payby{BILL} },
341 label => 'Enter cash payment',
342 popup => 'edit/cust_pay.cgi?popup=1;payby=CASH;custnum=$custnum',
343 actionlabel => 'Enter cash payment',
346 acl => [ 'Post payment', 'Post cash payment' ],
347 condition => sub { $payby{CASH} },
350 label => 'Enter Western Union payment',
351 popup => 'edit/cust_pay.cgi?popup=1;payby=WEST;custnum=$custnum',
352 actionlabel => 'Enter Western Union payment',
355 acl => [ 'Post payment', ],
356 condition => sub { $payby{WEST} },
359 label => 'Post manual (offline/POS) credit card payment',
360 popup => 'edit/cust_pay.cgi?popup=1;payby=MCRD;custnum=$custnum',
361 actionlabel => 'Enter credit card payment',
364 acl => [ 'Post payment', ],
365 condition => sub { $payby{MCRD} },
368 label => 'Post manual (offline/POS) electronic check',
369 popup => 'edit/cust_pay.cgi?popup=1;payby=MCHK;custnum=$custnum',
370 actionlabel => 'Enter credit card payment',
373 acl => [ 'Post payment', ],
374 condition => sub { $payby{MCHK} },
376 # realtime payments via payment.cgi
378 label => 'Process credit card payment',
379 url => 'misc/payment.cgi?payby=CARD;custnum=$custnum',
380 acl => [ 'Process payment', 'Process credit card payment', ],
381 condition => sub { $payby{CARD} or $payby{DCRD} },
384 label => 'Process electronic check payment',
385 url => 'misc/payment.cgi?payby=CHEK;custnum=$custnum',
386 acl => [ 'Process payment', 'Process Echeck payment', ],
387 condition => sub { $payby{CHEK} or $payby{DCHK} },
391 label => 'Enter credit',
392 popup => 'edit/cust_credit.cgi?custnum=$custnum',
393 actionlabel => 'Enter credit',
395 acl => 'Post credit',
398 label => 'Credit line items',
399 popup => 'edit/credit-cust_bill_pkg.html?custnum=$custnum',
400 actionlabel => 'Credit line items',
403 acl => 'Credit line items',
405 FS::cust_bill->count('custnum = ?', shift->custnum) > 0
409 label => 'Enter check refund',
410 popup => 'edit/cust_refund.cgi?popup=1;payby=BILL;custnum=$custnum',
411 actionlabel => 'Enter check refund',
413 acl => ['Post refund', 'Post check refund'],
414 condition => sub { $payby{BILL} },
417 label => 'Enter cash refund',
418 popup => 'edit/cust_refund.cgi?popup=1;payby=CASH;custnum=$custnum',
419 actionlabel => 'Enter cash refund',
421 acl => ['Post refund', 'Post cash refund'],
422 condition => sub { $payby{CASH} },
425 label => 'Enter manual (offline/POS) credit card refund',
426 popup => 'edit/cust_refund.cgi?popup=1;payby=MCRD;custnum=$custnum',
427 actionlabel => 'Enter credit card refund',
429 acl => ['Post refund' ],
430 condition => sub { $payby{MCRD} },
433 label => 'Enter manual (offline/POS) electronic check refund',
434 popup => 'edit/cust_refund.cgi?popup=1;payby=MCHK;custnum=$custnum',
435 actionlabel => 'Enter electronic check refund',
437 acl => ['Post refund' ],
438 condition => sub { $payby{MCHK} },
441 label => 'Add tax adjustment',
442 popup => 'edit/cust_tax_adjustment.html?custnum=$custnum',
443 actionlabel => 'Add tax adjustment',
445 confexists => 'enable_tax_adjustments',
446 acl => 'Add customer tax adjustment',
448 # separator, definitely
450 label => 'Download statement',
451 url => 'view/cust_main_statement-pdf.cgi?$custnum',
452 acl => 'List invoices',
454 FS::cust_bill->count('custnum = ?', shift->custnum) > 0
458 label => 'Search invoices',
459 url => 'search/report_cust_bill.html?custnum=$custnum',
460 acl => 'List invoices',
463 label => 'View tax exemptions',
464 url => 'search/cust_tax_exempt_pkg.cgi?custnum=$custnum',
465 acl => 'View customer tax exemptions',
468 label => 'View tax adjustments',
469 url => 'search/cust_tax_adjustment.html?custnum=$custnum',
470 confexists => 'enable_tax_adjustments',
471 acl => 'Add customer tax adjustment',
474 label => 'View pending payments',
475 url => 'search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=$custnum',
476 acl => 'View pending payments',
478 FS::cust_pay_pending->count('custnum = ?', shift->custnum) > 0
484 label => 'Change History',
485 show => 'change_history',
486 acl => 'View customer history',
493 foreach my $submenu (@menu) {
497 foreach my $entry ( @$submenu ) {
498 # if the menu head was skipped, skip the whole menu
499 last if (!$first and !@links);
503 if ( $entry->{acl} ) {
504 next unless $curuser->access_right( $entry->{acl} );
506 if ( $entry->{confexists} ) {
507 if ( $entry->{confexists} =~ /^!(.*)/ ) {
508 # confexists => !foo, a negative condition
509 next if $conf->exists( $1 );
511 next unless $conf->exists( $entry->{confexists} );
514 if ( $entry->{condition} ) {
515 next unless &{ $entry->{condition} }($cust_main);
518 my $label = emt($entry->{label});
519 my $target = $entry->{content}
523 if ( ref($target) eq 'CODE' ) {
524 $target = &$target($cust_main);
528 if ( $entry->{content} ) { # then the coderef specified the whole thing
531 } elsif ( $entry->{show} ) {
533 # the menu head: always a link back to this page
534 $cgi->param('show', $entry->{show});
535 $target = $cgi->self_url;
537 $a = qq[ <A HREF="$target"];
538 if ( $opt{'show'} eq $entry->{show} ) {
539 $a .= ' class="current_show"';
541 $a .= qq[>$label</A> ];
544 } elsif ( $entry->{popup} ) {
546 $target =~ s/\$custnum/$custnum/g;
547 $target = $p.$target;
548 $a = include('/elements/popup_link.html',
553 label => emt($label),
556 } elsif ( $entry->{url} ) {
558 $target =~ s/\$custnum/$custnum/g;
559 $target = $p.$target;
560 $a = qq[ <A HREF="$target">$label</A> ];
567 push @processed_menu, \@links;