LedgerSMB Documentation

Description manuals and libraries
LedgerSMB Documentation > Perl Modules > LedgerSMB::Company::Configuration::COANodes
Source

NAME

LedgerSMB::Company::Configuration::COANodes - Collection of CoA nodes

SYNOPSIS

   use LedgerSMB::Database;
   use LedgerSMB::Company;

   my $dbh = LedgerSMB::Database->new( connect_data => { ... })
       ->connect;
   my $c   = LedgerSMB::Company->new(dbh => $dbh)->configuration->coa_nodes;

   # look up a heading or account
   my $node   = $c->get(by => (accno => 'H-1500'));

   # create a new node (account)
   my $new    = $c->create(type        => 'account',
                           accno       => '1501',
                           description => 'Account 1501',
                           heading_id  => $node->id);

DESCRIPTION

Collection of Chart of Accounts nodes (accounts and headings) providing access to existing nodes as well as providing an API to create (instantiate) new ones.

ATTRIBUTES

CONSTRUCTOR ARGUMENTS

In addition to the attributes from the previous section, the following named arguments can (or even must) be provided to the new constructor.

dbh (required)

The database access handle. This is provided upon instantiation by the LedgerSMB::Company::Configuration::COANodes collection.

METHODS

create( type => $type, @args )

Instantiates a new CoA node of type type, associated with the database that the collection is associated with.

type can be either account or heading.

@args are passed to the constructor of the indicated type, LedgerSMB::Company::Configuration::Account for type account and LedgerSMB::Company::Configuration::Heading for type heading.

LICENSE AND COPYRIGHT

Copyright (C) 2020 The LedgerSMB Core Team

This file is licensed under the GNU General Public License version 2, or at your option any later version. A copy of the license should have been included with your software.