summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: e01618cc81edc147c7f03463474c4fae07bfdb41 (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 ledgersmb.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 = (
  16. 'aa.pl', 'admin.pl', 'am.pl', 'ap.pl',
  17. 'ar.pl', 'arap.pl', 'arapprn.pl', 'bp.pl',
  18. 'ca.pl', 'cp.pl', 'ct.pl', 'gl.pl',
  19. 'hr.pl', 'ic.pl', 'io.pl', 'ir.pl',
  20. 'is.pl', 'jc.pl', 'login.pl', 'menu.pl',
  21. 'oe.pl', 'pe.pl', 'pos.pl', 'ps.pl',
  22. 'pw.pl', 'rc.pl', 'rp.pl'
  23. );
  24. # if you have latex installed set to 1
  25. $latex = 1;
  26. # spool directory for batch printing
  27. $spool = "spool";
  28. # path to user configuration files
  29. $userspath = "users";
  30. # templates base directory
  31. $templates = "templates";
  32. # Temporary files stored at"
  33. $tempdir = ( $ENV{TEMP} || '/tmp' );
  34. # Backup path
  35. $backuppath = $tempdir;
  36. # member file
  37. $memberfile = "users/members";
  38. # location of sendmail
  39. $sendmail = "/usr/sbin/sendmail -t";
  40. # SMTP settings
  41. $smtphost = '';
  42. $smtptimout = 60;
  43. # set language for login and admin
  44. $language = "";
  45. # Maximum number of invoices that can be printed on a check
  46. $check_max_invoices = 5;
  47. # program to use for file compression
  48. $gzip = "gzip -S .gz";
  49. # Path to the translation files
  50. $localepath = 'locale/po';
  51. # available printers
  52. %printer = (
  53. Laser => 'lpr -Plaser',
  54. Epson => 'lpr -PEpson',
  55. );
  56. my %config;
  57. read_config( 'ledgersmb.conf' => %config ) or die;
  58. # Root variables
  59. for $var (
  60. qw(pathsep logging check_max_invoices language session latex
  61. db_autoupdate)
  62. )
  63. {
  64. ${$var} = $config{''}{$var} if $config{''}{$var};
  65. }
  66. %printer = %{ $config{printers} } if $config{printers};
  67. # ENV Paths
  68. for $var (qw(PATH PERL5LIB)) {
  69. $ENV{$var} .= $pathsep . ( join $pathsep, @{ $config{environment}{$var} } )
  70. if $config{environment}{$var};
  71. }
  72. # Application-specific paths
  73. for $var (qw(localepath spool templates images)) {
  74. ${$var} = $config{paths}{$var} if $config{paths}{$var};
  75. }
  76. # Programs
  77. for $var (qw(gzip)) {
  78. ${$var} = $config{programs}{$var} if $config{programs}{$var};
  79. }
  80. # mail configuration
  81. for $var (qw(sendmail smpthost smtptimeout)) {
  82. ${$var} = $config{mail}{$var} if $config{mail}{$var};
  83. }
  84. # We used to have a global dbconnect but have moved to single entries
  85. for $var (qw(DBhost DBport DBname DBUserName DBPassword)) {
  86. ${ "global" . $var } = $config{globaldb}{$var} if $config{globaldb}{$var};
  87. }
  88. #putting this in an if clause for now so not to break other devel users
  89. if ( $config{globaldb}{DBname} ) {
  90. my $dbconnect = "dbi:Pg:dbname=$globalDBname host=$globalDBhost
  91. port=$globalDBport user=$globalDBUserName
  92. password=$globalDBPassword"; # for easier debugging
  93. $GLOBALDBH = DBI->connect($dbconnect);
  94. if ( !$GLOBALDBH ) {
  95. $form = new Form;
  96. $form->error("No GlobalDBH Configured or Could not Connect");
  97. }
  98. $GLOBALDBH->{pg_enable_utf8} = 1;
  99. }
  100. # These lines prevent other apps in mod_perl from seeing the global db
  101. # connection info
  102. my $globalDBConnect = undef;
  103. my $globalUserName = undef;
  104. my $globalPassword = undef;
  105. 1;