use Data::Dumper;
use SL::DBUtils;
+use strict;
+
sub get_account {
$main::lxdebug->enter_sub();
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT id, description, discount, customernumberinit
+ my $query = qq|SELECT id, description, discount, customernumberinit, salesman
FROM business
ORDER BY 2|;
my $dbh = $form->dbconnect($myconfig);
my $query =
- qq|SELECT b.description, b.discount, b.customernumberinit
+ qq|SELECT b.description, b.discount, b.customernumberinit, b.salesman
FROM business b
WHERE b.id = ?|;
my $sth = $dbh->prepare($query);
# connect to database
my $dbh = $form->dbconnect($myconfig);
- my @values = ($form->{description}, $form->{discount},
- $form->{customernumberinit});
+ my @values = ($form->{description}, $form->{discount}, $form->{customernumberinit}, $form->{salesman} ? 't' : 'f');
# id is the old record
if ($form->{id}) {
$query = qq|UPDATE business SET
description = ?,
discount = ?,
- customernumberinit = ?
+ customernumberinit = ?,
+ salesman = ?
WHERE id = ?|;
push(@values, $form->{id});
} else {
$query = qq|INSERT INTO business
- (description, discount, customernumberinit)
- VALUES (?, ?, ?)|;
+ (description, discount, customernumberinit, salesman)
+ VALUES (?, ?, ?, ?)|;
}
do_query($form, $dbh, $query, @values);
$auth->create_or_refresh_session();
}
- if ($webdav) {
- my @webdavdirs =
- qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen);
- foreach my $directory (@webdavdirs) {
- my $file = "webdav/" . $directory . "/webdav-user";
- my $newfile;
- if ($myconfig->{$directory}) {
- open(HTACCESS, "$file") or die "cannot open webdav-user $!\n";
- while (<HTACCESS>) {
- my ($login, $password) = split(/:/, $_);
- if ($login ne $form->{login}) {
- $newfile .= $_;
- }
- }
- close(HTACCESS);
- open(HTACCESS, "> $file") or die "cannot open webdav-user $!\n";
- $newfile .= $myconfig->{login} . ":" . $myconfig->{password} . "\n";
- print(HTACCESS $newfile);
- close(HTACCESS);
- } else {
- $form->{$directory} = 0;
- open(HTACCESS, "$file") or die "cannot open webdav-user $!\n";
- while (<HTACCESS>) {
- my ($login, $password) = split(/:/, $_);
- if ($login ne $form->{login}) {
- $newfile .= $_;
- }
- }
- close(HTACCESS);
- open(HTACCESS, "> $file") or die "cannot open webdav-user $!\n";
- print(HTACCESS $newfile);
- close(HTACCESS);
- }
- }
- }
-
$main::lxdebug->leave_sub();
return $rc;