diff options
-rw-r--r-- | LedgerSMB/DBObject/Payment.pm | 7 | ||||
-rw-r--r-- | UI/lib/elements.html | 2 | ||||
-rw-r--r-- | UI/lib/ui-header.html | 4 | ||||
-rw-r--r-- | UI/payments/check_job.html | 36 | ||||
-rw-r--r-- | UI/payments/payments_detail.html | 2 | ||||
-rw-r--r-- | UI/payments/payments_filter.html | 17 | ||||
-rwxr-xr-x | job.pl | 3 | ||||
-rw-r--r-- | scripts/payment.pl | 32 | ||||
-rw-r--r-- | sql/modules/Payment.sql | 2 | ||||
-rw-r--r-- | utils/process_queue/config.pl.default (renamed from utils/process_queue/config.pl) | 0 |
10 files changed, 98 insertions, 7 deletions
diff --git a/LedgerSMB/DBObject/Payment.pm b/LedgerSMB/DBObject/Payment.pm index abd45de3..8bf22ee9 100644 --- a/LedgerSMB/DBObject/Payment.pm +++ b/LedgerSMB/DBObject/Payment.pm @@ -416,7 +416,7 @@ sub post_bulk { 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' @@ -429,4 +429,9 @@ sub post_bulk { return $self->{dbh}->commit; } +sub check_job { + my ($self) = @_; + ($self->{job}) = $self->exec_method(funcname => 'job__status'); +} + 1; diff --git a/UI/lib/elements.html b/UI/lib/elements.html index 8b6900c2..4345e7ee 100644 --- a/UI/lib/elements.html +++ b/UI/lib/elements.html @@ -109,7 +109,7 @@ <?lsmb text_attr = 'text' ?> <?lsmb END ?> <?lsmb IF element_data.defined('value_attr') ?> - <?lsmb text_attr = element_data.value_attr ?> + <?lsmb value_attr = element_data.value_attr ?> <?lsmb element.delete('value_attr') ?> <?lsmb ELSE ?> <?lsmb value_attr = 'value' ?> diff --git a/UI/lib/ui-header.html b/UI/lib/ui-header.html index 868b44ab..a3f46629 100644 --- a/UI/lib/ui-header.html +++ b/UI/lib/ui-header.html @@ -5,6 +5,10 @@ <title><?lsmb form.titlebar ? form.titlebar : titlebar ?></title> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> + <?lsmb IF refresh -?> + <meta http-equiv="refresh" + content="<?lsmb refresh.delay ?>;<?lsmb refresh.url ?>"> + <?lsmb END -?> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <?lsmb IF form.stylesheet ?> <link rel="stylesheet" href="css/<?lsmb form.stylesheet ?>" type="text/css" title="LedgerSMB stylesheet" /> diff --git a/UI/payments/check_job.html b/UI/payments/check_job.html new file mode 100644 index 00000000..18f786cc --- /dev/null +++ b/UI/payments/check_job.html @@ -0,0 +1,36 @@ +<?lsmb INCLUDE 'ui-header.html' + include_stylesheet = [ + 'css/global.css' + 'UI/payments/payments.css' + stylesheet + ] + titlebar = text('Checking Job') # ' + refresh = { + url = "payment.pl?job_id=${job_id}&account_class=${account_class}" + delay = 20 + } +?> +<body> + <div class="listtop"><?lsmb text('Checking Job [_1]', job_id) ?></div> + <div class="info"> + <?lsmb IF job.completed; + text('Status: Still Running'); + ELSE; + text('Status: Complete'); + END ?></div> + <?lsmb IF job.completed ?> + <div class="info"> + <?lsmb IF job.success; + text('Completed Successfully'); + ELSE; + text('Job Failed'); + END ?></div> + <?lsmb IF ! job.success ?> + <div class="info"> + <?lsmb text('Error:') ?><br /> + <?lsmb job.error_condition ?> + </div> + <?lsmb END # if ! job.success ?> + <?lsmb END # if job.completed ?> +</body> +</html> diff --git a/UI/payments/payments_detail.html b/UI/payments/payments_detail.html index 39a4f334..f926c041 100644 --- a/UI/payments/payments_detail.html +++ b/UI/payments/payments_detail.html @@ -265,7 +265,7 @@ value = count } ?> <?lsmb INCLUDE button element_data = { - text = text('Post'), + text = text((batch_id) ? 'Save' : 'Post'), value = 'post_payments_bulk' class = "submit" name = 'action' diff --git a/UI/payments/payments_filter.html b/UI/payments/payments_filter.html index 9f50a613..6ae341dd 100644 --- a/UI/payments/payments_filter.html +++ b/UI/payments/payments_filter.html @@ -2,6 +2,7 @@ include_stylesheet = [ 'css/global.css' 'UI/payments/payments.css' + stylesheet ] titlebar = text('Selection') ?> @@ -104,6 +105,22 @@ </select> </div> </div> +<div class="listtop"> + <!-- <?lsmb INCLUDE select element_data = { + name = "cash_accno" + default_values = [cash_accno] + options = cash_accounts + value_attr = "accno" + text_attr = "text" + label = text('Pay From:') # ' + } ?> --> + <select name="cash_accno" id="cash_account"> + <?lsmb FOREACH a = cash_accounts ?> + <option value="<?lsmb a.accno ?>"> + <?lsmb a.accno ?>--<?lsmb a.description ?> + </option> + <?lsmb END # foreach a ?> + </select> <div class = "input"> <?lsmb INCLUDE input element_data = { type = "text" @@ -0,0 +1,3 @@ +#!/usr/bin/perl + +require "lsmb-request.pl"; diff --git a/scripts/payment.pl b/scripts/payment.pl index f11a06c7..4f13e395 100644 --- a/scripts/payment.pl +++ b/scripts/payment.pl @@ -82,20 +82,46 @@ sub payments { $template->render($payment); } -sub post_payments_bulk { +sub check_job { my ($request) = @_; my $payment = LedgerSMB::DBObject::Payment->new({'base' => $request}); - $payment->post_bulk(); + $payment->check_job; my $template = LedgerSMB::Template->new( user => $request->{_user}, locale => $request->{_locale}, path => 'UI/payments', - template => 'payments_filter', + template => 'check_job', format => 'HTML', ); $template->render($payment); } +sub post_payments_bulk { + my ($request) = @_; + my $payment = LedgerSMB::DBObject::Payment->new({'base' => $request}); + $payment->post_bulk(); + my $template; + if ($payment->{queue_payments}){ + $payment->{job_label} = 'Payments'; + $template = LedgerSMB::Template->new( + user => $request->{_user}, + locale => $request->{_locale}, + path => 'UI/payments', + template => 'check_job', + format => 'HTML', + ); + } else { + $template = LedgerSMB::Template->new( + user => $request->{_user}, + locale => $request->{_locale}, + path => 'UI/payments', + template => 'payments_filter', + format => 'HTML', + ); + } + $template->render($payment); +} + sub display_payments { my ($request) = @_; my $payment = LedgerSMB::DBObject::Payment->new({'base' => $request}); diff --git a/sql/modules/Payment.sql b/sql/modules/Payment.sql index aae4917e..f48bd22f 100644 --- a/sql/modules/Payment.sql +++ b/sql/modules/Payment.sql @@ -230,7 +230,7 @@ BEGIN END; $$ LANGUAGE PLPGSQL; -CREATE OR REPLACE FUNCTION job__process_payments(in_job_id int) +CREATE OR REPLACE FUNCTION job__process_payment(in_job_id int) RETURNS bool AS $$ DECLARE queue_record RECORD diff --git a/utils/process_queue/config.pl b/utils/process_queue/config.pl.default index c977a2b8..c977a2b8 100644 --- a/utils/process_queue/config.pl +++ b/utils/process_queue/config.pl.default |