[freeside-commits] freeside/FS/FS Conf.pm, 1.372, 1.373 cust_main.pm, 1.517, 1.518
Ivan,,,
ivan at wavetail.420.am
Wed Jun 30 13:42:55 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv10712/FS/FS
Modified Files:
Conf.pm cust_main.pm
Log Message:
cust_main exports! cust_main-exports config option and part_export/cust_http.pm export, RT#8952
Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.372
retrieving revision 1.373
diff -u -w -d -r1.372 -r1.373
--- Conf.pm 29 Jun 2010 01:42:47 -0000 1.372
+++ Conf.pm 30 Jun 2010 20:42:53 -0000 1.373
@@ -3782,6 +3782,32 @@
'type' => 'checkbox',
},
+ {
+ 'key' => 'cust_main-exports',
+ 'section' => '',
+ 'description' => 'Export(s) to call on cust_main insert, modification and deletion.',
+ 'type' => 'select-sub',
+ 'multiple' => 1,
+ 'options_sub' => sub {
+ require FS::Record;
+ require FS::part_export;
+ my @part_export =
+ map { qsearch( 'part_export', {exporttype => $_ } ) }
+ keys %{FS::part_export::export_info('cust_main')};
+ map { $_->exportnum => $_->exporttype.' to '.$_->machine } @part_export;
+ },
+ 'option_sub' => sub {
+ require FS::Record;
+ require FS::part_export;
+ my $part_export = FS::Record::qsearchs(
+ 'part_export', { 'exportnum' => shift }
+ );
+ $part_export
+ ? $part_export->exporttype.' to '.$part_export->machine
+ : '';
+ },
+ },
+
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.517
retrieving revision 1.518
diff -u -w -d -r1.517 -r1.518
--- cust_main.pm 29 Jun 2010 04:32:22 -0000 1.517
+++ cust_main.pm 30 Jun 2010 20:42:53 -0000 1.518
@@ -62,6 +62,7 @@
use FS::part_pkg;
use FS::part_event;
use FS::part_event_condition;
+use FS::part_export;
#use FS::cust_event;
use FS::type_pkgs;
use FS::payment_gateway;
@@ -546,6 +547,45 @@
}
}
+ # cust_main exports!
+ warn " exporting\n" if $DEBUG > 1;
+
+ my $export_args = $options{'export_args'} || [];
+
+ my @part_export =
+ map qsearch( 'part_export', {exportnum=>$_} ),
+ $conf->config('cust_main-exports'); #, $agentnum
+
+ foreach my $part_export ( @part_export ) {
+ my $error = $part_export->export_insert($self, @$export_args);
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "exporting to ". $part_export->exporttype.
+ " (transaction rolled back): $error";
+ }
+ }
+
+ #foreach my $depend_jobnum ( @$depend_jobnums ) {
+ # warn "[$me] inserting dependancies on supplied job $depend_jobnum\n"
+ # if $DEBUG;
+ # foreach my $jobnum ( @jobnums ) {
+ # my $queue = qsearchs('queue', { 'jobnum' => $jobnum } );
+ # warn "[$me] inserting dependancy for job $jobnum on $depend_jobnum\n"
+ # if $DEBUG;
+ # my $error = $queue->depend_insert($depend_jobnum);
+ # if ( $error ) {
+ # $dbh->rollback if $oldAutoCommit;
+ # return "error queuing job dependancy: $error";
+ # }
+ # }
+ # }
+ #
+ #}
+ #
+ #if ( exists $options{'jobnums'} ) {
+ # push @{ $options{'jobnums'} }, @jobnums;
+ #}
+
warn " insert complete; committing transaction\n"
if $DEBUG > 1;
@@ -1340,6 +1380,23 @@
return $error;
}
+ # cust_main exports!
+
+ #my $export_args = $options{'export_args'} || [];
+
+ my @part_export =
+ map qsearch( 'part_export', {exportnum=>$_} ),
+ $conf->config('cust_main-exports'); #, $agentnum
+
+ foreach my $part_export ( @part_export ) {
+ my $error = $part_export->export_delete( $self ); #, @$export_args);
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "exporting to ". $part_export->exporttype.
+ " (transaction rolled back): $error";
+ }
+ }
+
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
'';
@@ -1478,6 +1535,23 @@
}
}
+ # cust_main exports!
+
+ my $export_args = $options{'export_args'} || [];
+
+ my @part_export =
+ map qsearch( 'part_export', {exportnum=>$_} ),
+ $conf->config('cust_main-exports'); #, $agentnum
+
+ foreach my $part_export ( @part_export ) {
+ my $error = $part_export->export_replace( $self, $old, @$export_args);
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "exporting to ". $part_export->exporttype.
+ " (transaction rolled back): $error";
+ }
+ }
+
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
'';
More information about the freeside-commits
mailing list