default payby for new installs, regression from 3.x, RT#73853
[freeside.git] / httemplate / view / cust_main / menu.html
1 <style type="text/css">
2
3 #customer_menu {
4   margin-top: .6em;
5   margin-bottom: 16px;
6 }
7
8 /* #customer_menu .ui-menu-item  */
9 #customer_menu > li {
10   background-color: #f8f8f8;
11 }
12
13 /* #customer_menu .ui-menu-item  */
14 #customer_menu > li.ui-state-focus {
15   background-color: #f8f8f8;
16 }
17
18 #customer_menu > li.ui-state-active {
19   background-color: #f8f8f8;
20 }
21
22 #customer_menu > li > a {
23   border-top: 1px solid transparent;
24   border-left: 1px solid transparent;
25   border-right: 1px solid transparent;
26   border-bottom: none;
27   padding: .5em .75em;
28 }
29
30 #customer_menu > li.ui-state-active > a {
31
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?
34   background: #ED55E7;
35 */
36 }
37
38 #customer_menu a.current_show {
39   font-weight: bold;
40   background: #FFFFFF;
41   border-top: 1px solid #7e0079;
42   border-left: 1px solid #7e0079;
43   border-right: 1px solid #7e0079;
44   border-bottom: 2px solid #ffffff;
45   margin-bottom: -2px;
46   border-bottom-left-radius: 2px;
47   border-bottom-right-radius: 2px;
48 }
49
50 #customer_menu a {
51   margin-left: 0;
52   margin-right: 1em;
53   margin-top: 0;
54   border-top-left-radius: .5em;
55   border-top-right-radius: .5em;
56
57   font-weight: normal;
58   background: #e0e0e0;
59   color: #525151;
60   text-decoration: none;
61 }
62
63 #customer_menu ul a {
64   background: transparent;
65 }
66
67 </style>
68
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=",
74      'menu'      => \@menu,
75      'cust_main' => $cust_main,
76      'show'      => $opt{'show'},
77 &>
78
79 <%init>
80 my %opt = @_;
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;
85
86 my @payby = grep /\w/, $conf->config('payby');
87 @payby = (qw( CARD DCRD CHEK DCHK ))
88   unless @payby;
89 my %payby = map { $_ => 1 } @payby;
90
91 # cached for conditions, to avoid looking it up twice
92 my $invoicing_list_emailonly = $cust_main->invoicing_list_emailonly;
93
94 # nice declarative menu; a parameter to some kind of menu generator
95 my @menu = ( 
96   [
97     { show        => 'basics',
98       label       => 'Basics',
99     },
100     {
101       label       => 'Edit customer',
102       url         => "edit/cust_main.cgi?$custnum",
103       acl         => 'Edit customer'
104     },
105     {
106       label       => 'Edit contacts',
107       url         => "edit/cust_main-contacts.html?$custnum",
108     },
109
110     { label   => '-',
111       content => '-',
112     },
113
114     {
115       label       => 'Bill now',
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,
121                            ),
122                      },
123     },
124     {
125       label       => 'Suspend',
126       popup       => "misc/suspend_cust.html?custnum=$custnum",
127       acl         => 'Suspend customer',
128       condition   => sub { shift->unsuspended_pkgs > 0 },
129       actionlabel => 'Confirm Suspension',
130       color       => '#ff9900',
131     },
132     {
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',
138     },
139     {
140       label       => 'Cancel',
141       popup       => "misc/cancel_cust.html?custnum=$custnum",
142       acl         => 'Cancel customer',
143       condition   => sub { shift->ncancelled_pkgs > 0 },
144       actionlabel => 'Confirm Cancellation',
145       color       => '#ff0000',
146     },
147     {
148       label       => 'Merge',
149       popup       => "misc/merge_cust.html?custnum=$custnum",
150       acl         => 'Merge customer',
151       actionlabel => 'Merge customer',
152       width       => 569,
153       height      => 210,
154     },
155     {
156       label       => 'Refer a new customer',
157       url         => "edit/cust_main.cgi?referral_custnum=$custnum",
158       confexists  => '!disable_customer_referrals',
159     },
160
161     { label   => '-',
162       content => '-',
163     },
164
165     {
166       label       => 'View this customer\'s referrals',
167       url         => "search/cust_main.cgi?referral_custnum=$custnum",
168       confexists  => '!disable_customer_referrals',
169       condition   => sub {
170         FS::cust_main->count('referral_custnum = ?', shift->custnum) > 0
171       },
172     },
173     {
174       label       => 'View billing events',
175       url         => "search/cust_event.html?custnum=$custnum",
176       acl         => [ 'Billing event reports',
177                        'View customer billing events' ],
178     },
179     {
180       label       => 'Email a notice to this customer',
181       url         => sub {
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);
187                      },
188       condition   => sub { $invoicing_list_emailonly },
189       acl         => 'Bulk send customer notices',
190     },
191   ],
192   [
193     {
194       label => 'Notes',
195       show  => 'notes',
196     },
197     {
198       label       => 'Add note',
199       popup       => "edit/cust_main_note.cgi?custnum=$custnum",
200       actionlabel => 'Add note',
201       confexists  => '!cust_main-disable_notes',
202       acl         => 'Add customer note',
203       width       => 875,
204       height      => 538,
205     },
206     {
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',
212       width       => 480,
213       height      => 296,
214     },
215   ],
216   [
217     {
218       label => 'Tickets',
219       show  => 'tickets',
220       confexists => 'ticket_system'
221     },
222   ],
223   [
224     {
225       label => 'Appointments',
226       show  => 'appointments',
227       confexists => 'ticket_system',
228       acl   => 'View appointments',
229     },
230     {
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',
236     },
237   ],
238   [
239     {
240       label => 'Quotations',
241       show  => 'quotations',
242     },
243     {
244       label => 'Create new quotation',
245       url   => "edit/quotation.html?custnum=$custnum",
246       acl   => 'Generate quotation',
247     },
248   ],
249   [
250     {
251       label => 'Packages',
252       show  => 'packages',
253     },
254     {
255       label       => 'New qualification',
256       popup       => "misc/qual.html?custnum=$custnum",
257       actionlabel => 'New qualification',
258       color       => '#333399',
259       width       => 763,
260       height      => 436,
261       acl         => 'Qualify service',
262     },
263     {
264       label       => 'Order new package',
265       popup       => "misc/order_pkg.html?custnum=$custnum",
266       actionlabel => 'Order new package',
267       color       => '#333399',
268       width       => 960,
269       height      => 740,
270       acl         => 'Order customer package',
271     },
272     {
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',
277     },
278     {
279       label       => 'Move services between packages',
280       popup       => "edit/bulk-cust_svc-pkgnum.html?custnum=$custnum",
281       actionlabel => 'Move services',
282       width       => 968,
283       height      => 575,
284       acl         => 'Bulk move customer services',
285     },
286     {
287       label       => 'Bulk order and cancel packages',
288       url         => "edit/cust_pkg.cgi?$custnum",
289       acl         => 'Bulk change customer packages',
290     },
291
292     { label   => '-',
293       content => '-',
294     },
295
296     {
297       label => 'Package reports',
298       url   => "search/report_cust_pkg.html?custnum=$custnum",
299     },
300     {
301       label => 'View qualifications',
302       url   => "search/qual.cgi?custnum=$custnum",
303       acl   => 'Qualify service',
304     },
305     {
306       label => 'View accounts',
307       url   => "search/report_svc_acct.html?custnum=$custnum",
308     },
309     {
310       label => 'View data usage',
311       popup => "search/report_sqlradius_usage-custnum.html?$custnum",
312       acl   => 'Usage: RADIUS sessions',
313       actionlabel => 'Data usage report',
314       width   => 480,
315       height  => 345,
316       condition => sub { shift->num_usage_pkgs > 0 },
317     },
318     {
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
322     },
323   ],
324   [
325     {
326       label => 'Payment History',
327       show  => 'payment_history',
328     },
329
330     # manual payment entry via edit/cust_pay
331     { label   => 'Enter payment',
332       submenu => [
333         {
334           label       => 'Enter check payment',
335           popup       => "edit/cust_pay.cgi?popup=1;payby=BILL;custnum=$custnum",
336           actionlabel => 'Enter check payment',
337           width       => 763,
338           height      => 392,
339           acl         => [ 'Post payment', 'Post check payment' ],
340         },
341         {
342           label       => 'Enter cash payment',
343           popup       => "edit/cust_pay.cgi?popup=1;payby=CASH;custnum=$custnum",
344           actionlabel => 'Enter cash payment',
345           width       => 763,
346           height      => 392,
347           acl         => [ 'Post payment', 'Post cash payment' ],
348         },
349         #{
350         #  label       => 'Enter Western Union payment',
351         #  popup       => "edit/cust_pay.cgi?popup=1;payby=WEST;custnum=$custnum",
352         #  actionlabel => 'Enter Western Union payment',
353         #  width       => 763,
354         #  height      => 392,
355         #  acl         => [ 'Post payment', ],
356         ##  condition   => sub { $payby{WEST} },
357         #},
358         #{
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',
362         #  width       => 763,
363         #  height      => 392,
364         #  acl         => [ 'Post payment', ],
365         ##  condition   => sub { $payby{MCRD} },
366         #},
367         #{
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',
371         #  width       => 763,
372         #  height      => 392,
373         #  acl         => [ 'Post payment', ],
374         ##  condition   => sub { $payby{MCHK} },
375         #},
376       ],
377     },
378
379     # realtime payments via payment.cgi
380     { label   => 'Process payment',
381       submenu => [
382         {
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} },
387         },
388         {
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} },
393         },
394       ],
395     },
396
397     { label   => '-',
398       content => '-',
399     },
400
401     {
402       label       => 'Enter credit',
403       popup       => "edit/cust_credit.cgi?custnum=$custnum",
404       actionlabel => 'Enter credit',
405       width       => 763,
406       acl         => 'Post credit',
407     },
408     {
409       label       => 'Credit line items',
410       popup       => "edit/credit-cust_bill_pkg.html?custnum=$custnum",
411       actionlabel => 'Credit line items',
412       width       => 968,
413       height      => 575,
414       acl         => 'Credit line items',
415       condition   => sub {
416         FS::cust_bill->count('custnum = ?', shift->custnum) > 0
417       },
418     },
419
420     { label   => '-',
421       content => '-',
422     },
423
424     { label   => 'Enter refund',
425       submenu => [
426
427         {
428           label       => 'Enter check refund',
429           popup       => "edit/cust_refund.cgi?popup=1;payby=BILL;custnum=$custnum",
430           actionlabel => 'Enter check refund',
431           width       => 440,
432           acl         => ['Post refund', 'Post check refund'],
433         },
434         {
435           label       => 'Enter cash refund',
436           popup       => "edit/cust_refund.cgi?popup=1;payby=CASH;custnum=$custnum",
437           actionlabel => 'Enter cash refund',
438           width       => 392,
439           acl         => ['Post refund', 'Post cash refund'],
440         },
441         #{
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',
445         #  width       => 440,
446         #  acl         => ['Post refund' ],
447         ##  condition   => sub { $payby{MCRD} },
448         #},
449         #{
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',
453         #  width       => 440,
454         #  acl         => ['Post refund' ],
455         ##  condition   => sub { $payby{MCHK} },
456         #},
457
458       ],
459
460     },
461
462     { label   => '-',
463       content => '-',
464     },
465
466     {
467       label       => 'Add tax adjustment',
468       popup       => "edit/cust_tax_adjustment.html?custnum=$custnum",
469       actionlabel => 'Add tax adjustment',
470       height      => 200,
471       confexists  => 'enable_tax_adjustments',
472       acl         => 'Add customer tax adjustment',
473     },
474
475     { label       => '-',
476       content     => '-',
477       confexists  => 'enable_tax_adjustments',
478       acl         => 'Add customer tax adjustment',
479     },
480
481     {
482       label       => 'Email statement to this customer',
483       url         => sub {
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);
489                      },
490       condition   => sub { $invoicing_list_emailonly },
491       acl         => 'Resend invoices',
492     },
493     {
494       label       => 'Download PDF statement',
495       url         => "view/cust_main_statement-pdf.cgi?$custnum",
496       acl         => 'View legacy typeset statements',
497       condition   => sub {
498         FS::cust_bill->count('custnum = ?', shift->custnum) > 0
499       },
500     },
501     {
502       label       => 'Search invoices',
503       url         => "search/report_cust_bill.html?custnum=$custnum",
504       acl         => 'List invoices',
505     },
506     {
507       label       => 'View tax exemptions',
508       url         => "search/cust_tax_exempt_pkg.cgi?custnum=$custnum",
509       acl         => 'View customer tax exemptions',
510     },
511     {
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',
516     },
517     {
518       label       => 'View pending payments',
519       url         => "search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=$custnum",
520       acl         => 'View pending payments',
521       condition   => sub { 
522         FS::cust_pay_pending->count('custnum = ?', shift->custnum) > 0
523       },
524     },
525
526   ],
527   [
528     {
529       label => 'Change History',
530       show  => 'change_history',
531       acl   => 'View customer history',
532     },
533   ],
534 );
535
536 </%init>