summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: 1d653465b1c892365395d279fa97ce78366837db (plain)
  1. #  This is the new configuration file for LedgerSMB. Eventually all system
  2. # configuration directives will go here, This will probably not fully replace
  3. # the ledger-smb.conf until 1.3, however.
  4. package LedgerSMB::Sysconfig;
  5. use LedgerSMB::Form;
  6. use Config::Std;
  7. use DBI qw(:sql_types);
  8. binmode STDOUT, ':utf8';
  9. # For Win32, change $pathsep to ';';
  10. $pathsep=':';
  11. $session='DB';
  12. $logging=0; # No logging on by default
  13. @io_lineitem_columns = qw(unit onhand sellprice discount linetotal);
  14. # Whitelist for redirect destination
  15. @scripts = ('aa.pl', 'admin.pl', 'am.pl', 'ap.pl', 'ar.pl', 'arap.pl',
  16. 'arapprn.pl', 'bp.pl', 'ca.pl', 'cp.pl', 'ct.pl', 'gl.pl', 'hr.pl',
  17. 'ic.pl', 'io.pl', 'ir.pl', 'is.pl', 'jc.pl', 'login.pl', 'menu.pl',
  18. 'oe.pl', 'pe.pl', 'pos.pl', 'ps.pl', 'pw.pl', 'rc.pl', 'rp.pl');
  19. # if you have latex installed set to 1
  20. $latex = 1;
  21. # spool directory for batch printing
  22. $spool = "spool";
  23. # path to user configuration files
  24. $userspath = "users";
  25. # images base directory
  26. $images = "images";
  27. # templates base directory
  28. $templates = "templates";
  29. # member file
  30. $memberfile = "users/members";
  31. # location of sendmail
  32. $sendmail = "/usr/sbin/sendmail -t";
  33. # SMTP settings
  34. $smtphost = '';
  35. $smtptimout = 60;
  36. # set language for login and admin
  37. $language = "";
  38. # Maximum number of invoices that can be printed on a check
  39. $check_max_invoices = 5;
  40. # program to use for file compression
  41. $gzip = "gzip -S .gz";
  42. # Path to the translation files
  43. $localepath = 'locale/po';
  44. # available printers
  45. %printer = ( Laser => 'lpr -Plaser',
  46. Epson => 'lpr -PEpson',
  47. );
  48. my %config;
  49. read_config('ledgersmb.conf' => %config) or die;
  50. # Root variables
  51. for $var (qw(pathsep logging check_max_invoices language session latex)){
  52. ${$var} = $config{''}{$var} if $config{''}{$var};
  53. }
  54. %printer = %{$config{printers}} if $config{printers};
  55. # ENV Paths
  56. for $var (qw(PATH PERL5LIB)){
  57. $ENV{$var} .= $pathsep.(join $pathsep, @{$config{environment}{$var}}) if
  58. $config{environment}{$var};
  59. }
  60. # Application-specific paths
  61. for $var (qw(localepath spool templates images)){
  62. ${$var} = $config{paths}{$var} if $config{paths}{$var};
  63. }
  64. # Programs
  65. for $var (qw(gzip)){
  66. ${$var} = $config{programs}{$var} if $config{programs}{$var};
  67. }
  68. # mail configuration
  69. for $var (qw(sendmail smpthost smtptimeout)){
  70. ${$var} = $config{mail}{$var} if $config{mail}{$var};
  71. }
  72. # We used to have a global dbconnect but have moved to single entries
  73. for $var (qw(DBhost DBport DBname DBUserName DBPassword)){
  74. ${"global".$var} = $config{globaldb}{$var} if $config{globaldb}{$var};
  75. }
  76. #putting this in an if clause for now so not to break other devel users
  77. if ($config{globaldb}{DBname}){
  78. my $dbconnect = "dbi:Pg:dbname=$globalDBname host=$globalDBhost
  79. port=$globalDBport user=$globalDBUserName
  80. password=$globalDBPassword"; # for easier debugging
  81. $GLOBALDBH = DBI->connect($dbconnect);
  82. if (!$GLOBALDBH){
  83. $form = new Form;
  84. $form->error("No GlobalDBH Configured or Could not Connect");
  85. }
  86. }
  87. # These lines prevent other apps in mod_perl from seeing the global db
  88. # connection info
  89. my $globalDBConnect = undef;
  90. my $globalUserName = undef;
  91. my $globalPassword = undef;
  92. 1;