fix FK upgrade for pkg_referral: remove records referencing non-existant customer...
[freeside.git] / httemplate / view / svc_forward.cgi
index ff84a28..75c8f5c 100755 (executable)
@@ -1,12 +1,26 @@
-<% include('/elements/header.html', 'Mail Forward View', menubar(
-  ( ( $pkgnum || $custnum )
-    ? ( "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum",
-      )
-    : ( "Cancel this (unaudited) mail forward" =>
-          "${p}misc/cancel-unaudited.cgi?$svcnum" )
-  )
-))
-%>
+% if ( $custnum ) {
+
+  <% include("/elements/header.html","View mail forward") %>
+  <% include( '/elements/small_custview.html', $custnum, '', 1,
+     "${p}view/cust_main.cgi") %>
+  <BR>
+
+% } else {
+
+  <% include("/elements/header.html",'View mail forward', menubar(
+       "Cancel this (unaudited) mail forward" =>
+         "javascript:areyousure('${p}misc/cancel-unaudited.cgi?$svcnum')",
+     ))
+  %>
+
+  <SCRIPT>
+  function areyousure(href) {
+      if (confirm("Permanently delete this mail forward?") == true)
+          window.location.href = href;
+  }
+  </SCRIPT>
+
+% }
 
 <A HREF="<% $p %>edit/svc_forward.cgi?<% $svcnum %>">Edit this information</A>
 
 </TABLE>
 
 <BR>
+
+<% include('elements/svc_export_settings.html', $svc_forward) %>
+
+<& /elements/table-tickets.html, object => $cust_svc &>
+
 <% joblisting({'svcnum'=>$svcnum}, 1) %>
 
 <% include('/elements/footer.html') %>
@@ -56,7 +75,9 @@ my $svc_forward = qsearchs({
                  ' LEFT JOIN cust_pkg  USING ( pkgnum  ) '.
                  ' LEFT JOIN cust_main USING ( custnum ) ',
   'hashref'   => {'svcnum'=>$svcnum},
-  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql(
+                            'null_right' => 'View/link unlinked services'
+                          ),
 });
 die "Unknown svcnum" unless $svc_forward;