finish up initial work on customer view tabs (ensure links back to customer view...
[freeside.git] / httemplate / search / cust_event.html
index f9cce46..e8164c2 100644 (file)
@@ -124,7 +124,12 @@ my $trigger_link = sub {
   my $eventtable = $cust_event->eventtable;
   if ( $eventtable eq 'cust_pkg' ) {
     my $custnum = $cust_event->cust_main_custnum;
-    [ "${p}view/cust_main.cgi?$custnum#cust_pkg", 'tablenum' ];
+    my $show = $FS::CurrentUser::CurrentUser->default_customer_view =~ /^(jumbo|packages)$/
+                 ? ''
+                 : ';show=packages';
+    my $pkgnum = $cust_event->tablenum;
+    my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment
+    [ "${p}view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#cust_pkg", 'tablenum' ];
   } else {
     [ "${p}view/$eventtable.cgi?", 'tablenum' ];
   }
@@ -151,7 +156,7 @@ my $title = $cgi->param('failed')
 my @search = ();
 
 if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
-  push @search, "agentnum = $1";
+  push @search, "cust_main.agentnum = $1";
   #my $agent = qsearchs('agent', { 'agentnum' => $1 } );
   #die "unknown agentnum $1" unless $agent;
 }
@@ -183,9 +188,7 @@ if ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
 }
 
 #here is the agent virtualization
-my $agent_sql = $curuser->agentnums_sql;
-$agent_sql =~ s/agentnum/cust_main.agentnum/g;
-push @search, $agent_sql;
+push @search, $curuser->agentnums_sql( 'table' => 'cust_main' );
 
 my $where = 'WHERE '. join(' AND ', @search );
 
@@ -261,16 +264,21 @@ function confirm_fax_process() {
 
 </SCRIPT>';
 
-my $menubar =  [
-                 'Re-print these events' =>
-                   "javascript:confirm_print_process()",
-                 'Re-email these events' =>
-                   "javascript:confirm_email_process()",
-               ];
+my $menubar = [];
 
-push @$menubar, 'Re-fax these events' =>
-                  "javascript:confirm_fax_process()"
-  if $conf->exists('hylafax');
+if ( $curuser->access_right('Resend invoices') ) {
+
+  push @$menubar, 'Re-print these events' =>
+                    "javascript:confirm_print_process()",
+                  'Re-email these events' =>
+                    "javascript:confirm_email_process()",
+                ;
+
+  push @$menubar, 'Re-fax these events' =>
+                    "javascript:confirm_fax_process()"
+    if $conf->exists('hylafax');
+
+}
 
 my $link_cust = sub {
   my $cust_event = shift;