1 <style type="text/css">
8 /* #customer_menu .ui-menu-item */
10 background-color: #f8f8f8;
13 /* #customer_menu .ui-menu-item */
14 #customer_menu > li.ui-state-focus {
15 background-color: #f8f8f8;
18 #customer_menu > li.ui-state-active {
19 background-color: #f8f8f8;
22 #customer_menu > li > a {
23 border-top: 1px solid transparent;
24 border-left: 1px solid transparent;
25 border-right: 1px solid transparent;
30 #customer_menu > li.ui-state-active > a {
32 /* if i could find something light enough that didn't look pink?
33 or is this too visually distracting and not the useful hint i think it is?
38 #customer_menu a.current_show {
41 border-top: 1px solid #7e0079;
42 border-left: 1px solid #7e0079;
43 border-right: 1px solid #7e0079;
44 border-bottom: 2px solid #ffffff;
46 border-bottom-left-radius: 2px;
47 border-bottom-right-radius: 2px;
54 border-top-left-radius: .5em;
55 border-top-right-radius: .5em;
60 text-decoration: none;
64 background: transparent;
69 <& /elements/dropdown-menu.html,
70 'id' => 'customer_menu',
71 #'class' => 'customer_submenu',
72 #XXX support installs outside /freeside in 4.x
73 'self_url' => "/freeside/view/cust_main.cgi?custnum=$custnum;show=",
75 'cust_main' => $cust_main,
76 'show' => $opt{'show'},
81 my $cust_main = $opt{'cust_main'};
82 my $custnum = $cust_main->custnum;
83 my $curuser = $FS::CurrentUser::CurrentUser;
84 my $conf = FS::Conf->new;
86 my @payby = grep /\w/, $conf->config('payby');
87 @payby = (qw( CARD DCRD CHEK DCHK ))
89 my %payby = map { $_ => 1 } @payby;
91 # cached for conditions, to avoid looking it up twice
92 my $invoicing_list_emailonly = $cust_main->invoicing_list_emailonly;
94 # nice declarative menu; a parameter to some kind of menu generator
101 label => 'Edit customer',
102 url => "edit/cust_main.cgi?$custnum",
103 acl => 'Edit customer'
106 label => 'Edit contacts',
107 url => "edit/cust_main-contacts.html?$custnum",
116 acl => 'Bill customer now',
117 content => sub { include( '/elements/bill.html',
118 label => emt('Bill now'),
119 url => $cgi->self_url,
120 custnum => shift->custnum,
126 popup => "misc/suspend_cust.html?custnum=$custnum",
127 acl => 'Suspend customer',
128 condition => sub { shift->unsuspended_pkgs > 0 },
129 actionlabel => 'Confirm Suspension',
133 label => 'Unsuspend',
134 popup => "misc/unsuspend_cust.html?custnum=$custnum",
135 acl => 'Unsuspend customer',
136 condition => sub { shift->suspended_pkgs > 0 },
137 actionlabel => 'Confirm Unsuspension',
141 popup => "misc/cancel_cust.html?custnum=$custnum",
142 acl => 'Cancel customer',
143 condition => sub { shift->ncancelled_pkgs > 0 },
144 actionlabel => 'Confirm Cancellation',
149 popup => "misc/merge_cust.html?custnum=$custnum",
150 acl => 'Merge customer',
151 actionlabel => 'Merge customer',
156 label => 'Refer a new customer',
157 url => "edit/cust_main.cgi?referral_custnum=$custnum",
158 confexists => '!disable_customer_referrals',
166 label => 'View this customer\'s referrals',
167 url => "search/cust_main.cgi?referral_custnum=$custnum",
168 confexists => '!disable_customer_referrals',
170 FS::cust_main->count('referral_custnum = ?', shift->custnum) > 0
174 label => 'View billing events',
175 url => "search/cust_event.html?custnum=$custnum",
176 acl => [ 'Billing event reports',
177 'View customer billing events' ],
180 label => 'Email a notice to this customer',
182 my $cust_main = shift;
183 my $agentnum = $cust_main->agentnum;
184 'misc/email-customers.html?table=cust_main;'.
185 'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
186 uri_escape($cgi->self_url);
188 condition => sub { $invoicing_list_emailonly },
189 acl => 'Bulk send customer notices',
199 popup => "edit/cust_main_note.cgi?custnum=$custnum",
200 actionlabel => 'Add note',
201 confexists => '!cust_main-disable_notes',
202 acl => 'Add customer note',
207 label => 'Attach file',
208 popup => "edit/cust_main_attach.cgi?custnum=$custnum",
209 actionlabel => 'Upload file',
210 confexists => '!disable_cust_attachment',
211 acl => 'Add attachment',
220 confexists => 'ticket_system'
225 label => 'Appointments',
226 show => 'appointments',
227 confexists => 'ticket_system',
228 acl => 'View appointments',
231 label => 'Schedule new appointment',
232 confexists => 'ticket_system',
233 acl => 'Make appointment',
234 popup => "misc/make_appointment.html?custnum=$custnum",
235 actionlabel => 'Schedule appointment',
240 label => 'Quotations',
241 show => 'quotations',
244 label => 'Create new quotation',
245 url => "edit/quotation.html?custnum=$custnum",
246 acl => 'Generate quotation',
255 label => 'New qualification',
256 popup => "misc/qual.html?custnum=$custnum",
257 actionlabel => 'New qualification',
261 acl => 'Qualify service',
264 label => 'Order new package',
265 popup => "misc/order_pkg.html?custnum=$custnum",
266 actionlabel => 'Order new package',
270 acl => 'Order customer package',
273 # it's just a popup, but there's some freaky CCH tax stuff in it
274 label => 'One-time charge',
275 url => "edit/quick-charge.html?custnum=$custnum",
276 acl => 'One-time charge',
279 label => 'Move services between packages',
280 popup => "edit/bulk-cust_svc-pkgnum.html?custnum=$custnum",
281 actionlabel => 'Move services',
284 acl => 'Bulk move customer services',
287 label => 'Bulk order and cancel packages',
288 url => "edit/cust_pkg.cgi?$custnum",
289 acl => 'Bulk change customer packages',
297 label => 'Package reports',
298 url => "search/report_cust_pkg.html?custnum=$custnum",
301 label => 'View qualifications',
302 url => "search/qual.cgi?custnum=$custnum",
303 acl => 'Qualify service',
306 label => 'View accounts',
307 url => "search/report_svc_acct.html?custnum=$custnum",
310 label => 'View data usage',
311 popup => "search/report_sqlradius_usage-custnum.html?$custnum",
312 acl => 'Usage: RADIUS sessions',
313 actionlabel => 'Data usage report',
316 condition => sub { shift->num_usage_pkgs > 0 },
319 label => 'View CDRs',
320 url => "search/report_cdr.html?custnum=$custnum",
321 # XXX should have a condition that the customer has any CDR packages
326 label => 'Payment History',
327 show => 'payment_history',
330 # manual payment entry via edit/cust_pay
331 { label => 'Enter payment',
334 label => 'Enter check payment',
335 popup => "edit/cust_pay.cgi?popup=1;payby=BILL;custnum=$custnum",
336 actionlabel => 'Enter check payment',
339 acl => [ 'Post payment', 'Post check payment' ],
342 label => 'Enter cash payment',
343 popup => "edit/cust_pay.cgi?popup=1;payby=CASH;custnum=$custnum",
344 actionlabel => 'Enter cash payment',
347 acl => [ 'Post payment', 'Post cash payment' ],
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 => 'Record 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 => 'Record 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} },
379 # realtime payments via payment.cgi
380 { label => 'Process payment',
383 label => 'Process credit card payment',
384 url => "misc/payment.cgi?payby=CARD;custnum=$custnum",
385 acl => [ 'Process payment', 'Process credit card payment', ],
386 condition => sub { $payby{CARD} or $payby{DCRD} },
389 label => 'Process electronic check payment',
390 url => "misc/payment.cgi?payby=CHEK;custnum=$custnum",
391 acl => [ 'Process payment', 'Process Echeck payment', ],
392 condition => sub { $payby{CHEK} or $payby{DCHK} },
402 label => 'Enter credit',
403 popup => "edit/cust_credit.cgi?custnum=$custnum",
404 actionlabel => 'Enter credit',
406 acl => 'Post credit',
409 label => 'Credit line items',
410 popup => "edit/credit-cust_bill_pkg.html?custnum=$custnum",
411 actionlabel => 'Credit line items',
414 acl => 'Credit line items',
416 FS::cust_bill->count('custnum = ?', shift->custnum) > 0
424 { label => 'Enter refund',
428 label => 'Enter check refund',
429 popup => "edit/cust_refund.cgi?popup=1;payby=BILL;custnum=$custnum",
430 actionlabel => 'Enter check refund',
432 acl => ['Post refund', 'Post check refund'],
435 label => 'Enter cash refund',
436 popup => "edit/cust_refund.cgi?popup=1;payby=CASH;custnum=$custnum",
437 actionlabel => 'Enter cash refund',
439 acl => ['Post refund', 'Post cash refund'],
442 # label => 'Record manual (offline/POS) credit card refund',
443 # popup => "edit/cust_refund.cgi?popup=1;payby=MCRD;custnum=$custnum",
444 # actionlabel => 'Enter credit card refund',
446 # acl => ['Post refund' ],
447 ## condition => sub { $payby{MCRD} },
450 # label => 'Record manual (offline/POS) electronic check refund',
451 # popup => "edit/cust_refund.cgi?popup=1;payby=MCHK;custnum=$custnum",
452 # actionlabel => 'Enter electronic check refund',
454 # acl => ['Post refund' ],
455 ## condition => sub { $payby{MCHK} },
467 label => 'Add tax adjustment',
468 popup => "edit/cust_tax_adjustment.html?custnum=$custnum",
469 actionlabel => 'Add tax adjustment',
471 confexists => 'enable_tax_adjustments',
472 acl => 'Add customer tax adjustment',
477 confexists => 'enable_tax_adjustments',
478 acl => 'Add customer tax adjustment',
482 label => 'Email statement to this customer',
484 my $cust_main = shift;
485 my $agentnum = $cust_main->agentnum;
486 'misc/email-customer-statement.html?table=cust_main;'.
487 'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
488 uri_escape($cgi->self_url);
490 condition => sub { $invoicing_list_emailonly },
491 acl => 'Resend invoices',
494 label => 'Download PDF statement',
495 url => "view/cust_main_statement-pdf.cgi?$custnum",
496 acl => 'View legacy typeset statements',
498 FS::cust_bill->count('custnum = ?', shift->custnum) > 0
502 label => 'Search invoices',
503 url => "search/report_cust_bill.html?custnum=$custnum",
504 acl => 'List invoices',
507 label => 'View tax exemptions',
508 url => "search/cust_tax_exempt_pkg.cgi?custnum=$custnum",
509 acl => 'View customer tax exemptions',
512 label => 'View tax adjustments',
513 url => "search/cust_tax_adjustment.html?custnum=$custnum",
514 confexists => 'enable_tax_adjustments',
515 acl => 'Add customer tax adjustment',
518 label => 'View pending payments',
519 url => "search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=$custnum",
520 acl => 'View pending payments',
522 FS::cust_pay_pending->count('custnum = ?', shift->custnum) > 0
529 label => 'Change History',
530 show => 'change_history',
531 acl => 'View customer history',