# we got a connection, check the version
my $query = qq|SELECT version FROM defaults|;
# we got a connection, check the version
my $query = qq|SELECT version FROM defaults|;
- open(FH, ">$main::userspath/nologin") or die("$!");
+ if (!open(FH, ">$main::userspath/nologin")) {
+ $form->show_generic_error($main::locale->text('A temporary file could not be created. ' .
+ 'Please verify that the directory "#1" is writeable by the webserver.',
+ $main::userspath),
+ 'back_button' => 1);
+ }
# Process a Perl script which updates the database.
# If the script returns 1 then the update was successful.
# Return code "2" means "needs more interaction; remove
# Process a Perl script which updates the database.
# If the script returns 1 then the update was successful.
# Return code "2" means "needs more interaction; remove
# All other return codes are fatal errors.
sub process_perl_script {
$main::lxdebug->enter_sub();
# All other return codes are fatal errors.
sub process_perl_script {
$main::lxdebug->enter_sub();
- ($my_a_from, $my_a_to) = split(/-/, $my_a);
- ($my_b_from, $my_b_to) = split(/-/, $my_b);
+ my ($my_a_from, $my_a_to) = split(/-/, $my_a);
+ my ($my_b_from, $my_b_to) = split(/-/, $my_b);
if ($file_type eq "sql") {
$self->process_query($form, $dbh, "sql/" . $form->{"dbdriver"} .
"-upgrade/$upgradescript", $str_maxdb, $db_charset);
if ($file_type eq "sql") {
$self->process_query($form, $dbh, "sql/" . $form->{"dbdriver"} .
"-upgrade/$upgradescript", $str_maxdb, $db_charset);
print $form->parse_html_template("dbupgrade/upgrade_message2", $control);
if ($file_type eq "sql") {
print $form->parse_html_template("dbupgrade/upgrade_message2", $control);
if ($file_type eq "sql") {
# format dbconnect and dboptions string
dbconnect_vars($self, $self->{dbname});
# format dbconnect and dboptions string
dbconnect_vars($self, $self->{dbname});
- $self->create_employee_entry($form, $dbh, $self);
+ $self->create_employee_entry($form, $dbh, $self, 1);
# add login to employee table if it does not exist
# no error check for employee table, ignore if it does not exist
# add login to employee table if it does not exist
# no error check for employee table, ignore if it does not exist
- my ($login) = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $self->{login});
+ my ($id) = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $self->{login});
- if (!$login) {
- $query = qq|INSERT INTO employee (login, name, workphone, role) VALUES (?, ?, ?, ?)|;
+ if (!$id) {
+ my $query = qq|INSERT INTO employee (login, name, workphone, role) VALUES (?, ?, ?, ?)|;
do_query($form, $dbh, $query, ($self->{login}, $myconfig->{name}, $myconfig->{tel}, "user"));
do_query($form, $dbh, $query, ($self->{login}, $myconfig->{name}, $myconfig->{tel}, "user"));
+
+ } elsif ($update_existing) {
+ my $query = qq|UPDATE employee SET name = ?, workphone = ?, role = 'user' WHERE id = ?|;
+ do_query($form, $dbh, $query, $myconfig->{name}, $myconfig->{tel}, $id);
currency dateformat dbconnect dbdriver dbhost dbport dboptions
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 default_media
default_printer_id copies show_form_details favorites
currency dateformat dbconnect dbdriver dbhost dbport dboptions
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 default_media
default_printer_id copies show_form_details favorites