summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-12-12 22:27:12 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-12-12 22:27:12 +0000
commit8f62103e122793ebe3db93819417e688ce5b1e18 (patch)
tree8816d01f47923ba2f0dc1b873cdf4ce0448e5631 /LedgerSMB/DBObject
parentc5c2bcb35af4b06be72d53364fb587123a1df930 (diff)
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
Diffstat (limited to 'LedgerSMB/DBObject')
-rw-r--r--LedgerSMB/DBObject/Payment.pm21
1 files changed, 18 insertions, 3 deletions
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;