From 03bfa825f47a35ff8fac5c9a0ffa95107687901c Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 13 Dec 2007 21:27:59 +0000 Subject: Added a routine to sanitize the CGI variables. Needed for some CSV exports routines. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1978 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB.pm | 13 +++++++++++++ LedgerSMB/DBObject/Payment.pm | 24 ++++++++++++++++-------- UI/payments/check_job.html | 6 ++---- UI/payments/payments_detail.html | 26 ++++++++++++++++++-------- UI/payments/payments_filter.html | 13 +++---------- sql/modules/Payment.sql | 15 ++++++--------- sql/modules/Voucher.sql | 25 +++++++++++++++++++++++++ 7 files changed, 83 insertions(+), 39 deletions(-) diff --git a/LedgerSMB.pm b/LedgerSMB.pm index 49126940..30c3b2b8 100755 --- a/LedgerSMB.pm +++ b/LedgerSMB.pm @@ -94,6 +94,11 @@ non-numbers. Copies the given key=>vars to $self. Allows for finer control of merging hashes into self. +=item remove_cgi_globals() + +Removes all elements starting with a . because these elements conflict with the +ability to hide the entire structure for things like CSV lookups. + =back =head1 Copyright (C) 2006, The LedgerSMB core team. @@ -796,6 +801,14 @@ sub set { } +sub remove_cgi_globals { + my ($self) = @_; + for my $key (keys %$self){ + if ($key =~ /^\./){ + delete $self->{key} + } + } +} 1; diff --git a/LedgerSMB/DBObject/Payment.pm b/LedgerSMB/DBObject/Payment.pm index 8bf22ee9..2d4ced79 100644 --- a/LedgerSMB/DBObject/Payment.pm +++ b/LedgerSMB/DBObject/Payment.pm @@ -75,6 +75,11 @@ sub get_metadata { ); @{$self->{debt_accounts}} = $self->exec_method( funcname => 'chart_get_ar_ap'); + @{$self->{cash_accounts}} = $self->exec_method( + funcname => 'chart_list_cash'); + for my $ref(@{$self->{cash_accounts}}){ + $ref->{text} = "$ref->{accno}--$ref->{description}"; + } } sub get_open_accounts { @@ -351,8 +356,6 @@ This method sets appropriate project, department, etc. fields. sub get_payment_detail_data { my ($self) = @_; - @{$self->{cash_accounts}} = $self->exec_method( - funcname => 'chart_list_cash'); $self->get_metadata(); my $source_inc; @@ -385,11 +388,17 @@ sub get_payment_detail_data { sub post_bulk { my ($self) = @_; my $total_count = 0; - my ($ref) = $self->callproc( + my ($ref) = $self->call_procedure( procname => 'setting_get', args => ['queue_payments'], ); my $queue_payments = $ref->{setting_get}; + if ($queue_payments){ + my ($job_ref) = $self->exec_method( + funcname => 'job__create' + ); + $self->{job_id} = $job_ref->{job__create}; + } $self->{payment_date} = $self->{datepaid}; for my $contact_row (1 .. $self->{contact_count}){ my $contact_id = $self->{"contact_$contact_row"}; @@ -414,12 +423,11 @@ sub post_bulk { $self->{transactions} = $invoice_array; $self->{source} = $self->{"source_$contact_id"}; 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' + funcname => 'payment_bulk_queue' + ); + ($self->{job}) = $self->exec_method( + funcname => 'job__status' ); } else { $self->exec_method(funcname => 'payment_bulk_post'); diff --git a/UI/payments/check_job.html b/UI/payments/check_job.html index 18f786cc..b59caeab 100644 --- a/UI/payments/check_job.html +++ b/UI/payments/check_job.html @@ -6,7 +6,7 @@ ] titlebar = text('Checking Job') # ' refresh = { - url = "payment.pl?job_id=${job_id}&account_class=${account_class}" + url = "payment.pl?job_id=${job_id}&account_class=${account_class}&action=check_job" delay = 20 } ?> @@ -18,19 +18,17 @@ ELSE; text('Status: Complete'); END ?> - +
-

- diff --git a/UI/payments/payments_detail.html b/UI/payments/payments_detail.html index f926c041..0e931ddc 100644 --- a/UI/payments/payments_detail.html +++ b/UI/payments/payments_detail.html @@ -137,14 +137,18 @@ -
- +
+ + + + + -- + +
@@ -270,6 +274,12 @@ class = "submit" name = 'action' } ?> + diff --git a/UI/payments/payments_filter.html b/UI/payments/payments_filter.html index 6ae341dd..c92a57c2 100644 --- a/UI/payments/payments_filter.html +++ b/UI/payments/payments_filter.html @@ -105,22 +105,15 @@ -
- - + } ?>