From: Jan Büren Date: Thu, 24 Mar 2022 14:46:36 +0000 (+0100) Subject: SKR03/SKR04 Entfernt ggf. uralte falsch verknüpfte Automatikkonten X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~107 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ee2a0ae982050060f37ceed52a4f992c2c771216;p=kivitendo-erp.git SKR03/SKR04 Entfernt ggf. uralte falsch verknüpfte Automatikkonten Laut der DATEV Steuerschlüssel Spezifikation darf es ferner auch kein Automatik-Konto mehrfach bei Steuerschlüssel verwendet werden. kivi erlaubt das schon immer, falls möglich setzt das skript den Wert auf unique --- diff --git a/sql/Pg-upgrade2/delete_wrong_charts_for_taxkeys.pl b/sql/Pg-upgrade2/delete_wrong_charts_for_taxkeys.pl new file mode 100644 index 000000000..159d4b0a4 --- /dev/null +++ b/sql/Pg-upgrade2/delete_wrong_charts_for_taxkeys.pl @@ -0,0 +1,62 @@ +# @tag: delete_wrong_charts_for_taxkeys +# @description: Uralte falsch angelegte Automatikkonten raus -> Chance auf tax.chart_id unique setzen +# @depends: release_3_6_0 +# @ignore: 0 +package SL::DBUpgrade2::delete_wrong_charts_for_taxkeys; + +use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); + +sub delete_chart_id_tax { + my $self = shift; + + my $q_fetch = < 1 +SQL + + # skr03 + my $q_update = <dbh->prepare($q_fetch); + $h_fetch->execute || $::form->dberror($q_fetch); + + my $h_update_03 = $self->dbh->prepare($q_update); + + while (my $entry = $h_fetch->fetchrow_hashref) { + $h_update_03->execute($entry->{chart_id}) || $::form->dberror($q_update); + } + # might be unique now + $h_fetch->execute || $::form->dberror($q_fetch); + + if (!$h_fetch->fetchrow_hashref) { + my $q_unique = <dbh->prepare($q_unique); + $q_unique_p->execute || $::form->dberror($q_unique_p); + } +} + +sub run { + my ($self) = @_; + + return 1 unless $self->check_coa('Germany-DATEV-SKR03EU'); + + $self->delete_chart_id_tax; + + return 1; +} + +1; diff --git a/sql/Pg-upgrade2/delete_wrong_charts_for_taxkeys_04.pl b/sql/Pg-upgrade2/delete_wrong_charts_for_taxkeys_04.pl new file mode 100644 index 000000000..95e408f7f --- /dev/null +++ b/sql/Pg-upgrade2/delete_wrong_charts_for_taxkeys_04.pl @@ -0,0 +1,63 @@ +# @tag: delete_wrong_charts_for_taxkeys_04 +# @description: SKR04: Uralte falsch angelegte Automatikkonten raus -> Chance auf tax.chart_id unique setzen +# @depends: release_3_6_0 +# @ignore: 0 +package SL::DBUpgrade2::delete_wrong_charts_for_taxkeys_04; + +use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); + +sub delete_chart_id_tax { + my $self = shift; + + my $q_fetch = < 1 +SQL + + # SKR04 + my $q_update_04 = <dbh->prepare($q_fetch); + $h_fetch->execute || $::form->dberror($q_fetch); + + my $h_update_04 = $self->dbh->prepare($q_update_04); + + while (my $entry = $h_fetch->fetchrow_hashref) { + $h_update_04->execute($entry->{chart_id}) || $::form->dberror($q_update_04); + } + # might be unique now + $h_fetch->execute || $::form->dberror($q_fetch); + + if (!$h_fetch->fetchrow_hashref) { + my $q_unique = <dbh->prepare($q_unique); + $q_unique_p->execute || $::form->dberror($q_unique_p); + } +} + +sub run { + my ($self) = @_; + + return 1 unless $self->check_coa('Germany-DATEV-SKR04EU'); + + $self->delete_chart_id_tax; + + return 1; +} + +1;