summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: d7d708a41d2bc722f479ecab56f3c05d79ecf197 (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('ledger-smb.conf' => %config) or die;
  50. $logging = $config{''}{logging} if $config{''}{logging};
  51. $check_max_invoices = $config{''}{check_max_invoices} if
  52. $config{''}{check_max_invoices};
  53. $language = $config{''}{language} if $config{''}{language};
  54. $session = $config{''}{session} if $config{''}{session};
  55. $latex = $config{''}{latex} if $config{''}{latex};
  56. $ENV{PATH} .= $pathsep.(join $pathsep, @{$config{environment}{PATH}}) if
  57. $config{environment}{PATH};
  58. $ENV{PERL5LIB} .= ":".(join ':', @{$config{environment}{PERL5LIB}}) if
  59. $config{environment}{PERL5LIB};
  60. %printer = %{$config{printers}} if $config{printers};
  61. $memberfile = $config{paths}{memberfile} if $config{paths}{memberfile};
  62. $userspath = $config{paths}{userspath} if $config{paths}{userspath};
  63. $localepath = $config{paths}{localepath} if $config{paths}{localepath};
  64. $spool = $config{paths}{spool} if $config{paths}{spool};
  65. $templates = $config{paths}{templates} if $config{paths}{templates};
  66. $images = $config{paths}{images} if $config{paths}{images};
  67. $gzip = $config{programs}{gzip} if $config{programs}{gzip};
  68. $sendmail = $config{mail}{sendmail} if $config{mail}{sendmail};
  69. $smtphost = $config{mail}{smtphost} if $config{mail}{smtphost};
  70. $smtptimeout = $config{mail}{smtptimeout} if $config{mail}{smtptimeout};
  71. $globalDBConnect = $config{globaldb}{DBConnect} if $config{globaldb}{DBConnect};
  72. $globalDBUserName = $config{globaldb}{DBUserName} if $config{globaldb}{DBUserName};
  73. $globalDBPassword = $config{globaldb}{DBPassword} if $config{globaldb}{DBPassword};
  74. #putting this in an if clause for now so not to break other devel users
  75. if ($config{globaldb}{DBConnect}){
  76. $GLOBALDBH = DBI->connect($globalDBConnect, $globalDBUserName,
  77. $globalDBPassword);
  78. if (!$GLOBALDBH){
  79. $form = new Form;
  80. $form->error("No GlobalDBH Configured or Could not Connect");
  81. }
  82. }
  83. # These lines prevent other apps in mod_perl from seeing the global db
  84. # connection info
  85. my $globalDBConnect = undef;
  86. my $globalUserName = undef;
  87. my $globalPassword = undef;
  88. 1;