1 <style type="text/css">
15 /* #customer_menu .ui-menu-item */
17 background-color: #f8f8f8;
21 /* #customer_menu .ui-menu-item */
22 #customer_menu > li.ui-state-focus {
23 background-color: #f8f8f8;
24 border: 1px solid transparent;
27 #customer_menu > li.ui-state-active {
28 background-color: #f8f8f8;
29 border: 1px solid transparent;
32 #customer_menu > li > a {
33 border-top: 1px solid transparent;
34 border-left: 1px solid transparent;
35 border-right: 1px solid transparent;
40 #customer_menu > li.ui-state-active > a {
42 /* if i could find something light enough that didn't look pink?
43 or is this too visually distracting and not the useful hint i think it is?
48 #customer_menu a.current_show {
51 border-top: 1px solid #7e0079;
52 border-left: 1px solid #7e0079;
53 border-right: 1px solid #7e0079;
54 border-bottom: 2px solid #ffffff;
56 border-bottom-left-radius: 2px;
57 border-bottom-right-radius: 2px;
64 border-top-left-radius: .5em;
65 border-top-right-radius: .5em;
71 text-decoration: none;
76 border: 1px solid #7e0079;
78 box-shadow: #333333 1px 1px 2px;
81 #customer_menu ul li {
89 background: transparent;
92 #customer_menu li.ui-menu-divider {
93 border-color: #7e0079;
98 #customer_menu a:hover {
99 text-decoration: underline;
103 #customer_menu ul li.ui-state-focus {
104 background: transparent;
105 border: 1px solid transparent;
110 #customer_menu ul li.ui-state-active {
112 border: 1px solid #7e0079;
118 #customer_menu a .arrow {
120 background-image: url("<% $p %>images/arrow.right.black.png");
126 @-moz-document url-prefix() {
127 #customer_menu a .arrow {
134 <& /elements/one_time_charge_link.html, form_only=>1 &>
136 <ul id="customer_menu">
137 % foreach my $submenu (@processed_menu) {
139 <% shift @$submenu %>
141 <ul class="customer_submenu">
142 % foreach my $link ( @$submenu ) {
151 <script type="text/javascript">
153 $("#customer_menu").menu({
154 position: { my: "left top", at: "left+1 bottom+3" },
156 $(this).menu("option", "position", { my:"left top", at:"left+1 bottom+3" } );
158 focus: function(e,ui) {
159 if ($("#customer_menu").get(0) !== $(ui).get(0).item.parent().get(0)) {
160 $(this).menu("option", "position", { my:"left top", at:"right+2 top"} );
170 my $cust_main = $opt{'cust_main'};
171 my $custnum = $cust_main->custnum;
172 my $curuser = $FS::CurrentUser::CurrentUser;
173 my $conf = FS::Conf->new;
175 my %payby = map { $_ => 1 } $conf->config('payby');
177 # cached for conditions, to avoid looking it up twice
178 my $invoicing_list_emailonly = $cust_main->invoicing_list_emailonly;
180 # nice declarative menu; should be a parameter to some kind of menu generator
187 label => 'Edit customer',
188 url => "edit/cust_main.cgi?$custnum",
189 acl => 'Edit customer'
192 label => 'Edit contacts',
193 url => "edit/cust_main-contacts.html?$custnum",
202 acl => 'Bill customer now',
203 content => sub { include( '/elements/bill.html',
204 label => emt('Bill now'),
205 url => $cgi->self_url,
206 custnum => shift->custnum,
212 popup => "misc/suspend_cust.html?custnum=$custnum",
213 acl => 'Suspend customer',
214 condition => sub { shift->unsuspended_pkgs > 0 },
215 actionlabel => 'Confirm Suspension',
219 label => 'Unsuspend',
220 popup => "misc/unsuspend_cust.html?custnum=$custnum",
221 acl => 'Unsuspend customer',
222 condition => sub { shift->suspended_pkgs > 0 },
223 actionlabel => 'Confirm Unsuspension',
227 popup => "misc/cancel_cust.html?custnum=$custnum",
228 acl => 'Cancel customer',
229 condition => sub { shift->ncancelled_pkgs > 0 },
230 actionlabel => 'Confirm Cancellation',
235 popup => "misc/merge_cust.html?custnum=$custnum",
236 acl => 'Merge customer',
237 actionlabel => 'Merge customer',
242 label => 'Refer a new customer',
243 url => "edit/cust_main.cgi?referral_custnum=$custnum",
244 confexists => '!disable_customer_referrals',
252 label => 'View this customer\'s referrals',
253 url => "search/cust_main.cgi?referral_custnum=$custnum",
254 confexists => '!disable_customer_referrals',
256 FS::cust_main->count('referral_custnum = ?', shift->custnum) > 0
260 label => 'View billing events',
261 url => "search/cust_event.html?custnum=$custnum",
262 acl => [ 'Billing event reports',
263 'View customer billing events' ],
266 label => 'Email a notice to this customer',
268 my $cust_main = shift;
269 my $agentnum = $cust_main->agentnum;
270 'misc/email-customers.html?table=cust_main;'.
271 'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
272 uri_escape($cgi->self_url);
274 condition => sub { $invoicing_list_emailonly },
275 acl => 'Bulk send customer notices',
285 popup => "edit/cust_main_note.cgi?custnum=$custnum",
286 actionlabel => 'Add note',
287 confexists => '!cust_main-disable_notes',
288 acl => 'Add customer note',
293 label => 'Attach file',
294 popup => "edit/cust_main_attach.cgi?custnum=$custnum",
295 actionlabel => 'Upload file',
296 confexists => '!disable_cust_attachment',
297 acl => 'Add attachment',
306 confexists => 'ticket_system'
311 label => 'Appointments',
312 show => 'appointments',
313 confexists => 'ticket_system',
314 acl => 'View appointments',
317 label => 'Schedule new appointment',
318 confexists => 'ticket_system',
319 acl => 'Make appointment',
320 popup => "misc/make_appointment.html?custnum=$custnum",
321 actionlabel => 'Schedule appointment',
326 label => 'Quotations',
327 show => 'quotations',
330 label => 'Create new quotation',
331 url => "edit/quotation.html?custnum=$custnum",
332 acl => 'Generate quotation',
341 label => 'New qualification',
342 popup => "misc/qual.html?custnum=$custnum",
343 actionlabel => 'New qualification',
347 acl => 'Qualify service',
350 label => 'Order new package',
351 popup => "misc/order_pkg.html?custnum=$custnum",
352 actionlabel => 'Order new package',
356 acl => 'Order customer package',
359 # it's just a popup, but there's some freaky CCH tax stuff in it
360 label => 'One-time charge',
362 include( '/elements/one_time_charge_link.html',
363 custnum => shift->custnum,
367 acl => 'One-time charge',
370 label => 'Move services between packages',
371 popup => "edit/bulk-cust_svc-pkgnum.html?custnum=$custnum",
372 actionlabel => 'Move services',
375 acl => 'Bulk move customer services',
378 label => 'Bulk order and cancel packages',
379 url => "edit/cust_pkg.cgi?$custnum",
380 acl => 'Bulk change customer packages',
388 label => 'Package reports',
389 url => "search/report_cust_pkg.html?custnum=$custnum",
392 label => 'View qualifications',
393 url => "search/qual.cgi?custnum=$custnum",
394 acl => 'Qualify service',
397 label => 'View accounts',
398 url => "search/report_svc_acct.html?custnum=$custnum",
401 label => 'View CDRs',
402 url => "search/report_cdr.html?custnum=$custnum",
407 label => 'Payment History',
408 show => 'payment_history',
411 # manual payment entry via edit/cust_pay
412 { label => 'Enter payment',
415 label => 'Enter check payment',
416 popup => "edit/cust_pay.cgi?popup=1;payby=BILL;custnum=$custnum",
417 actionlabel => 'Enter check payment',
420 acl => [ 'Post payment', 'Post check payment' ],
423 label => 'Enter cash payment',
424 popup => "edit/cust_pay.cgi?popup=1;payby=CASH;custnum=$custnum",
425 actionlabel => 'Enter cash payment',
428 acl => [ 'Post payment', 'Post cash payment' ],
431 # label => 'Enter Western Union payment',
432 # popup => "edit/cust_pay.cgi?popup=1;payby=WEST;custnum=$custnum",
433 # actionlabel => 'Enter Western Union payment',
436 # acl => [ 'Post payment', ],
437 ## condition => sub { $payby{WEST} },
440 # label => 'Record manual (offline/POS) credit card payment',
441 # popup => "edit/cust_pay.cgi?popup=1;payby=MCRD;custnum=$custnum",
442 # actionlabel => 'Enter credit card payment',
445 # acl => [ 'Post payment', ],
446 ## condition => sub { $payby{MCRD} },
449 # label => 'Record manual (offline/POS) electronic check',
450 # popup => "edit/cust_pay.cgi?popup=1;payby=MCHK;custnum=$custnum",
451 # actionlabel => 'Enter credit card payment',
454 # acl => [ 'Post payment', ],
455 ## condition => sub { $payby{MCHK} },
460 # realtime payments via payment.cgi
461 { label => 'Process payment',
464 label => 'Process credit card payment',
465 url => "misc/payment.cgi?payby=CARD;custnum=$custnum",
466 acl => [ 'Process payment', 'Process credit card payment', ],
467 condition => sub { $payby{CARD} or $payby{DCRD} },
470 label => 'Process electronic check payment',
471 url => "misc/payment.cgi?payby=CHEK;custnum=$custnum",
472 acl => [ 'Process payment', 'Process Echeck payment', ],
473 condition => sub { $payby{CHEK} or $payby{DCHK} },
483 label => 'Enter credit',
484 popup => "edit/cust_credit.cgi?custnum=$custnum",
485 actionlabel => 'Enter credit',
487 acl => 'Post credit',
490 label => 'Credit line items',
491 popup => "edit/credit-cust_bill_pkg.html?custnum=$custnum",
492 actionlabel => 'Credit line items',
495 acl => 'Credit line items',
497 FS::cust_bill->count('custnum = ?', shift->custnum) > 0
505 { label => 'Enter refund',
509 label => 'Enter check refund',
510 popup => "edit/cust_refund.cgi?popup=1;payby=BILL;custnum=$custnum",
511 actionlabel => 'Enter check refund',
513 acl => ['Post refund', 'Post check refund'],
516 label => 'Enter cash refund',
517 popup => "edit/cust_refund.cgi?popup=1;payby=CASH;custnum=$custnum",
518 actionlabel => 'Enter cash refund',
520 acl => ['Post refund', 'Post cash refund'],
523 # label => 'Record manual (offline/POS) credit card refund',
524 # popup => "edit/cust_refund.cgi?popup=1;payby=MCRD;custnum=$custnum",
525 # actionlabel => 'Enter credit card refund',
527 # acl => ['Post refund' ],
528 ## condition => sub { $payby{MCRD} },
531 # label => 'Record manual (offline/POS) electronic check refund',
532 # popup => "edit/cust_refund.cgi?popup=1;payby=MCHK;custnum=$custnum",
533 # actionlabel => 'Enter electronic check refund',
535 # acl => ['Post refund' ],
536 ## condition => sub { $payby{MCHK} },
548 label => 'Add tax adjustment',
549 popup => "edit/cust_tax_adjustment.html?custnum=$custnum",
550 actionlabel => 'Add tax adjustment',
552 confexists => 'enable_tax_adjustments',
553 acl => 'Add customer tax adjustment',
558 confexists => 'enable_tax_adjustments',
559 acl => 'Add customer tax adjustment',
563 label => 'Email statement to this customer',
565 my $cust_main = shift;
566 my $agentnum = $cust_main->agentnum;
567 'misc/email-customer-statement.html?table=cust_main;'.
568 'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
569 uri_escape($cgi->self_url);
571 condition => sub { $invoicing_list_emailonly },
572 acl => 'Resend invoices',
575 label => 'Download PDF statement',
576 url => "view/cust_main_statement-pdf.cgi?$custnum",
577 acl => 'View legacy typeset statements',
579 FS::cust_bill->count('custnum = ?', shift->custnum) > 0
583 label => 'Search invoices',
584 url => "search/report_cust_bill.html?custnum=$custnum",
585 acl => 'List invoices',
588 label => 'View tax exemptions',
589 url => "search/cust_tax_exempt_pkg.cgi?custnum=$custnum",
590 acl => 'View customer tax exemptions',
593 label => 'View tax adjustments',
594 url => "search/cust_tax_adjustment.html?custnum=$custnum",
595 confexists => 'enable_tax_adjustments',
596 acl => 'Add customer tax adjustment',
599 label => 'View pending payments',
600 url => "search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=$custnum",
601 acl => 'View pending payments',
603 FS::cust_pay_pending->count('custnum = ?', shift->custnum) > 0
610 label => 'Change History',
611 show => 'change_history',
612 acl => 'View customer history',
619 foreach my $submenu (@menu) {
623 foreach my $entry ( @$submenu ) {
624 # if the menu head was skipped, skip the whole menu
625 last if (!$first and !@links);
628 my $a = entry2link($entry, $cust_main, $opt{show});
629 push @links, $a if length($a);
634 push @processed_menu, \@links;
640 my( $entry, $cust_main, $show ) = @_;
643 if ( $entry->{acl} ) {
645 unless $FS::CurrentUser::CurrentUser->access_right( $entry->{acl} );
647 if ( $entry->{confexists} ) {
648 if ( $entry->{confexists} =~ /^!(.*)/ ) {
649 # confexists => !foo, a negative condition
650 return '' if FS::Conf->new->exists( $1 );
652 return '' unless FS::Conf->new->exists( $entry->{confexists} );
655 if ( $entry->{condition} ) {
656 return '' unless &{ $entry->{condition} }($cust_main);
659 my $label = emt($entry->{label});
661 if ( $entry->{submenu} ) {
663 my $a = '<a href="javascript:void(0);">'. $label.
664 '<span class="arrow"></span>'.
665 '</a><ul class="customer_subsubmenu">';
666 foreach my $submenu (@{ $entry->{submenu} }) {
667 $a .= '<li>'. entry2link($submenu, $cust_main, $show), '</li>';
674 my $target = $entry->{content}
678 if ( ref($target) eq 'CODE' ) {
679 $target = &$target($cust_main);
682 return $target if $entry->{content}; #the coderef specified the whole thing
684 if ( $entry->{show} ) {
686 # the menu head: always a link back to this page
687 $cgi->param('show', $entry->{show});
688 $target = $cgi->self_url;
689 $cgi->param('show', $show);
691 my $a = qq[ <A HREF="$target"];
692 $a .= ' class="current_show"' if $show eq $entry->{show};
693 return $a. qq[>$label</A> ];
695 } elsif ( $entry->{popup} ) {
697 $target =~ s/\$custnum/$custnum/g;
698 $target = $p.$target;
700 return include('/elements/popup_link.html',
708 } elsif ( $entry->{url} ) {
710 $target =~ s/\$custnum/$custnum/g;
711 $target = $p.$target;
713 return qq[ <A HREF="$target">$label</A> ];
716 die "bad entry ". join(',',%$entry). " in menu: no url, popup or content";