<style type="text/css">
-#menu_ul {
- padding: 0;
- margin: 0px 0px 18px 0px;
+
+#customer_menu {
+ font-size: smaller;
+ border: none;
+ margin-top: .6em;
+ margin-bottom: 16px;
}
-#menu_ul li {
+
+#customer_menu li {
float: left;
- list-style: none;
- position: relative;
+ padding: .25em;
}
-#menu_ul a {
- background: #dddddd;
- display: block;
- padding: 6px 8px;
- margin: 8px 8px 8px 0px;
-/* margin: 0px 0px 8px 0px; */
- color: #525151;
- font-size: 13px;
+
+/* #customer_menu .ui-menu-item */
+#customer_menu > li {
+ background-color: #f8f8f8;
+ padding-left: 0px;
+}
+
+/* #customer_menu .ui-menu-item */
+#customer_menu > li.ui-state-focus {
+ background-color: #f8f8f8;
+ border: 1px solid transparent;
+}
+
+#customer_menu > li.ui-state-active {
+ background-color: #f8f8f8;
+ border: 1px solid transparent;
+}
+
+#customer_menu > li > a {
+ border-top: 1px solid transparent;
+ border-left: 1px solid transparent;
+ border-right: 1px solid transparent;
+ border-bottom: none;
+ padding: .5em .75em;
+}
+
+#customer_menu > li.ui-state-active > a {
+
+/* if i could find something light enough that didn't look pink?
+ or is this too visually distracting and not the useful hint i think it is?
+ background: #ED55E7;
+*/
+}
+
+#customer_menu a.current_show {
font-weight: bold;
- white-space: nowrap;
- border-top-left-radius:2px;
- border-top-right-radius:2px;
+ background: #FFFFFF;
+ border-top: 1px solid #7e0079;
+ border-left: 1px solid #7e0079;
+ border-right: 1px solid #7e0079;
+ border-bottom: 2px solid #ffffff;
+ margin-bottom: -2px;
+ border-bottom-left-radius: 2px;
+ border-bottom-right-radius: 2px;
}
-#menu_ul a.current_show {
- background: #ffffff;
- border-top: 1px solid #7e007f;
- border-left: 1px solid #7e007f;
- border-right: 1px solid #7e007f;
- border-bottom: 1px solid #ffffff;
-
- display: block;
- padding: 6px 8px;
- margin: 8px 8px 8px 0px;
-/* margin: 0px 0px 8px 0px; */
+
+#customer_menu a {
+ margin-left: 0;
+ margin-right: 1em;
+ margin-top: 0;
+ border-top-left-radius: .5em;
+ border-top-right-radius: .5em;
+
+ font-weight: normal;
+ background: #e0e0e0;
color: #525151;
- font-size: 13px;
- font-weight: bold;
white-space: nowrap;
- border-top-left-radius:2px;
- border-top-right-radius:2px;
+ text-decoration: none;
}
-#menu_ul ul {
- margin:0;
- padding:0;
- display:none;
- position: absolute;
- top: 100%;
- left: -1px;
+#customer_menu ul {
background: #ffffff;
- border: 1px solid #7e007f;
+ border: 1px solid #7e0079;
+ border-radius: 2px;
+ box-shadow: #333333 1px 1px 2px;
}
-#menu_ul ul li {
+#customer_menu ul li {
float: none;
- border-style: none;
- display: inline;
- width: 100%;
+ margin-right: 2px;
+ margin-left: 2px;
}
-#menu_ul ul a {
- padding: 0px 10px;
+#customer_menu ul a {
color: #333333;
- font-size: 13px;
- font-weight: normal;
background: transparent;
}
-#menu_ul ul a:hover {
- color: #7e0079;
- background: #fff8fb; /* ?? too pink? */
- border-top-left-radius:0px;
- border-top-right-radius:0px;
+
+#customer_menu li.ui-menu-divider {
+ border-color: #7e0079;
+/* margin-right: 2px;
+ margin-left: 2px; */
}
-#menu_ul a.current_menu, #menu_ul a.hover {
+#customer_menu a:hover {
+ text-decoration: underline;
color: #7e0079;
}
+
+#customer_menu ul li.ui-state-focus {
+ background: transparent;
+ border: 1px solid transparent;
+ margin-right: 1px;
+ margin-left: 1px;
+}
+
+#customer_menu ul li.ui-state-active {
+ background: #f8f0fc;
+ border: 1px solid #7e0079;
+ border-radius: 2px;
+ margin-right: 1px;
+ margin-left: 1px;
+}
+
+#customer_menu a .arrow {
+ float: right;
+ background-image: url("<% $p %>images/arrow.right.black.png");
+ width: 3px;
+ height: 6px;
+ margin-top:4px;
+}
+
+@-moz-document url-prefix() {
+ #customer_menu a .arrow {
+ margin-top:-.8em;
+ }
+}
+
</style>
-<script src="<% $p %>elements/jquery.js"></script>
-<script type="text/javascript">
-$(document).ready(function() {
- $('#menu_ul > li').hover(function(){
- $('a:first', this).addClass('hover');
- $('ul:first', this).show();
- if ($('.current_menu:first', this).length == 0) {
- $('img[src*="dropdown_arrow_white"]', this).show();
- $('img[src*="dropdown_arrow_grey"]', this).hide();
- }
- }, function(){
- $('ul:first', this).hide();
- $('a:first', this).removeClass('hover');
- if ($('.current_menu:first', this).length == 0) {
- $('img[src*="dropdown_arrow_white"]', this).hide();
- $('img[src*="dropdown_arrow_grey"]', this).show();
- }
- });
-});
-</script>
-<ul id="menu_ul">
+<ul id="customer_menu">
% foreach my $submenu (@processed_menu) {
<li>
<% shift @$submenu %>
- <ul>
-% foreach my $link ( @$submenu ) {
- <li><% $link %></li>
+% if ( @$submenu ) {
+ <ul class="customer_submenu">
+% foreach my $link ( @$submenu ) {
+ <li><% $link %></li>
+% }
+ </ul>
% }
- </ul>
</li>
% }
</ul>
+<script type="text/javascript">
+
+ $("#customer_menu").menu({
+ position: { my: "left top", at: "left+1 bottom+3" },
+ blur: function() {
+ $(this).menu("option", "position", { my:"left top", at:"left+1 bottom+3" } );
+ },
+ focus: function(e,ui) {
+ if ($("#customer_menu").get(0) !== $(ui).get(0).item.parent().get(0)) {
+ $(this).menu("option", "position", { my:"left top", at:"right+2 top"} );
+ }
+ },
+ });
+
+</script>
+
+
<%init>
my %opt = @_;
my $cust_main = $opt{'cust_main'};
my %payby = map { $_ => 1 } $conf->config('payby');
+# cached for conditions, to avoid looking it up twice
+my $invoicing_list_emailonly = $cust_main->invoicing_list_emailonly;
+
# nice declarative menu; should be a parameter to some kind of menu generator
my @menu = (
[
},
{
label => 'Edit customer',
- url => 'edit/cust_main.cgi?$custnum',
+ url => "edit/cust_main.cgi?$custnum",
acl => 'Edit customer'
},
{
label => 'Edit contacts',
- url => 'edit/cust_main-contacts.html?$custnum',
+ url => "edit/cust_main-contacts.html?$custnum",
+ },
+
+ { label => '-',
+ content => '-',
},
-# separator
+
{
label => 'Bill now',
acl => 'Bill customer now',
},
{
label => 'Suspend',
- popup => 'misc/suspend_cust.html?custnum=$custnum',
+ popup => "misc/suspend_cust.html?custnum=$custnum",
acl => 'Suspend customer',
condition => sub { shift->unsuspended_pkgs > 0 },
actionlabel => 'Confirm Suspension',
},
{
label => 'Unsuspend',
- popup => 'misc/unsuspend_cust.html?custnum=$custnum',
+ popup => "misc/unsuspend_cust.html?custnum=$custnum",
acl => 'Unsuspend customer',
condition => sub { shift->suspended_pkgs > 0 },
actionlabel => 'Confirm Unsuspension',
},
{
label => 'Cancel',
- popup => 'misc/suspend_cust.html?custnum=$custnum',
+ popup => "misc/cancel_cust.html?custnum=$custnum",
acl => 'Cancel customer',
condition => sub { shift->ncancelled_pkgs > 0 },
actionlabel => 'Confirm Cancellation',
},
{
label => 'Merge',
- popup => 'misc/merge_cust.html?custnum=$custnum',
+ popup => "misc/merge_cust.html?custnum=$custnum",
acl => 'Merge customer',
actionlabel => 'Merge customer',
width => 569,
},
{
label => 'Refer a new customer',
- url => 'edit/cust_main.cgi?referral_custnum=$custnum',
+ url => "edit/cust_main.cgi?referral_custnum=$custnum",
confexists => '!disable_customer_referrals',
},
-# should have a separator here
+
+ { label => '-',
+ content => '-',
+ },
+
{
label => 'View this customer\'s referrals',
- url => 'search/cust_main.cgi?referral_custnum=$custnum',
+ url => "search/cust_main.cgi?referral_custnum=$custnum",
confexists => '!disable_customer_referrals',
condition => sub {
FS::cust_main->count('referral_custnum = ?', shift->custnum) > 0
},
{
label => 'View billing events',
- url => 'search/cust_event.html?custnum=$custnum',
+ url => "search/cust_event.html?custnum=$custnum",
acl => [ 'Billing event reports',
'View customer billing events' ],
},
url => sub {
my $cust_main = shift;
my $agentnum = $cust_main->agentnum;
- 'misc/email-customers.html?table=cust_main;search_hash='.
- 'agent_virt_agentnum='.$agentnum.';custnum=$custnum';
+ 'misc/email-customers.html?table=cust_main;'.
+ 'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
+ uri_escape($cgi->self_url);
},
- condition => sub { shift->invoicing_list_emailonly },
+ condition => sub { $invoicing_list_emailonly },
+ acl => 'Bulk send customer notices',
},
],
[
},
{
label => 'Add note',
- popup => 'edit/cust_main_note.cgi?custnum=$custnum',
+ popup => "edit/cust_main_note.cgi?custnum=$custnum",
actionlabel => 'Add note',
confexists => '!cust_main-disable_notes',
acl => 'Add customer note',
- width => 616,
+ width => 875,
height => 538,
},
{
label => 'Attach file',
- popup => 'edit/cust_main_attach.cgi?custnum=$custnum',
+ popup => "edit/cust_main_attach.cgi?custnum=$custnum",
actionlabel => 'Upload file',
confexists => '!disable_cust_attachment',
acl => 'Add attachment',
confexists => 'ticket_system',
acl => 'View appointments',
},
+ {
+ label => 'Schedule new appointment',
+ confexists => 'ticket_system',
+ acl => 'Make appointment',
+ popup => "misc/make_appointment.html?custnum=$custnum",
+ actionlabel => 'Schedule appointment',
+ },
],
[
{
show => 'quotations',
},
{
- label => 'Add quotation',
- url => 'edit/quotation.html?custnum=$custnum',
+ label => 'Create new quotation',
+ url => "edit/quotation.html?custnum=$custnum",
acl => 'Generate quotation',
},
],
},
{
label => 'New qualification',
- popup => 'misc/qual.html?custnum=$custnum',
+ popup => "misc/qual.html?custnum=$custnum",
actionlabel => 'New qualification',
color => '#333399',
width => 763,
},
{
label => 'Order new package',
- popup => 'misc/order_pkg.html?custnum=$custnum',
+ popup => "misc/order_pkg.html?custnum=$custnum",
actionlabel => 'Order new package',
color => '#333399',
width => 960,
{
# it's just a popup, but there's some freaky CCH tax stuff in it
label => 'One-time charge',
- content => sub {
- include( '/elements/one_time_charge_link.html',
- custnum => shift->custnum,
- );
- },
+ url => "edit/quick-charge.html?custnum=$custnum",
acl => 'One-time charge',
},
{
label => 'Move services between packages',
- popup => 'edit/bulk-cust_svc-pkgnum.html?custnum=$custnum',
+ popup => "edit/bulk-cust_svc-pkgnum.html?custnum=$custnum",
actionlabel => 'Move services',
width => 968,
height => 575,
},
{
label => 'Bulk order and cancel packages',
- url => 'edit/cust_pkg.cgi?$custnum',
+ url => "edit/cust_pkg.cgi?$custnum",
acl => 'Bulk change customer packages',
},
-# separator
+
+ { label => '-',
+ content => '-',
+ },
+
{
label => 'Package reports',
- url => 'search/report_cust_pkg?custnum=$custnum',
+ url => "search/report_cust_pkg.html?custnum=$custnum",
},
{
label => 'View qualifications',
- url => 'search/qual.cgi?custnum=$custnum',
+ url => "search/qual.cgi?custnum=$custnum",
acl => 'Qualify service',
},
{
label => 'View accounts',
- url => 'search/report_svc_acct.html?custnum=$custnum',
+ url => "search/report_svc_acct.html?custnum=$custnum",
+ },
+ {
+ label => 'View data usage',
+ popup => "search/report_sqlradius_usage-custnum.html?$custnum",
+ acl => 'Usage: RADIUS sessions',
+ actionlabel => 'Data usage report',
+ width => 480,
+ height => 345,
+ condition => sub { shift->num_usage_pkgs > 0 },
},
{
label => 'View CDRs',
- url => 'search/report_cdr.html?custnum=$custnum',
+ url => "search/report_cdr.html?custnum=$custnum",
+ # XXX should have a condition that the customer has any CDR packages
},
],
[
label => 'Payment History',
show => 'payment_history',
},
+
# manual payment entry via edit/cust_pay
- {
- label => 'Enter check payment',
- popup => 'edit/cust_pay.cgi?popup=1;payby=BILL;custnum=$custnum',
- actionlabel => 'Enter check payment',
- width => 763,
- height => 392,
- acl => [ 'Post payment', 'Post check payment' ],
- condition => sub { $payby{BILL} },
- },
- {
- label => 'Enter cash payment',
- popup => 'edit/cust_pay.cgi?popup=1;payby=CASH;custnum=$custnum',
- actionlabel => 'Enter cash payment',
- width => 763,
- height => 392,
- acl => [ 'Post payment', 'Post cash payment' ],
- condition => sub { $payby{CASH} },
- },
- {
- label => 'Enter Western Union payment',
- popup => 'edit/cust_pay.cgi?popup=1;payby=WEST;custnum=$custnum',
- actionlabel => 'Enter Western Union payment',
- width => 763,
- height => 392,
- acl => [ 'Post payment', ],
- condition => sub { $payby{WEST} },
- },
- {
- label => 'Post manual (offline/POS) credit card payment',
- popup => 'edit/cust_pay.cgi?popup=1;payby=MCRD;custnum=$custnum',
- actionlabel => 'Enter credit card payment',
- width => 763,
- height => 392,
- acl => [ 'Post payment', ],
- condition => sub { $payby{MCRD} },
- },
- {
- label => 'Post manual (offline/POS) electronic check',
- popup => 'edit/cust_pay.cgi?popup=1;payby=MCHK;custnum=$custnum',
- actionlabel => 'Enter credit card payment',
- width => 763,
- height => 392,
- acl => [ 'Post payment', ],
- condition => sub { $payby{MCHK} },
+ { label => 'Enter payment',
+ submenu => [
+ {
+ label => 'Enter check payment',
+ popup => "edit/cust_pay.cgi?popup=1;payby=BILL;custnum=$custnum",
+ actionlabel => 'Enter check payment',
+ width => 763,
+ height => 392,
+ acl => [ 'Post payment', 'Post check payment' ],
+ },
+ {
+ label => 'Enter cash payment',
+ popup => "edit/cust_pay.cgi?popup=1;payby=CASH;custnum=$custnum",
+ actionlabel => 'Enter cash payment',
+ width => 763,
+ height => 392,
+ acl => [ 'Post payment', 'Post cash payment' ],
+ },
+ #{
+ # label => 'Enter Western Union payment',
+ # popup => "edit/cust_pay.cgi?popup=1;payby=WEST;custnum=$custnum",
+ # actionlabel => 'Enter Western Union payment',
+ # width => 763,
+ # height => 392,
+ # acl => [ 'Post payment', ],
+ ## condition => sub { $payby{WEST} },
+ #},
+ #{
+ # label => 'Record manual (offline/POS) credit card payment',
+ # popup => "edit/cust_pay.cgi?popup=1;payby=MCRD;custnum=$custnum",
+ # actionlabel => 'Enter credit card payment',
+ # width => 763,
+ # height => 392,
+ # acl => [ 'Post payment', ],
+ ## condition => sub { $payby{MCRD} },
+ #},
+ #{
+ # label => 'Record manual (offline/POS) electronic check',
+ # popup => "edit/cust_pay.cgi?popup=1;payby=MCHK;custnum=$custnum",
+ # actionlabel => 'Enter credit card payment',
+ # width => 763,
+ # height => 392,
+ # acl => [ 'Post payment', ],
+ ## condition => sub { $payby{MCHK} },
+ #},
+ ],
},
+
# realtime payments via payment.cgi
- {
- label => 'Process credit card payment',
- url => 'misc/payment.cgi?payby=CARD;custnum=$custnum',
- acl => [ 'Process payment', 'Process credit card payment', ],
- condition => sub { $payby{CARD} or $payby{DCRD} },
+ { label => 'Process payment',
+ submenu => [
+ {
+ label => 'Process credit card payment',
+ url => "misc/payment.cgi?payby=CARD;custnum=$custnum",
+ acl => [ 'Process payment', 'Process credit card payment', ],
+ condition => sub { $payby{CARD} or $payby{DCRD} },
+ },
+ {
+ label => 'Process electronic check payment',
+ url => "misc/payment.cgi?payby=CHEK;custnum=$custnum",
+ acl => [ 'Process payment', 'Process Echeck payment', ],
+ condition => sub { $payby{CHEK} or $payby{DCHK} },
+ },
+ ],
},
- {
- label => 'Process electronic check payment',
- url => 'misc/payment.cgi?payby=CHEK;custnum=$custnum',
- acl => [ 'Process payment', 'Process Echeck payment', ],
- condition => sub { $payby{CHEK} or $payby{DCHK} },
+
+ { label => '-',
+ content => '-',
},
-#separator?
+
{
label => 'Enter credit',
- popup => 'edit/cust_credit.cgi?custnum=$custnum',
+ popup => "edit/cust_credit.cgi?custnum=$custnum",
actionlabel => 'Enter credit',
width => 763,
acl => 'Post credit',
},
{
label => 'Credit line items',
- popup => 'edit/credit-cust_bill_pkg.html?custnum=$custnum',
+ popup => "edit/credit-cust_bill_pkg.html?custnum=$custnum",
actionlabel => 'Credit line items',
width => 968,
height => 575,
FS::cust_bill->count('custnum = ?', shift->custnum) > 0
},
},
- {
- label => 'Enter check refund',
- popup => 'edit/cust_refund.cgi?popup=1;payby=BILL;custnum=$custnum',
- actionlabel => 'Enter check refund',
- width => 440,
- acl => ['Post refund', 'Post check refund'],
- condition => sub { $payby{BILL} },
- },
- {
- label => 'Enter cash refund',
- popup => 'edit/cust_refund.cgi?popup=1;payby=CASH;custnum=$custnum',
- actionlabel => 'Enter cash refund',
- width => 392,
- acl => ['Post refund', 'Post cash refund'],
- condition => sub { $payby{CASH} },
+
+ { label => '-',
+ content => '-',
},
- {
- label => 'Enter manual (offline/POS) credit card refund',
- popup => 'edit/cust_refund.cgi?popup=1;payby=MCRD;custnum=$custnum',
- actionlabel => 'Enter credit card refund',
- width => 440,
- acl => ['Post refund' ],
- condition => sub { $payby{MCRD} },
+
+ { label => 'Enter refund',
+ submenu => [
+
+ {
+ label => 'Enter check refund',
+ popup => "edit/cust_refund.cgi?popup=1;payby=BILL;custnum=$custnum",
+ actionlabel => 'Enter check refund',
+ width => 440,
+ acl => ['Post refund', 'Post check refund'],
+ },
+ {
+ label => 'Enter cash refund',
+ popup => "edit/cust_refund.cgi?popup=1;payby=CASH;custnum=$custnum",
+ actionlabel => 'Enter cash refund',
+ width => 392,
+ acl => ['Post refund', 'Post cash refund'],
+ },
+ #{
+ # label => 'Record manual (offline/POS) credit card refund',
+ # popup => "edit/cust_refund.cgi?popup=1;payby=MCRD;custnum=$custnum",
+ # actionlabel => 'Enter credit card refund',
+ # width => 440,
+ # acl => ['Post refund' ],
+ ## condition => sub { $payby{MCRD} },
+ #},
+ #{
+ # label => 'Record manual (offline/POS) electronic check refund',
+ # popup => "edit/cust_refund.cgi?popup=1;payby=MCHK;custnum=$custnum",
+ # actionlabel => 'Enter electronic check refund',
+ # width => 440,
+ # acl => ['Post refund' ],
+ ## condition => sub { $payby{MCHK} },
+ #},
+
+ ],
+
},
- {
- label => 'Enter manual (offline/POS) electronic check refund',
- popup => 'edit/cust_refund.cgi?popup=1;payby=MCHK;custnum=$custnum',
- actionlabel => 'Enter electronic check refund',
- width => 440,
- acl => ['Post refund' ],
- condition => sub { $payby{MCHK} },
+
+ { label => '-',
+ content => '-',
},
+
{
label => 'Add tax adjustment',
- popup => 'edit/cust_tax_adjustment.html?custnum=$custnum',
+ popup => "edit/cust_tax_adjustment.html?custnum=$custnum",
actionlabel => 'Add tax adjustment',
height => 200,
confexists => 'enable_tax_adjustments',
acl => 'Add customer tax adjustment',
},
-# separator, definitely
+
+ { label => '-',
+ content => '-',
+ confexists => 'enable_tax_adjustments',
+ acl => 'Add customer tax adjustment',
+ },
+
{
- label => 'Download statement',
- url => 'view/cust_main_statement-pdf.cgi?$custnum',
- acl => 'List invoices',
+ label => 'Email statement to this customer',
+ url => sub {
+ my $cust_main = shift;
+ my $agentnum = $cust_main->agentnum;
+ 'misc/email-customer-statement.html?table=cust_main;'.
+ 'agent_virt_agentnum='.$agentnum.";custnum=$custnum;url=".
+ uri_escape($cgi->self_url);
+ },
+ condition => sub { $invoicing_list_emailonly },
+ acl => 'Resend invoices',
+ },
+ {
+ label => 'Download PDF statement',
+ url => "view/cust_main_statement-pdf.cgi?$custnum",
+ acl => 'View legacy typeset statements',
condition => sub {
FS::cust_bill->count('custnum = ?', shift->custnum) > 0
},
},
{
label => 'Search invoices',
- url => 'search/report_cust_bill.html?custnum=$custnum',
+ url => "search/report_cust_bill.html?custnum=$custnum",
acl => 'List invoices',
},
{
label => 'View tax exemptions',
- url => 'search/cust_tax_exempt_pkg.cgi?custnum=$custnum',
+ url => "search/cust_tax_exempt_pkg.cgi?custnum=$custnum",
acl => 'View customer tax exemptions',
},
{
label => 'View tax adjustments',
- url => 'search/cust_tax_adjustment.html?custnum=$custnum',
+ url => "search/cust_tax_adjustment.html?custnum=$custnum",
confexists => 'enable_tax_adjustments',
acl => 'Add customer tax adjustment',
},
{
label => 'View pending payments',
- url => 'search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=$custnum',
+ url => "search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=$custnum",
acl => 'View pending payments',
condition => sub {
FS::cust_pay_pending->count('custnum = ?', shift->custnum) > 0
},
},
+
],
[
{
last if (!$first and !@links);
$first = 0;
+ my $a = entry2link($entry, $cust_main, $opt{show});
+ push @links, $a if length($a);
+
+ } # foreach $entry
+
+ if (@links) {
+ push @processed_menu, \@links;
+ }
+
+}
+
+sub entry2link {
+ my( $entry, $cust_main, $show ) = @_;
+
# check conditions
if ( $entry->{acl} ) {
- next unless $curuser->access_right( $entry->{acl} );
+ return ''
+ unless $FS::CurrentUser::CurrentUser->access_right( $entry->{acl} );
}
if ( $entry->{confexists} ) {
if ( $entry->{confexists} =~ /^!(.*)/ ) {
# confexists => !foo, a negative condition
- next if $conf->exists( $1 );
+ return '' if FS::Conf->new->exists( $1 );
} else {
- next unless $conf->exists( $entry->{confexists} );
+ return '' unless FS::Conf->new->exists( $entry->{confexists} );
}
}
if ( $entry->{condition} ) {
- next unless &{ $entry->{condition} }($cust_main);
+ return '' unless &{ $entry->{condition} }($cust_main);
}
my $label = emt($entry->{label});
+
+ if ( $entry->{submenu} ) {
+
+ my $a = '<a href="javascript:void(0);">'. $label.
+ '<span class="arrow"></span>'.
+ '</a><ul class="customer_subsubmenu">';
+ foreach my $submenu (@{ $entry->{submenu} }) {
+ $a .= '<li>'. entry2link($submenu, $cust_main, $show), '</li>';
+ }
+
+ return $a. '</ul>';
+
+ }
+
my $target = $entry->{content}
|| $entry->{popup}
|| $entry->{url};
if ( ref($target) eq 'CODE' ) {
$target = &$target($cust_main);
}
- my $a = '';
- if ( $entry->{content} ) { # then the coderef specified the whole thing
- $a = $target;
+ return $target if $entry->{content}; #the coderef specified the whole thing
- } elsif ( $entry->{show} ) {
+ if ( $entry->{show} ) {
# the menu head: always a link back to this page
$cgi->param('show', $entry->{show});
- $target = $cgi->self_url;
-
- $a = qq[ <A HREF="$target"];
- if ( $opt{'show'} eq $entry->{show} ) {
- $a .= ' class="current_show"';
- }
- $a .= qq[>$label</A> ];
+ $target = $cgi->self_url;
+ $cgi->param('show', $show);
+ my $a = qq[ <A HREF="$target"];
+ $a .= ' class="current_show"' if $show eq $entry->{show};
+ return $a. qq[>$label</A> ];
} elsif ( $entry->{popup} ) {
$target =~ s/\$custnum/$custnum/g;
$target = $p.$target;
- $a = include('/elements/popup_link.html',
+
+ return include('/elements/popup_link.html',
action => $target,
width => 616,
height => 410,
%$entry,
- label => emt($label),
+ label => $label,
);
} elsif ( $entry->{url} ) {
$target =~ s/\$custnum/$custnum/g;
$target = $p.$target;
- $a = qq[ <A HREF="$target">$label</A> ];
- }
- push @links, $a;
+ return qq[ <A HREF="$target">$label</A> ];
+
+ } else {
+ die "bad entry ". join(',',%$entry). " in menu: no url, popup or content";
+ }
- } # foreach $entry
- if (@links) {
- push @processed_menu, \@links;
- }
}
+
</%init>