[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4376] trunk



Revision: 4376
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4376&view=rev
Author:   einhverfr
Date:     2012-03-03 09:36:43 +0000 (Sat, 03 Mar 2012)
Log Message:
-----------
Cleaning up log messages in trunk if log set only to error

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Entity/Company.pm
    trunk/LedgerSMB/Database.pm
    trunk/LedgerSMB/Sysconfig.pm
    trunk/ledgersmb.conf.default
    trunk/sql/Pg-database.sql

Modified: trunk/LedgerSMB/DBObject/Entity/Company.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Entity/Company.pm	2012-03-02 15:04:12 UTC (rev 4375)
+++ trunk/LedgerSMB/DBObject/Entity/Company.pm	2012-03-03 09:36:43 UTC (rev 4376)
@@ -83,18 +83,64 @@
 
 This retrieves and returns the item as a blessed reference
 
+=cut
+
+sub get {
+    my ($self, $id) = @_;
+    my ($ref) = $self->exec_method({funcname => 'company__get'});
+    $self->prepare_dbhash($ref);
+    return $self->new(%$ref);
+}
+
 =item save()
 
 Saves the item and populates db defaults in id and created.
 
-=item delete()
+=cut
 
-Deletes the item from the db.  Only valid if it has no 
+sub save {
+    my ($self) = @_;
+    my ($ref) = $self->exec_method({funcname => 'company__save'});
+    $self->prepare_dbhash($ref);
+    $self = $self->new(%$ref);
+}
 
-=item search({})
+=item search({account_class => int, contact => string, contact_info => arrayref(string),
+              meta_number => string, address => string, city => string, state => string,
+              mail_code => string, country => string, date_from => date, 
+              date_to => date, business_id => int, legal_name => string, 
+              control_code string})
 
 Retrieves a list of companies matching search criteria.
 
+account_class is required and is an exact match.
+control_code and business_id are exact matches.
+All other criteria are partial matches.
+
+Except with account_class, undef matches all values.
+
+=cut
+
+sub search {
+    my ($self, $criteria) = @_;
+    my @results = $self->exec_method({funcname => 'company__search', 
+                                       arghash => $criteria}
+    );
+    for my $ref (@results){
+        $self->prepare_dbhash($ref);
+        $ref = $self->new(%$ref);
+    }
+    return @results;
+}
+
 =back
 
 =head1 COPYRIGHT
+
+Copyright (C) 2012, the LedgerSMB Core Team.  This file may be re-used under the GNU GPL
+version 2 or at your option any future version.  Please see the accompanying LICENSE 
+file for details.
+
+=cut
+
+return 1;

Modified: trunk/LedgerSMB/Database.pm
===================================================================
--- trunk/LedgerSMB/Database.pm	2012-03-02 15:04:12 UTC (rev 4375)
+++ trunk/LedgerSMB/Database.pm	2012-03-03 09:36:43 UTC (rev 4376)
@@ -28,6 +28,8 @@
 use LedgerSMB::Sysconfig;
 use base('LedgerSMB');
 use strict;
