LedgerSMB Documentation

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

NAME

LedgerSMB::Company::Configuration - Entry-point for company configuration

SYNOPSIS

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

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

   # Get the session duration validity
   print 'Session time-out after: ' . $c->setting('session_timeout');

   # Set the value of a setting
   $c->setting('company_name', 'Acme, Inc.');

DESCRIPTION

Access to the various parts of the company configuration, including settings, accounts, account headings, currency setup, standardized industry codes (SIC), etc.

Please note that the only correct procedure to get an instance of this class is through a LedgerSMB::Company instance. That is the only supported entry-point for the Perl API.

ATTRIBUTES

dbh (required)

This attribute is required and automatically passed into the instance upon instantiation by LedgerSMB::Company.

coa_nodes

Holds a LedgerSMB::Company::Configuration::COANodes instance, representing the configuration of the chart of accounts with its headings.

This attribute cannot be set at object instantiation.

currencies

Holds a LedgerSMB::Company::Configuration::Currencies instance, providing access to the currency setup, i.e. available currencies and default currency.

This attribute cannot be set at object instantiation.

gifi_codes

Holds a LedgerSMB::Company::Configuration::GIFIs instance, providing access to the GIFI setup in the company.

This attribute cannot be set at object instantiation.

industry_codes

Holds a LedgerSMB::Company::Configuration::SICs instance, providing access to the setup of Standardized Industry Codes (SIC).

This attribute cannot be set at object instantiation.

METHODS

from_xml($source)

Configures the company based on the XML content provided in $source, which can be either a string or a file handle. In case of a string, $source is interpreted as an XML source document. In case of a file handle, the XML content will be read from the backing file.

The specification of the XML structure (XSD) can be found at doc/company-setup/configuration.xsd in the LedgerSMB repository.

setting($name, [$new_value])

Returns the value of company setting $name when $new_value is not provided, or sets the value when $new_values is provided.

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.