[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1407] trunk/LedgerSMB/User.pm
- Subject: SF.net SVN: ledger-smb: [1407] trunk/LedgerSMB/User.pm
- From: ..hidden..
- Date: Mon, 16 Jul 2007 13:30:45 -0700
Revision: 1407
http://svn.sourceforge.net/ledger-smb/?rev=1407&view=rev
Author: tetragon
Date: 2007-07-16 13:30:44 -0700 (Mon, 16 Jul 2007)
Log Message:
-----------
podify User.pm
Modified Paths:
--------------
trunk/LedgerSMB/User.pm
Modified: trunk/LedgerSMB/User.pm
===================================================================
--- trunk/LedgerSMB/User.pm 2007-07-16 18:43:55 UTC (rev 1406)
+++ trunk/LedgerSMB/User.pm 2007-07-16 20:30:44 UTC (rev 1407)
@@ -1,41 +1,72 @@
-#=====================================================================
-# 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 <..hidden..>
-#
-#======================================================================
-#
-# This file has undergone whitespace cleanup.
-#
-#======================================================================
-#
-# user related functions
-#
-#=====================================================================
+=head1 NAME
+
+LedgerSMB::User
+
+=head1 SYNOPSIS
+
+This module provides user support and database management functions.
+
+=head1 STATUS
+
+Deprecated
+
+=head1 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 <..hidden..>
+ #
+ #====================================================================
+ #
+ # This file has undergone whitespace cleanup.
+ #
+ #====================================================================
+ #
+ # user related functions
+ #
+ #====================================================================
+
+=head1 METHODS
+
+=over
+
+=cut
+
+# inline documentation
+
package LedgerSMB::User;
use LedgerSMB::Sysconfig;
use LedgerSMB::Session;
use Data::Dumper;
+=item LedgerSMB::User->new($login);
+
+Create a LedgerSMB::User object. If the user $login exists, set the fields
+with values retrieved from the database.
+
+=cut
+
sub new {
my ( $type, $login ) = @_;
@@ -89,6 +120,13 @@
bless $self, $type;
}
+=item LedgerSMB::User->country_codes();
+
+Returns a hash where the keys are registered locales and the values are the
+textual representation of the locale name.
+
+=cut
+
sub country_codes {
use Locale::Country;
use Locale::Language;
@@ -114,6 +152,14 @@
}
+=item 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.
+
+=cut
+
sub fetch_config {
#I'm hoping that this function will go and is a temporary bridge
@@ -170,6 +216,12 @@
return \%myconfig;
}
+=item $user->login($form);
+
+Disused auth function.
+
+=cut
+
sub login {
my ( $self, $form ) = @_;
@@ -258,6 +310,12 @@
}
+=item LedgerSMB::User->check_recurring($form);
+
+Disused function to return the number of current recurring events.
+
+=cut
+
sub check_recurring {
my ( $self, $form ) = @_;
@@ -277,6 +335,12 @@
}
+=item LedgerSMB::User::dbconnect_vars($form, $db);
+
+Converts individual $form values into $form->{dboptions} and $form->{dbconnect}.
+
+=cut
+
sub dbconnect_vars {
my ( $form, $db ) = @_;
@@ -299,6 +363,12 @@
}
+=item LedgerSMB::User->dbdrivers();
+
+Returns a list of all drivers set up with DBI whose names end in 'Pg'.
+
+=cut
+
sub dbdrivers {
my @drivers = DBI->available_drivers();
@@ -308,6 +378,14 @@
}
+=item 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.
+
+=cut
+
sub dbsources {
my ( $self, $form ) = @_;
@@ -368,6 +446,14 @@
}
+=item 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).
+
+=cut
+
sub dbcreate {
my ( $self, $form ) = @_;
@@ -449,6 +535,13 @@
}
+=item LedgerSMB::User->process_query($form, $dbh, $filename);
+
+Load the file $filename into the database indicated through form using psql.
+$dbh is ignored.
+
+=cut
+
sub process_query {
my ( $self, $form, $dbh, $filename ) = @_;
@@ -469,6 +562,12 @@
}
}
+=item LedgerSMB::User->dbdelete($form);
+
+Disused function to drop the database $form->{db}.
+
+=cut
+
sub dbdelete {
my ( $self, $form ) = @_;
@@ -485,6 +584,13 @@
}
+=item 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.
+
+=cut
+
sub dbsources_unused {
my ( $self, $form, $memfile ) = @_;
@@ -522,6 +628,13 @@
}
+=item 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.
+
+=cut
+
sub dbneedsupdate {
my ( $self, $form ) = @_;
@@ -591,6 +704,12 @@
}
+=item LedgerSMB::User->dbupdate($form);
+
+Applies database upgrade scripts to upgrade the database to the current level.
+
+=cut
+
sub dbupdate {
my ( $self, $form ) = @_;
@@ -671,6 +790,23 @@
}
+=item 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 |
+ +----------+------------+
+
+=cut
+
sub calc_version {
my @v = split /\./, $_[0];
@@ -686,6 +822,12 @@
}
+=item script_version
+
+Sorting function for database upgrade scripts.
+
+=cut
+
sub script_version {
my ( $my_a, $my_b ) = ( $a, $b );
@@ -711,6 +853,13 @@
}
+=item $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.
+
+=cut
+
sub save_member {
my ($self) = @_;
@@ -900,6 +1049,12 @@
}
}
+=item LedgerSMB::User->delete_login($form);
+
+Disused function to delete the user $form->{login}.
+
+=cut
+
sub delete_login {
my ( $self, $form ) = @_;
@@ -931,6 +1086,12 @@
}
+=item LedgerSMB::User->config_vars();
+
+Disused function that returns a list of user config variable names.
+
+=cut
+
sub config_vars {
my @conf = qw(acs address businessnumber company countrycode
@@ -943,6 +1104,13 @@
}
+=item $self->error($msg);
+
+Privately used error function. Used in places where the more typically used
+$form->error cannot be used. Always dies.
+
+=cut
+
sub error {
my ( $self, $msg ) = @_;
@@ -960,3 +1128,5 @@
1;
+=back
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.