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

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



Revision: 4939
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4939&view=rev
Author:   einhverfr
Date:     2012-06-21 11:46:22 +0000 (Thu, 21 Jun 2012)
Log Message:
-----------
Cleaned up ledgersmb.conf format so no per-company vars

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/IR.pm
    trunk/LedgerSMB/IS.pm
    trunk/LedgerSMB/PGNumber.pm
    trunk/LedgerSMB/Scripts/configuration.pl
    trunk/LedgerSMB/Scripts/payment.pm
    trunk/LedgerSMB/Sysconfig.pm
    trunk/LedgerSMB.pm
    trunk/bin/io.pl
    trunk/bin/ir.pl
    trunk/bin/is.pl
    trunk/ledgersmb.conf.default

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/Changelog	2012-06-21 11:46:22 UTC (rev 4939)
@@ -22,6 +22,7 @@
 * Partsgroups can now be nested though this is not yet used by LSMB (Chris T)
 * Added file attachments to parts (Chris T)
 * Added file attachments to customers, vendors, employees, leads etc (Chris T)
+* LaTeX format detection now run-time call, not configured (Chris T)
 
 New RESTful Web Services Framework
 * Supports XML and JSON as input formats

Modified: trunk/LedgerSMB/IR.pm
===================================================================
--- trunk/LedgerSMB/IR.pm	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/LedgerSMB/IR.pm	2012-06-21 11:46:22 UTC (rev 4939)
@@ -41,6 +41,7 @@
 use LedgerSMB::Tax;
 use LedgerSMB::PriceMatrix;
 use LedgerSMB::Sysconfig;
+use LedgerSMB::Setting;
 use Math::BigFloat;
 
 =over
@@ -253,7 +254,7 @@
 
             my ($dec) = ( $fxsellprice =~ /\.(\d+)/ );
             # deduct discount
-            my $moneyplaces = $LedgerSMB::Sysconfig::decimal_places;
+            my $moneyplaces = LedgerSMB::Setting->get('decimal_places');
             $decimalplaces = ($form->{"precision_$i"} > $moneyplaces) 
                              ? $form->{"precision_$i"}
                              : $moneyplaces;
@@ -1279,7 +1280,7 @@
         $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
 
         my ($dec) = ( $ref->{sellprice} =~ /\.(\d+)/ );
-        my $moneyplaces = $LedgerSMB::Sysconfig::decimal_places;
+        my $moneyplaces = LedgerSMB::Setting->get('decimal_places');
         $dec = length $dec;
         my $decimalplaces = ( $dec > $moneyplaces ) ? $dec : $moneyplaces;
 

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/LedgerSMB/IS.pm	2012-06-21 11:46:22 UTC (rev 4939)
@@ -40,6 +40,7 @@
 use LedgerSMB::Tax;
 use LedgerSMB::PriceMatrix;
 use LedgerSMB::Sysconfig;
+use LedgerSMB::Setting;
 use Log::Log4perl;
 
 my $logger = Log::Log4perl->get_logger('LedgerSMB::IS');
@@ -392,7 +393,8 @@
 
             my ($dec) = ( $sellprice =~ /\.(\d+)/ );
             $dec = length $dec;
