summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: bfb9c890fc934e57b30dad448f69828f5458ea33 (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. db_autoupdate)){
  53. ${$var} = $config{''}{$var} if $config{''}{$var};
  54. }
  55. %printer = %{$config{printers}} if $config{printers};
  56. # ENV Paths
  57. for $var (qw(PATH PERL5LIB)){
  58. $ENV{$var} .= $pathsep.(join $pathsep, @{$config{environment}{$var}}) if
  59. $config{environment}{$var};
  60. }
  61. # Application-specific paths
  62. for $var (qw(localepath spool templates images)){
  63. ${$var} = $config{paths}{$var} if $config{paths}{$var};
  64. }
  65. # Programs
  66. for $var (qw(gzip)){
  67. ${$var} = $config{programs}{$var} if $config{programs}{$var};
  68. }
  69. # mail configuration
  70. for $var (qw(sendmail smpthost smtptimeout)){
  71. ${$var} = $config{mail}{$var} if $config{mail}{$var};
  72. }
  73. # We used to have a global dbconnect but have moved to single entries
  74. for $var (qw(DBhost DBport DBname DBUserName DBPassword)){
  75. ${"global".$var} = $config{globaldb}{$var} if $config{globaldb}{$var};
  76. }
  77. #putting this in an if clause for now so not to break other devel users
  78. if ($config{globaldb}{DBname}){
  79. my $dbconnect = "dbi:Pg:dbname=$globalDBname host=$globalDBhost
  80. port=$globalDBport user=$globalDBUserName
  81. password=$globalDBPassword"; # for easier debugging
  82. $GLOBALDBH = DBI->connect($dbconnect);
  83. if (!$GLOBALDBH){
  84. $form = new Form;
  85. $form->error("No GlobalDBH Configured or Could not Connect");
  86. }
  87. }
  88. # These lines prevent other apps in mod_perl from seeing the global db
  89. # connection info
  90. my $globalDBConnect = undef;
  91. my $globalUserName = undef;
  92. my $globalPassword = undef;
  93. 1;