---
name: "LedgerSMB::User"
section: "3pm"
platform: "linux"
package: "ledgersmb"
version: "1.3.40-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/LedgerSMB::User"
---

# LedgerSMB::User(3pm)

Provides user support and database management functions.

## NAME

LedgerSMB::User - Provides user support and database management functions.

## SYNOPSIS

This module provides user support and database management functions.

## STATUS

Deprecated

## COPYRIGHT

```
 #====================================================================
 # LedgerSMB
 # Small Medium Business Accounting software
 # http://www.ledgersmb.org/
 #
 # Copyright (C) 2006
 # This work contains copyrighted information from a number of sources
 # all used with permission.
 #
 # This file contains source code included with or based on SQL-Ledger
 # which is Copyright Dieter Simader and DWS Systems Inc. 2000-2005
 # and licensed under the GNU General Public License version 2 or, at
 # your option, any later version.  For a full list including contact
 # information of contributors, maintainers, and copyright holders,
 # see the CONTRIBUTORS file.
 #
 # Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
 # Copyright (C) 2000
 #
 #  Author: DWS Systems Inc.
 #     Web: http://www.sql-ledger.org
 #
 #  Contributors: Jim Rawlings <jim@your-dba.com>
 #
 #====================================================================
 #
 # This file has undergone whitespace cleanup.
 #
 #====================================================================
 #
 # user related functions
 #
 #====================================================================
```

## METHODS

- LedgerSMB::User-\>new($login);

  Create a LedgerSMB::User object.  If the user `$login` exists, set the fields with values retrieved from the database.

- LedgerSMB::User-\>*country\_codes()*;

  Returns a hash where the keys are registered locales and the values are the textual representation of the locale name.

- LedgerSMB::User-\>fetch\_config($login);

  Returns a reference to a hash that contains the user config for the user `$login`. If that user does not exist, output 'Access denied' if in CGI and die in all cases.

- LedgerSMB::User-\>check\_recurring($form);

  Disused function to return the number of current recurring events.

- LedgerSMB::User::dbconnect\_vars($form, $db);

  Converts individual `$form` values into `$form`-\>{dboptions} and `$form`-\>{dbconnect}.

- LedgerSMB::User-\>*dbdrivers()*;

  Returns a list of all drivers set up with DBI whose names end in 'Pg'.

- LedgerSMB::User-\>dbsources($form);

  Returns a list of all databases in the same cluster as the database that `$form` is set to.  If `$form`-\>{only\_acc\_db} is set, only non-template databases that have a defaults table owned by `$form`-\>{dbuser} are returned.

- LedgerSMB::User-\>dbcreate($form);

  Create the database indicated by `$form`-\>{db} and load Pg-database.sql, the chart indicated by `$form`-\>{chart} and custom tables and functions (Pg-custom\_tables.sql and Pg-custom\_functions).

- LedgerSMB::User-\>process\_query($form, $dbh, $filename);

  Load the file `$filename` into the database indicated through form using psql. `$dbh` is ignored.

- LedgerSMB::User-\>dbdelete($form);

  Disused function to drop the database `$form`-\>{db}.

- LedgerSMB::User-\>dbsources\_unused($form, $memfile);

  Disused function to identify all databases in a cluster with a defaults table that are not mentioned in the memberfile `$memfile`.

- LedgerSMB::User-\>dbneedsupdate($form);

  Disused function to locate all databases owned by `$form`-\>{dbuser} that are not a template\* database which have a defaults table with a version entry.

- LedgerSMB::User-\>dbupdate($form);

  Applies database upgrade scripts to upgrade the database to the current level.

- calc\_version($version);

  Returns a numeric form for the version passed in.  The numeric form is derived by converting each dotted portion of the version to a three-digit number and appending them.

  ```
   +----------+------------+
   | $version |   returned |
   +----------+------------+
   |   1.0.0  |    1000000 |
   |   1.2.33 |    1002033 |
   | 189.2.33 |  189002033 |
   |  1.2.3.4 | 1002003004 |
   +----------+------------+
  ```

- script\_version

  Sorting function for database upgrade scripts.

- $user-\>*save\_member()*;

  Updates the user config in the database for the user `$user`.  If no config for the user exists, the user to the database.

- LedgerSMB::User-\>delete\_login($form);

  Disused function to delete the user `$form`-\>{login}.

- LedgerSMB::User-\>*config\_vars()*;

  Disused function that returns a list of user config variable names.

- $self-\>error($msg);

  Privately used error function.  Used in places where the more typically used `$form`-\>error cannot be used.  Always dies.
