summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2008-09-10 08:34:32 +0000
committerivan <ivan>2008-09-10 08:34:32 +0000
commit96f1d947b394cb96690f5fde2f91f3efcd21dc21 (patch)
treefd6b8dc32bf71f19237e023af353569d7c1ed288
parentf5651a3f5978a89f208a861844d014217d4c31e8 (diff)
add re-FTP reprint, RT#create-me-tommorow-for-enet
-rw-r--r--FS/FS/Conf.pm38
-rw-r--r--FS/FS/cust_bill.pm32
-rw-r--r--httemplate/misc/ftp_invoices.cgi9
-rwxr-xr-xhttemplate/search/cust_bill.html12
4 files changed, 89 insertions, 2 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 64c034e13..d5ee8cbea 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -1841,12 +1841,48 @@ worry that config_items is freeside-specific and icky.
{
'key' => 'hylafax',
- 'section' => '',
+ 'section' => 'billing',
'description' => 'Options for a HylaFAX server to enable the FAX invoice destination. They should be in the form of a space separated list of arguments to the Fax::Hylafax::Client::sendfax subroutine. You probably shouldn\'t override things like \'docfile\'. *Note* Only supported when using typeset invoices (see the invoice_latex configuration option).',
'type' => [qw( checkbox textarea )],
},
{
+ 'key' => 'cust_bill-ftpformat',
+ 'section' => 'billing',
+ 'description' => 'Enable FTP of raw invoice data - format.',
+ 'type' => 'select',
+ 'select_enum' => [ '', 'default', 'billco', ],
+ },
+
+ {
+ 'key' => 'cust_bill-ftpserver',
+ 'section' => 'billing',
+ 'description' => 'Enable FTP of raw invoice data - server.',
+ 'type' => 'text',
+ },
+
+ {
+ 'key' => 'cust_bill-ftpusername',
+ 'section' => 'billing',
+ 'description' => 'Enable FTP of raw invoice data - server.',
+ 'type' => 'text',
+ },
+
+ {
+ 'key' => 'cust_bill-ftppassword',
+ 'section' => 'billing',
+ 'description' => 'Enable FTP of raw invoice data - server.',
+ 'type' => 'text',
+ },
+
+ {
+ 'key' => 'cust_bill-ftpdir',
+ 'section' => 'billing',
+ 'description' => 'Enable FTP of raw invoice data - server.',
+ 'type' => 'text',
+ },
+
+ {
'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.',
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index c302d1833..98091e1ac 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -913,6 +913,28 @@ sub fax_invoice {
}
+=item ftp_invoice [ TEMPLATENAME ]
+
+Sends this invoice data via FTP.
+
+TEMPLATENAME is unused?
+
+=cut
+
+sub ftp_invoice {
+ my $self = shift;
+ my $template = scalar(@_) ? shift : '';
+
+ $self->send_csv(
+ 'protocol' => 'ftp',
+ 'server' => $conf->config('cust_bill-ftpserver'),
+ 'username' => $conf->config('cust_bill-ftpusername'),
+ 'password' => $conf->config('cust_bill-ftppassword'),
+ 'dir' => $conf->config('cust_bill-ftpdir'),
+ 'format' => $conf->config('cust_bill-ftpformat'),
+ );
+}
+
=item send_if_newest [ TEMPLATENAME [ , AGENTNUM [ , INVOICE_FROM ] ] ]
Like B<send>, but only sends the invoice if it is the newest open invoice for
@@ -2670,6 +2692,14 @@ sub process_refax {
process_re_X('fax', @_);
}
+=item reftp
+
+=cut
+
+sub process_reftp {
+ process_re_X('ftp', @_);
+}
+
use Storable qw(thaw);
use Data::Dumper;
use MIME::Base64;
@@ -2713,6 +2743,8 @@ sub re_X {
'debug' => 1,
} );
+ $method .= '_invoice' unless $method eq 'email' || $method eq 'print';
+
warn " $me re_X $method: ". scalar(@cust_bill). " invoices found\n"
if $DEBUG;
diff --git a/httemplate/misc/ftp_invoices.cgi b/httemplate/misc/ftp_invoices.cgi
new file mode 100644
index 000000000..9a072b99f
--- /dev/null
+++ b/httemplate/misc/ftp_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_reftp', $cgi;
+
+</%init>
diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html
index 2860f7a4d..d22c74483 100755
--- a/httemplate/search/cust_bill.html
+++ b/httemplate/search/cust_bill.html
@@ -188,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_ ) ).
'<SCRIPT TYPE="text/javascript">
@@ -210,6 +210,12 @@ 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();
+}
</SCRIPT>';
@@ -225,6 +231,10 @@ if ( $FS::CurrentUser::CurrentUser->access_right('Resend invoices') ) {
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');
}
</%init>