# remove lock file
unlink("$userspath/nologin");
- print($form->parse_html_template("dbupgrade/footer"));
+ my $menufile =
+ $self->{"menustyle"} eq "v3" ? "menuv3.pl" :
+ $self->{"menustyle"} eq "neu" ? "menunew.pl" :
+ "menu.pl";
+
+ print($form->parse_html_template("dbupgrade/footer",
+ { "menufile" => $menufile }));
$rc = -2;
my ($self, $form) = @_;
+ $form->{sid} = $form->{dbdefault};
+ &dbconnect_vars($form, $form->{dbdefault});
+ my $dbh =
+ DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
+ or $form->dberror;
+
my %dbcreate = (
'Pg' => qq|CREATE DATABASE "$form->{db}"|,
'Oracle' =>
qq|CREATE USER "$form->{db}" DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP IDENTIFIED BY "$form->{db}"|
);
- $dbcreate{Pg} .= " WITH ENCODING = '$form->{encoding}'" if $form->{encoding};
+ my %dboptions = (
+ 'Pg' => [],
+ );
+
+ push(@{$dboptions{"Pg"}}, "ENCODING = " . $dbh->quote($form->{"encoding"}))
+ if ($form->{"encoding"});
+ if ($form->{"dbdefault"}) {
+ my $dbdefault = $form->{"dbdefault"};
+ $dbdefault =~ s/[^a-zA-Z0-9_\-]//g;
+ push(@{$dboptions{"Pg"}}, "TEMPLATE = $dbdefault");
+ }
- $form->{sid} = $form->{dbdefault};
- &dbconnect_vars($form, $form->{dbdefault});
- my $dbh =
- DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd})
- or $form->dberror;
my $query = qq|$dbcreate{$form->{dbdriver}}|;
+ $query .= " WITH " . join(" ", @{$dboptions{"Pg"}}) if (@{$dboptions{"Pg"}});
+
$dbh->do($query) || $form->dberror($query);
if ($form->{dbdriver} eq 'Oracle') {
sub process_perl_script {
$main::lxdebug->enter_sub();
- my ($self, $form, $dbh, $filename, $version) = @_;
+ my ($self, $form, $dbh, $filename, $version_or_control) = @_;
open(FH, "$filename") or $form->error("$filename : $!\n");
my $contents = join("", <FH>);
exit(0);
}
- if ($version) {
- $dbh->do("UPDATE defaults SET version = " . $dbh->quote($version));
+ if (ref($version_or_control) eq "HASH") {
+ $dbh->do("INSERT INTO schema_info (tag, login) VALUES (" .
+ $dbh->quote($version_or_control->{"tag"}) . ", " .
+ $dbh->quote($form->{"login"}) . ")");
+ } elsif ($version_or_control) {
+ $dbh->do("UPDATE defaults SET version = " .
+ $dbh->quote($version_or_control));
}
$dbh->commit();
$dbh->quote($version_or_control->{"tag"}) . ", " .
$dbh->quote($form->{"login"}) . ")");
} elsif ($version_or_control) {
- $dbh->do("UPDATE defaults SET version = " . $dbh->quote($version));
+ $dbh->do("UPDATE defaults SET version = " .
+ $dbh->quote($version_or_control));
}
$dbh->commit();
my @conf = qw(acs address admin businessnumber charset company countrycode
currency dateformat dbconnect dbdriver dbhost dbport dboptions
- dbname dbuser dbpasswd email fax name numberformat in_numberformat password
+ dbname dbuser dbpasswd email fax name numberformat password
printer role sid signature stylesheet tel templates vclimit angebote bestellungen rechnungen
anfragen lieferantenbestellungen einkaufsrechnungen taxnumber co_ustid duns menustyle
- template_format copies);
+ template_format default_media default_printer_id copies show_form_details);
$main::lxdebug->leave_sub();