1 # @tag: defaults_posting_config
 
   2 # @description: Einstellung, ob und wann Zahlungen änderbar sind, vom Config-File in die DB verlagern.
 
   3 # @depends: release_2_7_0
 
   9 die("This script cannot be run from the command line.") unless ($main::form);
 
  13   die($dbup_locale->text("Database update error:") .
 
  14       "<br>$msg<br>" . $DBI::errstr);
 
  18   my ($query, $may_fail) = @_;
 
  20   if (!$dbh->do($query)) {
 
  21     mydberror($query) unless ($may_fail);
 
  29   # this query will fail if column already exist (new database)
 
  30   do_query(qq|ALTER TABLE defaults ADD COLUMN payments_changeable integer NOT NULL DEFAULT 0|, 1);
 
  32   # check current configuration and set default variables accordingly, so that
 
  33   # Lx-Office behaviour isn't changed by this update
 
  34   # if payments_changeable is not set in config set it to 0
 
  35   my $payments_changeable = 0;
 
  36   if ($::lx_office_conf{features}->{payments_changeable} == 1 ) {
 
  37     $payments_changeable = 1;
 
  38   } elsif ($::lx_office_conf{features}->{payments_changeable} == 2 ) {
 
  39     $payments_changeable = 2;
 
  42   my $update_column = "UPDATE defaults SET payments_changeable = '$payments_changeable';";
 
  43   do_query($update_column);