[freeside-commits] branch master updated. 16fe3ab085213efe13680a7d2d8c50e38cf8750a

Mark Wells mark at 420.am
Sat May 16 16:01:11 PDT 2015


The branch, master has been updated
       via  16fe3ab085213efe13680a7d2d8c50e38cf8750a (commit)
      from  f898b5423751e9bb15500cc815e57b0bb84a32c9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 16fe3ab085213efe13680a7d2d8c50e38cf8750a
Author: Mark Wells <mark at freeside.biz>
Date:   Sat May 16 16:00:59 2015 -0700

    new top menu for view/cust_main

diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 637c015..020c09d 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -23,13 +23,7 @@
 </TABLE>
 % }
 
-<& /elements/menubar.html,
-             { 'newstyle' => 1,
-               'selected' => $viewname{$view},
-               'url_base' => $cgi->url. "?custnum=$custnum;show=",
-             },
-             %views,
-&>
+<& cust_main/menu.html, cust_main => $cust_main, show => $view &>
 <DIV CLASS="fstabcontainer">
 
 <& /elements/init_overlib.html &>
@@ -41,6 +35,7 @@ function areyousure(href, message) {
 }
 </SCRIPT>
 
+<br><br>
 
 % ###
 % # Basics
@@ -48,99 +43,7 @@ function areyousure(href, message) {
 
 % if ( $view eq 'basics' || $view eq 'jumbo' ) {
 
-% if ( $curuser->access_right('Edit customer') ) { 
-  <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>"><% mt('Edit this customer') |h %></A> | 
-% } 
-
-% if ( $curuser->access_right('Suspend customer')
-%        && scalar($cust_main->unsuspended_pkgs)
-%      ) {
-  <& /elements/popup_link-cust_main.html,
-              { 'action'      => $p. 'misc/suspend_cust.html',
-                'label'       => emt('Suspend this customer'),
-                'actionlabel' => emt('Confirm Suspension'),
-                'color'       => '#ff9900',
-                'cust_main'   => $cust_main,
-                'width'       => 768, #make room for reasons
-                'height'      => 450, 
-              }
-  &> | 
-% }
-
-% if ( $curuser->access_right('Unsuspend customer')
-%        && scalar($cust_main->suspended_pkgs)
-%      ) {
-  <& /elements/popup_link-cust_main.html,
-              { 'action'      => $p. 'misc/unsuspend_cust.html',
-                'label'       => emt('Unsuspend this customer'),
-                'actionlabel' => emt('Confirm Unsuspension'),
-                #'color'       => '#ff9900',
-                'cust_main'   => $cust_main,
-                #'width'       => 616, #make room for reasons
-                #'height'      => 366,
-              }
-  &> | 
-% }
-
-% if ( $curuser->access_right('Cancel customer')
-%        && scalar($cust_main->ncancelled_pkgs)
-%      ) {
-  <& /elements/popup_link-cust_main.html,
-              { 'action'      => $p. 'misc/cancel_cust.html',
-                'label'       => emt('Cancel this customer'),
-                'actionlabel' => emt('Confirm Cancellation'),
-                'color'       => '#ff0000',
-                'cust_main'   => $cust_main,
-                'width'       => 616, #make room for reasons
-                'height'      => 410,
-              }
-  &> | 
-% }
-
-% if (     $curuser->access_right('Merge customer')
-%      and (    scalar($cust_main->ncancelled_pkgs)
-%            # || we start supporting payment info merge again in some way
-%          )
-%    )
-% {
-  <& /elements/popup_link-cust_main.html,
-              { 'action'      => $p. 'misc/merge_cust.html',
-                'label'       => emt('Merge this customer'),
-                'actionlabel' => emt('Merge customer'),
-                'cust_main'   => $cust_main,
-                'width'       => 569,
-                'height'      => 210,
-              }
-  &> | 
-% } 
-
-% unless ( $conf->exists('disable_customer_referrals') ) { 
-  <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('Refer a new customer') |h %></A> | 
-  <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>"><% mt('View this customer\'s referrals') |h %></A>
-% } 
-
-<BR><BR>
-
 % my $br = 0;
-% if (    $curuser->access_right('Billing event reports') 
-%      || $curuser->access_right('View customer billing events')
-%    ) {
-% $br=1;
-  <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>"><% mt('View billing events for this customer') |h %></A>
-% }
-% 
-% my $email_link = ($cust_main->invoicing_list_emailonly) && 
-%   include('/elements/email-link.html',
-%            'table'               => 'cust_main', 
-%            'search_hash'         => { 'custnum' => $custnum },
-%            'agent_virt_agentnum' => $cust_main->agentnum,
-%            'label'               => 'Email a notice to this customer',
-% );
-% if ( $email_link and $br ) {
- | 
-% }
-<% $email_link || '' %>
-
 % if ( $curuser->access_right('Order customer package') && $conf->exists('cust_main-enable_order_package') ) {
   | <& /elements/order_pkg_link.html, 'cust_main'=>$cust_main &>
 % }
@@ -324,6 +227,7 @@ if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
   my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
   $query =~ /^(\d+)$/;
   $custnum = $1;
+  $cgi->delete('keywords');
   $cgi->param('custnum', $1);
 }
 
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index 4f4b745..c70c5c3 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -1,18 +1,4 @@
 <FONT CLASS="fsinnerbox-title"><% mt('Billing information') |h %></FONT>
-%# If we can't see the unencrypted card, then bill now is an exercise in
-%# frustration (without some sort of job queue magic to send it to a secure
-%# machine, anyway)
-%if (  $FS::CurrentUser::CurrentUser->access_right('Bill customer now')
-%      && ! $cust_main->is_encrypted($cust_main->payinfo)
-%   ) { 
-%#  (<A HREF="<% $p %>misc/bill.cgi?<% $cust_main->custnum %>"><% mt('Bill now') |h %></A>)
-  <& /elements/bill.html,
-       custnum   => $cust_main->custnum,
-       label     => emt('Bill now'),
-       url       => $p.'view/cust_main.cgi?'.$cust_main->custnum,
-  &>
-% } 
-
 % my $yes = emt('yes');
 % my $no = emt('no');
 
diff --git a/httemplate/view/cust_main/contacts_new.html b/httemplate/view/cust_main/contacts_new.html
index f0bc0b8..683841c 100644
--- a/httemplate/view/cust_main/contacts_new.html
+++ b/httemplate/view/cust_main/contacts_new.html
@@ -1,6 +1,5 @@
 <BR>
 <FONT CLASS="fsinnerbox-title">Contacts</FONT>
-<A HREF="<%$p%>edit/cust_main-contacts.html?<% $cust_main->custnum %>">Edit contacts</A>
 
 <& /elements/table-grid.html &>
 % my $bgcolor1 = '#eeeeee';
diff --git a/httemplate/view/cust_main/menu.html b/httemplate/view/cust_main/menu.html
new file mode 100644
index 0000000..81ad959
--- /dev/null
+++ b/httemplate/view/cust_main/menu.html
@@ -0,0 +1,559 @@
+<style type="text/css">
+#menu_ul {
+  padding: 0;
+  margin: 0 auto;
+}
+#menu_ul li {
+  float: left;
+  list-style: none;
+  position: relative;
+  border-right: 4px solid #e8e8e8;
+}
+#menu_ul a {
+  display: block;
+  padding: 6px 8px;
+  color: #525151;
+  font-size: 13px;
+  font-weight: bold;
+  white-space: nowrap;
+  background: #cccccc;
+  -moz-border-radius-topleft:8px;
+  -moz-border-radius-topright:8px;
+  -webkit-border-radius-topleft:8px;
+  -webkit-border-radius-topright:8px;
+  border-top-left-radius:8px;
+  border-top-right-radius:8px;
+}
+
+#menu_ul ul {
+  margin:0;
+  padding:0;
+  display:none;
+  position: absolute;
+  top: 100%;
+  left: -1px;
+  background: #ae2099;
+  border: 1px solid #ffffff;
+}
+
+#menu_ul ul li {
+  float: none;
+  border-style: none;
+  display: inline;
+  width: 100%;
+}
+
+#menu_ul ul a {
+  padding: 4px 10px;
+  color: #ffffff;
+  font-size: 12px;
+  font-weight: normal;
+  background: transparent;
+}
+#menu_ul ul a:hover  {
+  background: #7e0079;
+  -moz-border-radius-topleft:0px;
+  -moz-border-radius-topright:0px;
+  -webkit-border-radius-topleft:0px;
+  -webkit-border-radius-topright:0px;
+  border-top-left-radius:0px;
+  border-top-right-radius:0px;
+}
+
+#menu_ul a.current_menu, #menu_ul a.hover {
+  color: #ffffff;
+  background: #7e0079;
+}
+</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">
+% foreach my $submenu (@processed_menu) {
+  <li>
+    <% shift @$submenu %>
+    <ul>
+%   foreach my $link ( @$submenu ) {
+      <li><% $link %></li>
+%   }
+    </ul>
+  </li>
+% }
+</ul>
+
+<%init>
+my %opt = @_;
+my $cust_main = $opt{'cust_main'};
+my $custnum = $cust_main->custnum;
+my $curuser = $FS::CurrentUser::CurrentUser;
+my $conf = FS::Conf->new;
+
+my %payby = map { $_ => 1 } $conf->config('payby');
+
+# nice declarative menu; should be a parameter to some kind of menu generator
+my @menu = ( 
+  [
+    { show        => 'basics',
+      label       => 'Basics',
+    },
+    {
+      label       => 'Edit customer',
+      url         => 'edit/cust_main.cgi?$custnum',
+      acl         => 'Edit customer'
+    },
+    {
+      label       => 'Edit contacts',
+      url         => 'edit/cust_main-contacts.html?$custnum',
+    },
+# separator
+    {
+      label       => 'Bill now',
+      acl         => 'Bill customer now',
+      content     => sub { include( '/elements/bill.html',
+                              label   => emt('Bill now'),
+                              url     => $cgi->self_url,
+                              custnum => shift->custnum,
+                           ),
+                     },
+    },
+    {
+      label       => 'Suspend',
+      popup       => 'misc/suspend_cust.html?custnum=$custnum',
+      acl         => 'Suspend customer',
+      condition   => sub { shift->unsuspended_pkgs > 0 },
+      actionlabel => 'Confirm Suspension',
+      color       => '#ff9900',
+    },
+    {
+      label       => 'Unsuspend',
+      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',
+      acl         => 'Cancel customer',
+      condition   => sub { shift->ncancelled_pkgs > 0 },
+      actionlabel => 'Confirm Cancellation',
+      color       => '#ff0000',
+    },
+    {
+      label       => 'Merge',
+      popup       => 'misc/merge_cust.html?custnum=$custnum',
+      acl         => 'Merge customer',
+      actionlabel => 'Merge customer',
+      width       => 569,
+      height      => 210,
+    },
+    {
+      label       => 'Refer a new customer',
+      url         => 'edit/cust_main.cgi?referral_custnum=$custnum',
+      confexists  => '!disable_customer_referrals',
+    },
+# should have a separator here
+    {
+      label       => 'View this customer\'s referrals',
+      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',
+      acl         => [ 'Billing event reports',
+                       'View customer billing events' ],
+    },
+    {
+      label       => 'Email a notice to this customer',
+      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';
+                     },
+      condition   => sub { shift->invoicing_list_emailonly },
+    },
+  ],
+  [
+    {
+      label => 'Notes',
+      show  => 'notes',
+    },
+    {
+      label       => 'Add note',
+      popup       => 'edit/cust_main_note.cgi?custnum=$custnum',
+      actionlabel => 'Add note',
+      confexists  => '!cust_main-disable_notes',
+      acl         => 'Add customer note',
+      width       => 616,
+      height      => 538,
+    },
+    {
+      label       => 'Attach file',
+      popup       => 'edit/cust_main_attach.cgi?custnum=$custnum',
+      actionlabel => 'Upload file',
+      confexists  => '!disable_cust_attachment',
+      acl         => 'Add attachment',
+      width       => 480,
+      height      => 296,
+    },
+  ],
+  [
+    {
+      label => 'Tickets',
+      show  => 'tickets',
+      confexists => 'ticket_system'
+    },
+  ],
+  [
+    {
+      label => 'Appointments',
+      show  => 'appointments',
+      confexists => 'ticket_system',
+      acl   => 'View appointments',
+    },
+  ],
+  [
+    {
+      label => 'Quotations',
+      show  => 'quotations',
+    },
+    {
+      label => 'Add quotation',
+      url   => 'edit/quotation.html?custnum=$custnum',
+      acl   => 'Generate quotation',
+    },
+  ],
+  [
+    {
+      label => 'Packages',
+      show  => 'packages',
+    },
+    {
+      label       => 'New qualification',
+      popup       => 'misc/qual.html?custnum=$custnum',
+      actionlabel => 'New qualification',
+      color       => '#333399',
+      width       => 763,
+      height      => 436,
+      acl         => 'Qualify service',
+    },
+    {
+      label       => 'Order new package',
+      popup       => 'misc/order_pkg.html?custnum=$custnum',
+      actionlabel => 'Order new package',
+      color       => '#333399',
+      width       => 960,
+      height      => 740,
+      acl         => 'Order customer package',
+    },
+    {
+      # 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,
+                      );
+                     },
+      acl         => 'One-time charge',
+    },
+    {
+      label       => 'Move services between packages',
+      popup       => 'edit/bulk-cust_svc-pkgnum.html?custnum=$custnum',
+      actionlabel => 'Move services',
+      width       => 968,
+      height      => 575,
+      acl         => 'Bulk move customer services',
+    },
+    {
+      label       => 'Bulk order and cancel packages',
+      url         => 'edit/cust_pkg.cgi?$custnum',
+      acl         => 'Bulk change customer packages',
+    },
+# separator
+    {
+      label => 'Package reports',
+      url   => 'search/report_cust_pkg?custnum=$custnum',
+    },
+    {
+      label => 'View qualifications',
+      url   => 'search/qual.cgi?custnum=$custnum',
+      acl   => 'Qualify service',
+    },
+    {
+      label => 'View accounts',
+      url   => 'search/report_svc_acct.html?custnum=$custnum',
+    },
+    {
+      label => 'View CDRs',
+      url   => 'search/report_cdr.html?custnum=$custnum',
+    },
+  ],
+  [
+    {
+      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} },
+    },
+    # 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 electronic check payment',
+      url         => 'misc/payment.cgi?payby=CHEK;custnum=$custnum',
+      acl         => [ 'Process payment', 'Process Echeck payment', ],
+      condition   => sub { $payby{CHEK} or $payby{DCHK} },
+    },
+#separator?
+    {
+      label       => 'Enter credit',
+      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',
+      actionlabel => 'Credit line items',
+      width       => 968,
+      height      => 575,
+      acl         => 'Credit line items',
+      condition   => sub {
+        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       => '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 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       => 'Add tax adjustment',
+      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       => 'Download statement',
+      url         => 'view/cust_main_statement-pdf.cgi?$custnum',
+      acl         => 'List invoices',
+      condition   => sub {
+        FS::cust_bill->count('custnum = ?', shift->custnum) > 0
+      },
+    },
+    {
+      label       => 'Search invoices',
+      url         => 'search/report_cust_bill.html?custnum=$custnum',
+      acl         => 'List invoices',
+    },
+    {
+      label       => 'View tax exemptions',
+      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',
+      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',
+      acl         => 'View pending payments',
+      condition   => sub { 
+        FS::cust_pay_pending->count('custnum = ?', shift->custnum) > 0
+      },
+    },
+  ],
+  [
+    {
+      label => 'Change History',
+      show  => 'change_history',
+      acl   => 'View customer history',
+    },
+  ],
+);
+
+
+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;
+
+    # check conditions
+    if ( $entry->{acl} ) {
+      next unless $curuser->access_right( $entry->{acl} );
+    }
+    if ( $entry->{confexists} ) {
+      if ( $entry->{confexists} =~ /^!(.*)/ ) {
+        # confexists => !foo, a negative condition
+        next if $conf->exists( $1 );
+      } else {
+        next unless $conf->exists( $entry->{confexists} );
+      }
+    }
+    if ( $entry->{condition} ) {
+      next unless &{ $entry->{condition} }($cust_main);
+    }
+
+    my $label = emt($entry->{label});
+    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;
+
+    } elsif ( $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="fstabselected"';
+      }
+      $a .= qq[>$label</A> ];
+
+
+    } elsif ( $entry->{popup} ) {
+
+      $target =~ s/\$custnum/$custnum/g;
+      $target = $p.$target;
+      $a = include('/elements/popup_link.html',
+        action  => $target,
+        width   => 616,
+        height  => 410,
+        %$entry,
+        label   => emt($label),
+      );
+
+    } elsif ( $entry->{url} ) {
+
+      $target =~ s/\$custnum/$custnum/g;
+      $target = $p.$target;
+      $a = qq[ <A HREF="$target">$label</A> ];
+    }
+
+    push @links, $a;
+
+  } # foreach $entry
+  if (@links) {
+    push @processed_menu, \@links;
+  }
+}
+</%init>
diff --git a/httemplate/view/cust_main/notes.html b/httemplate/view/cust_main/notes.html
index deba956..7a19f8b 100755
--- a/httemplate/view/cust_main/notes.html
+++ b/httemplate/view/cust_main/notes.html
@@ -23,20 +23,6 @@
 
 %   }
 
