[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add new sproc for account_heading_get -- seems sloppy. Changed AM to use it for header accounts.
- Subject: Re: [PATCH] Add new sproc for account_heading_get -- seems sloppy. Changed AM to use it for header accounts.
- From: Chris Travers <..hidden..>
- Date: Tue, 12 Oct 2010 15:03:51 -0700
Thanks. Will look at applying shortly
Best Wishes,
Chris Travers
On Tue, Oct 12, 2010 at 2:36 PM, John Locke <..hidden..> wrote:
> ---
> LedgerSMB/DBObject/Account.pm | 9 +++++----
> sql/modules/Account.sql | 13 ++++++++++++-
> 2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/LedgerSMB/DBObject/Account.pm b/LedgerSMB/DBObject/Account.pm
> index 509ca20..065c523 100644
> --- a/LedgerSMB/DBObject/Account.pm
> +++ b/LedgerSMB/DBObject/Account.pm
> @@ -45,12 +45,13 @@ value must be properly set.
> sub get {
> my $self = shift @_;
> - my @accounts = $self->exec_method(funcname => 'account_get');
> + my $func = 'account_get';
> + if ($self->{charttype} and $self->{charttype} eq 'H'){
> + $func = 'account_heading_get';
> + }
> + my @accounts = $self->exec_method(funcname => $func);
> $self->{account_list} = [];
> for my $ref (@accounts){
> - if ($self->{charttype} and $self->{charttype} ne
> $ref->{charttype}){
> - next;
> - }
> bless $ref, 'LedgerSMB::DBObject::Account';
> $ref->merge($self, keys => ['_user', '_locale', 'stylesheet',
> 'dbh', '_roles', '_request']);
> push (@{$self->{account_list}}, $ref);
> diff --git a/sql/modules/Account.sql b/sql/modules/Account.sql
> index 1237fa1..7fff111 100644
> --- a/sql/modules/Account.sql
> +++ b/sql/modules/Account.sql
> @@ -22,7 +22,18 @@ $$
> DECLARE
> account chart%ROWTYPE;
> BEGIN
> - SELECT * INTO account FROM chart WHERE id = in_id;
> + SELECT * INTO account FROM chart WHERE id = in_id AND charttype = 'A';
> + RETURN account;
> +END;
> +$$ LANGUAGE plpgsql;
> +
> +
> +CREATE OR REPLACE FUNCTION account_heading_get (in_id int) RETURNS chart AS
> +$$
> +DECLARE
> + account chart%ROWTYPE;
> +BEGIN
> + SELECT * INTO account FROM chart WHERE id = in_id AND charttype = 'H';
> RETURN account;
> END;
> $$ LANGUAGE plpgsql;
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Ledger-smb-devel mailing list
> ..hidden..
> https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel
>