X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fmenu.html;h=b1464b5ca11264404f56a9e44c0158ef7dbb4d29;hp=c6aa15cd05bfe426907bef4ade77012cdc01bece;hb=9b8823fca219e54ece55ebddf75d3943c8108a5e;hpb=ea63022518b3fb7360e64aa2bb1bb0d9d56ce9d4 diff --git a/httemplate/view/cust_main/menu.html b/httemplate/view/cust_main/menu.html index c6aa15cd0..b1464b5ca 100644 --- a/httemplate/view/cust_main/menu.html +++ b/httemplate/view/cust_main/menu.html @@ -1,32 +1,22 @@ - - - - +<& /elements/dropdown-menu.html, + 'id' => 'customer_menu', + #'class' => 'customer_submenu', + #XXX support installs outside /freeside in 4.x + 'self_url' => "/freeside/view/cust_main.cgi?custnum=$custnum;show=", + 'menu' => \@menu, + 'cust_main' => $cust_main, + 'show' => $opt{'show'}, +&> <%init> my %opt = @_; @@ -170,12 +85,15 @@ my $custnum = $cust_main->custnum; my $curuser = $FS::CurrentUser::CurrentUser; my $conf = FS::Conf->new; -my %payby = map { $_ => 1 } $conf->config('payby'); +my @payby = grep /\w/, $conf->config('payby'); +@payby = (qw( CARD DCRD CHEK DCHK )) + unless @payby; +my %payby = map { $_ => 1 } @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 +# nice declarative menu; a parameter to some kind of menu generator my @menu = ( [ { show => 'basics', @@ -261,6 +179,11 @@ my @menu = ( 'View customer billing events' ], }, { + label => 'Test billing events', + url => "misc/test-part_event.html?custnum=$custnum", + acl => 'Configuration', + }, + { label => 'Email a notice to this customer', url => sub { my $cust_main = shift; @@ -285,7 +208,7 @@ my @menu = ( confexists => '!cust_main-disable_notes', acl => 'Add customer note', width => 875, - height => 538, + height => 548, }, { label => 'Attach file', @@ -350,7 +273,7 @@ my @menu = ( actionlabel => 'Order new package', color => '#333399', width => 960, - height => 740, + height => 850, acl => 'Order customer package', }, { @@ -457,6 +380,15 @@ my @menu = ( # acl => [ 'Post payment', ], ## condition => sub { $payby{MCHK} }, #}, + { + label => 'Record manual (non-Freeside) Paypal payment', + popup => "edit/cust_pay.cgi?popup=1;payby=PPAL;custnum=$custnum", + actionlabel => 'Enter Paypal payment', + width => 763, + height => 392, + acl => [ 'Post Payment', 'Post Paypal payment', ], + condition => sub { $payby{PPAL} }, + }, ], }, @@ -538,6 +470,16 @@ my @menu = ( # acl => ['Post refund' ], ## condition => sub { $payby{MCHK} }, #}, + { + label => 'Enter electronic check refund', + popup => "edit/cust_refund.cgi?popup=1;payby=CHEK;custnum=$custnum", + actionlabel => 'Enter electronic check refund', + width => 440, + acl => ['Post refund' ], + condition => sub { + FS::pay_batch->can_handle_electronic_refunds + }, + }, ], @@ -617,114 +559,4 @@ my @menu = ( ], ); - -my @processed_menu; -foreach my $submenu (@menu) { - - my @links; - my $first = 1; - foreach my $entry ( @$submenu ) { - # if the menu head was skipped, skip the whole menu - 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} ) { - return '' - unless $FS::CurrentUser::CurrentUser->access_right( $entry->{acl} ); - } - if ( $entry->{confexists} ) { - if ( $entry->{confexists} =~ /^!(.*)/ ) { - # confexists => !foo, a negative condition - return '' if FS::Conf->new->exists( $1 ); - } else { - return '' unless FS::Conf->new->exists( $entry->{confexists} ); - } - } - if ( $entry->{condition} ) { - return '' unless &{ $entry->{condition} }($cust_main); - } - - my $label = emt($entry->{label}); - - if ( $entry->{submenu} ) { - - my $a = ''. $label. - ''. - ''; - - } - - my $target = $entry->{content} - || $entry->{popup} - || $entry->{url}; - - if ( ref($target) eq 'CODE' ) { - $target = &$target($cust_main); - } - - return $target if $entry->{content}; #the coderef specified the whole thing - - if ( $entry->{show} ) { - - # the menu head: always a link back to this page - $cgi->param('show', $entry->{show}); - - #$target = $cgi->self_url; - #XXX support installs outside /freeside in 4.x - $target = '/freeside/view/cust_main.cgi?'. - 'show='. $entry->{show}. - ';custnum='. $cust_main->custnum; - - $cgi->param('show', $show); - - my $a = qq[ {show}; - return $a. qq[>$label ]; - - } elsif ( $entry->{popup} ) { - - $target =~ s/\$custnum/$custnum/g; - $target = $p.$target; - - return include('/elements/popup_link.html', - action => $target, - width => 616, - height => 410, - %$entry, - label => $label, - ); - - } elsif ( $entry->{url} ) { - - $target =~ s/\$custnum/$custnum/g; - $target = $p.$target; - - return qq[ $label ]; - - } else { - die "bad entry ". join(',',%$entry). " in menu: no url, popup or content"; - } - -} -