-%   if ( $curuser->access_right('Add customer note') &&
-%        ! $conf->exists('cust_main-disable_notes')
-%      ) {
-
-  <& /elements/popup_link-cust_main.html,
-                'label'       => emt('Add customer note'),
-                'action'      => $p. 'edit/cust_main_note.cgi',
-                'actionlabel' => emt('Enter customer note'),
-                'cust_main'   => $cust_main,
-                'width'       => 616,
-                'height'      => 538, #575
-  &>
-
-%   }
 <BR>
 
 % # actually display notes
@@ -49,19 +35,6 @@
 % if( $curuser->access_right('View attachments') ) {
 % # List attachments
 <& notes/attachments.html, 'cust_main' => $cust_main &>
-% # "Attach file" link
-% if(! $conf->config('disable_cust_attachment')
-%  and $curuser->access_right('Add attachment')) {
-<& /elements/popup_link-cust_main.html,
-              'label'       => emt('Attach file'),
-              'action'      => $p.'edit/cust_main_attach.cgi',
-              'actionlabel' => emt('Upload file'),
-              'cust_main'   => $cust_main,
-              'width'       => 480,
-              'height'      => 296,
-&>
-% }
-
 %   if ($cgi->param('show_deleted')) {
 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
            ($view ? ";show=$view" : '') . '#notes' 
diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html
index 9098511..4131570 100755
--- a/httemplate/view/cust_main/packages.html
+++ b/httemplate/view/cust_main/packages.html
@@ -78,48 +78,6 @@ for (var i = 0; i < all_buttons.length; i++) {
 if ( el ) el.scrollIntoView(true);
 </&>
 </SCRIPT>
-% unless ( $opt{no_links} ) {
-
-%   my $s = 0;
-
-% if ( $curuser->access_right('Qualify service') ) { 
-  <% $s++ ? ' | ' : '' %>
-  <& qual_link.html, $cust_main &>
-% }
-
-% if ( $curuser->access_right('Order customer package') ) { 
-  <% $s++ ? ' | ' : '' %>
-  <& /elements/order_pkg_link.html, 'cust_main'=>$cust_main &>
-% } 
-
-% if ( $curuser->access_right('One-time charge') ) {
-  <% $s++ ? ' | ' : '' %>
-  <& /elements/one_time_charge_link.html, 'custnum'=>$cust_main->custnum &>
-% } 
-
-% if ( $curuser->access_right('Bulk move customer services') ) { 
-  <% $s++ ? ' | ' : '' %>
-
-  <& /elements/popup_link-cust_main.html,
-               'label'       => emt('Move services between packages'),
-               'action'      => "${p}edit/bulk-cust_svc-pkgnum.html",
-               'cust_main'   => $cust_main,
-               'actionlabel' => emt('Move services'),
-               'width'       => 968, #763,
-               'height'      => 575,
-  &>
-
-% } 
-
-% if ( $curuser->access_right('Bulk change customer packages') ) { 
-  <% $s++ ? ' | ' : '' %>
-  <A HREF="<% $p %>edit/cust_pkg.cgi?<% $cust_main->custnum %>"><% mt('Bulk order and cancel packages') |h %></A>
-% } 
-
-<BR><BR>
-
-% } # unless $opt{no_links}
-
 <TABLE>
   <TR>
     <TD ALIGN="left" VALIGN="top">
@@ -153,22 +111,6 @@ if ( el ) el.scrollIntoView(true);
 
     </TD>
 
-%   unless ( $opt{no_links} ) {
-
-    <TD ALIGN="right">
-      <A HREF="<%$p%>search/report_cust_pkg.html?custnum=<% $cust_main->custnum %>"><% mt('Package reports') |h %></A>
-% if ( $curuser->access_right('Qualify service') ) { 
-    | <A HREF="<%$p%>search/qual.cgi?custnum=<% $cust_main->custnum %>"><% mt('View Qualifications') |h %></A>
-% }
-      <BR>
-      <% mt('Service reports:') |h %> 
-        <A HREF="<%$p%>search/report_svc_acct.html?custnum=<% $cust_main->custnum %>"><% mt('accounts') |h %></A><BR>
-      <% mt('Usage reports:') |h %> 
-        <A HREF="<%$p%>search/report_cdr.html?custnum=<% $cust_main->custnum %>"><% mt('CDRs') |h %></A>
-    </TD>
-
-%   } # unless $opt{no_links}
-
   </TR>
 
   <TR>
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html
index 04e427f..171c29c 100644
--- a/httemplate/view/cust_main/payment_history.html
+++ b/httemplate/view/cust_main/payment_history.html
@@ -2,194 +2,6 @@
   <TR>
     <TD ALIGN="left">
 
-%# payment links
-
-% my $s = 0;
-% if ( $payby{'BILL'} && $curuser->access_right(['Post payment', 'Post check payment' ]) ) { 
-  <% $s++ ? ' | ' : '' %>
-  <& /elements/popup_link-cust_main.html,
-               'label'       => emt('Enter check payment'),
-               'action'      => "${p}edit/cust_pay.cgi?popup=1;payby=BILL",
-               'cust_main'   => $cust_main,
-               'actionlabel' => emt('Enter check payment'),
-               'width'       => ( $opt{'pkg-balances'} ? 763 : 392),
-               'height'      => 392,
-  &>
-% } 
-
-% if ( $payby{'CASH'} && $curuser->access_right(['Post payment', 'Post cash payment']) ) { 
-  <% $s++ ? ' | ' : '' %>
-  <& /elements/popup_link-cust_main.html,
-               'label'       => emt('Enter cash payment'),
-               'action'      => "${p}edit/cust_pay.cgi?popup=1;payby=CASH",
-               'cust_main'   => $cust_main,
-               'actionlabel' => emt('Enter cash payment'),
-               'width'       => ( $opt{'pkg-balances'} ? 763 : 392),
-               'height'      => 392,
-  &>
-% } 
-
-% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { 
-  <% $s++ ? ' | ' : '' %>
-  <A HREF="<% $p %>edit/cust_pay.cgi?payby=WEST;custnum=<% $custnum %>"><% mt('Enter Western Union payment') |h %></A>
-% } 
-
-<% $s ? '<BR>' : '' %>
-% $s=0;
-
-% if ( ( $payby{'CARD'} || $payby{'DCRD'} )
-%        && $curuser->access_right(['Process payment', 'Process credit card payment'])
-%        && ! $cust_main->is_encrypted($cust_main->payinfo)
-%      ) {
-  <% $s++ ? ' | ' : '' %>
-  <A HREF="<% $p %>misc/payment.cgi?payby=CARD;custnum=<% $custnum %>"><% mt('Process credit card payment') |h %></A>
-% } 
-
-% if ( ( $payby{'CHEK'} || $payby{'DCHK'} )
-%        && $curuser->access_right(['Process payment', 'Process Echeck payment'])
-%        && ! $cust_main->is_encrypted($cust_main->payinfo)
-%      ) {
-  <% $s++ ? ' | ' : '' %>
-  <A HREF="<% $p %>misc/payment.cgi?payby=CHEK;custnum=<% $custnum %>"><% mt('Process electronic check (ACH) payment') |h %></A>
-% } 
-
-% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { 
-  <% $s++ ? ' | ' : '' %>
-  <A HREF="<% $p %>edit/cust_pay.cgi?payby=MCRD;custnum=<% $custnum %>"><% mt('Post manual (offline/POS) credit card payment') |h %></A>
-% } 
-
-% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { 
-  <% $s++ ? ' | ' : '' %>
-  <A HREF="<% $p %>edit/cust_pay.cgi?payby=MCHK;custnum=<% $custnum %>"><% mt('Post manual (offline) electronic check payment') |h %></A>
-% } 
-
-<% $s ? '<BR>' : '' %>
-
-%# credit links
-
-% $s=0;
-% if ( $curuser->access_right('Post credit') ) { 
-  <% $s++ ? ' | ' : '' %>
-  <& /elements/popup_link-cust_main.html,
-               'label'       => emt('Enter credit'),
-               'action'      => "${p}edit/cust_credit.cgi",
-               'cust_main'   => $cust_main,
-               'actionlabel' => emt('Enter credit'),
-               'width'       => ( $opt{'pkg-balances'} ? 763 : 616),
-  &>
-% }
-% if ( $curuser->access_right('Credit line items') ) { 
-  <% $s++ ? ' | ' : '' %>
-  <& /elements/popup_link-cust_main.html,
-               'label'       => emt('Credit line items'),
-               #'action'      => "${p}search/cust_bill_pkg.cgi?nottax=1;type=select",
-               'action'      => "${p}edit/credit-cust_bill_pkg.html",
-               'cust_main'   => $cust_main,
-               'actionlabel' => emt('Credit line items'),
-               'width'       => 968, #763,
-               'height'      => 575,
-  &>
-% } 
-<% $s ? '<BR>' : '' %>
-
-%# refund links
-
-% $s = 0;
-% if ( $payby{'BILL'} && $curuser->access_right(['Post refund', 'Post check refund']) ) { 
-  <% $s++ ? ' | ' : '' %>
-  <& /elements/popup_link-cust_main.html,
-               'label'       => emt('Enter check refund'),
-               'action'      => "${p}edit/cust_refund.cgi?popup=1;payby=BILL",
-               'cust_main'   => $cust_main,
-               'actionlabel' => emt('Enter check refund'),
-               'width'       => 440,
-  &>
-% } 
-
-% if ( $payby{'CASH'} && $curuser->access_right(['Post refund', 'Post cash refund']) ) { 
-  <% $s++ ? ' | ' : '' %>
-  <& /elements/popup_link-cust_main.html,
-               'label'       => emt('Enter cash refund'),
-               'action'      => "${p}edit/cust_refund.cgi?popup=1;payby=CASH",
-               'cust_main'   => $cust_main,
-               'actionlabel' => emt('Enter cash refund'),
-               'width'       => 392,
-  &>
-% } 
-
-%# someday, perhaps.  very few gateways let you do unlinked refunds at all.
-%# Authorize.net makes you sign a special form
-%#
-%#    % if ( ( $payby{'CARD'} || $payby{'DCRD'} )
-%#    %        && $curuser->access_right('Process refund')
-%#    %        && ! $cust_main->is_encrypted($cust_main->payinfo)
-%#    %      ) {
-%#      <% $s++ ? ' | ' : '' %>
-%#      <A HREF="<% $p %>misc/refund.cgi?payby=CARD;custnum=<% $custnum %>">Process credit card refund</A>
-%#    % } 
-%#    
-%#    % if ( ( $payby{'CHEK'} || $payby{'DCHK'} )
-%#    %        && $curuser->access_right('Process refund')
-%#    %        && ! $cust_main->is_encrypted($cust_main->payinfo)
-%#    %      ) {
-%#      <% $s++ ? ' | ' : '' %>
-%#      <A HREF="<% $p %>misc/refund.cgi?payby=CHEK;custnum=<% $custnum %>">Process electronic check (ACH) refund</A>
-%#    % } 
-
-% if ( $payby{'MCRD'} && $curuser->access_right('Post refund') ) { 
-  <% $s++ ? ' | ' : '' %>
-  <A HREF="<% $p %>edit/cust_refund.cgi?payby=MCRD;custnum=<% $custnum %>"><% mt('Post manual (offline/POS) credit card refund') |h %></A>
-% } 
-
-% if ( $payby{'MCHK'} && $curuser->access_right('Post refund') ) { 
-  <% $s++ ? ' | ' : '' %>
-  <A HREF="<% $p %>edit/cust_refund.cgi?payby=MCRD;custnum=<% $custnum %>"><% mt('Post manual (offline) electronic check refund') |h %></A>
-% } 
-
-    </TD>
-    <TD ALIGN="right" VALIGN="top">
-
-%# invoice reports, combined statement
-% if ( $curuser->access_right('List invoices') ) { 
-%   if ( $num_cust_bill > 0 ) {
-  <A HREF="<% $p %>view/cust_main_statement-pdf.cgi?<% $custnum %>"><%
-  mt('Download typeset statement PDF') |h %></A>
-  <BR>
-%   }
-  <A HREF="<% $p %>search/report_cust_bill.html?custnum=<% $custnum %>"><% mt('Invoice reports') |h %></A>
-% } 
-<BR>
-
-%# XXX payments, credits, refund reports
-
-%# tax exemption link
-
-% my $view_exemptions = $curuser->access_right('View customer tax exemptions');
-% my $add_adjustment = ( $conf->exists('enable_tax_adjustments')
-%                       && $curuser->access_right('Add customer tax adjustment')
-%                      );
-% if ( $view_exemptions || $add_adjustment ) {
-
-%   if ( $view_exemptions ) {
-      <A HREF="<% $p %>search/cust_tax_exempt_pkg.cgi?custnum=<% $custnum %>"><% mt('View tax exemptions') |h %></A>
-      <% $add_adjustment ? '|' : '' %>
-%   } 
-
-%   if ( $add_adjustment ) {
-      <& /elements/popup_link.html, {
-           'action' => $p.'edit/cust_tax_adjustment.html?custnum='. $cust_main->custnum,
-           'label'  => emt('Add tax adjustment'),
-           'actionlabel' => emt('Add tax adjustment'),
-           'height' => 200,
-         }
-      &>
-      |
-      <A HREF="<% $p %>search/cust_tax_adjustment.html?custnum=<% $custnum %>"><% mt('View tax adjustments') |h %></A>
-%   } 
-
-  <BR>
-% }
-
 %# batched payment links
 
 % if ( ( $conf->exists('batch-enable') || $conf->config('batch-enable_payby') )
@@ -204,15 +16,6 @@
     <BR>
 % } 
 
-%# pending payment links
-
-% if ( $curuser->access_right('View customer pending payments')
-%      && scalar($cust_main->cust_pay_pending)
-%    )
-% {
-    <A HREF="<% $p %>search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=<% $custnum %>"><% mt('View pending payments') |h %></A><BR>
-% }
-
     </TD>
   </TR>
   <TR>

-----------------------------------------------------------------------

Summary of changes:
 httemplate/view/cust_main.cgi                  |  102 +----
 httemplate/view/cust_main/billing.html         |   14 -
 httemplate/view/cust_main/contacts_new.html    |    1 -
 httemplate/view/cust_main/menu.html            |  559 ++++++++++++++++++++++++
 httemplate/view/cust_main/notes.html           |   27 --
 httemplate/view/cust_main/packages.html        |   58 ---
 httemplate/view/cust_main/payment_history.html |  197 ---------
 7 files changed, 562 insertions(+), 396 deletions(-)
 create mode 100644 httemplate/view/cust_main/menu.html




More information about the freeside-commits mailing list