summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: 1634bfccee60184c7257ff9ae04d6cef0e74a9c3 (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. # For Win32, change $pathsep to ';';
  9. $pathsep=':';
  10. $session='DB';
  11. $logging=0; # No logging on by default
  12. @io_lineitem_columns = qw(unit onhand sellprice discount linetotal);
  13. # Whitelist for redirect destination
  14. @scripts = ('aa.pl', 'admin.pl', 'am.pl', 'ap.pl', 'ar.pl', 'arap.pl',
  15. 'arapprn.pl', 'bp.pl', 'ca.pl', 'cp.pl', 'ct.pl', 'gl.pl', 'hr.pl',
  16. 'ic.pl', 'io.pl', 'ir.pl', 'is.pl', 'jc.pl', 'login.pl', 'menu.pl',
  17. 'oe.pl', 'pe.pl', 'pos.pl', 'ps.pl', 'pw.pl', 'rc.pl', 'rp.pl');
  18. # if you have latex installed set to 1
  19. $latex = 1;
  20. # spool directory for batch printing
  21. $spool = "spool";
  22. # path to user configuration files
  23. $userspath = "users";
  24. # templates base directory
  25. $templates = "templates";
  26. # member file
  27. $memberfile = "users/members";
  28. # location of sendmail
  29. $sendmail = "/usr/sbin/sendmail -t";
  30. # SMTP settings
  31. $smtphost = '';
  32. $smtptimout = 60;
  33. # set language for login and admin
  34. $language = "";
  35. # Maximum number of invoices that can be printed on a check
  36. $check_max_invoices = 5;
  37. # program to use for file compression
  38. $gzip = "gzip -S .gz";
  39. # Path to the translation files
  40. $localepath = 'locale/po';
  41. # available printers
  42. %printer = ( Laser => 'lpr -Plaser',
  43. Epson => 'lpr -PEpson',
  44. );
  45. my %config;
  46. read_config('ledger-smb.conf' => %config) or die;
  47. $logging = $config{''}{logging} if $config{''}{logging};
  48. $check_max_invoices = $config{''}{check_max_invoices} if
  49. $config{''}{check_max_invoices};
  50. $language = $config{''}{language} if $config{''}{language};
  51. $session = $config{''}{session} if $config{''}{session};
  52. $latex = $config{''}{latex} if $config{''}{latex};
  53. $ENV{PATH} .= $pathsep.(join $pathsep, @{$config{environment}{PATH}}) if
  54. $config{environment}{PATH};
  55. $ENV{PERL5LIB} .= ":".(join ':', @{$config{environment}{PERL5LIB}}) if
  56. $config{environment}{PERL5LIB};
  57. %printer = %{$config{printers}} if $config{printers};
  58. $memberfile = $config{paths}{memberfile} if $config{paths}{memberfile};
  59. $userspath = $config{paths}{userspath} if $config{paths}{userspath};
  60. $localepath = $config{paths}{localepath} if $config{paths}{localepath};
  61. $spool = $config{paths}{spool} if $config{paths}{spool};
  62. $templates = $config{paths}{templates} if $config{paths}{templates};
  63. $gzip = $config{programs}{gzip} if $config{programs}{gzip};
  64. $sendmail = $config{mail}{sendmail} if $config{mail}{sendmail};
  65. $smtphost = $config{mail}{smtphost} if $config{mail}{smtphost};
  66. $smtptimeout = $config{mail}{smtptimeout} if $config{mail}{smtptimeout};
  67. $globalDBConnect = $config{globaldb}{DBConnect} if $config{globaldb}{DBConnect};
  68. $globalDBUserName = $config{globaldb}{DBUserName} if $config{globaldb}{DBUserName};
  69. $globalDBPassword = $config{globaldb}{DBPassword} if $config{globaldb}{DBPassword};
  70. #putting this in an if clause for now so not to break other devel users
  71. if ($config{globaldb}{DBConnect}){
  72. $GLOBALDBH = DBI->connect($globalDBConnect, $globalDBUserName,
  73. $globalDBPassword);
  74. if (!$GLOBALDBH){
  75. $form = new Form;
  76. $form->error("No GlobalDBH Configured or Could not Connect");
  77. }
  78. }
  79. # These lines prevent other apps in mod_perl from seeing the global db
  80. # connection info
  81. my $globalDBConnect = undef;
  82. my $globalUserName = undef;
  83. my $globalPassword = undef;
  84. 1;