[freeside-commits] freeside/FS/FS/part_export cust_http.pm, NONE, 1.1 http.pm, 1.3, 1.4
Ivan,,,
ivan at wavetail.420.am
Wed Jun 30 13:42:55 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv10712/FS/FS/part_export
Modified Files:
http.pm
Added Files:
cust_http.pm
Log Message:
cust_main exports! cust_main-exports config option and part_export/cust_http.pm export, RT#8952
--- NEW FILE: cust_http.pm ---
package FS::part_export::cust_http;
use vars qw( @ISA %info );
use FS::part_export::http;
use Tie::IxHash;
@ISA = qw( FS::part_export::http );
$options{'insert_data'}->{'default'} = join("\n",
"action 'insert'",
"custnum \$cust_main->custnum",
"first \$cust_main->first",
"last \$cust_main->get('last')",
( map "$_ \$cust_main->$_", qw( company address1 address2 city county state zip country daytime night fax last ) ),
"email \$cust_main->invoicing_list_emailonly_scalar",
);
$options{'delete_data'}->{'default'} = join("\n",
"action 'delete'",
"custnum \$cust_main->custnum",
);
$options{'replace_data'}->{'default'} = join("\n",
"action 'replace'",
"custnum \$new_cust_main->custnum",
"first \$new_cust_main->first",
"last \$new_cust_main->get('last')",
( map "$_ \$cust_main->$_", qw( company address1 address2 city county state zip country daytime night fax last ) ),
"email \$new_cust_main->invoicing_list_emailonly_scalar",
);
%info = (
'svc' => 'cust_main',
'desc' => 'Send an HTTP or HTTPS GET or POST request, for customers.',
'options' => \%options,
'notes' => <<'END'
Send an HTTP or HTTPS GET or POST to the specified URL on customer addition,
modification and deletion. For HTTPS support,
<a href="http://search.cpan.org/dist/Crypt-SSLeay">Crypt::SSLeay</a>
or <a href="http://search.cpan.org/dist/IO-Socket-SSL">IO::Socket::SSL</a>
is required.
END
);
1;
Index: http.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/http.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- http.pm 21 Mar 2005 22:13:37 -0000 1.3
+++ http.pm 30 Jun 2010 20:42:53 -0000 1.4
@@ -1,12 +1,10 @@
package FS::part_export::http;
-use vars qw(@ISA %info);
+use base qw( FS::part_export );
+use vars qw( %options %info );
use Tie::IxHash;
-use FS::part_export;
-
- at ISA = qw(FS::part_export);
-tie my %options, 'Tie::IxHash',
+tie %options, 'Tie::IxHash',
'method' => { label =>'Method',
type =>'select',
#options =>[qw(POST GET)],
@@ -66,6 +64,10 @@
return unless $self->option("${action}_data");
+ my $cust_main = $svc_x->table eq 'cust_main'
+ ? $svc_x
+ : $svc_x->cust_svc->cust_pkg->cust_main;
+
$self->http_queue( $svc_x->svcnum,
$self->option('method'),
$self->option('url'),
@@ -85,6 +87,10 @@
return unless $self->option('replace_data');
+ my $new_cust_main = $new->table eq 'cust_main'
+ ? $new
+ : $new->cust_svc->cust_pkg->cust_main;
+
$self->http_queue( $svc_x->svcnum,
$self->option('method'),
$self->option('url'),
@@ -100,10 +106,8 @@
sub http_queue {
my($self, $svcnum) = (shift, shift);
- my $queue = new FS::queue {
- 'svcnum' => $svcnum,
- 'job' => "FS::part_export::http::http",
- };
+ my $queue = new FS::queue { 'job' => "FS::part_export::http::http" };
+ $queue->svcnum($svcnum) if $svcnum;
$queue->insert( @_ );
}
More information about the freeside-commits
mailing list