summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-24 00:01:16 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-24 00:01:16 +0000
commitc3c9871298597e417d67f691fca24cd913ef802a (patch)
treec743f476ab241b97069518fbd90f89a1f2ae5f00
parent0dc5b99d6e3bd63c2e20e131b39b38503add2dc0 (diff)
Moved all scalars out of ledger-smb.conf
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@268 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB/AA.pm10
-rwxr-xr-xLedgerSMB/AM.pm24
-rwxr-xr-xLedgerSMB/BP.pm10
-rwxr-xr-xLedgerSMB/CP.pm6
-rwxr-xr-xLedgerSMB/Form.pm14
-rwxr-xr-xLedgerSMB/IR.pm10
-rwxr-xr-xLedgerSMB/IS.pm12
-rwxr-xr-xLedgerSMB/JC.pm10
-rw-r--r--LedgerSMB/Log.pm2
-rwxr-xr-xLedgerSMB/OE.pm12
-rwxr-xr-xLedgerSMB/Session.pm6
-rw-r--r--LedgerSMB/Sysconfig.pm40
-rwxr-xr-xLedgerSMB/User.pm16
-rwxr-xr-xadmin.pl2
-rwxr-xr-xbin/aa.pl8
-rwxr-xr-xbin/admin.pl74
-rwxr-xr-xbin/am.pl14
-rwxr-xr-xbin/arap.pl2
-rwxr-xr-xbin/arapprn.pl18
-rwxr-xr-xbin/bp.pl12
-rwxr-xr-xbin/cp.pl14
-rwxr-xr-xbin/hr.pl4
-rwxr-xr-xbin/io.pl16
-rwxr-xr-xbin/is.pl6
-rwxr-xr-xbin/jc.pl18
-rwxr-xr-xbin/login.pl12
-rwxr-xr-xbin/oe.pl6
-rwxr-xr-xbin/pe.pl2
-rwxr-xr-xbin/pos.pl4
-rwxr-xr-xbin/rp.pl10
-rw-r--r--ledger-smb.conf39
-rwxr-xr-xlogin.pl2
-rwxr-xr-xmenu.pl2
33 files changed, 218 insertions, 219 deletions
diff --git a/LedgerSMB/AA.pm b/LedgerSMB/AA.pm
index bf6c7224..8772a59a 100755
--- a/LedgerSMB/AA.pm
+++ b/LedgerSMB/AA.pm
@@ -595,11 +595,11 @@ sub delete_transaction {
my $sth = $dbh->prepare($query);
$sth->execute($form->{id}) || $form->dberror($query);
- my $spoolfile;
+ my ${LedgerSMB::Sysconfig::spool}file;
my @spoolfiles = ();
- while (($spoolfile) = $sth->fetchrow_array) {
- push @spoolfiles, $spoolfile;
+ while ((${LedgerSMB::Sysconfig::spool}file) = $sth->fetchrow_array) {
+ push @spoolfiles, ${LedgerSMB::Sysconfig::spool}file;
}
$sth->finish;
@@ -611,8 +611,8 @@ sub delete_transaction {
my $rc = $dbh->commit;
if ($rc) {
- foreach $spoolfile (@spoolfiles) {
- unlink "$spool/$spoolfile" if $spoolfile;
+ foreach ${LedgerSMB::Sysconfig::spool}file (@spoolfiles) {
+ unlink "${LedgerSMB::Sysconfig::spool}/$spoolfile" if $spoolfile;
}
}
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm
index 57c75cb3..63c7e0b5 100755
--- a/LedgerSMB/AM.pm
+++ b/LedgerSMB/AM.pm
@@ -1238,9 +1238,9 @@ sub check_template_name {
if ($form->{file} =~ /^(.:)*?\/|\.\.\/|^\//){
$form->error("Directory transversal not allowed.");
}
- my $userspath = ${main::userspath};
- if ($form->{file} =~ /^$userspath\//){
- $form->error("Not allowed to access $userspath/ with this method");
+ my ${LedgerSMB::Sysconfig::userspath} = ${main::userspath};
+ if ($form->{file} =~ /^${LedgerSMB::Sysconfig::userspath}\//){
+ $form->error("Not allowed to access ${LedgerSMB::Sysconfig::userspath}/ with this method");
}
my $whitelisted = 0;
for (@allowedsuff){
@@ -1292,7 +1292,7 @@ sub save_template {
sub save_preferences {
- my ($self, $myconfig, $form, $memberfile, $userspath) = @_;
+ my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::memberfile}, ${LedgerSMB::Sysconfig::userspath}) = @_;
# connect to database
my $dbh = $form->{dbh};
@@ -1317,7 +1317,7 @@ sub save_preferences {
$dbh->commit;
- my $myconfig = new User "$memberfile", "$form->{login}";
+ my $myconfig = new User "${LedgerSMB::Sysconfig::memberfile}", "$form->{login}";
foreach my $item (keys %$form) {
$myconfig->{$item} = $form->{$item};
@@ -1325,7 +1325,7 @@ sub save_preferences {
$myconfig->{password} = $form->{new_password} if ($form->{old_password} ne $form->{new_password});
- $myconfig->save_member($memberfile, $userspath);
+ $myconfig->save_member(${LedgerSMB::Sysconfig::memberfile}, ${LedgerSMB::Sysconfig::userspath});
1;
@@ -1565,7 +1565,7 @@ sub save_taxes {
sub backup {
- my ($self, $myconfig, $form, $userspath, $gzip) = @_;
+ my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::userspath}, ${LedgerSMB::Sysconfig::gzip}) = @_;
my $mail;
my $err;
@@ -1577,7 +1577,7 @@ sub backup {
$t[4] = substr("0$t[4]", -2);
my $boundary = time;
- my $tmpfile = "$userspath/$boundary.$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql";
+ my $tmpfile = "${LedgerSMB::Sysconfig::userspath}/$boundary.$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql";
my $out = $form->{OUT};
$form->{OUT} = ">$tmpfile";
@@ -1596,8 +1596,8 @@ sub backup {
my $suffix = "";
if ($form->{media} eq 'email') {
- if ($gzip){
- print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname} | $gzip`;
+ if (${LedgerSMB::Sysconfig::gzip}){
+ print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname} | ${LedgerSMB::Sysconfig::gzip}`;
} else {
print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname}`;
}
@@ -1625,8 +1625,8 @@ sub backup {
print OUT qq|Content-Type: application/file;\n| .
qq|Content-Disposition: attachment; filename="$myconfig->{dbname}-$form->{dbversion}-$t[5]$t[4]$t[3].sql$suffix"\n\n|;
- if ($gzip){
- print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname} | $gzip`;
+ if (${LedgerSMB::Sysconfig::gzip}){
+ print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname} | ${LedgerSMB::Sysconfig::gzip}`;
} else {
print OUT `pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} $myconfig->{dbname}`;
}
diff --git a/LedgerSMB/BP.pm b/LedgerSMB/BP.pm
index 3821cd87..d902be91 100755
--- a/LedgerSMB/BP.pm
+++ b/LedgerSMB/BP.pm
@@ -242,7 +242,7 @@ sub get_spoolfiles {
sub delete_spool {
- my ($self, $myconfig, $form, $spool) = @_;
+ my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::spool}) = @_;
# connect to database, turn AutoCommit off
my $dbh = $form->dbconnect_noauto($myconfig);
@@ -278,7 +278,7 @@ sub delete_spool {
if ($rc) {
foreach my $i (1 .. $form->{rowcount}) {
- $_ = qq|$spool/$form->{"spoolfile_$i"}|;
+ $_ = qq|${LedgerSMB::Sysconfig::spool}/$form->{"spoolfile_$i"}|;
if ($form->{"checked_$i"}) {
unlink;
}
@@ -291,7 +291,7 @@ sub delete_spool {
sub print_spool {
- my ($self, $myconfig, $form, $spool) = @_;
+ my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::spool}) = @_;
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
@@ -310,10 +310,10 @@ sub print_spool {
open(OUT, $form->{OUT}) or $form->error("$form->{OUT} : $!");
binmode(OUT);
- $spoolfile = qq|$spool/$form->{"spoolfile_$i"}|;
+ ${LedgerSMB::Sysconfig::spool}file = qq|$spool/$form->{"spoolfile_$i"}|;
# send file to printer
- open(IN, $spoolfile) or $form->error("$spoolfile : $!");
+ open(IN, ${LedgerSMB::Sysconfig::spool}file) or $form->error("$spoolfile : $!");
binmode(IN);
while (<IN>) {
diff --git a/LedgerSMB/CP.pm b/LedgerSMB/CP.pm
index 9db05ce6..f3ff50fa 100755
--- a/LedgerSMB/CP.pm
+++ b/LedgerSMB/CP.pm
@@ -266,7 +266,7 @@ sub get_openinvoices {
my $vth = $dbh->prepare($query);
- my $spoolfile;
+ my ${LedgerSMB::Sysconfig::spool}file;
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
@@ -276,8 +276,8 @@ sub get_openinvoices {
$vth->execute($ref->{id});
$ref->{queue} = "";
- while (($spoolfile) = $vth->fetchrow_array) {
- $ref->{queued} .= "$form->{formname} $spoolfile ";
+ while ((${LedgerSMB::Sysconfig::spool}file) = $vth->fetchrow_array) {
+ $ref->{queued} .= "$form->{formname} ${LedgerSMB::Sysconfig::spool}file ";
}
$vth->finish;
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index b42f68bb..6f4ee35e 100755
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -570,7 +570,7 @@ sub get_my_emp_num {
sub parse_template {
- my ($self, $myconfig, $userspath) = @_;
+ my ($self, $myconfig, ${LedgerSMB::Sysconfig::userspath}) = @_;
my ($chars_per_line, $lines_on_first_page, $lines_on_second_page) = (0, 0, 0);
my ($current_page, $current_line) = (1, 1);
@@ -605,7 +605,7 @@ sub parse_template {
my $fileid = time;
my $tmpfile = $self->{IN};
$tmpfile =~ s/\./_$self->{fileid}./ if $self->{fileid};
- $self->{tmpfile} = "$userspath/${fileid}_${tmpfile}";
+ $self->{tmpfile} = "${LedgerSMB::Sysconfig::userspath}/${fileid}_${tmpfile}";
if ($self->{format} =~ /(postscript|pdf)/ || $self->{media} eq 'email') {
$out = $self->{OUT};
@@ -822,15 +822,15 @@ sub parse_template {
use Cwd;
$self->{cwd} = cwd();
- $self->{tmpdir} = "$self->{cwd}/$userspath";
+ $self->{tmpdir} = "$self->{cwd}/${LedgerSMB::Sysconfig::userspath}";
- unless (chdir("$userspath")) {
+ unless (chdir("${LedgerSMB::Sysconfig::userspath}")) {
$err = $!;
$self->cleanup;
$self->error("chdir : $err");
}
- $self->{tmpfile} =~ s/$userspath\///g;
+ $self->{tmpfile} =~ s/${LedgerSMB::Sysconfig::userspath}\///g;
$self->{errfile} = $self->{tmpfile};
$self->{errfile} =~ s/tex$/err/;
@@ -2407,7 +2407,7 @@ sub update_status {
my $dbh = $self->{dbh};
my %queued = split / +/, $self->{queued};
- my $spoolfile = ($queued{$self->{formname}}) ? "'$queued{$self->{formname}}'" : 'NULL';
+ my ${LedgerSMB::Sysconfig::spool}file = ($queued{$self->{formname}}) ? "'$queued{$self->{formname}}'" : 'NULL';
my $query = qq|DELETE FROM status
WHERE formname = ?
@@ -2427,7 +2427,7 @@ sub update_status {
VALUES (?, ?, ?, ?, ?)|;
$sth = $dbh->prepare($query);
- $sth->execute($self->{id}, $printed, $emailed, $spoolfile,
+ $sth->execute($self->{id}, $printed, $emailed, ${LedgerSMB::Sysconfig::spool}file,
$self->{formname});
$sth->finish;
diff --git a/LedgerSMB/IR.pm b/LedgerSMB/IR.pm
index 9f2da830..d2703958 100755
--- a/LedgerSMB/IR.pm
+++ b/LedgerSMB/IR.pm
@@ -703,11 +703,11 @@ sub delete_invoice {
my $sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- my $spoolfile;
+ my ${LedgerSMB::Sysconfig::spool}file;
my @spoolfiles = ();
- while (($spoolfile) = $sth->fetchrow_array) {
- push @spoolfiles, $spoolfile;
+ while ((${LedgerSMB::Sysconfig::spool}file) = $sth->fetchrow_array) {
+ push @spoolfiles, ${LedgerSMB::Sysconfig::spool}file;
}
$sth->finish;
@@ -728,8 +728,8 @@ sub delete_invoice {
$dbh->commit;
}
- foreach $spoolfile (@spoolfiles) {
- unlink "$spool/$spoolfile" if $spoolfile;
+ foreach ${LedgerSMB::Sysconfig::spool}file (@spoolfiles) {
+ unlink "${LedgerSMB::Sysconfig::spool}/$spoolfile" if $spoolfile;
}
}
diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm
index 0b38b3a8..96aafdac 100755
--- a/LedgerSMB/IS.pm
+++ b/LedgerSMB/IS.pm
@@ -1224,7 +1224,7 @@ sub reverse_invoice {
sub delete_invoice {
- my ($self, $myconfig, $form, $spool) = @_;
+ my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::spool}) = @_;
# connect to database
my $dbh = $form->dbconnect_noauto($myconfig);
@@ -1251,11 +1251,11 @@ sub delete_invoice {
my $sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- my $spoolfile;
+ my ${LedgerSMB::Sysconfig::spool}file;
my @spoolfiles = ();
- while (($spoolfile) = $sth->fetchrow_array) {
- push @spoolfiles, $spoolfile;
+ while ((${LedgerSMB::Sysconfig::spool}file) = $sth->fetchrow_array) {
+ push @spoolfiles, ${LedgerSMB::Sysconfig::spool}file;
}
$sth->finish;
@@ -1267,8 +1267,8 @@ sub delete_invoice {
my $rc = $dbh->commit;
if ($rc) {
- foreach $spoolfile (@spoolfiles) {
- unlink "$spool/$spoolfile" if $spoolfile;
+ foreach ${LedgerSMB::Sysconfig::spool}file (@spoolfiles) {
+ unlink "${LedgerSMB::Sysconfig::spool}/$spoolfile" if $spoolfile;
}
}
diff --git a/LedgerSMB/JC.pm b/LedgerSMB/JC.pm
index 02fcb914..37ed40d1 100755
--- a/LedgerSMB/JC.pm
+++ b/LedgerSMB/JC.pm
@@ -308,11 +308,11 @@ sub delete_timecard {
my $sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- my $spoolfile;
+ my ${LedgerSMB::Sysconfig::spool}file;
my @spoolfiles = ();
- while (($spoolfile) = $sth->fetchrow_array) {
- push @spoolfiles, $spoolfile;
+ while ((${LedgerSMB::Sysconfig::spool}file) = $sth->fetchrow_array) {
+ push @spoolfiles, ${LedgerSMB::Sysconfig::spool}file;
}
$sth->finish;
@@ -325,8 +325,8 @@ sub delete_timecard {
my $rc = $dbh->commit;
if ($rc) {
- foreach $spoolfile (@spoolfiles) {
- unlink "$spool/$spoolfile" if $spoolfile;
+ foreach ${LedgerSMB::Sysconfig::spool}file (@spoolfiles) {
+ unlink "${LedgerSMB::Sysconfig::spool}/$spoolfile" if $spoolfile;
}
}
diff --git a/LedgerSMB/Log.pm b/LedgerSMB/Log.pm
index 954a1a6b..235a2ded 100644
--- a/LedgerSMB/Log.pm
+++ b/LedgerSMB/Log.pm
@@ -46,7 +46,7 @@ use LedgerSMB::Sysconfig;
our $fh;
sub print {
- if (!$LSMBConfig::logging){
+ if (!$LedgerSMB::Sysconfig::logging){
return 0;
}
shift;
diff --git a/LedgerSMB/OE.pm b/LedgerSMB/OE.pm
index 0d9ab99d..0dfd2937 100755
--- a/LedgerSMB/OE.pm
+++ b/LedgerSMB/OE.pm
@@ -665,7 +665,7 @@ sub save {
sub delete {
- my ($self, $myconfig, $form, $spool) = @_;
+ my ($self, $myconfig, $form, ${LedgerSMB::Sysconfig::spool}) = @_;
# connect to database
my $dbh = $form->{dbh};
@@ -678,11 +678,11 @@ sub delete {
$sth = $dbh->prepare($query);
$sth->execute($form->{id}) || $form->dberror($query);
- my $spoolfile;
+ my ${LedgerSMB::Sysconfig::spool}file;
my @spoolfiles = ();
- while (($spoolfile) = $sth->fetchrow_array) {
- push @spoolfiles, $spoolfile;
+ while ((${LedgerSMB::Sysconfig::spool}file) = $sth->fetchrow_array) {
+ push @spoolfiles, ${LedgerSMB::Sysconfig::spool}file;
}
$sth->finish;
@@ -751,8 +751,8 @@ sub delete {
$dbh->disconnect;
if ($rc) {
- foreach $spoolfile (@spoolfiles) {
- unlink "$spool/$spoolfile" if $spoolfile;
+ foreach ${LedgerSMB::Sysconfig::spool}file (@spoolfiles) {
+ unlink "${LedgerSMB::Sysconfig::spool}/$spoolfile" if $spoolfile;
}
}
diff --git a/LedgerSMB/Session.pm b/LedgerSMB/Session.pm
index 39de16e6..76ed27ce 100755
--- a/LedgerSMB/Session.pm
+++ b/LedgerSMB/Session.pm
@@ -16,8 +16,8 @@ package Session;
use LedgerSMB::Sysconfig;
-if (!${LSMBConfig::session}){
- ${LSMBConfig::session} = 'DB';
+if (!${LedgerSMB::Sysconfig::session}){
+ ${LedgerSMB::Sysconfig::session} = 'DB';
}
-require "LedgerSMB/Session/".${LSMBConfig::session}.".pm";
+require "LedgerSMB/Session/".${LedgerSMB::Sysconfig::session}.".pm";
diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm
index 7d0f56fe..aaab3319 100644
--- a/LedgerSMB/Sysconfig.pm
+++ b/LedgerSMB/Sysconfig.pm
@@ -2,12 +2,50 @@
# configuration directives will go here, This will probably not fully replace
# the ledger-smb.conf until 1.3, however.
-package LSMBConfig;
+package LedgerSMB::Sysconfig;
$session='DB';
$logging=0; # No logging on by default
@io_lineitem_columns = qw(unit onhand sellprice discount linetotal);
+# if you have latex installed set to 1
+$latex = 1;
+
+# spool directory for batch printing
+$spool = "spool";
+
+# path to user configuration files
+$userspath = "users";
+
+# templates base directory
+$templates = "templates";
+
+# member file
+$memberfile = "users/members";
+
+# location of sendmail
+$sendmail = "| /usr/sbin/sendmail -t";
+
+# set language for login and admin
+$language = "";
+
+# Maximum number of invoices that can be printed on a check
+$check_max_invoices = 5;
+
+# program to use for file compression
+$gzip = "gzip -S .gz";
+
+#################################
+# Global database parameters
+#################################
+# These parameters *must* be set correctly
+# for LedgerSMB >= 1.2 to work
+my $globalDBConnect = 'dbi:Pg:dbname=ledgersmb;host=localhost;port=5432';
+my $globalUserName = "ledgersmb";
+my $globalPassword = "set me to correct password";
+
+#$GLOBALDBH = DBI->connect($globalDBConnect, $globalDBUserName, $globalDBPassword);
+
1;
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm
index 7f3549c0..52516885 100755
--- a/LedgerSMB/User.pm
+++ b/LedgerSMB/User.pm
@@ -98,7 +98,7 @@ sub country_codes {
sub login {
- my ($self, $form, $userspath) = @_;
+ my ($self, $form, ${LedgerSMB::Sysconfig::userspath}) = @_;
my $rc = -1;
@@ -112,9 +112,9 @@ sub login {
}
#there shouldn't be any harm in always doing this. It might even un-bork things.
- $self->create_config("$userspath/$self->{login}.conf");
+ $self->create_config("${LedgerSMB::Sysconfig::userspath}/$self->{login}.conf");
- do "$userspath/$self->{login}.conf";
+ do "${LedgerSMB::Sysconfig::userspath}/$self->{login}.conf";
$myconfig{dbpasswd} = unpack 'u', $myconfig{dbpasswd};
# check if database is down
@@ -752,18 +752,18 @@ sub create_config {
sub save_member {
- my ($self, $memberfile, $userspath) = @_;
+ my ($self, ${LedgerSMB::Sysconfig::memberfile}, ${LedgerSMB::Sysconfig::userspath}) = @_;
# format dbconnect and dboptions string
&dbconnect_vars($self, $self->{dbname});
- $self->error("$memberfile locked!") if (-f "${memberfile}.LCK");
+ $self->error("${LedgerSMB::Sysconfig::memberfile} locked!") if (-f "${memberfile}.LCK");
open(FH, ">${memberfile}.LCK") or $self->error("${memberfile}.LCK : $!");
close(FH);
- if (! open(CONF, "+<$memberfile")) {
+ if (! open(CONF, "+<${LedgerSMB::Sysconfig::memberfile}")) {
unlink "${memberfile}.LCK";
- $self->error("$memberfile : $!");
+ $self->error("${LedgerSMB::Sysconfig::memberfile} : $!");
}
@config = <CONF>;
@@ -819,7 +819,7 @@ sub save_member {
# create conf file
if (! $self->{'root login'}) {
- $self->create_config("$userspath/$self->{login}.conf");
+ $self->create_config("${LedgerSMB::Sysconfig::userspath}/$self->{login}.conf");
$self->{dbpasswd} =~ s/\\'/'/g;
$self->{dbpasswd} =~ s/\\\\/\\/g;
diff --git a/admin.pl b/admin.pl
index 7f83eb74..5c9db43d 100755
--- a/admin.pl
+++ b/admin.pl
@@ -52,7 +52,7 @@
# setup defaults, DO NOT CHANGE
$userspath = "users";
$spool = "spool";
-$templates = "templates";
+${LedgerSMB::Sysconfig::templates} = "templates";
$memberfile = "users/members";
$sendmail = "| /usr/sbin/sendmail -t";
%printer = ( Printer => 'lpr' );
diff --git a/bin/aa.pl b/bin/aa.pl
index c6e32fed..e173f678 100755
--- a/bin/aa.pl
+++ b/bin/aa.pl
@@ -132,7 +132,7 @@ sub create_links {
$form->{selectformname} = qq|<option value="transaction">|.$locale->text('Transaction');
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
if ($form->{ARAP} eq 'AR') {
$form->{selectformname} .= qq|
<option value="receipt">|.$locale->text('Receipt');
@@ -721,14 +721,14 @@ sub form_footer {
for ("Post", "Print and Post", "Delete") { delete $button{$_} }
}
- if (!$latex) {
+ if (!${LedgerSMB::Sysconfig::latex}) {
for ("Print and Post", "Print and Post as new") { delete $button{$_} }
}
} else {
for ("Post as new", "Print and Post as new", "Delete") { delete $button{$_} }
- delete $button{"Print and Post"} if ! $latex;
+ delete $button{"Print and Post"} if ! ${LedgerSMB::Sysconfig::latex};
if ($transdate <= $closedto) {
for ("Post", "Print and Post") { delete $button{$_} }
@@ -944,7 +944,7 @@ sub delete {
sub yes {
- if (AA->delete_transaction(\%myconfig, \%$form, $spool)) {
+ if (AA->delete_transaction(\%myconfig, \%$form, ${LedgerSMB::Sysconfig::spool})) {
$form->redirect($locale->text('Transaction deleted!'));
} else {
$form->error($locale->text('Cannot delete transaction!'));
diff --git a/bin/admin.pl b/bin/admin.pl
index ce96cd6e..e1a6f420 100755
--- a/bin/admin.pl
+++ b/bin/admin.pl
@@ -43,7 +43,7 @@ use LedgerSMB::User;
$form = new Form;
-$locale = LedgerSMB::Locale->get_handle($language);
+$locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language});
$locale->encoding('UTF-8');
$form->{charset} = 'UTF-8';
#$form->{charset} = $locale->encoding;
@@ -78,8 +78,8 @@ if ($form->{action}) {
$form->error($locale->text('No Database Drivers available!')) unless (User->dbdrivers);
# create memberfile
- if (! -f $memberfile) {
- open(FH, ">$memberfile") or $form->error("$memberfile : $!");
+ if (! -f ${LedgerSMB::Sysconfig::memberfile}) {
+ open(FH, ">${LedgerSMB::Sysconfig::memberfile}") or $form->error("$memberfile : $!");
print FH qq|# LedgerSMB Accounting members
[root login]
@@ -88,7 +88,7 @@ password=
close FH;
}
- $root = new User "$memberfile", "root login";
+ $root = new User "${LedgerSMB::Sysconfig::memberfile}", "root login";
unless($root && $root->{password}) {
&setup_initial_password();
@@ -192,7 +192,7 @@ sub login {
sub logout {
$form->{callback} = "$form->{script}?path=$form->{path}&amp;endsession=1";
- unlink "$userspath/adminhash";
+ unlink "${LedgerSMB::Sysconfig::userspath}/adminhash";
print qq|Set-Cookie: LedgerSMB=; path=/;\n|;
$form->redirect($locale->text('You are logged out'));
@@ -248,11 +248,11 @@ sub form_footer {
sub list_users {
- open(FH, "$memberfile") or $form->error("$memberfile : $!");
+ open(FH, "${LedgerSMB::Sysconfig::memberfile}") or $form->error("$memberfile : $!");
$nologin = qq|<button type="submit" class="submit" name="action" value="lock_system">|.$locale->text('Lock System').qq|</button>|;
- if (-e "$userspath/nologin") {
+ if (-e "${LedgerSMB::Sysconfig::userspath}/nologin") {
$nologin = qq|<button type="submit" class="submit" name="action" value="unlock_system">|.$locale->text('Unlock System').qq|</button>|;
}
@@ -318,7 +318,7 @@ sub list_users {
$href = "$script?action=edit&amp;login=$key&amp;path=$form->{path}&amp;sessionid=$form->{sessionid}";
$href =~ s/ /%20/g;
- $member{$key}{templates} =~ s/^$templates\///;
+ $member{$key}{templates} =~ s/^${LedgerSMB::Sysconfig::templates}\///;
$member{$key}{dbhost} = $locale->text('localhost') unless $member{$key}{dbhost};
$column_data{login} = qq|<td><a href="$href">$key</a></td>|;
@@ -372,13 +372,13 @@ sub form_header {
if ($form->{login}) {
# get user
- $myconfig = new User "$memberfile", "$form->{login}";
+ $myconfig = new User "${LedgerSMB::Sysconfig::memberfile}", "$form->{login}";
for (qw(company address signature)) { $myconfig->{$_} = $form->quote($myconfig->{$_}) }
for (qw(address signature)) { $myconfig->{$_} =~ s/\\n/\n/g }
# strip basedir from templates directory
- $myconfig->{templates} =~ s/^$templates\///;
+ $myconfig->{templates} =~ s/^${LedgerSMB::Sysconfig::templates}\///;
$myconfig->{dbpasswd} = unpack 'u', $myconfig->{dbpasswd};
}
@@ -404,11 +404,11 @@ sub form_header {
$countrycodes = qq|<option value="">English</option>\n$countrycodes|;
# is there a templates basedir
- if (! -d "$templates") {
- $form->error($locale->text('Directory').": $templates ".$locale->text('does not exist'));
+ if (! -d "${LedgerSMB::Sysconfig::templates}") {
+ $form->error($locale->text('Directory').": ${LedgerSMB::Sysconfig::templates} ".$locale->text('does not exist'));
}
- opendir TEMPLATEDIR, "$templates/." or $form->error("$templates : $!");
+ opendir TEMPLATEDIR, "${LedgerSMB::Sysconfig::templates}/." or $form->error("$templates : $!");
@all = grep !/^\.\.?$/, readdir TEMPLATEDIR;
closedir TEMPLATEDIR;
@@ -417,7 +417,7 @@ sub form_header {
@alldir = ();
for (@all) {
- if (-d "$templates/$_") {
+ if (-d "${LedgerSMB::Sysconfig::templates}/$_") {
push @alldir, $_;
}
}
@@ -464,7 +464,7 @@ sub form_header {
$selectstylesheet .= "<option></option>\n";
- if (%printer && $latex) {
+ if (%printer && ${LedgerSMB::Sysconfig::latex}) {
$selectprinter = "<option></option>\n";
@@ -770,7 +770,7 @@ sub save {
# check for duplicates
if (!$form->{edit}) {
- $temp = new User "$memberfile", "$form->{login}";
+ $temp = new User "${LedgerSMB::Sysconfig::memberfile}", "$form->{login}";
if ($temp->{login}) {
$form->error("$form->{login} ".$locale->text('is already a member!'));
@@ -787,15 +787,15 @@ sub save {
}
# is there a basedir
- if (! -d "$templates") {
- $form->error($locale->text('Directory').": $templates ".$locale->text('does not exist'));
+ if (! -d "${LedgerSMB::Sysconfig::templates}") {
+ $form->error($locale->text('Directory').": ${LedgerSMB::Sysconfig::templates} ".$locale->text('does not exist'));
}
# add base directory to $form->{templates}
- $form->{templates} = "$templates/$form->{templates}";
+ $form->{templates} = "${LedgerSMB::Sysconfig::templates}/$form->{templates}";
- $myconfig = new User "$memberfile", "$form->{login}";
+ $myconfig = new User "${LedgerSMB::Sysconfig::memberfile}", "$form->{login}";
# redo acs variable and delete all the acs codes
@acs = split /;/, $form->{acs};
@@ -838,7 +838,7 @@ sub save {
$myconfig->{packpw} = 1;
- $myconfig->save_member($memberfile, $userspath);
+ $myconfig->save_member(${LedgerSMB::Sysconfig::memberfile}, ${LedgerSMB::Sysconfig::userspath});
# create user template directory and copy master files
if (! -d "$form->{templates}") {
@@ -849,13 +849,13 @@ sub save {
umask(007);
# copy templates to the directory
- opendir TEMPLATEDIR, "$templates/." or $form->error("$templates : $!");
+ opendir TEMPLATEDIR, "${LedgerSMB::Sysconfig::templates}/." or $form->error("$templates : $!");
@templates = grep /$form->{mastertemplates}-/, readdir TEMPLATEDIR;
closedir TEMPLATEDIR;
foreach $file (@templates) {
- open(TEMP, "$templates/$file") or $form->error("$templates/$file : $!");
+ open(TEMP, "${LedgerSMB::Sysconfig::templates}/$file") or $form->error("$templates/$file : $!");
$file =~ s/$form->{mastertemplates}-//;
open(NEW, ">$form->{templates}/$file") or $form->error("$form->{templates}/$file : $!");
@@ -879,16 +879,16 @@ sub save {
sub delete {
- $form->{templates} = ($form->{templates}) ? "$templates/$form->{templates}" : "$templates/$form->{login}";
+ $form->{templates} = ($form->{templates}) ? "${LedgerSMB::Sysconfig::templates}/$form->{templates}" : "$templates/$form->{login}";
- $form->error("$memberfile ".$locale->text('locked!')) if (-f ${memberfile}.LCK);
+ $form->error("${LedgerSMB::Sysconfig::memberfile} ".$locale->text('locked!')) if (-f ${memberfile}.LCK);
open(FH, ">${memberfile}.LCK") or $form->error("${memberfile}.LCK : $!");
close(FH);
- if (! open(CONF, "+<$memberfile")) {
+ if (! open(CONF, "+<${LedgerSMB::Sysconfig::memberfile}")) {
unlink "${memberfile}.LCK";
- $form->error("$memberfile : $!");
+ $form->error("${LedgerSMB::Sysconfig::memberfile} : $!");
}
@config = <CONF>;
@@ -972,7 +972,7 @@ sub delete {
User->delete_login(\%$form);
# delete config file for user
- unlink "$userspath/$form->{login}.conf";
+ unlink "${LedgerSMB::Sysconfig::userspath}/$form->{login}.conf";
}
$form->redirect($locale->text('User deleted!'));
@@ -1035,7 +1035,7 @@ sub change_password {
$form->error($locale->text('Passwords do not match!')) if $form->{new_password} ne $form->{confirm_password};
$root->{password} = $form->{new_password};
$root->{'root login'} = 1;
- $root->save_member($memberfile);
+ $root->save_member(${LedgerSMB::Sysconfig::memberfile});
$form->{callback} = "$form->{script}?action=list_users&amp;path=$form->{path}&amp;sessionid=$form->{sessionid}";
$form->redirect($locale->text('Password changed!'));
}
@@ -1048,7 +1048,7 @@ sub get_hash {
sub check_password {
- $root = new User "$memberfile", "root login";
+ $root = new User "${LedgerSMB::Sysconfig::memberfile}", "root login";
if ($root->{password}) {
@@ -1064,7 +1064,7 @@ sub check_password {
&get_hash;
- open(HASHFILE, "> $userspath/adminhash") || $form->error("Can't Open Hashfile: $!");
+ open(HASHFILE, "> ${LedgerSMB::Sysconfig::userspath}/adminhash") || $form->error("Can't Open Hashfile: $!");
print HASHFILE $form->{hash};
print qq|Set-Cookie: LedgerSMB=$form->{hash}; path=/;\n|;
@@ -1077,14 +1077,14 @@ sub check_password {
$cookie = ($form->{path} eq 'bin/lynx') ? $cookie{login} : $cookie{"LedgerSMB-root login"};
#fixes problem with first login and such
- if (!(-f "$userspath/adminhash")) {
+ if (!(-f "${LedgerSMB::Sysconfig::userspath}/adminhash")) {
&get_hash;
- open(HASHFILE, "> $userspath/adminhash") || $form->error("Can't Open Hashfile: $!");
+ open(HASHFILE, "> ${LedgerSMB::Sysconfig::userspath}/adminhash") || $form->error("Can't Open Hashfile: $!");
print HASHFILE $form->{hash};
close(HASHFILE);
}
- open (HASHFILE, "< $userspath/adminhash") || $form->error("Can't Open Hashfile: $!");
+ open (HASHFILE, "< ${LedgerSMB::Sysconfig::userspath}/adminhash") || $form->error("Can't Open Hashfile: $!");
chomp($form->{hash} = <HASHFILE>);
%cookies = split /[=;]/, $ENV{HTTP_COOKIE};
@@ -1372,7 +1372,7 @@ sub dbcreate {
sub delete_dataset {
- if (@dbsources = User->dbsources_unused(\%$form, $memberfile)) {
+ if (@dbsources = User->dbsources_unused(\%$form, ${LedgerSMB::Sysconfig::memberfile})) {
foreach $item (sort @dbsources) {
$dbsources .= qq|<input name="db" class="radio" type="radio" value="$item" />&nbsp;$item |;
@@ -1463,7 +1463,7 @@ sub dbdelete {
sub unlock_system {
- unlink "$userspath/nologin";
+ unlink "${LedgerSMB::Sysconfig::userspath}/nologin";
$form->{callback} = "$form->{script}?action=list_users&amp;path=$form->{path}&amp;sessionid=$form->{sessionid}";
$form->redirect($locale->text('Lockfile removed!'));
}
@@ -1471,7 +1471,7 @@ sub unlock_system {
sub lock_system {
- open(FH, ">$userspath/nologin") or $form->error($locale->text('Cannot create Lock!'));
+ open(FH, ">${LedgerSMB::Sysconfig::userspath}/nologin") or $form->error($locale->text('Cannot create Lock!'));
close(FH);
$form->{callback} = "$form->{script}?action=list_users&amp;path=$form->{path}&amp;sessionid=$form->{sessionid}";
$form->redirect($locale->text('Lockfile created!'));
diff --git a/bin/am.pl b/bin/am.pl
index cdc5959e..f51e029b 100755
--- a/bin/am.pl
+++ b/bin/am.pl
@@ -2064,7 +2064,7 @@ sub config {
}
$selectstylesheet .= "<option>\n";
- if (%printer && $latex) {
+ if (%printer && ${LedgerSMB::Sysconfig::latex}) {
$selectprinter = "<option>\n";
foreach $item (sort keys %printer) {
if ($myconfig{printer} eq $item) {
@@ -2233,7 +2233,7 @@ sub save_preferences {
$form->error($locale->text('Password does not match!')) if $form->{new_password} ne $form->{confirm_password};
}
- if (AM->save_preferences(\%myconfig, \%$form, $memberfile, $userspath)) {
+ if (AM->save_preferences(\%myconfig, \%$form, ${LedgerSMB::Sysconfig::memberfile}, ${LedgerSMB::Sysconfig::userspath})) {
$form->redirect($locale->text('Preferences saved!'));
} else {
$form->error($locale->text('Cannot save preferences!'));
@@ -2247,12 +2247,12 @@ sub backup {
if ($form->{media} eq 'email') {
$form->error($locale->text('No email address for')." $myconfig{name}") unless ($myconfig{email});
- $form->{OUT} = "$sendmail";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::sendmail}";
}
$SIG{INT} = 'IGNORE';
- AM->backup(\%myconfig, \%$form, $userspath, $gzip);
+ AM->backup(\%myconfig, \%$form, ${LedgerSMB::Sysconfig::userspath}, ${LedgerSMB::Sysconfig::gzip});
if ($form->{media} eq 'email') {
$form->redirect($locale->text('Backup sent to').qq| $myconfig{email}|);
@@ -2954,7 +2954,7 @@ sub edit_recurring {
}
$form->{selectformat} = qq|<option value="html">html\n|;
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
$form->{selectformat} .= qq|
<option value="postscript">|.$locale->text('Postscript').qq|
<option value="pdf">|.$locale->text('PDF');
@@ -3083,7 +3083,7 @@ sub process_transactions {
$form->info(" ..... ".$locale->text('done'));
# print form
- if ($latex && $ok) {
+ if (${LedgerSMB::Sysconfig::latex} && $ok) {
$ok = &print_recurring(\%$pt, $defaultprinter);
}
@@ -3136,7 +3136,7 @@ sub process_transactions {
}
# print form
- if ($latex && $ok) {
+ if (${LedgerSMB::Sysconfig::latex} && $ok) {
&print_recurring(\%$pt, $defaultprinter);
}
diff --git a/bin/arap.pl b/bin/arap.pl
index 29191aaa..4f3c61c1 100755
--- a/bin/arap.pl
+++ b/bin/arap.pl
@@ -615,7 +615,7 @@ sub schedule {
}
- if (%printer && $latex && %formname) {
+ if (%printer && ${LedgerSMB::Sysconfig::latex} && %formname) {
$selectprinter = qq|<option>\n|;
for (sort keys %printer) { $selectprinter .= qq|<option value="$_">$_\n| }
diff --git a/bin/arapprn.pl b/bin/arapprn.pl
index 45ded305..f5d120f5 100755
--- a/bin/arapprn.pl
+++ b/bin/arapprn.pl
@@ -107,7 +107,7 @@ sub print {
}
if ($filename = $queued{$form->{formname}}) {
$form->{queued} =~ s/$form->{formname} $filename//;
- unlink "$spool/$filename";
+ unlink "${LedgerSMB::Sysconfig::spool}/$filename";
$filename =~ s/\..*$//g;
} else {
$filename = time;
@@ -115,7 +115,7 @@ sub print {
}
$filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
- $form->{OUT} = ">$spool/$filename";
+ $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
$form->{queued} .= " $form->{formname} $filename";
$form->{queued} =~ s/^ //;
@@ -215,7 +215,7 @@ sub print_check {
id => $form->{id} );
$form->{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
- $form->{OUT} = ">$spool/$filename";
+ $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
$form->{queued} .= " $form->{formname} $filename";
$form->{queued} =~ s/^ //;
@@ -252,7 +252,7 @@ sub print_check {
$form->{fileid} = $invnumber;
$form->{fileid} =~ s/(\s|\W)+//g;
- $form->parse_template(\%myconfig, $userspath);
+ $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
if ($form->{previousform}) {
@@ -415,7 +415,7 @@ sub print_transaction {
if ($filename = $queued{$form->{formname}}) {
$form->{queued} =~ s/$form->{formname} $filename//;
- unlink "$spool/$filename";
+ unlink "${LedgerSMB::Sysconfig::spool}/$filename";
$filename =~ s/\..*$//g;
} else {
$filename = time;
@@ -423,7 +423,7 @@ sub print_transaction {
}
$filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
- $form->{OUT} = ">$spool/$filename";
+ $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
$form->{queued} .= " $form->{formname} $filename";
$form->{queued} =~ s/^ //;
@@ -468,7 +468,7 @@ sub print_transaction {
$form->{fileid} = $form->{invnumber};
$form->{fileid} =~ s/(\s|\W)+//g;
- $form->parse_template(\%myconfig, $userspath);
+ $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
if (%$old_form) {
$old_form->{invnumber} = $form->{invnumber};
@@ -625,12 +625,12 @@ sub print_options {
$form->{selectformat} = qq|<option value="html">html\n|;
- if (%printer && $latex) {
+ if (%printer && ${LedgerSMB::Sysconfig::latex}) {
for (sort keys %printer) { $media .= qq|
<option value="$_">$_| }
}
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
$form->{selectformat} .= qq|
<option value="postscript">|.$locale->text('Postscript').qq|
<option value="pdf">|.$locale->text('PDF');
diff --git a/bin/bp.pl b/bin/bp.pl
index 1e7b3a07..e1dc01eb 100755
--- a/bin/bp.pl
+++ b/bin/bp.pl
@@ -253,7 +253,7 @@ sub yes {
$form->info($locale->text('Removing marked entries from queue ...'));
$form->{callback} .= "&header=1" if $form->{callback};
- if (BP->delete_spool(\%myconfig, \%$form, $spool)) {
+ if (BP->delete_spool(\%myconfig, \%$form, ${LedgerSMB::Sysconfig::spool})) {
$form->redirect($locale->text('Removed spoolfiles!'));
} else {
$form->error($locale->text('Cannot remove files!'));
@@ -274,7 +274,7 @@ sub print {
$form->{OUT} = "| $printer{$form->{media}}";
$form->info($locale->text('Printing')." ...");
- if (BP->print_spool(\%myconfig, \%$form, $spool)) {
+ if (BP->print_spool(\%myconfig, \%$form, ${LedgerSMB::Sysconfig::spool})) {
print $locale->text('done');
$form->redirect($locale->text('Marked entries printed!'));
}
@@ -432,7 +432,7 @@ sub list_spool {
$column_data{transdate} = "<td>$ref->{transdate}&nbsp;</td>";
- if ($spoolfile eq $ref->{spoolfile}) {
+ if (${LedgerSMB::Sysconfig::spool}file eq $ref->{spoolfile}) {
$column_data{checked} = qq|<td></td>|;
} else {
$column_data{checked} = qq|<td><input name=checked_$i type=checkbox class=checkbox $form->{"checked_$i"} $form->{"checked_$i"}></td>|;
@@ -458,11 +458,11 @@ sub list_spool {
$column_data{name} = "<td>$ref->{name}</td>";
- $column_data{spoolfile} = qq|<td><a href=$spool/$ref->{spoolfile}>$ref->{spoolfile}</a></td>
+ $column_data{spoolfile} = qq|<td><a href=${LedgerSMB::Sysconfig::spool}/$ref->{spoolfile}>$ref->{spoolfile}</a></td>
|;
- $spoolfile = $ref->{spoolfile};
+ ${LedgerSMB::Sysconfig::spool}file = $ref->{spoolfile};
$j++; $j %= 2;
print "
@@ -496,7 +496,7 @@ sub list_spool {
$form->hide_form(qw(callback title vc type sort module account path login sessionid));
- if (%printer && $latex) {
+ if (%printer && ${LedgerSMB::Sysconfig::latex}) {
foreach $key (sort keys %printer) {
print qq|
<input name=media type=radio class=radio value="$key" |;
diff --git a/bin/cp.pl b/bin/cp.pl
index 86ae69b2..be796242 100755
--- a/bin/cp.pl
+++ b/bin/cp.pl
@@ -452,7 +452,7 @@ sub payments_footer {
$transdate = $form->datetonum(\%myconfig, $form->{datepaid});
$closedto = $form->datetonum(\%myconfig, $form->{closedto});
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
$media = qq|<select name=media>
<option value=screen>|.$locale->text('Screen');
@@ -486,7 +486,7 @@ sub payments_footer {
'Post' => { ndx => 4, key => 'O', value => $locale->text('Post') },
);
- if (! $latex) {
+ if (! ${LedgerSMB::Sysconfig::latex}) {
delete $button{'Print'};
}
@@ -1051,7 +1051,7 @@ sub payment_footer {
$transdate = $form->datetonum(\%myconfig, $form->{datepaid});
$closedto = $form->datetonum(\%myconfig, $form->{closedto});
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
if ($form->{selectlanguage}) {
$form->{"selectlanguage"} = $form->unescape($form->{"selectlanguage"});
$form->{"selectlanguage"} =~ s/ selected//;
@@ -1088,7 +1088,7 @@ sub payment_footer {
'Post' => { ndx => 4, key => 'O', value => $locale->text('Post') },
);
- if (! $latex) {
+ if (! ${LedgerSMB::Sysconfig::latex}) {
delete $button{'Print'};
}
@@ -1269,7 +1269,7 @@ sub print_form {
$form->{OUT} = "| $printer{$form->{media}}";
}
- $form->parse_template(\%myconfig, $userspath);
+ $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
}
@@ -1286,8 +1286,8 @@ sub print_payment {
%temp = ();
for (@a) { $temp{$_} = $form->{$_} }
- if (scalar @{$form->{invnumber}} > $check_max_invoices) {
- $#{$form->{invnumber}} = $check_max_invoices - 1;
+ if (scalar @{$form->{invnumber}} > ${LedgerSMB::Sysconfig::check_max_invoices}) {
+ $#{$form->{invnumber}} = ${LedgerSMB::Sysconfig::check_max_invoices} - 1;
$form->{invnumbers_maxed} = 1;
$form->{message} = $locale->text("Please see attatched report for list of invoices paid.");
}
diff --git a/bin/hr.pl b/bin/hr.pl
index 93f11b67..c124f0a9 100755
--- a/bin/hr.pl
+++ b/bin/hr.pl
@@ -716,7 +716,7 @@ sub save_employee {
# if it is a login change memberfile and .conf
if ($form->{employeelogin}) {
- $user = new User $memberfile, $form->{employeelogin};
+ $user = new User ${LedgerSMB::Sysconfig::memberfile}, $form->{employeelogin};
for (qw(name email role)) { $user->{$_} = $form->{$_} }
@@ -726,7 +726,7 @@ sub save_employee {
for (qw(dbpasswd password)) { $user->{"old_$_"} = $user->{$_} }
$user->{packpw} = 1;
- $user->save_member($memberfile, $userspath) if $user->{login};
+ $user->save_member(${LedgerSMB::Sysconfig::memberfile}, ${LedgerSMB::Sysconfig::userspath}) if $user->{login};
}
$form->redirect($locale->text('Employee saved!'));
diff --git a/bin/io.pl b/bin/io.pl
index d0d94a0a..efbe689c 100755
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -1099,11 +1099,11 @@ sub print_options {
$media = qq|<select name=media>
<option value="screen">|.$locale->text('Screen');
- if (%printer && $latex) {
+ if (%printer && ${LedgerSMB::Sysconfig::latex}) {
for (sort keys %printer) { $media .= qq|
<option value="$_">$_| }
}
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
$media .= qq|
<option value="queue">|.$locale->text('Queue');
}
@@ -1118,7 +1118,7 @@ sub print_options {
$form->{selectformat} = qq|<option value="html">html\n|;
# <option value="txt">|.$locale->text('Text');
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
$form->{selectformat} .= qq|
<option value="postscript">|.$locale->text('Postscript').qq|
<option value="pdf">|.$locale->text('PDF');
@@ -1138,7 +1138,7 @@ sub print_options {
<td>$media</td>
|;
- if (%printer && $latex && $form->{media} ne 'email') {
+ if (%printer && ${LedgerSMB::Sysconfig::latex} && $form->{media} ne 'email') {
print qq|
<td nowrap>|.$locale->text('Copies').qq|
<input name=copies size=2 value=$form->{copies}></td>
@@ -1457,7 +1457,7 @@ sub print_form {
$form->{subject} = qq|$form->{label} $form->{"${inv}number"}| unless $form->{subject};
$form->{plainpaper} = 1;
- $form->{OUT} = "$sendmail";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::sendmail}";
if ($form->{emailed} !~ /$form->{formname}/) {
$form->{emailed} .= " $form->{formname}";
@@ -1505,7 +1505,7 @@ sub print_form {
if ($filename = $queued{$form->{formname}}) {
$form->{queued} =~ s/$form->{formname} $filename//;
- unlink "$spool/$filename";
+ unlink "${LedgerSMB::Sysconfig::spool}/$filename";
$filename =~ s/\..*$//g;
} else {
$filename = time;
@@ -1513,7 +1513,7 @@ sub print_form {
}
$filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
- $form->{OUT} = ">$spool/$filename";
+ $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
$form->{queued} .= " $form->{formname} $filename";
$form->{queued} =~ s/^ //;
@@ -1539,7 +1539,7 @@ sub print_form {
$form->{fileid} = $form->{"${inv}number"};
$form->{fileid} =~ s/(\s|\W)+//g;
- $form->parse_template(\%myconfig, $userspath);
+ $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
# if we got back here restore the previous form
if (defined %$old_form) {
diff --git a/bin/is.pl b/bin/is.pl
index 321f1f4a..b29645db 100755
--- a/bin/is.pl
+++ b/bin/is.pl
@@ -663,7 +663,7 @@ sub form_footer {
for ("Post", "Print and Post", "Delete") { delete $button{$_} }
}
- if (!$latex) {
+ if (!${LedgerSMB::Sysconfig::latex}) {
for ("Print and Post", "Print and Post as new") { delete $button{$_} }
}
@@ -672,7 +672,7 @@ sub form_footer {
if ($transdate > $closedto) {
for ("Update", "Ship to", "Print", "E-mail", "Post", "Schedule") { $a{$_} = 1 }
- $a{'Print and Post'} = 1 if $latex;
+ $a{'Print and Post'} = 1 if ${LedgerSMB::Sysconfig::latex};
}
for (keys %button) { delete $button{$_} if ! $a{$_} }
@@ -962,7 +962,7 @@ sub delete {
sub yes {
- if (IS->delete_invoice(\%myconfig, \%$form, $spool)) {
+ if (IS->delete_invoice(\%myconfig, \%$form, ${LedgerSMB::Sysconfig::spool})) {
$form->redirect($locale->text('Invoice deleted!'));
} else {
$form->error($locale->text('Cannot delete invoice!'));
diff --git a/bin/jc.pl b/bin/jc.pl
index 175a5df3..2375fae2 100755
--- a/bin/jc.pl
+++ b/bin/jc.pl
@@ -629,7 +629,7 @@ sub timecard_footer {
if (!$form->{locked}) {
for ('Update', 'Print', 'Save', 'Save as new') { $a{$_} = 1 }
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
for ('Print and Save', 'Print and Save as new') { $a{$_} = 1 }
}
@@ -645,7 +645,7 @@ sub timecard_footer {
for ('Update', 'Print', 'Save') { $a{$_} = 1 }
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
$a{'Print and Save'} = 1;
}
@@ -842,7 +842,7 @@ sub storescard_footer {
if (!$form->{locked}) {
for ('Update', 'Print', 'Save', 'Save as new') { $a{$_} = 1 }
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
for ('Print and Save', 'Print and Save as new') { $a{$_} = 1 }
}
if ($form->{orphaned}) {
@@ -855,7 +855,7 @@ sub storescard_footer {
if ($transdate > $closedto) {
for ('Update', 'Print', 'Save') { $a{$_} = 1 }
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
$a{'Print and Save'} = 1;
}
}
@@ -1761,12 +1761,12 @@ sub print_options {
$form->{selectformat} = qq|<option value="html">html\n|;
- if (%printer && $latex) {
+ if (%printer && ${LedgerSMB::Sysconfig::latex}) {
for (sort keys %printer) { $media .= qq|
<option value="$_">$_| }
}
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
$media .= qq|
<option value="queue">|.$locale->text('Queue');
@@ -1886,7 +1886,7 @@ sub print_timecard {
if ($filename = $queued{$form->{formname}}) {
$form->{queued} =~ s/$form->{formname} $filename//;
- unlink "$spool/$filename";
+ unlink "${LedgerSMB::Sysconfig::spool}/$filename";
$filename =~ s/\..*$//g;
} else {
$filename = time;
@@ -1894,7 +1894,7 @@ sub print_timecard {
}
$filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
- $form->{OUT} = ">$spool/$filename";
+ $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
$form->{queued} = "$form->{formname} $filename";
$form->update_status(\%myconfig);
@@ -1911,7 +1911,7 @@ sub print_timecard {
$status{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
}
- $form->parse_template(\%myconfig, $userspath);
+ $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
if (defined %$old_form) {
diff --git a/bin/login.pl b/bin/login.pl
index c52c3b9e..a3a70b9b 100755
--- a/bin/login.pl
+++ b/bin/login.pl
@@ -47,7 +47,7 @@ use LedgerSMB::Locale;
$form = new Form;
-$locale = LedgerSMB::Locale->get_handle($language);
+$locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language});
$locale->encoding('UTF-8');
$form->{charset} = 'UTF-8';
#$form->{charset} = $locale->encoding;
@@ -235,7 +235,7 @@ sub login {
$form->error($locale->text('You did not enter a name!')) unless ($form->{login});
if (! $form->{beenthere}) {
- open(FH, "$memberfile") or $form->error("$memberfile : $!");
+ open(FH, "${LedgerSMB::Sysconfig::memberfile}") or $form->error("$memberfile : $!");
@a = <FH>;
close(FH);
@@ -262,10 +262,10 @@ sub login {
}
- $user = new User $memberfile, $form->{login};
+ $user = new User ${LedgerSMB::Sysconfig::memberfile}, $form->{login};
# if we get an error back, bale out
- if (($errno = $user->login(\%$form, $userspath)) <= -1) {
+ if (($errno = $user->login(\%$form, ${LedgerSMB::Sysconfig::userspath})) <= -1) {
$errno *= -1;
$err[1] = $locale->text('Access Denied!');
@@ -274,7 +274,7 @@ sub login {
if ($errno == 4) {
# upgrade dataset and log in again
- open FH, ">$userspath/nologin" or $form->error($!);
+ open FH, ">${LedgerSMB::Sysconfig::userspath}/nologin" or $form->error($!);
for (qw(dbname dbhost dbport dbdriver dbuser dbpasswd)) { $form->{$_} = $user->{$_} }
@@ -293,7 +293,7 @@ sub login {
$user->dbupdate(\%$form);
# remove lock file
- unlink "$userspath/nologin";
+ unlink "${LedgerSMB::Sysconfig::userspath}/nologin";
print $locale->text('done');
diff --git a/bin/oe.pl b/bin/oe.pl
index 7427014b..a97088a7 100755
--- a/bin/oe.pl
+++ b/bin/oe.pl
@@ -723,13 +723,13 @@ sub form_footer {
%a = ();
for ("Update", "Ship to", "Print", "E-mail", "Save") { $a{$_} = 1 }
- $a{'Print and Save'} = 1 if $latex;
+ $a{'Print and Save'} = 1 if ${LedgerSMB::Sysconfig::latex};
if ($form->{id}) {
$a{'Delete'} = 1;
$a{'Save as new'} = 1;
- $a{'Print and Save as new'} = 1 if $latex;
+ $a{'Print and Save as new'} = 1 if ${LedgerSMB::Sysconfig::latex};
if ($form->{type} =~ /sales_/) {
if ($myconfig{acs} !~ /AR--Sales Invoice/) {
@@ -1861,7 +1861,7 @@ sub yes {
$err = $locale->text('Cannot delete quotation!');
}
- if (OE->delete(\%myconfig, \%$form, $spool)) {
+ if (OE->delete(\%myconfig, \%$form, ${LedgerSMB::Sysconfig::spool})) {
$form->redirect($msg);
} else {
$form->error($err);
diff --git a/bin/pe.pl b/bin/pe.pl
index 8d4c380c..2696317a 100755
--- a/bin/pe.pl
+++ b/bin/pe.pl
@@ -2552,7 +2552,7 @@ sub generate_sales_orders {
if (OE->save(\%myconfig, \%$order)) {
if (! PE->allocate_projectitems(\%myconfig, \%$order)) {
- OE->delete(\%myconfig, \%$order, $spool);
+ OE->delete(\%myconfig, \%$order, ${LedgerSMB::Sysconfig::spool});
}
} else {
$order->error($locale->text('Failed to save order!'));
diff --git a/bin/pos.pl b/bin/pos.pl
index e501d19e..fb191a85 100755
--- a/bin/pos.pl
+++ b/bin/pos.pl
@@ -550,7 +550,7 @@ sub form_footer {
delete $button{'Delete'};
}
- delete $button{'Print and Post'} unless $latex;
+ delete $button{'Print and Post'} unless ${LedgerSMB::Sysconfig::latex};
} else {
for ('Print', 'Post', 'Print and Post', 'Delete') { delete $button{$_} }
}
@@ -850,7 +850,7 @@ sub print_form {
delete $form->{stylesheet};
$form->{cd_open} = $pos_config{rp_cash_drawer_open};
- $form->parse_template(\%myconfig, $userspath);
+ $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
if ($form->{printed} !~ /$form->{formname}/) {
$form->{printed} .= " $form->{formname}";
diff --git a/bin/rp.pl b/bin/rp.pl
index 34d43438..685bf943 100755
--- a/bin/rp.pl
+++ b/bin/rp.pl
@@ -1751,7 +1751,7 @@ sub print_options {
$media = qq|
<td><select name=media>
<option value=screen>|.$locale->text('Screen');
- if (%printer && $latex) {
+ if (%printer && ${LedgerSMB::Sysconfig::latex}) {
for (sort keys %printer) { $media .= qq|
<option value="$_">$_| }
}
@@ -1760,7 +1760,7 @@ sub print_options {
$media =~ s/(<option value="\Q$form->{media}\E")/$1 selected/;
$media .= qq|</select></td>|;
- if ($latex) {
+ if (${LedgerSMB::Sysconfig::latex}) {
$format .= qq|
<option value=postscript $form->{DF}{postscript}>|.$locale->text('Postscript').qq|
<option value=pdf $form->{DF}{pdf}>|.$locale->text('PDF');
@@ -1774,7 +1774,7 @@ sub print_options {
$media
|;
- if (%printer && $latex && $form->{media} ne 'email') {
+ if (%printer && ${LedgerSMB::Sysconfig::latex} && $form->{media} ne 'email') {
print qq|
<td>|.$locale->text('Copies').qq|
<input name=copies size=2 value=$form->{copies}></td>
@@ -1891,7 +1891,7 @@ sub e_mail {
sub send_email {
- $form->{OUT} = "$sendmail";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::sendmail}";
$form->{subject} = $locale->text('Statement').qq| - $form->{todate}| unless $form->{subject};
$form->isblank("email", $locale->text('E-mail address missing!'));
@@ -2020,7 +2020,7 @@ sub print_form {
for ("c0", "c30", "c60", "c90", "") { $form->{"${_}total"} = $form->format_amount(\%myconfig, $form->{"${_}total"}, 2) }
- $form->parse_template(\%myconfig, $userspath);
+ $form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
}
}
diff --git a/ledger-smb.conf b/ledger-smb.conf
index dd0c9f03..995e92fc 100644
--- a/ledger-smb.conf
+++ b/ledger-smb.conf
@@ -1,49 +1,10 @@
use vars qw($userspath $spool $memberfile $templates $sendmail $language $sid $latex %printer $gzip $GLOBALDBH);
-#################################
-# Global database parameters
-#################################
-# These parameters *must* be set correctly
-# for LedgerSMB >= 1.2 to work
-my $globalDBConnect = 'dbi:Pg:dbname=ledgersmb;host=localhost;port=5432';
-my $globalUserName = "ledgersmb";
-my $globalPassword = "set me to correct password";
-
-#$GLOBALDBH = DBI->connect($globalDBConnect, $globalDBUserName, $globalDBPassword);
-
-# path to user configuration files
-$userspath = "users";
-
-# spool directory for batch printing
-$spool = "spool";
-
-# templates base directory
-$templates = "templates";
-
-# member file
-$memberfile = "users/members";
-
-# location of sendmail
-$sendmail = "| /usr/sbin/sendmail -t";
-
-# set language for login and admin
-$language = "";
-
-# Maximum number of invoices that can be printed on a check
-$check_max_invoices = 5;
-
-
-# if you have latex installed set to 1
-$latex = 1;
-
# available printers
%printer = ( Laser => 'lpr -Plaser',
Epson => 'lpr -PEpson',
);
-# program to use for file compression
-$gzip = "gzip -S .gz";
-
# if the server can't find gzip, latex, dvips or pdflatex, add the path
$ENV{PATH} .= ":/usr/local/bin:/usr/local/pgsql/bin";
diff --git a/login.pl b/login.pl
index 2fe123f5..7d97626d 100755
--- a/login.pl
+++ b/login.pl
@@ -53,7 +53,7 @@
# setup defaults, DO NOT CHANGE
$userspath = "users";
$spool = "spool";
-$templates = "templates";
+${LedgerSMB::Sysconfig::templates} = "templates";
$memberfile = "users/members";
$sendmail = "| /usr/sbin/sendmail -t";
%printer = ( Printer => 'lpr' );
diff --git a/menu.pl b/menu.pl
index 6ac31ebf..8fecdf32 100755
--- a/menu.pl
+++ b/menu.pl
@@ -49,7 +49,7 @@
# setup defaults, DO NOT CHANGE
$userspath = "users";
$spool = "spool";
-$templates = "templates";
+${LedgerSMB::Sysconfig::templates} = "templates";
$memberfile = "users/members";
$sendmail = "| /usr/sbin/sendmail -t";
$latex = 0;