+Log::Log4perl::init(\$LedgerSMB::Sysconfig::log4perl_config);
+my $logger = Log::Log4perl->get_logger('');
 
 my $dbversions = {
     '1.2' => '1.2.0',
@@ -268,7 +270,8 @@
     my $creds = LedgerSMB::Auth->get_credentials();
     my $dbh = DBI->connect(
         "dbi:Pg:dbname=$self->{company_name}", 
-         "$creds->{login}", "$creds->{password}", { AutoCommit => 0 }
+         "$creds->{login}", "$creds->{password}", 
+         { AutoCommit => 0, PrintError => $logger->is_debug(), }
     );
     if (!$dbh){ # Could not connect, try to validate existance by connecting
                 # to template1 and checking

Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm	2012-03-02 15:04:12 UTC (rev 4375)
+++ trunk/LedgerSMB/Sysconfig.pm	2012-03-03 09:36:43 UTC (rev 4376)
@@ -18,7 +18,6 @@
 our $pathsep = ':';
 
 our $auth = 'DB';
-our $logging = 0;      # No logging on by default
 our $images = getcwd() . '/images'; 
 
 our $force_username_case = undef; # don't force case
@@ -102,14 +101,15 @@
 our %config;
 my $cfg_h = new Config::General("ledgersmb.conf") or die;
 %config = $cfg_h->getall;
+
 # Root variables
 for my $var (
-    qw(pathsep logging log_level DBI_TRACE check_max_invoices language auth latex
+    qw(pathsep log_level DBI_TRACE check_max_invoices language auth latex
     db_autoupdate force_username_case max_post_size decimal_places cookie_name
     return_accno no_db_str tempdir cache_templates)
   )
 {
-    ${$var} = $config{''}{$var} if $config{''}{$var};
+    ${$var} = $config{$var} if $config{$var};
 }
 
 %printer = %{ $config{printers} } if $config{printers};

Modified: trunk/ledgersmb.conf.default
===================================================================
--- trunk/ledgersmb.conf.default	2012-03-02 15:04:12 UTC (rev 4375)
+++ trunk/ledgersmb.conf.default	2012-03-03 09:36:43 UTC (rev 4376)
@@ -1,33 +1,33 @@
-auth : DB
-logging  : 0
+auth = DB
+logging  = 0
 #Be aware of tempdir setting.If client_browser and server_apache on same machine, sharing tmp-dir , problems 'Permission denied' if server tries to write temp-file wich already exists as client-owned
-tempdir : /tmp/ledgersmb
+tempdir = /tmp/ledgersmb
 
 # Set language for login and admin pages
-language : 
+language = 
 
-log_level : ERROR
-#DBI_TRACE : 1=/tmp/dbi.trace
-DBI_TRACE : 0
-# For Windows, uncomment the pathsep line:
-# pathsep : ;
+log_level = ERROR
+#DBI_TRACE = 1=/tmp/dbi.trace
+DBI_TRACE = 0
+# For Windows, uncomment the pathsep line=
+# pathsep = ;
 
 # If you have LaTeX installed, set to 1
-latex : 1
+latex = 1
 
 # Maximum number of invoices that can be printed on a cheque
-check_max_invoices : 5
+check_max_invoices = 5
 
 # Maximum POST size to prevent DoS (4MB default)
-max_post_size : 4194304
+max_post_size = 4194304
 
 # Define global settings for decimal places
-decimal_places : 2
+decimal_places = 2
 
 # Spelling of cookie name for this instance of LedgerSMB.
 # Used to keep multiple instances and/or different versions
 # logged in at the same time
-cookie_name : LedgerSMB-1.3
+cookie_name = LedgerSMB-1.3
 
 # This is the string we look for in the failed connection error to determine
 # if the database was not found.  For English-language locales, this can be
@@ -35,12 +35,12 @@
 # need to be changed.  Any partial match on the connection error assumes that
 # the failure to connect was caused by an invalid database request.
 
-no_db_str : database
+no_db_str = database
 
 [environment]
 # If the server can't find applications, append to the path
-PATH: /usr/local/pgsql/bin
-PATH: /usr/local/bin
+PATH= /usr/local/pgsql/bin
+PATH= /usr/local/bin
 
 # If on Mac OS X using Fink's Perl libs, append to the path
 #PERL5LIB = /sw/lib/perl5
@@ -101,5 +101,5 @@
 sslmode = prefer
 
 [log4perl_config_modules_loglevel]
-LedgerSMB : INFO
+LedgerSMB = INFO
 LedgerSMB.DBObject = INFO

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2012-03-02 15:04:12 UTC (rev 4375)
+++ trunk/sql/Pg-database.sql	2012-03-03 09:36:43 UTC (rev 4376)
@@ -2,6 +2,25 @@
 
 begin;
 
+CREATE TABLE lsmb_module (
+     id int not null unique,
+     label text primary key
+);
+
+COMMENT ON TABLE lsmb_module IS
+$$ This stores categories functionality into modules.  Addons may add rows here, but 
+the id should be hardcoded.  As always 900-1000 will be reserved for internal use, 
+and negative numbers will be reserved for testing.$$;
+
+INSERT INTO lsmb_module (id, label)
+VALUES (1, 'AR'),
+       (2, 'AP'),
+       (3, 'GL'),
+       (4, 'Entity'),
+       (5, 'Manufacturing'),
+       (6, 'Fixed Assets');
+
+
 CREATE OR REPLACE FUNCTION person__get_my_entity_id() RETURNS INT AS
 $$ SELECT -1;$$ LANGUAGE SQL;
 
@@ -1800,7 +1819,6 @@
     id serial not null unique,
     label text primary key,
     active bool not null default false,
-    non_accounting bool not null default false,
     ordering int
 );
 
@@ -1814,8 +1832,22 @@
        (3, 'Job', '0', '30'),
        (4, 'Fund', '0', '40'),
        (5, 'Customer', '0', '50'),
-       (6, 'Vendor', '0', '60');
+       (6, 'Vendor', '0', '60'),
+       (7, 'Lot',  0, 50);
 
+CREATE TABLE bu_class_to_module (
+   bu_class_id int references business_unit_class(id),
+   module_id int references lsmb_module(id),
+   primary key (bu_class_id, module_id)
+);
+
+INSERT INTO  bu_class_to_module (bu_class_id, module_id)
+SELECT business_unit_class.id, lsmb_module.id
+  FROM business_unit_class
+ CROSS
+  JOIN lsmb_module; -- by default activate all existing business units on all modules
+       
+
 CREATE TABLE business_unit (
   id serial PRIMARY KEY,
   class_id int not null references business_unit_class(id),

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.