diff options
author | ivan <ivan> | 2008-12-21 18:09:55 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-12-21 18:09:55 +0000 |
commit | 9bf05e6da4c33578efb15313533f2060d18bdeb4 (patch) | |
tree | e7a7b58ad7543b70b3de8d9b0b12871274f1430a /FS/FS | |
parent | 7d37d1e44896e9c6e7ee8f2649d2fbd9a0f75d54 (diff) |
have freeside-queued put billing jobs in the queue, so they run in their own short-lived processes, RT#4423
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/Schema.pm | 18 | ||||
-rw-r--r-- | FS/FS/queue.pm | 20 |
2 files changed, 26 insertions, 12 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 61f743764..17665b132 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -1439,18 +1439,18 @@ sub tables_hashref { 'queue' => { 'columns' => [ - 'jobnum', 'serial', '', '', '', '', - 'job', 'text', '', '', '', '', - '_date', 'int', '', '', '', '', - 'status', 'varchar', '', $char_d, '', '', - 'statustext', 'text', 'NULL', '', '', '', - 'svcnum', 'int', 'NULL', '', '', '', - 'secure', 'char', 'NULL', 1, '', '', # Y = needs to be run on machine - # w/private key + 'jobnum', 'serial', '', '', '', '', + 'job', 'text', '', '', '', '', + '_date', 'int', '', '', '', '', + 'status', 'varchar', '', $char_d, '', '', + 'statustext', 'text', 'NULL', '', '', '', + 'svcnum', 'int', 'NULL', '', '', '', + 'custnum', 'int', 'NULL', '', '', '', + 'secure', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'jobnum', 'unique' => [], - 'index' => [ [ 'svcnum' ], [ 'status' ] ], + 'index' => [ [ 'job' ], [ 'svcnum' ], [ 'custnum' ], [ 'status' ] ], }, 'queue_arg' => { diff --git a/FS/FS/queue.pm b/FS/FS/queue.pm index ff94a4e0b..61cee0a8a 100644 --- a/FS/FS/queue.pm +++ b/FS/FS/queue.pm @@ -70,7 +70,18 @@ UNIX timestamp =item svcnum -Optional link to service (see L<FS::cust_svc>) +Optional link to service (see L<FS::cust_svc>). + +=item custnum + +Optional link to customer (see L<FS::cust_main>). + +=item secure + +Secure flag, 'Y' indicates that when using encryption, the job needs to be +run on a machine with the private key. + +=cut =back @@ -103,7 +114,7 @@ created (see L<FS::queue_arg>). #false laziness w/part_export.pm sub insert { - my $self = shift; + my( $self, @args ) = @_; local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; @@ -116,13 +127,16 @@ sub insert { local $FS::UID::AutoCommit = 0; my $dbh = dbh; + my %args = @args; + $self->custnum( $args{'custnum'} ) if $args{'custnum'}; + my $error = $self->SUPER::insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; } - foreach my $arg ( @_ ) { + foreach my $arg ( @args ) { my $queue_arg = new FS::queue_arg ( { 'jobnum' => $self->jobnum, 'arg' => $arg, |