summaryrefslogtreecommitdiff
path: root/LedgerSMB
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 /LedgerSMB
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
Diffstat (limited to 'LedgerSMB')
-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
13 files changed, 105 insertions, 67 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;