add billco respooling, not re-FTPing, RT#3971
[freeside.git] / httemplate / search / cust_bill.html
index 9166f6d..6f440db 100755 (executable)
@@ -159,7 +159,8 @@ if ( $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/ ) {
                      FS::cust_bill->owed_sql. ' AS owed',
                      FS::cust_bill->net_sql.  ' AS net',
                    ),
-    'extra_sql' => "$extra_sql $orderby"
+    'extra_sql' => $extra_sql,
+    'order_by'  => $orderby,
   };
 
 }
@@ -187,7 +188,7 @@ my $html_init = join("\n", map {
  qq!<FORM NAME="${_}form">!,
  ( map qq!<INPUT TYPE="hidden" NAME="$_" VALUE="$search{$_}">!, keys %search ),
  qq!</FORM>!
-} qw( print_ email_ fax_ ) ). 
+} qw( print_ email_ fax_ ftp_ spool_ ) ). 
 
 '<SCRIPT TYPE="text/javascript">
 
@@ -209,18 +210,42 @@ function confirm_fax_process() {
   }
   fax_process();
 }
+function confirm_ftp_process() {
+  if ( ! confirm("Are you sure you want to re-FTP these invoices?") ) {
+    return;
+  }
+  ftp_process();
+}
+function confirm_spool_process() {
+  if ( ! confirm("Are you sure you want to re-spool these invoices?") ) {
+    return;
+  }
+  spool_process();
+}
 
 </SCRIPT>';
 
-my $menubar =  [
-                'Print these invoices' =>
-                  "javascript:confirm_print_process()",
-                'Email these invoices' =>
-                  "javascript:confirm_email_process()",
-              ];
+my $menubar = [];
 
-push @$menubar, 'Fax these invoices' =>
-                 "javascript:confirm_fax_process()"
- if $conf->exists('hylafax');
+if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) {
+
+  push @$menubar, 'Print these invoices' =>
+                    "javascript:confirm_print_process()",
+                  'Email these invoices' =>
+                    "javascript:confirm_email_process()";
+
+  push @$menubar, 'Fax these invoices' =>
+                    "javascript:confirm_fax_process()"
+    if $conf->exists('hylafax');
+
+  push @$menubar, 'FTP these invoices' =>
+                    "javascript:confirm_ftp_process()"
+    if $conf->exists('cust_bill-ftpformat');
+
+  push @$menubar, 'Spool these invoices' =>
+                    "javascript:confirm_spool_process()"
+    if $conf->exists('cust_bill-spoolformat');
+
+}
 
 </%init>