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