-            my $decimalplaces = ( $dec > 2 ) ? $dec : 2;
+            my $dp = LedgerSMB::Setting->get('decimal_places');
+            my $decimalplaces = ( $dec > $dp ) ? $dec : $dp;
 
             my $discount = $form->round_amount(
                 $sellprice *
@@ -1085,7 +1087,7 @@
             my $fxsellprice =
               $form->parse_amount( $myconfig, $form->{"sellprice_$i"} );
 
-            my $moneyplaces = $LedgerSMB::Sysconfig::decimal_places;
+            my $moneyplaces = LedgerSMB::Setting->get('decimal_places');
             my $decimalplaces = ($form->{"precision_$i"} > $moneyplaces) 
                              ? $form->{"precision_$i"}
                              : $moneyplaces;

Modified: trunk/LedgerSMB/PGNumber.pm
===================================================================
--- trunk/LedgerSMB/PGNumber.pm	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/LedgerSMB/PGNumber.pm	2012-06-21 11:46:22 UTC (rev 4939)
@@ -7,6 +7,7 @@
 use strict;
 use warnings;
 use Number::Format;
+use LedgerSMB::Setting;
 
 package LedgerSMB::PGNumber;
 
@@ -187,7 +188,7 @@
                               : $LedgerSMB::App_State::User->{numberformat};
 
     my $places = undef;
-    $places = $LedgerSMB::Sysconfig::decimal_places if $args{money};
+    $places = LedgerSMB::Setting->get('decimal_places') if $args{money};
     $places = ($args{places}) ? $args{places} : $places;
     my $str = $self->bstr;
     my $dplaces = $places;

Modified: trunk/LedgerSMB/Scripts/configuration.pl
===================================================================
--- trunk/LedgerSMB/Scripts/configuration.pl	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/LedgerSMB/Scripts/configuration.pl	2012-06-21 11:46:22 UTC (rev 4939)
@@ -43,6 +43,10 @@
                              label =>  $locale->text('Company Sales Tax ID') },
    { name => 'company_license_number',
                            label =>  $locale->text('Company License Number') },
