X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=sql%2FPg-upgrade2%2Fdefaults_posting_config.pl;h=a94f2f53e1d007f1d93c9a89c0a51463dfbf80ed;hb=8bde65163db8c36ffa5e83bed7ee68ab859c106d;hp=dd033d43c62c501bafbda1ec4480f95bf1af317f;hpb=8a40e3dd0f638557b8c666fe708ccbc1ac709c4e;p=kivitendo-erp.git
diff --git a/sql/Pg-upgrade2/defaults_posting_config.pl b/sql/Pg-upgrade2/defaults_posting_config.pl
index dd033d43c..a94f2f53e 100644
--- a/sql/Pg-upgrade2/defaults_posting_config.pl
+++ b/sql/Pg-upgrade2/defaults_posting_config.pl
@@ -1,36 +1,21 @@
# @tag: defaults_posting_config
# @description: Einstellung, ob und wann Zahlungen änderbar sind, vom Config-File in die DB verlagern.
# @depends: release_2_7_0
-# @charset: utf-8
+package SL::DBUpgrade2::defaults_posting_config;
-use utf8;
use strict;
+use utf8;
-die("This script cannot be run from the command line.") unless ($main::form);
-
-sub mydberror {
- my ($msg) = @_;
- die($dbup_locale->text("Database update error:") .
- "
$msg
" . $DBI::errstr);
-}
-
-sub do_query {
- my ($query, $may_fail) = @_;
-
- if (!$dbh->do($query)) {
- mydberror($query) unless ($may_fail);
- $dbh->rollback();
- $dbh->begin_work();
- }
-}
+use parent qw(SL::DBUpgrade2::Base);
-sub do_update {
+sub run {
+ my ($self) = @_;
# this query will fail if column already exist (new database)
- do_query(qq|ALTER TABLE defaults ADD COLUMN payments_changeable integer NOT NULL DEFAULT 0|, 1);
+ $self->db_query(qq|ALTER TABLE defaults ADD COLUMN payments_changeable integer NOT NULL DEFAULT 0|, may_fail => 1);
# check current configuration and set default variables accordingly, so that
- # Lx-Office behaviour isn't changed by this update
+ # kivitendo behaviour isn't changed by this update
# if payments_changeable is not set in config set it to 0
my $payments_changeable = 0;
if ($::lx_office_conf{features}->{payments_changeable} == 1 ) {
@@ -40,10 +25,9 @@ sub do_update {
}
my $update_column = "UPDATE defaults SET payments_changeable = '$payments_changeable';";
- do_query($update_column);
+ $self->db_query($update_column);
return 1;
}
-return do_update();
-
+1;