From 8f62103e122793ebe3db93819417e688ce5b1e18 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Wed, 12 Dec 2007 22:27:12 +0000 Subject: Basic outline of Job Queue System git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1975 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/DBObject/Payment.pm | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'LedgerSMB') diff --git a/LedgerSMB/DBObject/Payment.pm b/LedgerSMB/DBObject/Payment.pm index 417843df..abd45de3 100644 --- a/LedgerSMB/DBObject/Payment.pm +++ b/LedgerSMB/DBObject/Payment.pm @@ -385,6 +385,11 @@ sub get_payment_detail_data { sub post_bulk { my ($self) = @_; my $total_count = 0; + my ($ref) = $self->callproc( + procname => 'setting_get', + args => ['queue_payments'], + ); + my $queue_payments = $ref->{setting_get}; $self->{payment_date} = $self->{datepaid}; for my $contact_row (1 .. $self->{contact_count}){ my $contact_id = $self->{"contact_$contact_row"}; @@ -408,10 +413,20 @@ sub post_bulk { } $self->{transactions} = $invoice_array; $self->{source} = $self->{"source_$contact_id"}; - $self->exec_method(funcname => 'payment_bulk_post'); - + if ($queue_payments){ + my ($job_ref) = $self->exec_method( + funcname => 'job__create' + ) + $self->{job_id} = $job_ref->{job__create}; + $self->exec_method( + funcname => 'payment_bulk_queue_entry' + ); + } else { + $self->exec_method(funcname => 'payment_bulk_post'); + } } - $self->{dbh}->commit; + $self->{queue_payments} = $queue_payments; + return $self->{dbh}->commit; } 1; -- cgit v1.2.3