From faa9e03809537153822776b375d3add5de7c7800 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 12 Sep 2008 02:02:01 +0000 Subject: [PATCH] add billco respooling, not re-FTPing, RT#3971 --- FS/FS/Conf.pm | 17 ++++++++++++++++- FS/FS/cust_bill.pm | 34 ++++++++++++++++++++++++++++++---- httemplate/misc/spool_invoices.cgi | 9 +++++++++ httemplate/search/cust_bill.html | 13 ++++++++++++- 4 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 httemplate/misc/spool_invoices.cgi diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index cf569a9ea..d244dcea0 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1865,6 +1865,21 @@ worry that config_items is freeside-specific and icky. }, { + 'key' => 'cust_bill-spoolformat', + 'section' => 'billing', + 'description' => 'Enable spooling of raw invoice data - format.', + 'type' => 'select', + 'select_enum' => [ '', 'default', 'billco', ], + }, + + { + 'key' => 'cust_bill-spoolagent', + 'section' => 'billing', + 'description' => 'Enable per-agent spooling of raw invoice data.', + 'type' => 'checkbox', + }, + + { 'key' => 'svc_acct-usage_suspend', 'section' => 'billing', 'description' => 'Suspends the package an account belongs to when svc_acct.seconds or a bytecount is decremented to 0 or below (accounts with an empty seconds and up|down|totalbytes value are ignored). Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.', @@ -2337,7 +2352,7 @@ worry that config_items is freeside-specific and icky. { 'key' => 'card_masking_method', 'section' => 'UI', - 'description' => 'Digits to display when masking credit cards. Note that the first six digits are necessary to canonically identify the credit card type (Visa/MC, Amex, Discover, Maestro, etc.) in all cases. The first four digits can identify the most common credit card types in most cases (Visa/MC, Amex, and Discover). The first two digits can distinguish between Visa/MC and Amex.', + 'description' => 'Digits to display when masking credit cards. Note that the first six digits are necessary to canonically identify the credit card type (Visa/MC, Amex, Discover, Maestro, etc.) in all cases. The first four digits can identify the most common credit card types in most cases (Visa/MC, Amex, and Discover). The first two digits can distinguish between Visa/MC and Amex. Note: You should manually remove stored paymasks if you change this value on an existing database, to avoid problems using stored cards.', 'type' => 'select', 'select_hash' => [ '' => '123456xxxxxx1234', diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 4fa876bb9..61ae6c092 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -996,6 +996,24 @@ sub ftp_invoice { ); } +=item spool_invoice [ TEMPLATENAME ] + +Spools this invoice data (see L) + +TEMPLATENAME is unused? + +=cut + +sub spool_invoice { + my $self = shift; + my $template = scalar(@_) ? shift : ''; + + $self->spool_csv( + 'format' => $conf->config('cust_bill-spoolformat'), + 'agent_spools' => $conf->exists('cust_bill-spoolagent'), + ); +} + =item send_if_newest [ TEMPLATENAME [ , AGENTNUM [ , INVOICE_FROM ] ] ] Like B, but only sends the invoice if it is the newest open invoice for @@ -2887,7 +2905,7 @@ sub _items_payments { =over 4 -=item reprint +=item process_reprint =cut @@ -2895,7 +2913,7 @@ sub process_reprint { process_re_X('print', @_); } -=item reemail +=item process_reemail =cut @@ -2903,7 +2921,7 @@ sub process_reemail { process_re_X('email', @_); } -=item refax +=item process_refax =cut @@ -2911,7 +2929,7 @@ sub process_refax { process_re_X('fax', @_); } -=item reftp +=item process_reftp =cut @@ -2919,6 +2937,14 @@ sub process_reftp { process_re_X('ftp', @_); } +=item respool + +=cut + +sub process_respool { + process_re_X('spool', @_); +} + use Storable qw(thaw); use Data::Dumper; use MIME::Base64; diff --git a/httemplate/misc/spool_invoices.cgi b/httemplate/misc/spool_invoices.cgi new file mode 100644 index 000000000..bfe24e6ea --- /dev/null +++ b/httemplate/misc/spool_invoices.cgi @@ -0,0 +1,9 @@ +<% $server->process %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices'); + +my $server = new FS::UI::Web::JSRPC 'FS::cust_bill::process_respool', $cgi; + + diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html index d22c74483..6f440db7e 100755 --- a/httemplate/search/cust_bill.html +++ b/httemplate/search/cust_bill.html @@ -188,7 +188,7 @@ my $html_init = join("\n", map { qq!
!, ( map qq!!, keys %search ), qq!
! -} qw( print_ email_ fax_ ftp_ ) ). +} qw( print_ email_ fax_ ftp_ spool_ ) ). ''; @@ -235,6 +241,11 @@ if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) { 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'); + } -- 2.11.0