+   { name => 'check_max_invoices',
+                           label =>  $locale->text('Max Invoices per Check Stub') },
+   { name => 'decimal_places',
+                           label =>  $locale->text('Decimal Places for Money') },
 );
 
 our @default_others = qw(businessnumber weightunit separate_duties default_language

Modified: trunk/LedgerSMB/Scripts/payment.pm
===================================================================
--- trunk/LedgerSMB/Scripts/payment.pm	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/LedgerSMB/Scripts/payment.pm	2012-06-21 11:46:22 UTC (rev 4939)
@@ -46,6 +46,7 @@
 
 package LedgerSMB::Scripts::payment;
 use LedgerSMB::Template;
+use LedgerSMB::Setting;
 use LedgerSMB::Sysconfig;
 use LedgerSMB::DBObject::Payment;
 use LedgerSMB::DBObject::Date;
@@ -480,13 +481,13 @@
             $check->{source} = $payment->{"source_$id"};
 
             my $inv_count; 
-
-            if ($LedgerSMB::Sysconfig::check_max_invoices > 
-                           $payment->{"invoice_count_$id"})
-            {
+            my $check_max_invoices = LedgerSMB::Setting->get(
+                         'check_max_invoices'
+            );
+            if ($check_max_invoices > $payment->{"invoice_count_$id"}) {
                 $inv_count = $payment->{"invoice_count_$id"};
             } else {
-                $inv_count = $LedgerSMB::Sysconfig::check_max_invoices;
+                $inv_count = $check_max_invoices;
             }
 
             for my $inv (1 .. $payment->{"invoice_count_$id"}){

Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/LedgerSMB/Sysconfig.pm	2012-06-21 11:46:22 UTC (rev 4939)
@@ -45,14 +45,11 @@
 );
 
 # if you have latex installed set to 1
-our $latex = 1;
+our $latex = eval {require LedgerSMB::Template::LaTeX}; 
 
 # Defaults to 1 megabyte
 our $max_post_size = 1024 * 1024;
 
-# defaults to 2-- default number of places to round amounts to
-our $decimal_places = 2;
-
 # defaults to LedgerSMB-1.3 - default spelling of cookie
 our $cookie_name = "LedgerSMB-1.3";
 
@@ -105,8 +102,8 @@
 
 # Root variables
 for my $var (
-    qw(pathsep log_level cssdir DBI_TRACE check_max_invoices language auth latex
-    db_autoupdate force_username_case max_post_size decimal_places cookie_name
+    qw(pathsep log_level cssdir DBI_TRACE check_max_invoices language auth
+    db_autoupdate force_username_case max_post_size cookie_name
     return_accno no_db_str tempdir cache_templates fs_cssdir)
   )
 {

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/LedgerSMB.pm	2012-06-21 11:46:22 UTC (rev 4939)
@@ -591,7 +591,7 @@
         return undef;
     }
     if (!defined $args{precision} and defined $args{money}){
-       $places = $LedgerSMB::Sysconfig::decimal_places;
+       $places = LedgerSMB::Setting->get('decimal_places');
     }
 
     return $amount->to_output({format => $format, 
@@ -623,7 +623,7 @@
     # We will grab the default value, if it isnt defined
     #
     if (!defined $places){
-       $places = ${LedgerSMB::Sysconfig::decimal_places};
+       $places = LedgerSMB::Setting->get('decimal_places');
     }
     
     # These rounding rules follow from the previous implementation.

Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/bin/io.pl	2012-06-21 11:46:22 UTC (rev 4939)
@@ -42,6 +42,7 @@
 use LedgerSMB::Tax;
 use LedgerSMB::Template;
 use LedgerSMB::Sysconfig;
+use LedgerSMB::Setting;
 use LedgerSMB::Company_Config;
 use LedgerSMB::File;
 
@@ -256,7 +257,7 @@
         else {
             ( $null, $dec ) = split /,/, $form->{"sellprice_$i"};
         }
-        my $moneyplaces = $LedgerSMB::Sysconfig::decimal_places;
+        my $moneyplaces = LedgerSMB::Setting->get('decimal_places');
         $dec = length $dec;
         $dec ||= $moneyplaces;
         $form->{"precision_$i"} ||= $dec;
@@ -682,7 +683,7 @@
             $form->{"partsgroup_$i"} =
               qq|$form->{"new_partsgroup_$j"}--$form->{"new_partsgroup_id_$j"}|;
 
-            my $moneyplaces = $LedgerSMB::Sysconfig::decimal_places;
+            my $moneyplaces = LedgerSMB::Setting->get('decimal_places');
             ($dec) = ( $form->{"sellprice_$i"} =~ /\.(\d+)/ );
             $dec = length $dec;
             $dec ||=$moneyplaces;

Modified: trunk/bin/ir.pl
===================================================================
--- trunk/bin/ir.pl	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/bin/ir.pl	2012-06-21 11:46:22 UTC (rev 4939)
@@ -41,6 +41,7 @@
 use LedgerSMB::IR;
 use LedgerSMB::PE;
 use LedgerSMB::Tax;
+use LedgerSMB::Setting;
 
 require "bin/io.pl";
 require "bin/arap.pl";
@@ -313,7 +314,7 @@
             $form->{"discount_$i"} =
               $form->format_amount( \%myconfig, $form->{"discount_$i"} * 100 );
 
-            my $moneyplaces = $LedgerSMB::Sysconfig::decimal_places;
+            my $moneyplaces = LedgerSMB::Setting->get('decimal_places');
             my ($dec) = ($form->{"sellprice_$i"} =~/\.(\d*)/);
             $dec = length $dec;
             $form->{"precision_$i"} ||= $dec;

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/bin/is.pl	2012-06-21 11:46:22 UTC (rev 4939)
@@ -46,6 +46,7 @@
 use LedgerSMB::IS;
 use LedgerSMB::PE;
 use LedgerSMB::Tax;
+use LedgerSMB::Setting;
 
 require "bin/arap.pl";
 require "bin/io.pl";
@@ -312,7 +313,7 @@
             $form->{"discount_$i"} =
               $form->format_amount( \%myconfig, $form->{"discount_$i"} * 100 );
 
-            my $moneyplaces = $LedgerSMB::Sysconfig::decimal_places;
+            my $moneyplaces = LedgerSMB::Setting->get('decimal_places');
             my ($dec) = ($form->{"sellprice_$i"} =~/\.(\d*)/);
             $dec = length $dec;
             $form->{"precision_$i"} = $dec;

Modified: trunk/ledgersmb.conf.default
===================================================================
--- trunk/ledgersmb.conf.default	2012-06-21 08:54:52 UTC (rev 4938)
+++ trunk/ledgersmb.conf.default	2012-06-21 11:46:22 UTC (rev 4939)
@@ -1,7 +1,9 @@
 [main]
 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
+# 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
 
 # This is the logical CSS directory.  I.e. it is what comes before the 
@@ -22,18 +24,9 @@
 # For Windows, uncomment the pathsep line=
 # pathsep = ;
 
-# If you have LaTeX installed, set to 1
-latex = 1
-
-# Maximum number of invoices that can be printed on a cheque
-check_max_invoices = 5
-
 # Maximum POST size to prevent DoS (4MB default)
 max_post_size = 4194304
 
-# Define global settings for decimal places
-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

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