projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Dateimanagement: erst nur letzte Version anzeigen / alle Versionen ausklappbar.
[kivitendo-erp.git]
/
sql
/
Pg-upgrade2
/
umstellung_eur.pl
diff --git
a/sql/Pg-upgrade2/umstellung_eur.pl
b/sql/Pg-upgrade2/umstellung_eur.pl
index
c0c2b7a
..
0b88400
100644
(file)
--- a/
sql/Pg-upgrade2/umstellung_eur.pl
+++ b/
sql/Pg-upgrade2/umstellung_eur.pl
@@
-1,33
+1,18
@@
# @tag: umstellung_eur
# @tag: umstellung_eur
-# @description: Variable eur umstellen: bitte
doc/umstellung_eur.txt
lesen
+# @description: Variable eur umstellen: bitte
in doc/dokumentation.pdf das entsprechende Kapitel zur Konfiguration von EUR
lesen
# @depends: release_2_6_3
# @depends: release_2_6_3
-# @charset: utf-8
-
-# this script relies on $eur still being set in lx_office.conf, and the
-# variable available in $::lx_office_conf{system}->{eur}
+package SL::DBUpgrade2::umstellung_eur;
+use strict;
use utf8;
use utf8;
-#use strict;
-use Data::Dumper;
-die("This script cannot be run from the command line.") unless ($main::form);
-
-sub mydberror {
- my ($msg) = @_;
- die($dbup_locale->text("Database update error:") .
- "<br>$msg<br>" . $DBI::errstr);
-}
-sub do_query {
- my ($query, $may_fail) = @_;
+use parent qw(SL::DBUpgrade2::Base);
- if (!$dbh->do($query)) {
- mydberror($query) unless ($may_fail);
- $dbh->rollback();
- $dbh->begin_work();
- }
-}
+# this script relies on $eur still being set in kivitendo.conf, and the
+# variable available in $::lx_office_conf{system}->{eur}
-sub do_update {
+sub run {
+ my ($self) = @_;
# check if accounting_method has already been set (new database), if so return
# only set variables according to eur for update of existing database
# check if accounting_method has already been set (new database), if so return
# only set variables according to eur for update of existing database
@@
-35,7
+20,7
@@
sub do_update {
foreach my $column (qw(accounting_method inventory_system profit_determination)) {
# this query will fail if columns already exist (new database)
foreach my $column (qw(accounting_method inventory_system profit_determination)) {
# this query will fail if columns already exist (new database)
-
do_query(qq|ALTER TABLE defaults ADD COLUMN ${column} TEXT|,
1);
+
$self->db_query(qq|ALTER TABLE defaults ADD COLUMN ${column} TEXT|, may_fail =>
1);
}
my $accounting_method;
}
my $accounting_method;
@@
-43,9
+28,9
@@
sub do_update {
my $profit_determination;
# check current configuration and set default variables accordingly, so that
my $profit_determination;
# 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 ($::lx_office_conf{system}->{eur} == 0 ) {
+ if (
!defined $::lx_office_conf{system}->{eur} ||
$::lx_office_conf{system}->{eur} == 0 ) {
$accounting_method = 'accrual';
$inventory_system = 'perpetual';
$profit_determination = 'balance';
$accounting_method = 'accrual';
$inventory_system = 'perpetual';
$profit_determination = 'balance';
@@
-62,13
+47,12
@@
sub do_update {
# only set parameters if they haven't already been set (this in only the case
# when upgrading)
# only set parameters if they haven't already been set (this in only the case
# when upgrading)
- my $update_eur = "UPDATE defaults set accounting_method = '$accounting_method' where accounting_method is null;" .
+ my $update_eur = "UPDATE defaults set accounting_method = '$accounting_method' where accounting_method is null;" .
"UPDATE defaults set inventory_system = '$inventory_system' where inventory_system is null; " .
"UPDATE defaults set profit_determination = '$profit_determination' where profit_determination is null;";
"UPDATE defaults set inventory_system = '$inventory_system' where inventory_system is null; " .
"UPDATE defaults set profit_determination = '$profit_determination' where profit_determination is null;";
-
do
_query($update_eur);
+
$self->db
_query($update_eur);
return 1;
}
return 1;
}
-return do_update();
-
+1;