X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=sql%2FPg-upgrade2%2Ffix_acc_trans_ap_taxkey_bug.pl;h=ec9e7f6afdcdd0f75aa5800fa6a0878543248b81;hb=6ea1dd9bb2e7965da7d0ef66a0b464267ce41a9b;hp=a2e70f9441c9a96d3ba259cefbccee7ccd4bd76c;hpb=b5138b786cad868f567966489d492d5d83b5fb9d;p=kivitendo-erp.git
diff --git a/sql/Pg-upgrade2/fix_acc_trans_ap_taxkey_bug.pl b/sql/Pg-upgrade2/fix_acc_trans_ap_taxkey_bug.pl
index a2e70f944..ec9e7f6af 100644
--- a/sql/Pg-upgrade2/fix_acc_trans_ap_taxkey_bug.pl
+++ b/sql/Pg-upgrade2/fix_acc_trans_ap_taxkey_bug.pl
@@ -1,28 +1,16 @@
# @tag: fix_acc_trans_ap_taxkey_bug
-# @description: Korrektur falscher Steuerschlüssel in acc_trans bei Eingangsrechnungen
+# @description: Korrektur falscher Steuerschlüssel in acc_trans bei Eingangsrechnungen
# @depends: release_2_6_0
+package SL::DBUpgrade2::fix_acc_trans_ap_taxkey_bug;
use strict;
+use utf8;
-die "This script cannot be run from the command line." unless $::form;
+use parent qw(SL::DBUpgrade2::Base);
-sub mydberror {
- my $msg = shift;
- die $dbup_locale->text("Database update error:") . "
$msg
" . $DBI::errstr;
-}
-
-sub do_query {
- my $query = shift;
- my $may_fail = shift;
-
- if (!$dbh->do($query)) {
- mydberror($query) unless $may_fail;
- $dbh->rollback();
- $dbh->begin_work();
- }
-}
+sub run {
+ my ($self) = @_;
-sub do_update {
my $q_find = <prepare($q_find) || mydberror($q_find);
- my $h_change = $dbh->prepare($q_change) || mydberror($q_change);
+ my $h_find = $self->dbh->prepare($q_find) || $self->db_error($q_find);
+ my $h_change = $self->dbh->prepare($q_change) || $self->db_error($q_change);
- $h_find->execute() || mydberror($q_find);
+ $h_find->execute() || $self->db_error($q_find);
my $num_changed = 0;
while (my $ref = $h_find->fetchrow_hashref()) {
# $::lxdebug->dump(0, "ref", $ref);
- $h_change->execute($ref->{wanted_taxkey}, $ref->{acc_trans_id}) || mydberror($q_change);
+ $h_change->execute($ref->{wanted_taxkey}, $ref->{acc_trans_id}) || $self->db_error($q_change);
$num_changed++;
}
$h_find->finish();
$h_change->finish();
- print $dbup_locale->text('Number of entries changed: #1', $num_changed) . "
\n";
+ print $::locale->text('Number of entries changed: #1', $num_changed) . "
\n";
+
+ return 1;
}
-do_update();
+1;