From: Moritz Bunkus Date: Tue, 23 Apr 2013 12:01:44 +0000 (+0200) Subject: Perl-Datenbank-Upgradescripte auf Objektorientierung & strict umgestellt X-Git-Tag: release-3.1.0beta1~477 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=347f2cff58f8d798bb0fe52495fb09b4e08db036;p=kivitendo-erp.git Perl-Datenbank-Upgradescripte auf Objektorientierung & strict umgestellt --- diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index 83210316c..86ae9fdee 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -4,6 +4,7 @@ use IO::File; use List::MoreUtils qw(any); use SL::Common; +use SL::DBUpgrade2::Base; use SL::DBUtils; use SL::Iconv; @@ -79,6 +80,7 @@ sub parse_dbupdate_controls { next if ($control->{ignore}); + $control->{charset} = 'UTF-8' if $file =~ m/\.pl$/; $control->{charset} = $control->{charset} || $control->{encoding} || Common::DEFAULT_CHARSET; if (!$control->{"tag"}) { @@ -240,39 +242,17 @@ sub process_perl_script { my ($self, $dbh, $filename, $version_or_control, $db_charset) = @_; - my $form = $self->{form}; - my $fh = IO::File->new($filename, "r") or $form->error("$filename : $!\n"); - my $file_charset = Common::DEFAULT_CHARSET; - - if (ref($version_or_control) eq "HASH") { - $file_charset = $version_or_control->{charset}; - - } else { - while (<$fh>) { - last if !/^--/; - next if !/^--\s*\@(?:charset|encoding):\s*(.+)/; - $file_charset = $1; - last; - } - $fh->seek(0, SEEK_SET); - } - - my $contents = join "", <$fh>; - $fh->close(); + $dbh->begin_work; - $db_charset ||= Common::DEFAULT_CHARSET; - - my $iconv = SL::Iconv->new($file_charset, $db_charset); - - $dbh->begin_work(); - - # setup dbup_ export vars - my %dbup_myconfig = (); - map({ $dbup_myconfig{$_} = $form->{$_}; } qw(dbname dbuser dbpasswd dbhost dbport dbconnect)); - - my $dbup_locale = $::locale; - - my $result = eval($contents); + # setup dbup_ export vars & run script + my %dbup_myconfig = map { ($_ => $::form->{$_}) } qw(dbname dbuser dbpasswd dbhost dbport dbconnect); + my $result = SL::DBUpgrade2::Base::execute_script( + file_name => $filename, + tag => $version_or_control->{tag}, + dbh => $dbh, + locale => $::locale, + myconfig => \%dbup_myconfig, + ); if (1 != $result) { $dbh->rollback(); @@ -280,9 +260,7 @@ sub process_perl_script { } if (!defined($result)) { - print $form->parse_html_template("dbupgrade/error", - { "file" => $filename, - "error" => $@ }); + print $::form->parse_html_template("dbupgrade/error", { file => $filename, error => $@ }); ::end_of_request(); } elsif (1 != $result) { unlink("users/nologin") if (2 == $result); @@ -290,7 +268,7 @@ sub process_perl_script { } if (ref($version_or_control) eq "HASH") { - $dbh->do("INSERT INTO " . $self->{schema} . "schema_info (tag, login) VALUES (" . $dbh->quote($version_or_control->{"tag"}) . ", " . $dbh->quote($form->{"login"}) . ")"); + $dbh->do("INSERT INTO " . $self->{schema} . "schema_info (tag, login) VALUES (" . $dbh->quote($version_or_control->{tag}) . ", " . $dbh->quote($::form->{login}) . ")"); } elsif ($version_or_control) { $dbh->do("UPDATE defaults SET version = " . $dbh->quote($version_or_control)); } diff --git a/SL/DBUpgrade2/Base.pm b/SL/DBUpgrade2/Base.pm new file mode 100644 index 000000000..25e0777d4 --- /dev/null +++ b/SL/DBUpgrade2/Base.pm @@ -0,0 +1,157 @@ +package SL::DBUpgrade2::Base; + +use strict; + +use parent qw(Rose::Object); + +use English qw(-no_match_vars); +use Rose::Object::MakeMethods::Generic ( + scalar => [ qw(dbh myconfig) ], +); + +use SL::DBUtils; + +sub execute_script { + my (%params) = @_; + + my $file_name = delete $params{file_name}; + + if (!eval { require $file_name }) { + delete $INC{$file_name}; + die $EVAL_ERROR; + } + + my $package = delete $params{tag}; + $package =~ s/[^a-zA-Z0-9_]+/_/g; + $package = "SL::DBUpgrade2::${package}"; + + $package->new(%params)->run; +} + +sub db_error { + my ($self, $msg) = @_; + + die $self->locale->text("Database update error:") . "
$msg
" . $DBI::errstr; +} + +sub db_query { + my ($self, $query, $may_fail) = @_; + + return if $self->dbh->do($query); + + $self->db_error($query) unless $may_fail; + + $self->dbh->rollback; + $self->dbh->begin_work; +} + +sub check_coa { + my ($self, $wanted_coa) = @_; + + my ($have_coa) = selectrow_query($::form, $self->dbh, q{ SELECT count(*) FROM defaults WHERE coa = ? }, $wanted_coa); + + return $have_coa; +} + +sub is_coa_empty { + my ($self) = @_; + + my $query = q{ SELECT count(*) + FROM ar, ap, gl, invoice, acc_trans, customer, vendor, parts + }; + my ($empty) = selectrow_query($::form, $self->dbh, $query); + + return !$empty; +} + +1; +__END__ + +=pod + +=encoding utf8 + +=head1 NAME + +SL::DBUpgrade2::Base - Base class for Perl-based database upgrade files + +=head1 OVERVIEW + +Database scripts written in Perl must be derived from this class and +provide a method called C. + +The functions in this base class offer functionality for the upgrade +scripts. + +=head1 PROPERTIES + +The following properties (which can be accessed with +C<$self-Eproperty_name>) are available to the database upgrade +script: + +=over 4 + +=item C + +The database handle; an Instance of L. It is connected, and a +transaction has been started right before the script (the method +L)) was executed. + +=item C + +The stripped-down version of the C<%::myconfig> hash: this hash +reference only contains the database connection parameters applying to +the current database. + +=back + + +=head1 FUNCTIONS + +=over 4 + +=item C + +Returns trueish if the database uses the chart of accounts named +C<$coa_name>. + +=item C + +Outputs an error message C<$message> to the user and aborts execution. + +=item C + +Executes an SQL query. What the method does if the query fails depends +on C<$may_fail>. If it is falsish then the method will simply die +outputting the error message via L. If C<$may_fail> is +trueish then the current transaction will be rolled back, a new one +will be started + +=item C + +Executes a named database upgrade script. This function is not +supposed to be called from an upgrade script. Instead, the upgrade +manager L uses it in order to execute the actual +database upgrade scripts. + +=item C + +Returns trueish if no transactions have been recorded in the table +C yet. + +=item C + +This method is the entry point for the actual upgrade. Each upgrade +script must provide this method. + +=back + +=head1 BUGS + +Nothing here yet. + +=head1 AUTHOR + +Moritz Bunkus Em.bunkus@linet-services.deE + +=cut diff --git a/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl b/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl index 78726cc67..79df5f801 100644 --- a/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl +++ b/sql/Pg-upgrade2-auth/auth_schema_normalization_1.pl @@ -1,30 +1,33 @@ -#!/usr/bin/perl # @tag: auth_schema_normalization_1 # @description: Auth-Datenbankschema Normalisierungen Teil 1 # @depends: +package SL::DBUpgrade2::auth_schema_normalization_1; use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); sub do_one { - my ($dbh, $query) = @_; + my ($self, $query) = @_; - if ($dbh->do($query)) { - $dbh->commit(); + if ($self->dbh->do($query)) { + $self->dbh->commit(); } else { - $dbh->rollback(); + $self->dbh->rollback(); } } -sub do_all { - my $dbh = $::auth->dbconnect(); +sub run { + my ($self) = @_; + + $self->dbh($::auth->dbconnect); my @queries = ( qq|ALTER TABLE auth.group_rights ADD PRIMARY KEY (group_id, "right");|, qq|ALTER TABLE auth.user_config ADD PRIMARY KEY (user_id, cfg_key);|, qq|ALTER TABLE auth.user_group ADD PRIMARY KEY (user_id, group_id);|); - do_one($dbh, $_) for @queries; + $self->do_one($_) for @queries; } -do_all(); - 1; diff --git a/sql/Pg-upgrade2/SKR04-3804-addition.pl b/sql/Pg-upgrade2/SKR04-3804-addition.pl index 23630765f..e11d7928e 100644 --- a/sql/Pg-upgrade2/SKR04-3804-addition.pl +++ b/sql/Pg-upgrade2/SKR04-3804-addition.pl @@ -1,33 +1,18 @@ # @tag: SKR04-3804-addition # @description: Konto 3804 zu SKR04 hinzufügen: Umsatzsteuer 19% für Steuerschlüssel 13 (Umsatzsteuer aus EG-Erwerb) # @depends: -# @charset: UTF-8 +package SL::DBUpgrade2::SKR04_3804_addition; use utf8; use strict; -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) = @_; # 1. Überprüfen ob Kontenrahmen SKR04 ist, wenn nicht alles überspringen - my ($kontenrahmen) = $dbh->selectrow_array("select coa from defaults"); + my ($kontenrahmen) = $self->dbh->selectrow_array("select coa from defaults"); unless ( $kontenrahmen eq 'Germany-DATEV-SKR04EU' ) { print "Kontenrahmen ist nicht SKR04, überspringen
"; @@ -39,41 +24,43 @@ sub do_update { # mit der falschen MwSt (16%) gebucht worden, wenn dies nicht manuell # geändert worden ist - my ($anzahl_buchungen) = $dbh->selectrow_array("select count (*) from acc_trans where taxkey=13 and transdate >= '2007-01-01';"); + my ($anzahl_buchungen) = $self->dbh->selectrow_array("select count (*) from acc_trans where taxkey=13 and transdate >= '2007-01-01';"); if ( $anzahl_buchungen > 0 ) { - if ($main::form->{bookings_exist} ) { + if ($::form->{bookings_exist} ) { # Benutzer hat Meldung bestätigt print "Buchungen nach dem 01.01.2007 existierten, Upgrade überspringen"; - return 1; - } else { - # Meldung anzeigen und auf Rückgabe warten - print_past_booking_warning(); - return 2; - }; - } else { # es gibt keine Buchungen mit taxkey 13 nach 01.01.2007 - - # prüfen ob Konto 3804 schon existiert - my ($konto_existiert) = $dbh->selectrow_array("select count (*) from chart where accno = '3804'"); - if ( $konto_existiert ) { - # 3804 existiert, wir gehen davon aus, daß der Benutzer das Konto schon selber angelegt hat und - # ordnungsgemäß benutzt - - if ($main::form->{account_exists} ) { + return 1; + } + + # Meldung anzeigen und auf Rückgabe warten + print_past_booking_warning(); + return 2; + } + + # es gibt keine Buchungen mit taxkey 13 nach 01.01.2007 + + # prüfen ob Konto 3804 schon existiert + my ($konto_existiert) = $self->dbh->selectrow_array("select count (*) from chart where accno = '3804'"); + if ( $konto_existiert ) { + # 3804 existiert, wir gehen davon aus, daß der Benutzer das Konto schon selber angelegt hat und + # ordnungsgemäß benutzt + + if ($::form->{account_exists} ) { # Benutzer hat Meldung bestätigt - print "Konto existiert, Upgrade überspringen\n"; - return 1; - } else { - # Meldung anzeigen und auf Rückgabe warten - print_3804_already_exists(); - return 2; - }; - } else { + print "Konto existiert, Upgrade überspringen\n"; + return 1; + } + + # Meldung anzeigen und auf Rückgabe warten + print_3804_already_exists(); + return 2; + } # noch keine Buchungen mit taxkey 13 und Konto 3804 existiert noch nicht, # also legen wir es an und machen noch die nötigen Einstellungen in tax und # taxkeys - my $insert_chart = <prepare($insert_chart) || mydberror($insert_chart); - + $self->db_query($insert_chart); - # 13-1 (16%) korrigieren: - my $edit_taxkey_13 = qq|UPDATE tax SET taxdescription = 'Steuerpflichtige EG-Lieferung zum vollen Steuersatz', rate = '0.16', chart_id = (select id FROM chart where accno = '3803'), taxnumber = 3803 WHERE taxkey = '13'|; - do_query($edit_taxkey_13); + my $konto_anlegen = $self->dbh->prepare($insert_chart) || $self->db_error($insert_chart); - # Sicherstellen, daß 3803 die richtige Bezeichnung hat - my $update_3803 = qq|update chart set description = 'Umsatzsteuer aus EG-Erwerb 16%' where accno = '3803'|; - do_query($update_3803); + # 13-1 (16%) korrigieren: + my $edit_taxkey_13 = qq|UPDATE tax SET taxdescription = 'Steuerpflichtige EG-Lieferung zum vollen Steuersatz', rate = '0.16', chart_id = (select id FROM chart where accno = '3803'), taxnumber = 3803 WHERE taxkey = '13'|; + $self->db_query($edit_taxkey_13); - # Zweiter Eintrag für taxkey 13 in key: 19% - my $insert_taxkey_13_2 = qq|INSERT INTO tax ( taxkey, taxdescription, rate, chart_id, taxnumber ) VALUES ('13', 'Steuerpflichtige EG-Lieferung zum vollen Steuersatz', '0.19', (select id from chart where accno = '3804'), '3804')|; + # Sicherstellen, daß 3803 die richtige Bezeichnung hat + my $update_3803 = qq|update chart set description = 'Umsatzsteuer aus EG-Erwerb 16%' where accno = '3803'|; + $self->db_query($update_3803); - do_query($insert_taxkey_13_2); + # Zweiter Eintrag für taxkey 13 in key: 19% + my $insert_taxkey_13_2 = qq|INSERT INTO tax ( taxkey, taxdescription, rate, chart_id, taxnumber ) VALUES ('13', 'Steuerpflichtige EG-Lieferung zum vollen Steuersatz', '0.19', (select id from chart where accno = '3804'), '3804')|; - # alle Konten finden, bei denen 3803 das Steuerautomatikkonto ist, - # und dort den zweiten Eintrag ab 1.1.2007 für 19% einstellen - my $sth_query = $dbh->prepare(qq|select c.id from chart c join taxkeys t on (c.id = t.chart_id) where tax_id = (select id from tax where taxnumber = '3803')|); - my $sth_insert = $dbh->prepare(qq|INSERT INTO taxkeys ( taxkey_id, chart_id, tax_id, pos_ustva, startdate ) - VALUES (13, ?, (select id from tax where taxkey = 13 and rate = '0.19'), - (select pos_ustva from taxkeys where tax_id = (select id from tax where taxnumber = '3803') and pos_ustva > 0 limit 1), - '01.01.2007')|); - $sth_query->execute(); + $self->db_query($insert_taxkey_13_2); - while (my $ref = $sth_query->fetchrow_hashref()) { - $sth_insert->execute($ref->{id}); - } - $sth_query->finish(); - $sth_insert->finish(); + # alle Konten finden, bei denen 3803 das Steuerautomatikkonto ist, + # und dort den zweiten Eintrag ab 1.1.2007 für 19% einstellen + my $sth_query = $self->dbh->prepare(qq|select c.id from chart c join taxkeys t on (c.id = t.chart_id) where tax_id = (select id from tax where taxnumber = '3803')|); + my $sth_insert = $self->dbh->prepare(< 0 LIMIT 1), + '01.01.2007' ) +SQL + $sth_query->execute; - }; # end code update - }; # end check if 3804 exists + while (my $ref = $sth_query->fetchrow_hashref) { + $sth_insert->execute($ref->{id}); + } + $sth_query->finish; + $sth_insert->finish; -}; # end do_update +} # end run sub print_past_booking_warning { - print $main::form->parse_html_template("dbupgrade/SKR04_3804_update"); -}; + print $::form->parse_html_template("dbupgrade/SKR04_3804_update"); +} + sub print_3804_already_exists { - print $main::form->parse_html_template("dbupgrade/SKR04_3804_already_exists"); -}; + print $::form->parse_html_template("dbupgrade/SKR04_3804_already_exists"); +} -return do_update(); +1; diff --git a/sql/Pg-upgrade2/USTVA_abstraction.pl b/sql/Pg-upgrade2/USTVA_abstraction.pl index 24dbd42ed..a1b4a9caa 100644 --- a/sql/Pg-upgrade2/USTVA_abstraction.pl +++ b/sql/Pg-upgrade2/USTVA_abstraction.pl @@ -1,6 +1,12 @@ # @tag: USTVA_abstraction # @description: Abstraktion der USTVA Report Daten. Dies vereinfacht die Integration von Steuerberichten anderer Nationen in kivitendo. # @depends: release_2_4_2 +package SL::DBUpgrade2::USTVA_abstraction; + +use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); # Abstraktionlayer between general Taxreports and USTVA # Most of the data and structures are not used yet, but maybe in future, @@ -8,28 +14,8 @@ ################### -use strict; - -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(); - } -} - - sub create_tables { + my ($self) = @_; # Watch out, SCHEMAs are new in Lx! my @queries = ( # Watch out, it's a normal array! @@ -61,14 +47,15 @@ sub create_tables { }, ); - do_query("DROP SCHEMA tax CASCADE;", 1); - map({ do_query($_, 0); } @queries); + $self->db_query("DROP SCHEMA tax CASCADE;", 1); + map({ $self->db_query($_, 0); } @queries); return 1; } sub do_copy { + my ($self) = @_; my @copy_statements = ( "INSERT INTO tax.report_categorys (id, description, subdescription) VALUES (?, ?, ?)", @@ -78,85 +65,89 @@ sub do_copy { my @copy_data = ( [ "0;;", - "1;Lieferungen und sonstige Leistungen;(einschließlich unentgeltlicher Wertabgaben)", + "1;Lieferungen und sonstige Leistungen;(einschließlich unentgeltlicher Wertabgaben)", "2;Innergemeinschaftliche Erwerbe;", - "3;Ergänzende Angaben zu Umsätzen;", + "3;Ergänzende Angaben zu Umsätzen;", "99;Summe;", ], ["0;0;;;", - "1;1;received;Steuerfreie Umsätze mit Vorsteuerabzug;", - "2;1;recieved;Steuerfreie Umsätze ohne Vorsteuerabzug;", - "3;1;recieved;Steuerpflichtige Umsätze;(Lieferungen und sonstige Leistungen einschl. unentgeltlicher Wertabgaben)", + "1;1;received;Steuerfreie Umsätze mit Vorsteuerabzug;", + "2;1;recieved;Steuerfreie Umsätze ohne Vorsteuerabzug;", + "3;1;recieved;Steuerpflichtige Umsätze;(Lieferungen und sonstige Leistungen einschl. unentgeltlicher Wertabgaben)", "4;2;recieved;Steuerfreie innergemeinschaftliche Erwerbe;", "5;2;recieved;Steuerpflichtige innergemeinschaftliche Erwerbe;", - "6;3;recieved;Umsätze, für die als Leistungsempfänger die Steuer nach § 13b Abs. 2 UStG geschuldet wird;", + "6;3;recieved;Umsätze, für die als Leistungsempfänger die Steuer nach § 13b Abs. 2 UStG geschuldet wird;", "66;3;recieved;;", - "7;3;paied;Abziehbare Vorsteuerbeträge;", - "8;3;paied;Andere Steuerbeträge;", + "7;3;paied;Abziehbare Vorsteuerbeträge;", + "8;3;paied;Andere Steuerbeträge;", "99;99;;Summe;", ], ["0;keine;0;< < < keine UStVa Position > > >;;;19700101", - "1;41;1;Innergemeinschaftliche Lieferungen (§ 4 Nr. 1 Buchst. b UStG) an Abnehmer mit USt-IdNr.;0;0;19700101", + "1;41;1;Innergemeinschaftliche Lieferungen (§ 4 Nr. 1 Buchst. b UStG) an Abnehmer mit USt-IdNr.;0;0;19700101", "2;44;1;neuer Fahrzeuge an Abnehmer ohne USt-IdNr.;0;0;19700101", - "3;49;1;neuer Fahrzeuge außerhalb eines Unternehmens (§ 2a UStG);0;0;19700101", - "4;43;1;Weitere steuerfreie Umsätze mit Vorsteuerabzug;0;0;19700101", - "5;48;2;Umsätze nach § 4 Nr. 8 bis 28 UStG;0;0;19700101", + "3;49;1;neuer Fahrzeuge außerhalb eines Unternehmens (§ 2a UStG);0;0;19700101", + "4;43;1;Weitere steuerfreie Umsätze mit Vorsteuerabzug;0;0;19700101", + "5;48;2;Umsätze nach § 4 Nr. 8 bis 28 UStG;0;0;19700101", "6;51;3;zum Steuersatz von 16 %;0;0;19700101", "7;511;3;;6;2;19700101", "8;81;3;zum Steuersatz von 19 %;0;0;19700101", "9;811;3;;8;2;19700101", "10;86;3;zum Steuersatz von 7 %;0;0;19700101", "11;861;3;;10;2;19700101", - "12;35;3;Umsätze, die anderen Steuersätzen unterliegen;0;0;19700101", + "12;35;3;Umsätze, die anderen Steuersätzen unterliegen;0;0;19700101", "13;36;3;;12;2;19700101", - "14;77;3;Lieferungen in das übrige Gemeinschaftsgebiet an Abnehmer mit USt-IdNr.;0;0;19700101", - "15;76;3;Umsätze, für die eine Steuer nach § 24 UStG zu entrichten ist;0;0;19700101", + "14;77;3;Lieferungen in das übrige Gemeinschaftsgebiet an Abnehmer mit USt-IdNr.;0;0;19700101", + "15;76;3;Umsätze, für die eine Steuer nach § 24 UStG zu entrichten ist;0;0;19700101", "16;80;3;;15;2;19700101", - "17;91;4;Erwerbe nach § 4b UStG;0;0;19700101", + "17;91;4;Erwerbe nach § 4b UStG;0;0;19700101", "18;97;5;zum Steuersatz von 16 %;0;0;19700101", "19;971;5;;18;2;19700101", "20;89;5;zum Steuersatz von 19 %;0;0;19700101", "21;891;5;;20;2;19700101", "22;93;5;zum Steuersatz von 7 %;0;0;19700101", "23;931;5;;22;2;19700101", - "24;95;5;zu anderen Steuersätzen;0;0;19700101", + "24;95;5;zu anderen Steuersätzen;0;0;19700101", "25;98;5;;24;2;19700101", "26;94;5;neuer Fahrzeuge von Lieferern ohne USt-IdNr. zum allgemeinen Steuersatz;0;0;19700101", "27;96;5;;26;2;19700101", - "28;42;66;Lieferungen des ersten Abnehmers bei innergemeinschaftlichen Dreiecksgeschäften (§ 25b Abs. 2 UStG);0;0;19700101", - "29;60;66;Steuerpflichtige Umsätze im Sinne des § 13b Abs. 1 Satz 1 Nr. 1 bis 5 UStG, für die der Leistungsempfänger die Steuer schuldet;0;0;19700101", - "30;45;66;Nicht steuerbare Umsätze (Leistungsort nicht im Inland);0;0;19700101", - "31;52;6;Leistungen eines im Ausland ansässigen Unternehmers (§ 13b Abs. 1 Satz 1 Nr. 1 und 5 UStG);0;0;19700101", + "28;42;66;Lieferungen des ersten Abnehmers bei innergemeinschaftlichen Dreiecksgeschäften (§ 25b Abs. 2 UStG);0;0;19700101", + "29;60;66;Steuerpflichtige Umsätze im Sinne des § 13b Abs. 1 Satz 1 Nr. 1 bis 5 UStG, für die der Leistungsempfänger die Steuer schuldet;0;0;19700101", + "30;45;66;Nicht steuerbare Umsätze (Leistungsort nicht im Inland);0;0;19700101", + "31;52;6;Leistungen eines im Ausland ansässigen Unternehmers (§ 13b Abs. 1 Satz 1 Nr. 1 und 5 UStG);0;0;19700101", "32;53;6;;31;2;19700101", - "33;73;6;Lieferungen sicherungsübereigneter Gegenstände und Umsätze, die unter das GrEStG fallen (§ 13b Abs. 1 Satz 1 Nr. 2 und 3 UStG);0;0;19700101", + "33;73;6;Lieferungen sicherungsübereigneter Gegenstände und Umsätze, die unter das GrEStG fallen (§ 13b Abs. 1 Satz 1 Nr. 2 und 3 UStG);0;0;19700101", "34;74;6;;33;2;19700101", - "35;84;6;Bauleistungen eines im Inland ansässigen Unternehmers (§ 13b Abs. 1 Satz 1 Nr. 4 UStG);0;0;19700101", + "35;84;6;Bauleistungen eines im Inland ansässigen Unternehmers (§ 13b Abs. 1 Satz 1 Nr. 4 UStG);0;0;19700101", "36;85;6;;35;2;19700101", - "37;65;6;Steuer infolge Wechsels der Besteuerungsform sowie Nachsteuer auf versteuerte Anzahlungen u. ä. wegen Steuersatzänderung;;2;19700101", - "38;66;7;Vorsteuerbeträge aus Rechnungen von anderen Unternehmern (§ 15 Abs. 1 Satz 1 Nr. 1 UStG), aus Leistungen im Sinne des § 13a Abs. 1 Nr. 6 UStG (§ 15 Abs. 1 Satz 1 Nr. 5 UStG) und aus innergemeinschaftlichen Dreiecksgeschäften (§ 25b Abs. 5 UStG);;2;19700101", - "39;61;7;Vorsteuerbeträge aus dem innergemeinschaftlichen Erwerb von Gegenständen (§ 15 Abs. 1 Satz 1 Nr. 3 UStG);;2;19700101", - "40;62;7;Entrichtete Einfuhrumsatzsteuer (§ 15 Abs. 1 Satz 1 Nr. 2 UStG);;2;19700101", - "41;67;7;Vorsteuerbeträge aus Leistungen im Sinne des § 13b Abs. 1 UStG (§ 15 Abs. 1 Satz 1 Nr. 4 UStG);;2;19700101", - "42;63;7;Vorsteuerbeträge, die nach allgemeinen Durchschnittssätzen berechnet sind (§§ 23 und 23a UStG);;2;19700101", - "43;64;7;Berichtigung des Vorsteuerabzugs (§ 15a UStG);;2;19700101", - "44;59;7;Vorsteuerabzug für innergemeinschaftliche Lieferungen neuer Fahrzeuge außerhalb eines Unternehmens (§ 2a UStG) sowie von Kleinunternehmern im Sinne des § 19 Abs. 1 UStG (§ 15 Abs. 4a UStG);;2;19700101", - "45;69;8;in Rechnungen unrichtig oder unberechtigt ausgewiesene Steuerbeträge (§ 14c UStG) sowie Steuerbeträge, die nach § 4 Nr. 4a Satz 1 Buchst. a Satz 2, § 6a Abs. 4 Satz 2, § 17 Abs. 1 Satz 6 oder § 25b Abs. 2 UStG geschuldet werden;;2;19700101", - "46;39;8;Anrechnung (Abzug) der festgesetzten Sondervorauszahlung für Dauerfristverlängerung (nur auszufüllen in der letzten Voranmeldung des Besteuerungszeitraums, in der Regel Dezember);;2;19700101", + "37;65;6;Steuer infolge Wechsels der Besteuerungsform sowie Nachsteuer auf versteuerte Anzahlungen u. ä. wegen Steuersatzänderung;;2;19700101", + "38;66;7;Vorsteuerbeträge aus Rechnungen von anderen Unternehmern (§ 15 Abs. 1 Satz 1 Nr. 1 UStG), aus Leistungen im Sinne des § 13a Abs. 1 Nr. 6 UStG (§ 15 Abs. 1 Satz 1 Nr. 5 UStG) und aus innergemeinschaftlichen Dreiecksgeschäften (§ 25b Abs. 5 UStG);;2;19700101", + "39;61;7;Vorsteuerbeträge aus dem innergemeinschaftlichen Erwerb von Gegenständen (§ 15 Abs. 1 Satz 1 Nr. 3 UStG);;2;19700101", + "40;62;7;Entrichtete Einfuhrumsatzsteuer (§ 15 Abs. 1 Satz 1 Nr. 2 UStG);;2;19700101", + "41;67;7;Vorsteuerbeträge aus Leistungen im Sinne des § 13b Abs. 1 UStG (§ 15 Abs. 1 Satz 1 Nr. 4 UStG);;2;19700101", + "42;63;7;Vorsteuerbeträge, die nach allgemeinen Durchschnittssätzen berechnet sind (§§ 23 und 23a UStG);;2;19700101", + "43;64;7;Berichtigung des Vorsteuerabzugs (§ 15a UStG);;2;19700101", + "44;59;7;Vorsteuerabzug für innergemeinschaftliche Lieferungen neuer Fahrzeuge außerhalb eines Unternehmens (§ 2a UStG) sowie von Kleinunternehmern im Sinne des § 19 Abs. 1 UStG (§ 15 Abs. 4a UStG);;2;19700101", + "45;69;8;in Rechnungen unrichtig oder unberechtigt ausgewiesene Steuerbeträge (§ 14c UStG) sowie Steuerbeträge, die nach § 4 Nr. 4a Satz 1 Buchst. a Satz 2, § 6a Abs. 4 Satz 2, § 17 Abs. 1 Satz 6 oder § 25b Abs. 2 UStG geschuldet werden;;2;19700101", + "46;39;8;Anrechnung (Abzug) der festgesetzten Sondervorauszahlung für Dauerfristverlängerung (nur auszufüllen in der letzten Voranmeldung des Besteuerungszeitraums, in der Regel Dezember);;2;19700101", ], ); for my $statement ( 0 .. $#copy_statements ) { - my $query = $iconv->convert($copy_statements[$statement]); - my $sth = $dbh->prepare($query) || mydberror($query); + my $query = $copy_statements[$statement]; + my $sth = $self->dbh->prepare($query) || $self->db_error($query); for my $copy_line ( 0 .. $#{$copy_data[$statement]} ) { #print $copy_data[$statement][$copy_line] . "
" - $sth->execute(split m/;/, $iconv->convert($copy_data[$statement][$copy_line]), -1) || mydberror($query); + $sth->execute(split m/;/, $copy_data[$statement][$copy_line], -1) || $self->db_error($query); } $sth->finish(); } return 1; } +sub run { + my ($self) = @_; + return $self->create_tables && $self->do_copy; +} -return create_tables() && do_copy(); +1; diff --git a/sql/Pg-upgrade2/USTVA_at.pl b/sql/Pg-upgrade2/USTVA_at.pl index 1cafb2de9..2cffc3d78 100644 --- a/sql/Pg-upgrade2/USTVA_at.pl +++ b/sql/Pg-upgrade2/USTVA_at.pl @@ -1,71 +1,46 @@ # @tag: USTVA_at # @description: USTVA Report Daten fuer Oesterreich. Vielen Dank an Gerhard Winkler.. # @depends: USTVA_abstraction +package SL::DBUpgrade2::USTVA_at; use strict; +use utf8; -use SL::DBUtils; +use parent qw(SL::DBUpgrade2::Base); -unless ( $main::form ) { - die("This script cannot be run from the command line."); -} +sub run { + my ($self) = @_; -if ( check_coa('Austria') ){ - - if ( coa_is_empty() ) { - print qq|Eine leere Datenbank mit Kontenrahmen Österreich vorgefunden.
- Die Aktualisierungen werden eingespielt...
- Achtung: Dieses Update ist ungetestet und bedarf weiterer Konfiguration|; - - return 1 - && clear_tables(( 'tax.report_variables', 'tax.report_headings', - 'tax.report_categorys', 'taxkeys', - 'tax', 'chart', - 'buchungsgruppen', - )) - && do_copy_tax_report_structure() - && do_insert_chart() - && do_insert_tax() - && do_insert_taxkeys() - && do_insert_buchungsgruppen() - ; + if (!$self->check_coa('Austria')) { + print qq|Nichts zu tun in diesem Kontenrahmen.|; + return 1; } - else { - print qq|Eine österreichische Datenbank in der bereits Buchungssätze enthalten sind, kann nicht aktualisiert werden.
+ + if (!$self->is_coa_empty) { + print qq|Eine österreichische Datenbank in der bereits Buchungssätze enthalten sind, kann nicht aktualisiert werden.
Bitte eine neue Datenbank mit Kontenrahmen 'Austria' anlegen.|; return 1; } + print qq|Eine leere Datenbank mit Kontenrahmen Österreich vorgefunden.
+ Die Aktualisierungen werden eingespielt...
+ Achtung: Dieses Update ist ungetestet und bedarf weiterer Konfiguration|; + + return + $self->clear_tables('tax.report_variables', 'tax.report_headings', + 'tax.report_categorys', 'taxkeys', + 'tax', 'chart', + 'buchungsgruppen') + && $self->do_copy_tax_report_structure() + && $self->do_insert_chart() + && $self->do_insert_tax() + && $self->do_insert_taxkeys() + && $self->do_insert_buchungsgruppen() + ; } -else { - print qq|Nichts zu tun in diesem Kontenrahmen.|; - return 1; -} - -return 0; - -###################################################### - -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(); - } -} - sub clear_tables { - - my @clear = @_; + my ($self, @clear) = @_; my @queries = ( q{ DELETE FROM tax.report_categorys; }, @@ -73,44 +48,21 @@ sub clear_tables { q{ DELETE FROM tax.report_variables; }, ); - map({ do_query("DELETE FROM $_ ;", 0); } @clear); + map({ $self->db_query("DELETE FROM $_ ;", 0); } @clear); return 1; } -sub check_coa { - - my ( $want_coa ) = @_; - - my $query = q{ SELECT count(*) FROM defaults WHERE coa = ? }; - my ($have_coa) = selectrow_query($main::form, $dbh, $query, $want_coa); - - return $have_coa; - -} - -sub coa_is_empty { - - my $query = q{ SELECT count(*) - FROM ar, ap, gl, invoice, acc_trans, customer, vendor, parts - }; - my ($empty) = selectrow_query($main::form, $dbh, $query); - - $empty = !$empty; - - return $empty; -} - - sub do_copy_tax_report_structure { + my ($self) = @_; my @queries = ( "INSERT INTO tax.report_categorys (id, description, subdescription) VALUES (0, NULL, NULL)", "INSERT INTO tax.report_headings (id, category_id, type, description, subdescription) VALUES (0, 0, NULL, NULL, NULL)", ); - map({ do_query($_); } @queries); + map({ $self->db_query($_); } @queries); my @copy_statements = ( @@ -120,66 +72,66 @@ sub do_copy_tax_report_structure { my @copy_data = ( [ - "1;000;0;a) Gesamtbetrag der Bemessungsgrundlage für Lieferungen und sonstige Leistungen (ohne den nachstehend angeführten Eigenverbrauch) einschließlich Anzahlungen (jeweils ohne Umsatzsteuer);2;1970-01-01", - "2;001;0;zuzüglich Eigenverbrauch (§1 Abs. 1 Z 2, § 3 Abs. 2 und § 3a Abs. 1a);2;1970-01-01", - "3;021;0;abzüglich Umsätze für die die Steuerschuld gemäß § 19 Abs. 1 zweiter Satz sowie gemäß § 19 Abs. 1a, Abs. 1b, Abs. 1c auf den Leistungsempfänger übergegangen ist.;2;1970-01-01", - "4;011;0;a) §6 Abs. 1 Z 1 iVm § 7 (Ausfuhrlieferungen);2;1970-01-01", - "5;012;0;b) §6 Abs. 1 Z 1 iVm § 8 (Lohnveredelungen);2;1970-01-01", - "6;015;0;c) §6 Abs. 1 Z 2 bis 6 sowie § 23 Abs. 5 (Seeschifffahrt, Luftfahrt, grenzüberschreitende Personenbeförderung, Diplomaten, Reisevorleistungen im Drittlandsgebiet usw.);2;1970-01-01", - "7;017;0;d) Art. 6 Abs. 1 (innergemeinschaftliche Lieferungen ohne die nachstehend gesondert anzuführenden Fahrzeuglieferungen);2;1970-01-01", - "8;018;0;e) Art. 6 Abs. 1, sofern Lieferungen neuer Fahrzeuge an Abnehmer ohne UID-Nummer bzw. durch Fahrzeuglieferer gemäß Art. 2 erfolgen.;2;1970-01-01", - "9;019;0;a) § 6 Abs. 1 Z 9 lit. a (Grundstücksumsätze);2;1970-01-01", - "10;016;0;b) §6 Abs. 1 Z 27 (Kleinunternehmer);2;1970-01-01", - "11;020;0;c) § 6 Abs. 1 Z ___ (übrige steuerfreie Umsätze ohne Vorsteuerabzug);2;1970-01-01", + "1;000;0;a) Gesamtbetrag der Bemessungsgrundlage für Lieferungen und sonstige Leistungen (ohne den nachstehend angeführten Eigenverbrauch) einschließlich Anzahlungen (jeweils ohne Umsatzsteuer);2;1970-01-01", + "2;001;0;zuzüglich Eigenverbrauch (§1 Abs. 1 Z 2, § 3 Abs. 2 und § 3a Abs. 1a);2;1970-01-01", + "3;021;0;abzüglich Umsätze für die die Steuerschuld gemäß § 19 Abs. 1 zweiter Satz sowie gemäß § 19 Abs. 1a, Abs. 1b, Abs. 1c auf den Leistungsempfänger übergegangen ist.;2;1970-01-01", + "4;011;0;a) §6 Abs. 1 Z 1 iVm § 7 (Ausfuhrlieferungen);2;1970-01-01", + "5;012;0;b) §6 Abs. 1 Z 1 iVm § 8 (Lohnveredelungen);2;1970-01-01", + "6;015;0;c) §6 Abs. 1 Z 2 bis 6 sowie § 23 Abs. 5 (Seeschifffahrt, Luftfahrt, grenzüberschreitende Personenbeförderung, Diplomaten, Reisevorleistungen im Drittlandsgebiet usw.);2;1970-01-01", + "7;017;0;d) Art. 6 Abs. 1 (innergemeinschaftliche Lieferungen ohne die nachstehend gesondert anzuführenden Fahrzeuglieferungen);2;1970-01-01", + "8;018;0;e) Art. 6 Abs. 1, sofern Lieferungen neuer Fahrzeuge an Abnehmer ohne UID-Nummer bzw. durch Fahrzeuglieferer gemäß Art. 2 erfolgen.;2;1970-01-01", + "9;019;0;a) § 6 Abs. 1 Z 9 lit. a (Grundstücksumsätze);2;1970-01-01", + "10;016;0;b) §6 Abs. 1 Z 27 (Kleinunternehmer);2;1970-01-01", + "11;020;0;c) § 6 Abs. 1 Z ___ (übrige steuerfreie Umsätze ohne Vorsteuerabzug);2;1970-01-01", "12;022_links;0;20% Nominalsteuersatz;2;1970-01-01", "13;022_rechts;0;20% Nominalsteuersatz;2;1970-01-01", - "14;029_links;0;10% ermäßigter Steuersatz;2;1970-01-01", - "15;029_rechts;0;10% ermäßigter Steuersatz;2;1970-01-01", - "16;025_links;0;12% für Weinumsätze durch landwirtschaftliche Betriebe;2;1970-01-01", - "17;025_rechts;0;12% für Weinumsätze durch landwirtschaftliche Betriebe;2;1970-01-01", - "18;035_links;0;16% für Jungholz und Mittelberg;2;1970-01-01", - "19;035_rechts;0;16% für Jungholz und Mittelberg;2;1970-01-01", - "20;052_links;0;10% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01", - "21;052_rechts;0;10% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01", - "22;038_links;0;8% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01", - "23;038_rechts;0;8% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01", - "24;056;0;Steuerschuld gemäß § 11 Abs. 12 und 14, § 16 Abs. 2 sowie gemäß Art. 7 Abs. 4;2;1970-01-01", - "25;057;0;Steuerschuld gemäß § 19 Abs. 1 zweiter Satz, § 19 Abs. 1c sowie gemäß Art. 25 Abs. 5;2;1970-01-01", - "26;048;0;Steuerschuld gemäß § 19 Abs. 1a (Bauleistungen);2;1970-01-01", - "27;044;0;Steuerschuld gemäß § 19 Abs. 1b (Sicherungseigentum, Vorbehaltseigentum und Grundstücke im Zwangsversteigerungsverfahren);2;1970-01-01", - "28;070;0;Gesamtbetrag der Bemessungsgrundlagen für innergemeinschaftliche Erwerbe;2;1970-01-01", - "29;071;0;Davon Steuerfrei gemäß Art. 6 Abs 2;2;1970-01-01", + "14;029_links;0;10% ermäßigter Steuersatz;2;1970-01-01", + "15;029_rechts;0;10% ermäßigter Steuersatz;2;1970-01-01", + "16;025_links;0;12% für Weinumsätze durch landwirtschaftliche Betriebe;2;1970-01-01", + "17;025_rechts;0;12% für Weinumsätze durch landwirtschaftliche Betriebe;2;1970-01-01", + "18;035_links;0;16% für Jungholz und Mittelberg;2;1970-01-01", + "19;035_rechts;0;16% für Jungholz und Mittelberg;2;1970-01-01", + "20;052_links;0;10% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01", + "21;052_rechts;0;10% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01", + "22;038_links;0;8% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01", + "23;038_rechts;0;8% Zusatzsteuer für pauschalierte land- und forstwirtschaftliche Betriebe;2;1970-01-01", + "24;056;0;Steuerschuld gemäß § 11 Abs. 12 und 14, § 16 Abs. 2 sowie gemäß Art. 7 Abs. 4;2;1970-01-01", + "25;057;0;Steuerschuld gemäß § 19 Abs. 1 zweiter Satz, § 19 Abs. 1c sowie gemäß Art. 25 Abs. 5;2;1970-01-01", + "26;048;0;Steuerschuld gemäß § 19 Abs. 1a (Bauleistungen);2;1970-01-01", + "27;044;0;Steuerschuld gemäß § 19 Abs. 1b (Sicherungseigentum, Vorbehaltseigentum und Grundstücke im Zwangsversteigerungsverfahren);2;1970-01-01", + "28;070;0;Gesamtbetrag der Bemessungsgrundlagen für innergemeinschaftliche Erwerbe;2;1970-01-01", + "29;071;0;Davon Steuerfrei gemäß Art. 6 Abs 2;2;1970-01-01", "30;072_links;0;20% Nominalsteuersatz;2;1970-01-01", "31;072_rechts;0;20% Nominalsteuersatz;2;1970-01-01", - "32;073_links;0;10% ermäßigter Steuersatz;2;1970-01-01", - "33;073_rechts;0;10% ermäßigter Steuersatz;2;1970-01-01", - "34;075_links;0;16% für Jungholz und Mittelberg;2;1970-01-01", - "35;075_rechts;0;16% für Jungholz und Mittelberg;2;1970-01-01", - "36;076;0;Erwerbe gemäß Art. 3 Abs. 8 zweiter Satz, die im Mitgliedstaat des Bestimmungslandes besteuert worden sind;2;1970-01-01", - "37;077;0;Erwerbe gemäß Art. 3 Abs. 8 zweiter Satz, die gemäß Art. 25 Abs. 2 im Inland als besteuert gelten;2;1970-01-01", - "38;060;0;Gesamtbetrag der Vorsteuern (ohne die nachstehend gesondert anzuführenden Beträge);2;1970-01-01", - "39;061;0;Vorsteuern betreffend die entrichtete Einfuhrumsatzsteuer (§12 Abs. 1 Z 2 lit.a);2;1970-01-01", - "40;083;0;Vorsteuern betreffend die am Abgabenkonto verbuchte Einfuhrumsatzsteuer (§12 Abs. 1 Z 2 lit.b);2;1970-01-01", + "32;073_links;0;10% ermäßigter Steuersatz;2;1970-01-01", + "33;073_rechts;0;10% ermäßigter Steuersatz;2;1970-01-01", + "34;075_links;0;16% für Jungholz und Mittelberg;2;1970-01-01", + "35;075_rechts;0;16% für Jungholz und Mittelberg;2;1970-01-01", + "36;076;0;Erwerbe gemäß Art. 3 Abs. 8 zweiter Satz, die im Mitgliedstaat des Bestimmungslandes besteuert worden sind;2;1970-01-01", + "37;077;0;Erwerbe gemäß Art. 3 Abs. 8 zweiter Satz, die gemäß Art. 25 Abs. 2 im Inland als besteuert gelten;2;1970-01-01", + "38;060;0;Gesamtbetrag der Vorsteuern (ohne die nachstehend gesondert anzuführenden Beträge);2;1970-01-01", + "39;061;0;Vorsteuern betreffend die entrichtete Einfuhrumsatzsteuer (§12 Abs. 1 Z 2 lit.a);2;1970-01-01", + "40;083;0;Vorsteuern betreffend die am Abgabenkonto verbuchte Einfuhrumsatzsteuer (§12 Abs. 1 Z 2 lit.b);2;1970-01-01", "41;065;0;Vorsteuern aus dem innergemeinschaftlichen Erwerb;2;1970-01-01", - "42;066;0;Vorsteuern betreffend der Steuerschuld gemäß § 19 Abs. 1c sowie gemäß Art. 25 Abs. 5;2;1970-01-01", - "43;082;0;Vorsteuern betreffend der Steuerschuld gemäß § 19 Abs. 1a (Bauleistungen);2;1970-01-01", - "44;087;0;Vorsteuern betreffend die Steuerschuld gemäß § 19 Abs. 1b (Sicherungseigentum, Vorbehaltseigentum und Grundstücke im Zwangsversteigerungsverfahren);2;1970-01-01", - "45;064;0;Vorsteuern gemäß §12 Abs. 16 und Vorsteuern für innergemeinschaftliche Lieferungen neuer Fahrzeuge von Fahrzeuglieferanten gemäß Art. 2;2;1970-01-01", - "46;062;0;Davon gemäß § 12 Abs. 3 iVm Abs. 4 und 5;2;1970-01-01", - "47;063;0;Berichtigung gemäß § 12 Abs. 10 und 11;2;1970-01-01", - "48;067;0;Berichtigung gemäß § 16;2;1970-01-01", + "42;066;0;Vorsteuern betreffend der Steuerschuld gemäß § 19 Abs. 1c sowie gemäß Art. 25 Abs. 5;2;1970-01-01", + "43;082;0;Vorsteuern betreffend der Steuerschuld gemäß § 19 Abs. 1a (Bauleistungen);2;1970-01-01", + "44;087;0;Vorsteuern betreffend die Steuerschuld gemäß § 19 Abs. 1b (Sicherungseigentum, Vorbehaltseigentum und Grundstücke im Zwangsversteigerungsverfahren);2;1970-01-01", + "45;064;0;Vorsteuern gemäß §12 Abs. 16 und Vorsteuern für innergemeinschaftliche Lieferungen neuer Fahrzeuge von Fahrzeuglieferanten gemäß Art. 2;2;1970-01-01", + "46;062;0;Davon gemäß § 12 Abs. 3 iVm Abs. 4 und 5;2;1970-01-01", + "47;063;0;Berichtigung gemäß § 12 Abs. 10 und 11;2;1970-01-01", + "48;067;0;Berichtigung gemäß § 16;2;1970-01-01", "49;090;0;Sonstige Berichtigungen;2;1970-01-01", "50;095;0;Zahllast/Gutschrift;2;1970-01-01", ], ); for my $statement ( 0 .. $#copy_statements ) { - my $query = $iconv->convert($copy_statements[$statement]); - my $sth = $dbh->prepare($query) || mydberror($query); + my $query = $copy_statements[$statement]; + my $sth = $self->dbh->prepare($query) || $self->db_error($query); for my $copy_line ( 0 .. $#{$copy_data[$statement]} ) { #print $copy_data[$statement][$copy_line] . "
" - $sth->execute(split m/;/, $iconv->convert($copy_data[$statement][$copy_line]), -1) || mydberror($query); + $sth->execute(split m/;/, $copy_data[$statement][$copy_line], -1) || $self->db_error($query); } #/ $sth->finish(); } @@ -187,39 +139,40 @@ sub do_copy_tax_report_structure { } sub do_insert_chart { + my ($self) = @_; my @copy_statements = ( - "INSERT INTO chart VALUES (1, '0000', 'AUFWENDUNGEN FÜR INGANGSETZEN UND ERWEITERN DES BETRIEBES', 'H', 'A', '', '00', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.276724', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (1, '0000', 'AUFWENDUNGEN FÜR INGANGSETZEN UND ERWEITERN DES BETRIEBES', 'H', 'A', '', '00', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.276724', NULL, NULL, NULL);", "INSERT INTO chart VALUES (2, '0010', 'Firmenwert', 'A', 'A', 'AP_amount', '015', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.28365', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (3, '0100', 'IMMATERIELLE VERMÖGENSGEGENSTÄNDE', 'H', 'A', '', '01', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.288542', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (3, '0100', 'IMMATERIELLE VERMÖGENSGEGENSTÄNDE', 'H', 'A', '', '01', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.288542', NULL, NULL, NULL);", "INSERT INTO chart VALUES (4, '0110', 'Rechte', 'A', 'A', 'AP_amount', '011', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.291937', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (5, '0200', 'GRUNDSTÜCKE', 'H', 'A', '', '02-03', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.294929', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (6, '0210', 'unbebaute Grundstücke', 'A', 'A', 'AP_amount', '020', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.297958', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (7, '0220', 'bebaute Grundstücke', 'A', 'A', 'AP_amount', '021', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.300987', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (8, '0229', 'kum. Abschreibung bebaute Grundstücke', 'A', 'A', '', '039', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.304114', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (5, '0200', 'GRUNDSTÜCKE', 'H', 'A', '', '02-03', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.294929', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (6, '0210', 'unbebaute Grundstücke', 'A', 'A', 'AP_amount', '020', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.297958', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (7, '0220', 'bebaute Grundstücke', 'A', 'A', 'AP_amount', '021', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.300987', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (8, '0229', 'kum. Abschreibung bebaute Grundstücke', 'A', 'A', '', '039', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.304114', NULL, NULL, NULL);", "INSERT INTO chart VALUES (10, '0410', 'Maschinen', 'A', 'A', 'AP_amount', '041', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.312216', NULL, NULL, NULL);", "INSERT INTO chart VALUES (11, '0419', 'kum. Abschreibung Maschinen', 'A', 'A', '', '069', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.316198', NULL, NULL, NULL);", "INSERT INTO chart VALUES (12, '0500', 'FAHRZEUGE', 'H', 'A', '', '06', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.319978', NULL, NULL, NULL);", "INSERT INTO chart VALUES (13, '0510', 'Fahrzeuge', 'A', 'A', 'AP_amount', '063', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.323002', NULL, NULL, NULL);", "INSERT INTO chart VALUES (14, '0519', 'kum. Abschreibung Fahrzeuge', 'A', 'A', '', '069', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.326041', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (15, '0600', 'BETRIEBS- UND GESCHÄFTSAUSSTATTUNG', 'H', 'A', '', '06', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.330691', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (16, '0620', 'Büroeinrichtungen', 'A', 'A', 'AP_amount', '066', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.33373', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (17, '0625', 'kum. Abschreibung Betriebs- und Geschäftsausstattung', 'A', 'A', '', '069', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.336939', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (15, '0600', 'BETRIEBS- UND GESCHÄFTSAUSSTATTUNG', 'H', 'A', '', '06', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.330691', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (16, '0620', 'Büroeinrichtungen', 'A', 'A', 'AP_amount', '066', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.33373', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (17, '0625', 'kum. Abschreibung Betriebs- und Geschäftsausstattung', 'A', 'A', '', '069', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.336939', NULL, NULL, NULL);", "INSERT INTO chart VALUES (18, '0700', 'GELEISTETE ANZAHLUNGEN', 'H', 'A', '', '07', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.340614', NULL, NULL, NULL);", "INSERT INTO chart VALUES (19, '0800', 'FINANZANLAGEN', 'H', 'A', '', '08-09', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.3436', NULL, NULL, NULL);", "INSERT INTO chart VALUES (20, '0810', 'Beteiligungen', 'A', 'A', 'AP_amount', '081', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.346638', NULL, NULL, NULL);", "INSERT INTO chart VALUES (21, '0820', 'Wertpapiere', 'A', 'A', 'AP_amount', '080', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.351452', NULL, NULL, NULL);", "INSERT INTO chart VALUES (22, '1100', 'ROHSTOFFE', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.354419', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (23, '1120', 'Vorräte - Rohstoffe', 'A', 'A', 'IC', '110-119', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.357447', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (23, '1120', 'Vorräte - Rohstoffe', 'A', 'A', 'IC', '110-119', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.357447', NULL, NULL, NULL);", "INSERT INTO chart VALUES (24, '1200', 'BEZOGENE TEILE', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.360423', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (25, '1220', 'Vorräte - bezogene Teile', 'A', 'A', 'IC', '120-129', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.363627', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (25, '1220', 'Vorräte - bezogene Teile', 'A', 'A', 'IC', '120-129', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.363627', NULL, NULL, NULL);", "INSERT INTO chart VALUES (26, '1300', 'HILFS- UND BETRIEBSSTOFFE', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.368083', NULL, NULL, NULL);", "INSERT INTO chart VALUES (27, '1320', 'Hilfsstoffe', 'A', 'A', 'IC', '130-134', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.372229', NULL, NULL, NULL);", "INSERT INTO chart VALUES (28, '1350', 'Betriebssstoffe', 'A', 'A', 'IC', '135-139', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.375303', NULL, NULL, NULL);", "INSERT INTO chart VALUES (29, '1400', 'UNFERTIGE ERZEUGNISSE', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.378277', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (30, '1420', 'Vorräte - unfertige Erzeugnisse', 'A', 'A', 'IC', '140-149', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.381463', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (30, '1420', 'Vorräte - unfertige Erzeugnisse', 'A', 'A', 'IC', '140-149', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.381463', NULL, NULL, NULL);", "INSERT INTO chart VALUES (31, '1500', 'FERTIGE ERZEUGNISSE', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.384434', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (34, '1540', 'Vorräte - Gruppe C', 'A', 'A', 'IC', '150-159', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.395426', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (34, '1540', 'Vorräte - Gruppe C', 'A', 'A', 'IC', '150-159', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.395426', NULL, NULL, NULL);", "INSERT INTO chart VALUES (35, '1600', 'WAREN', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.39872', NULL, NULL, NULL);", "INSERT INTO chart VALUES (36, '1700', 'NOCH NICHT ABGERECHNETE LEISTUNGEN', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.401807', NULL, NULL, NULL);", "INSERT INTO chart VALUES (37, '1800', 'GELEISTETE ANZAHLUNGEN', 'H', 'A', '', '1', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.404851', NULL, NULL, NULL);", @@ -230,7 +183,7 @@ sub do_insert_chart { "INSERT INTO chart VALUES (43, '2320', 'sonstige Forderungen', 'A', 'A', 'AP_amount', '23-24', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.428868', NULL, NULL, NULL);", "INSERT INTO chart VALUES (44, '2500', 'FORDERUNGEN AUS ABGABENVERRECHNUNG', 'H', 'A', '', '2', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.432042', NULL, NULL, NULL);", "INSERT INTO chart VALUES (46, '2600', 'WERTPAPIERE UND ANTEILE', 'H', 'A', '', '2', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.438205', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (47, '2620', 'Wertpapiere Umlaufvermögen', 'A', 'A', 'AP_amount', '26', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.441382', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (47, '2620', 'Wertpapiere Umlaufvermögen', 'A', 'A', 'AP_amount', '26', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.441382', NULL, NULL, NULL);", "INSERT INTO chart VALUES (48, '2700', 'KASSABESTAND', 'H', 'A', '', '2', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.444391', NULL, NULL, NULL);", "INSERT INTO chart VALUES (50, '2800', 'SCHECKS, GUTHABEN BEI KREDITINSTITUTEN', 'H', 'A', '', '2', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.45237', NULL, NULL, NULL);", "INSERT INTO chart VALUES (53, '3100', 'LANGFRISTIGE VERBINDLICHKEITEN', 'H', 'L', '', '3', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.461985', NULL, NULL, NULL);", @@ -239,7 +192,7 @@ sub do_insert_chart { "INSERT INTO chart VALUES (58, '3500', 'VERBINDLICHKEITEN FINANZAMT', 'H', 'L', '', '35', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.480487', NULL, NULL, NULL);", "INSERT INTO chart VALUES (105, '7611', 'Reinigungsmaterial', 'A', 'E', 'AP_amount', '', 9, NULL, 11, 3, NULL, false, '2006-01-28 18:22:52.649072', '2006-02-03 15:26:38.591173', NULL, NULL);", "INSERT INTO chart VALUES (163, '7340', 'Reisekosten', 'A', 'E', 'AP_amount', '', 9, NULL, NULL, 3, NULL, false, '2006-02-03 15:38:11.636188', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (74, '4600', 'SONSTIGE ERLÖSE', 'H', 'I', '', '4', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.539718', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (74, '4600', 'SONSTIGE ERLÖSE', 'H', 'I', '', '4', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.539718', NULL, NULL, NULL);", "INSERT INTO chart VALUES (95, '7120', 'Grundsteuer', 'A', 'E', '', '', 0, NULL, 12, 3, NULL, false, '2006-01-28 18:22:52.612982', '2006-02-03 15:07:18.076256', NULL, NULL);", "INSERT INTO chart VALUES (94, '7110', 'Ertragssteuern', 'A', 'E', '', '', 0, NULL, 12, 3, NULL, false, '2006-01-28 18:22:52.60961', '2006-02-03 15:07:57.018877', NULL, NULL);", "INSERT INTO chart VALUES (159, '7130', 'Gewerbl. Sozialversicherung', 'A', 'E', 'AP_amount', '', 0, NULL, 12, 3, NULL, false, '2006-02-03 15:16:10.635938', NULL, NULL, NULL);", @@ -253,86 +206,86 @@ sub do_insert_chart { "INSERT INTO chart VALUES (89, '6710', 'freiwilliger Sozialaufwand', 'A', 'E', '', '660-665', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.592541', NULL, NULL, NULL);", "INSERT INTO chart VALUES (90, '7000', 'ABSCHREIBUNGEN', 'H', 'E', '', '7', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.595566', NULL, NULL, NULL);", "INSERT INTO chart VALUES (91, '7010', 'Abschreibungen', 'A', 'E', '', '700', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.598657', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (92, '7020', 'geringwertige Wirtschaftsgüter', 'A', 'E', 'AP_amount', '701-708', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.601829', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (92, '7020', 'geringwertige Wirtschaftsgüter', 'A', 'E', 'AP_amount', '701-708', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.601829', NULL, NULL, NULL);", "INSERT INTO chart VALUES (93, '7100', 'SONSTIGE STEUERN', 'H', 'E', '', '71', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.604871', NULL, NULL, NULL);", "INSERT INTO chart VALUES (96, '7200', 'INSTANDHALTUNGSAUFWAND', 'H', 'E', '', '7', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.6171', NULL, NULL, NULL);", "INSERT INTO chart VALUES (98, '7300', 'TRANSPORTKOSTEN', 'H', 'L', '', '73', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.623721', NULL, NULL, NULL);", "INSERT INTO chart VALUES (100, '7400', 'MIET-,PACHT-,LEASING-, LIZENZAUFWAND', 'H', 'E', '', '74', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.631869', NULL, NULL, NULL);", "INSERT INTO chart VALUES (113, '7710', 'Sachversicherung', 'A', 'E', 'AP_amount', '', 0, NULL, 13, NULL, NULL, false, '2006-01-28 18:22:52.677258', '2006-02-03 15:19:30.793109', NULL, NULL);", "INSERT INTO chart VALUES (103, '7600', 'VERWALTUNGSKOSTEN', 'H', 'E', '', '76', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.641023', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (161, '7780', 'Beiträge zur Berufsvertretung', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, 3, NULL, false, '2006-02-03 15:33:11.055578', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (161, '7780', 'Beiträge zur Berufsvertretung', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, 3, NULL, false, '2006-02-03 15:33:11.055578', NULL, NULL, NULL);", "INSERT INTO chart VALUES (102, '7420', 'Betriebsk. und ant. AfA Garage + Werkst.', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, 3, NULL, false, '2006-01-28 18:22:52.637918', '2006-02-03 15:41:13.126408', NULL, NULL);", - "INSERT INTO chart VALUES (112, '7700', 'VERSICHERUNGEN UND ÜBRIGE AUFWÄNDUNGEN', 'H', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.674186', '2006-02-03 15:44:43.301845', NULL, NULL);", - "INSERT INTO chart VALUES (114, '8000', 'FINANZERTRÄGE UND FINANZAUFWÄNDUNGEN', 'H', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.680743', '2006-02-03 15:45:08.299546', NULL, NULL);", - "INSERT INTO chart VALUES (33, '1530', 'Vorräte Gruppe B', 'A', 'A', 'IC', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.392343', '2006-02-03 16:25:53.167131', NULL, NULL);", + "INSERT INTO chart VALUES (112, '7700', 'VERSICHERUNGEN UND ÜBRIGE AUFWÄNDUNGEN', 'H', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.674186', '2006-02-03 15:44:43.301845', NULL, NULL);", + "INSERT INTO chart VALUES (114, '8000', 'FINANZERTRÄGE UND FINANZAUFWÄNDUNGEN', 'H', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.680743', '2006-02-03 15:45:08.299546', NULL, NULL);", + "INSERT INTO chart VALUES (33, '1530', 'Vorräte Gruppe B', 'A', 'A', 'IC', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.392343', '2006-02-03 16:25:53.167131', NULL, NULL);", "INSERT INTO chart VALUES (120, '9020', 'nicht einbezahltes Kapital', 'A', 'Q', '', '919', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.700926', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (121, '9200', 'KAPITALRÜCKLAGEN', 'H', 'Q', '', '9', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.703925', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (122, '9210', 'freie Rücklage', 'A', 'Q', '', '920-929', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.708819', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (121, '9200', 'KAPITALRÜCKLAGEN', 'H', 'Q', '', '9', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.703925', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (122, '9210', 'freie Rücklage', 'A', 'Q', '', '920-929', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.708819', NULL, NULL, NULL);", "INSERT INTO chart VALUES (123, '9300', 'GEWINN', 'H', 'Q', '', '939', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.712247', NULL, NULL, NULL);", "INSERT INTO chart VALUES (124, '9310', 'Gewinnvortrag Vorjahr', 'A', 'Q', '', '980', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.716177', NULL, NULL, NULL);", "INSERT INTO chart VALUES (125, '9320', 'Jahresgewinn', 'A', 'Q', '', '985', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.719991', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (126, '9400', 'RÜCKSTELLUNGEN', 'H', 'L', '', '3', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.723021', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (127, '9420', 'Abfertigungsrückstellung', 'A', 'L', '', '300', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.726006', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (128, '9430', 'Urlaubsrückstellung', 'A', 'L', '', '304-309', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.730698', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (126, '9400', 'RÜCKSTELLUNGEN', 'H', 'L', '', '3', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.723021', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (127, '9420', 'Abfertigungsrückstellung', 'A', 'L', '', '300', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.726006', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (128, '9430', 'Urlaubsrückstellung', 'A', 'L', '', '304-309', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.730698', NULL, NULL, NULL);", "INSERT INTO chart VALUES (129, '9700', 'EINLAGEN STILLER GESELLSCHAFTER', 'H', 'Q', '', '9', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.73381', NULL, NULL, NULL);", "INSERT INTO chart VALUES (71, '4300', 'UMSATZ DIENSTLEISTUNGEN', 'H', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.529746', '2006-01-28 18:34:28.843136', NULL, NULL);", - "INSERT INTO chart VALUES (9, '0300', 'BETRIEBS- UND GESCHÄFTSGEBÄUDE', 'H', 'A', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.308885', '2006-02-02 09:31:17.849895', NULL, NULL);", + "INSERT INTO chart VALUES (9, '0300', 'BETRIEBS- UND GESCHÄFTSGEBÄUDE', 'H', 'A', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.308885', '2006-02-02 09:31:17.849895', NULL, NULL);", "INSERT INTO chart VALUES (45, '2530', 'sonstige Forderungen aus Abgebenverrechnung', 'A', 'A', 'AP_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.435243', '2006-02-02 09:59:42.729713', NULL, NULL);", - "INSERT INTO chart VALUES (67, '4000', 'BETRIEBLICHE ERTRÄGE', 'H', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.513926', '2006-02-02 10:05:21.278993', NULL, NULL);", - "INSERT INTO chart VALUES (75, '4630', 'Erlöse aus Abgang vom Anlagevermögen', 'A', 'I', 'AR_amount:IC_income', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.542817', '2006-02-02 10:09:41.959462', NULL, NULL);", - "INSERT INTO chart VALUES (131, '4450', 'Erlösschmälerung durch Skontoaufwand', 'A', 'I', 'AR_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.740526', '2006-02-02 10:20:51.822294', NULL, NULL);", - "INSERT INTO chart VALUES (144, '4640', 'Erträge aus Abgang vom Anlagevermögen', 'A', 'I', 'AR_amount:IC_income', '', 0, NULL, NULL, NULL, NULL, false, '2006-02-02 10:24:49.118289', '2006-02-02 10:25:34.716838', NULL, NULL);", - "INSERT INTO chart VALUES (118, '9000', 'KAPITAL, UNVERSTEUERTE RÜCKLAGEN, ABSCHLUSS- UND EVIDENZKONTEN', 'H', 'Q', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.694841', '2006-02-02 10:28:27.424046', NULL, NULL);", + "INSERT INTO chart VALUES (67, '4000', 'BETRIEBLICHE ERTRÄGE', 'H', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.513926', '2006-02-02 10:05:21.278993', NULL, NULL);", + "INSERT INTO chart VALUES (75, '4630', 'Erlöse aus Abgang vom Anlagevermögen', 'A', 'I', 'AR_amount:IC_income', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.542817', '2006-02-02 10:09:41.959462', NULL, NULL);", + "INSERT INTO chart VALUES (131, '4450', 'Erlösschmälerung durch Skontoaufwand', 'A', 'I', 'AR_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.740526', '2006-02-02 10:20:51.822294', NULL, NULL);", + "INSERT INTO chart VALUES (144, '4640', 'Erträge aus Abgang vom Anlagevermögen', 'A', 'I', 'AR_amount:IC_income', '', 0, NULL, NULL, NULL, NULL, false, '2006-02-02 10:24:49.118289', '2006-02-02 10:25:34.716838', NULL, NULL);", + "INSERT INTO chart VALUES (118, '9000', 'KAPITAL, UNVERSTEUERTE RÜCKLAGEN, ABSCHLUSS- UND EVIDENZKONTEN', 'H', 'Q', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.694841', '2006-02-02 10:28:27.424046', NULL, NULL);", "INSERT INTO chart VALUES (147, '9410', 'Privatentnahme', 'A', 'Q', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-02-02 11:52:04.383364', NULL, NULL, NULL);", "INSERT INTO chart VALUES (76, '5000', 'MATERIALAUFWAND', 'H', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.545768', '2006-02-02 12:02:53.065559', NULL, NULL);", "INSERT INTO chart VALUES (160, '7140', 'Fremdenverkehrsabgabe', 'A', 'E', 'AP_amount', '', 0, NULL, 12, 3, NULL, false, '2006-02-03 15:16:52.380825', NULL, NULL, NULL);", "INSERT INTO chart VALUES (99, '7310', 'Frachtaufwand durch Dritte', 'A', 'E', 'AP_amount:IC_expense', '', 9, NULL, NULL, 3, NULL, false, '2006-01-28 18:22:52.628717', '2006-02-03 15:22:49.082217', NULL, NULL);", "INSERT INTO chart VALUES (152, '7320', 'KFZ-Aufwand', 'A', 'E', 'AP_amount:IC_expense', '', 9, NULL, NULL, 3, NULL, false, '2006-02-02 12:22:18.511562', '2006-02-03 15:23:31.584235', NULL, NULL);", "INSERT INTO chart VALUES (80, '5600', 'VERBRAUCH BRENN- UND TREIBSTOFFE, ENERGIE UND WASSER', 'H', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.56006', '2006-02-02 12:17:24.198896', NULL, NULL);", - "INSERT INTO chart VALUES (109, '7390', 'Porto und Postgebühren', 'A', 'E', 'AP_amount:IC_expense', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.661848', '2006-02-02 12:28:47.456197', NULL, NULL);", + "INSERT INTO chart VALUES (109, '7390', 'Porto und Postgebühren', 'A', 'E', 'AP_amount:IC_expense', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.661848', '2006-02-02 12:28:47.456197', NULL, NULL);", "INSERT INTO chart VALUES (101, '7410', 'Miete und Pachtaufwand', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.634888', '2006-02-02 12:29:27.184902', NULL, NULL);", "INSERT INTO chart VALUES (107, '7620', 'Zeitungen und Zeitschriften', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.655683', '2006-02-02 12:32:43.287819', NULL, NULL);", "INSERT INTO chart VALUES (106, '7670', 'Werbung und Marketing', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.652584', '2006-02-02 12:33:37.934111', NULL, NULL);", - "INSERT INTO chart VALUES (110, '7680', 'Repräsentationsaufwand', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.665034', '2006-02-02 12:35:16.950252', NULL, NULL);", + "INSERT INTO chart VALUES (110, '7680', 'Repräsentationsaufwand', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.665034', '2006-02-02 12:35:16.950252', NULL, NULL);", "INSERT INTO chart VALUES (111, '7750', 'Rechtsberatung', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.671109', '2006-02-02 12:36:56.116865', NULL, NULL);", "INSERT INTO chart VALUES (153, '7755', 'Steuerberatung', 'A', 'E', 'AP_amount', '', 0, NULL, NULL, NULL, NULL, false, '2006-02-02 12:37:35.558667', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (115, '8280', 'Bankzinsen und Gebühren', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.683783', '2006-02-02 12:41:44.274229', NULL, NULL);", - "INSERT INTO chart VALUES (117, '8110', 'Erträge aus Zinsen', 'A', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.691802', '2006-02-02 12:42:41.520779', NULL, NULL);", - "INSERT INTO chart VALUES (132, '8050', 'Erträge aus Wertpapieren', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.743602', '2006-02-02 12:44:29.033245', NULL, NULL);", - "INSERT INTO chart VALUES (104, '7610', 'Büromaterial', 'A', 'E', 'AP_amount', '', 9, NULL, 11, 3, NULL, false, '2006-01-28 18:22:52.644151', '2006-02-03 15:25:38.53287', NULL, NULL);", - "INSERT INTO chart VALUES (116, '8010', 'Erträge aus Beteiligungen', 'A', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.688643', '2006-02-02 12:47:19.930787', NULL, NULL);", - "INSERT INTO chart VALUES (119, '9010', 'Kapital, Geschäftsanteile', 'A', 'Q', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.69788', '2006-02-02 12:48:41.514201', NULL, NULL);", + "INSERT INTO chart VALUES (115, '8280', 'Bankzinsen und Gebühren', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.683783', '2006-02-02 12:41:44.274229', NULL, NULL);", + "INSERT INTO chart VALUES (117, '8110', 'Erträge aus Zinsen', 'A', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.691802', '2006-02-02 12:42:41.520779', NULL, NULL);", + "INSERT INTO chart VALUES (132, '8050', 'Erträge aus Wertpapieren', 'A', 'E', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.743602', '2006-02-02 12:44:29.033245', NULL, NULL);", + "INSERT INTO chart VALUES (104, '7610', 'Büromaterial', 'A', 'E', 'AP_amount', '', 9, NULL, 11, 3, NULL, false, '2006-01-28 18:22:52.644151', '2006-02-03 15:25:38.53287', NULL, NULL);", + "INSERT INTO chart VALUES (116, '8010', 'Erträge aus Beteiligungen', 'A', 'I', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.688643', '2006-02-02 12:47:19.930787', NULL, NULL);", + "INSERT INTO chart VALUES (119, '9010', 'Kapital, Geschäftsanteile', 'A', 'Q', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.69788', '2006-02-02 12:48:41.514201', NULL, NULL);", "INSERT INTO chart VALUES (108, '7380', 'Telefonkosten, Internetkosten', 'A', 'E', 'AP_amount', '', 9, NULL, 11, 3, NULL, false, '2006-01-28 18:22:52.658721', '2006-02-03 15:24:27.553821', NULL, NULL);", - "INSERT INTO chart VALUES (32, '1520', 'Vorräte Gruppe A', 'A', 'A', 'IC', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.389168', '2006-02-03 16:26:08.72507', NULL, NULL);", + "INSERT INTO chart VALUES (32, '1520', 'Vorräte Gruppe A', 'A', 'A', 'IC', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.389168', '2006-02-03 16:26:08.72507', NULL, NULL);", "INSERT INTO chart VALUES (52, '2820', 'Bankguthaben', 'A', 'A', 'AR_paid:AP_paid', '', 0, NULL, NULL, 1, NULL, false, '2006-01-28 18:22:52.458922', '2006-02-04 15:00:18.424069', NULL, NULL);", - "INSERT INTO chart VALUES (59, '3550', 'Finanzamt Verrechnung Körperschaftssteuer', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.483655', '2006-02-08 20:09:47.697565', NULL, NULL);", + "INSERT INTO chart VALUES (59, '3550', 'Finanzamt Verrechnung Körperschaftssteuer', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.483655', '2006-02-08 20:09:47.697565', NULL, NULL);", "INSERT INTO chart VALUES (60, '3540', 'Finanzamt Verrechnung Umsatzsteuer', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.48865', '2006-02-08 20:15:23.622013', NULL, NULL);", "INSERT INTO chart VALUES (78, '5030', 'Warengruppe 1 10 %', 'A', 'E', 'AP_amount:IC_cogs', '', 7, NULL, 4, 2, NULL, false, '2006-01-28 18:22:52.553586', '2006-02-08 20:31:31.539794', NULL, NULL);", "INSERT INTO chart VALUES (79, '5040', 'Warengruppe 2 20%', 'A', 'E', 'AP_amount:IC_cogs', '', 9, NULL, 4, 2, NULL, false, '2006-01-28 18:22:52.55679', '2006-02-03 14:44:38.100283', NULL, NULL);", "INSERT INTO chart VALUES (155, '5210', 'Sonst. Verbrauchsmaterial', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 3, NULL, false, '2006-02-03 14:49:06.01478', '2006-02-03 14:54:51.813269', NULL, NULL);", "INSERT INTO chart VALUES (146, '9850', 'Schlussbilanz', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-02-02 10:36:45.059659', '2006-02-02 10:38:05.014595', NULL, NULL);", - "INSERT INTO chart VALUES (150, '5640', 'Verbrauch von sonstigen Ölen und Schmierstoffen', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 1, 19, false, '2006-02-02 12:07:52.512006', '2006-02-03 15:01:09.867763', NULL, NULL);", - "INSERT INTO chart VALUES (130, '9810', 'Eröffnungsbilanz', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.736825', '2006-02-02 10:37:49.001565', NULL, NULL);", + "INSERT INTO chart VALUES (150, '5640', 'Verbrauch von sonstigen Ölen und Schmierstoffen', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 1, 19, false, '2006-02-02 12:07:52.512006', '2006-02-03 15:01:09.867763', NULL, NULL);", + "INSERT INTO chart VALUES (130, '9810', 'Eröffnungsbilanz', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.736825', '2006-02-02 10:37:49.001565', NULL, NULL);", "INSERT INTO chart VALUES (164, '9800', 'BILANZKONTEN', 'H', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-03-06 22:23:47.795675', NULL, NULL, NULL);", "INSERT INTO chart VALUES (148, '5620', 'Verbrauch von Treibstoffen (Diesel)', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, 17, false, '2006-02-02 11:59:26.297394', '2006-02-03 15:00:02.362976', NULL, NULL);", - "INSERT INTO chart VALUES (149, '5630', 'Verbrauch von Treib- und Schmierstoffen für Motorsägen', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 1, 19, false, '2006-02-02 12:01:05.969406', '2006-02-03 15:00:30.512596', NULL, NULL);", - "INSERT INTO chart VALUES (158, '5650', 'gasförmige Brennstoffe', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, 12, false, '2006-02-03 15:02:36.649746', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (149, '5630', 'Verbrauch von Treib- und Schmierstoffen für Motorsägen', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 1, 19, false, '2006-02-02 12:01:05.969406', '2006-02-03 15:00:30.512596', NULL, NULL);", + "INSERT INTO chart VALUES (158, '5650', 'gasförmige Brennstoffe', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, 12, false, '2006-02-03 15:02:36.649746', NULL, NULL, NULL);", "INSERT INTO chart VALUES (156, '5710', 'Warenbezugskosten', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, 8, false, '2006-02-03 14:56:21.395879', NULL, NULL, NULL);", "INSERT INTO chart VALUES (157, '5750', 'Fremdarbeit', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, NULL, false, '2006-02-03 14:58:23.887944', NULL, NULL, NULL);", "INSERT INTO chart VALUES (154, '5310', 'Arbeitskleidung', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 1, NULL, false, '2006-02-03 14:48:10.349391', '2006-02-03 16:23:46.154559', NULL, NULL);", "INSERT INTO chart VALUES (151, '5510', 'Verbrauchswerkzeug', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, NULL, false, '2006-02-02 12:19:18.193535', '2006-02-03 14:51:29.573924', NULL, NULL);", "INSERT INTO chart VALUES (81, '5610', 'Energie (Strom und Wasser)', 'A', 'E', 'AP_amount', '', 9, NULL, 4, 2, NULL, false, '2006-01-28 18:22:52.563249', '2006-02-03 14:59:32.292173', NULL, NULL);", "INSERT INTO chart VALUES (97, '7210', 'Reparatur und Instandhaltung', 'A', 'E', 'AP_amount', '', 9, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.620315', '2006-02-03 15:14:08.186799', NULL, NULL);", - "INSERT INTO chart VALUES (72, '4320', 'Erlöse Beratung', 'A', 'I', 'AR_amount:IC_sale:IC_income', '', 3, 51, 1, 1, 2, false, '2006-01-28 18:22:52.533226', '2006-02-04 23:05:45.241847', NULL, NULL);", - "INSERT INTO chart VALUES (73, '4330', 'Erlöse Programmierung', 'A', 'I', 'AR_amount:IC_sale:IC_income', '', 3, 51, 1, 1, 1, false, '2006-01-28 18:22:52.536409', '2006-02-04 23:06:03.959353', NULL, NULL);", - "INSERT INTO chart VALUES (69, '4030', 'Erlöse - Softwareverkauf', 'A', 'I', 'AR_amount:IC_sale', '', 2, 86, 1, 1, 1, false, '2006-01-28 18:22:52.521819', '2006-02-02 10:06:58.91888', NULL, NULL);", - "INSERT INTO chart VALUES (70, '4040', 'Erlöse - Ersatzteilverkauf', 'A', 'I', 'AR_amount:IC_sale', '', 3, 51, 1, 1, 1, false, '2006-01-28 18:22:52.524987', '2006-02-02 10:07:34.327738', NULL, NULL);", + "INSERT INTO chart VALUES (72, '4320', 'Erlöse Beratung', 'A', 'I', 'AR_amount:IC_sale:IC_income', '', 3, 51, 1, 1, 2, false, '2006-01-28 18:22:52.533226', '2006-02-04 23:05:45.241847', NULL, NULL);", + "INSERT INTO chart VALUES (73, '4330', 'Erlöse Programmierung', 'A', 'I', 'AR_amount:IC_sale:IC_income', '', 3, 51, 1, 1, 1, false, '2006-01-28 18:22:52.536409', '2006-02-04 23:06:03.959353', NULL, NULL);", + "INSERT INTO chart VALUES (69, '4030', 'Erlöse - Softwareverkauf', 'A', 'I', 'AR_amount:IC_sale', '', 2, 86, 1, 1, 1, false, '2006-01-28 18:22:52.521819', '2006-02-02 10:06:58.91888', NULL, NULL);", + "INSERT INTO chart VALUES (70, '4040', 'Erlöse - Ersatzteilverkauf', 'A', 'I', 'AR_amount:IC_sale', '', 3, 51, 1, 1, 1, false, '2006-01-28 18:22:52.524987', '2006-02-02 10:07:34.327738', NULL, NULL);", "INSERT INTO chart VALUES (57, '3310', 'Verbindlichkeiten aus Lieferungen & Leistungen', 'A', 'L', 'AP', '', 0, NULL, NULL, 1, NULL, false, '2006-01-28 18:22:52.477485', '2006-02-02 18:12:21.634302', NULL, NULL);", "INSERT INTO chart VALUES (51, '2810', 'Schecks', 'A', 'A', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.455807', NULL, NULL, NULL);", - "INSERT INTO chart VALUES (55, '3120', 'Kredite von Eigentümern', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.471098', NULL, NULL, NULL);", + "INSERT INTO chart VALUES (55, '3120', 'Kredite von Eigentümern', 'A', 'L', '', '', 0, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.471098', NULL, NULL, NULL);", "INSERT INTO chart VALUES (49, '2710', 'Kassa', 'A', 'A', 'AR_paid', '', 0, NULL, NULL, 1, NULL, false, '2006-01-28 18:22:52.449148', '2006-02-04 14:59:14.410329', NULL, NULL);", "INSERT INTO chart VALUES (77, '5020', 'Warengruppe 0', 'A', 'E', 'IC:IC_cogs:AP_amount', '', 7, NULL, NULL, NULL, 8, false, '2006-01-28 18:22:52.550381', '2006-02-08 20:30:42.871241', NULL, NULL);", - "INSERT INTO chart VALUES (68, '4020', 'Erlöse - Hardwareverkauf', 'A', 'I', 'AR_amount:IC_sale', '', 2, 86, 1, 1, 1, false, '2006-01-28 18:22:52.51796', '2006-02-04 23:05:12.810823', NULL, NULL);", + "INSERT INTO chart VALUES (68, '4020', 'Erlöse - Hardwareverkauf', 'A', 'I', 'AR_amount:IC_sale', '', 2, 86, 1, 1, 1, false, '2006-01-28 18:22:52.51796', '2006-02-04 23:05:12.810823', NULL, NULL);", "INSERT INTO chart VALUES (40, '2010', 'Forderungen Lieferung & Leistung', 'A', 'A', 'AR', '200-207', NULL, NULL, NULL, NULL, NULL, false, '2006-01-28 18:22:52.41697', NULL, NULL, NULL);", "INSERT INTO chart VALUES (65, '2510', 'Vorsteuer 10%', 'A', 'E', 'AR_tax:AP_tax:IC_taxpart:IC_taxservice', NULL, 0, 66, NULL, NULL, NULL, false, '2006-01-28 18:22:52.505337', '2006-02-02 17:38:40.373624', NULL, NULL);", "INSERT INTO chart VALUES (64, '2512', 'Vorsteuer 12%', 'A', 'E', 'AR_tax:AP_tax:IC_taxpart:IC_taxservice', NULL, 0, 66, NULL, NULL, NULL, false, '2006-01-28 18:22:52.502023', '2006-02-08 20:14:19.543049', NULL, NULL);", @@ -343,22 +296,23 @@ sub do_insert_chart { "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('0400','MASCHINEN','H','04-05','A','');", "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('7411','Lizenzen','A','748-749','E','AP_amount');", "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('7631','Internetkosten','A','738-739','E','AP_amount:IC_expense');", - "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('7632','Reise- und Repräsentationsaufwand','A','734-735','E','');", - "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('7634','Registrierungsgebühren','A','748-749','E','AP_amount');", - "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('8020','Bankzinsen und Gebühren','A','80-83','E','');", + "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('7632','Reise- und Repräsentationsaufwand','A','734-735','E','');", + "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('7634','Registrierungsgebühren','A','748-749','E','AP_amount');", + "insert into chart (accno,description,charttype,gifi_accno,category,link) values ('8020','Bankzinsen und Gebühren','A','80-83','E','');", ); for my $statement ( 0 .. $#copy_statements ) { - my $query = $iconv->convert($copy_statements[$statement]); + my $query = $copy_statements[$statement]; #print $query . "
"; # Diagnose only! - do_query($query, 0); + $self->db_query($query, 0); } return 1; } sub do_insert_tax { + my ($self) = @_; my @copy_statements = ( "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (65, '2510', 7, 'Vorsteuer 10%', '2006-01-30 11:08:23.332857', '2006-02-08 20:28:09.63567', 0.10000, 173);", @@ -374,14 +328,15 @@ sub do_insert_tax { ); for my $statement ( 0 .. $#copy_statements ) { - my $query = $iconv->convert($copy_statements[$statement]); + my $query = $copy_statements[$statement]; #print $query . "
"; # Diagnose only! - do_query($query, 0); + $self->db_query($query, 0); } return 1; } sub do_insert_taxkeys { + my ($self) = @_; my @copy_statements = ( "INSERT INTO taxkeys VALUES (230, 69, 177, 2, NULL, '1970-01-01');", @@ -496,9 +451,9 @@ sub do_insert_taxkeys { ); for my $statement ( 0 .. $#copy_statements ) { - my $query = $iconv->convert($copy_statements[$statement]); + my $query = $copy_statements[$statement]; #print $query . "
"; # Diagnose only! - do_query($query, 0); + $self->db_query($query, 0); } return 1; @@ -506,21 +461,21 @@ return 1; } sub do_insert_buchungsgruppen { + my ($self) = @_; my @copy_statements = ( - "INSERT INTO buchungsgruppen VALUES (256, 'Erlöse aus Dienstleistungen', 23, 72, 99, 72, 77, 72, 77, 72, 77, 3);", - "INSERT INTO buchungsgruppen VALUES (254, 'Erlöse aus Warenlieferungen', 23, 68, 77, 72, 77, 72, 77, 72, 77, 2);", - "INSERT INTO buchungsgruppen VALUES (255, 'Erlöse aus Dienstleistungen', 23, 72, 77, 72, 77, 72, 77, 72, 77, 1);", + "INSERT INTO buchungsgruppen VALUES (256, 'Erlöse aus Dienstleistungen', 23, 72, 99, 72, 77, 72, 77, 72, 77, 3);", + "INSERT INTO buchungsgruppen VALUES (254, 'Erlöse aus Warenlieferungen', 23, 68, 77, 72, 77, 72, 77, 72, 77, 2);", + "INSERT INTO buchungsgruppen VALUES (255, 'Erlöse aus Dienstleistungen', 23, 72, 77, 72, 77, 72, 77, 72, 77, 1);", ); for my $statement ( 0 .. $#copy_statements ) { - my $query = $iconv->convert($copy_statements[$statement]); + my $query = $copy_statements[$statement]; #print $query . "
"; # Diagnose only! - do_query($query, 0); + $self->db_query($query, 0); } -return 1; + return 1; } - - +1; diff --git a/sql/Pg-upgrade2/acc_trans_constraints.pl b/sql/Pg-upgrade2/acc_trans_constraints.pl index 7d57efbc1..a7e17481a 100644 --- a/sql/Pg-upgrade2/acc_trans_constraints.pl +++ b/sql/Pg-upgrade2/acc_trans_constraints.pl @@ -1,36 +1,23 @@ # @tag: acc_trans_constraints # @description: Fügt NOT-NULL-Constraints ein für die Spalten # @depends: -# @charset: UTF-8 +package SL::DBUpgrade2::acc_trans_constraints; use utf8; use strict; -die("This script cannot be run from the command line.") unless ($main::form); +use parent qw(SL::DBUpgrade2::Base); -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(); - } -} +sub run { + my ($self) = @_; -sub do_update { my $query = qq|SELECT count(*) FROM acc_trans WHERE chart_id IS NULL|; - my ($no_chart_id) = $dbh->selectrow_array($query); + my ($no_chart_id) = $self->dbh->selectrow_array($query); $query = qq|SELECT count(*) FROM acc_trans WHERE trans_id IS NULL|; - my ($no_trans_id) = $dbh->selectrow_array($query); + my ($no_trans_id) = $self->dbh->selectrow_array($query); - $form->{no_chart_id}=$no_chart_id; - $form->{no_trans_id}=$no_trans_id; + $::form->{no_chart_id}=$no_chart_id; + $::form->{no_trans_id}=$no_trans_id; if ($no_chart_id > 0 or $no_trans_id > 0){ #list all invalid transactions where only chart_id is null: @@ -97,13 +84,12 @@ sub do_update { LEFT JOIN project p ON (p.id=acc.project_id) WHERE acc.chart_id IS NULL;|; - my $sth = $dbh->prepare($query); - $sth->execute || $main::form->dberror($query); + my $sth = $self->dbh->prepare($query); + $sth->execute || $::form->dberror($query); - $main::form->{NO_CHART_ID} = []; + $::form->{NO_CHART_ID} = []; while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { - map {$ref->{$_} = $::locale->{iconv_utf8}->convert($ref->{$_})} keys %$ref; - push @{ $main::form->{NO_CHART_ID} }, $ref; + push @{ $::form->{NO_CHART_ID} }, $ref; } $sth->finish; @@ -123,12 +109,11 @@ sub do_update { LEFT JOIN project p ON (p.id=acc.project_id) WHERE acc.trans_id IS NULL;|; - $sth = $dbh->prepare($query); - $sth->execute || $main::form->dberror($query); + $sth = $self->dbh->prepare($query); + $sth->execute || $::form->dberror($query); - $main::form->{NO_TRANS_ID} = []; + $::form->{NO_TRANS_ID} = []; while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { - map {$ref->{$_} = $::locale->{iconv_utf8}->convert($ref->{$_})} keys %$ref; $ref->{category} = ($ref->{category} eq 'A') ? $::locale->text('Account Category A') : ($ref->{category} eq 'E') ? $::locale->text('Account Category E') : ($ref->{category} eq 'L') ? $::locale->text('Account Category L') @@ -137,7 +122,7 @@ sub do_update { : ($ref->{category} eq 'C') ? $::locale->text('Account Category C') : ($ref->{category} eq 'G') ? $::locale->text('Account Category G') : $::locale->text('Unknown Category') . ': ' . $ref->{category}; - push @{ $main::form->{NO_TRANS_ID} }, $ref; + push @{ $::form->{NO_TRANS_ID} }, $ref; } $sth->finish; @@ -148,12 +133,12 @@ sub do_update { $query = qq|ALTER TABLE acc_trans ALTER COLUMN chart_id SET NOT NULL;|; $query .= qq|ALTER TABLE acc_trans ALTER COLUMN trans_id SET NOT NULL;|; - do_query($query); + $self->db_query($query); return 1; } sub print_error_message { - print $main::form->parse_html_template("dbupgrade/acc_trans_constraints"); + print $::form->parse_html_template("dbupgrade/acc_trans_constraints"); } -return do_update(); +1; diff --git a/sql/Pg-upgrade2/acc_trans_id_uniqueness.pl b/sql/Pg-upgrade2/acc_trans_id_uniqueness.pl index 1b8e5cadb..f90d73157 100644 --- a/sql/Pg-upgrade2/acc_trans_id_uniqueness.pl +++ b/sql/Pg-upgrade2/acc_trans_id_uniqueness.pl @@ -1,30 +1,18 @@ # @tag: acc_trans_id_uniqueness # @description: Sorgt dafür, dass acc_trans.acc_trans_id eindeutig ist # @depends: release_2_6_1 -# @charset: utf-8 +package SL::DBUpgrade2::acc_trans_id_uniqueness; use utf8; use strict; -use Data::Dumper; -die "This script cannot be run from the command line." unless $::form; +use parent qw(SL::DBUpgrade2::Base); -sub mydberror { - my ($msg) = @_; - die $dbup_locale->text("Database update error:") . "
$msg
" . $DBI::errstr; -} - -sub do_query { - my ($query, $may_fail) = @_; +use SL::DBUtils; - return if $dbh->do($query); - - mydberror($query) unless ($may_fail); - $dbh->rollback(); - $dbh->begin_work(); -} +sub run { + my ($self) = @_; -sub do_update { my $query = <dbh, $query); return 1 unless @entries; @@ -45,7 +33,7 @@ SQL )) SQL - do_query($query, 0); + $self->db_query($query, 0); my %skipped_acc_trans_ids; foreach my $entry (@entries) { @@ -62,11 +50,11 @@ SQL AND (mtime $mtime) SQL - do_query($query, 0); + $self->db_query($query, 0); } } return 1; } -return do_update(); +1; diff --git a/sql/Pg-upgrade2/add_more_constraints_fibu_projekt_xplace.pl b/sql/Pg-upgrade2/add_more_constraints_fibu_projekt_xplace.pl index c9c720b0c..67e8e8d68 100644 --- a/sql/Pg-upgrade2/add_more_constraints_fibu_projekt_xplace.pl +++ b/sql/Pg-upgrade2/add_more_constraints_fibu_projekt_xplace.pl @@ -1,50 +1,38 @@ # @tag: add_more_constraints_fibu_projekt_xplace3 # @description: Falls der Datenbestand es unproblematisch hergibt, ein paar 'schärfere' Constraints für die acc_trans gesetzt. Keine acc_trans-Eintrag ohne trans_id oder chart_id. Ferner project_id in acc_trans als Fremdschlüssel für project definiert. # @depends: release_2_6_0 fix_acc_trans_ap_taxkey_bug -# @charset: utf-8 +package SL::DBUpgrade2::add_more_constraints_fibu_projekt_xplace3; -use utf8; use strict; -use Data::Dumper; -die("This script cannot be run from the command line.") unless ($main::form); +use utf8; -sub mydberror { - my ($msg) = @_; - die($dbup_locale->text("Database update error:") . - "
$msg
" . $DBI::errstr); -} +use parent qw(SL::DBUpgrade2::Base); -sub do_query { - my ($query, $may_fail) = @_; +use SL::DBUtils; - if (!$dbh->do($query)) { - mydberror($query) unless ($may_fail); - $dbh->rollback(); - $dbh->begin_work(); - } -} +sub run { + my ($self) = @_; -sub do_update { my @queries; - # die project_id in der acc_trans ist auch zwingend fremdschlüssel in project + # die project_id in der acc_trans ist auch zwingend fremdschlüssel in project push @queries, "ALTER TABLE acc_trans ADD FOREIGN KEY (project_id) REFERENCES project(id)"; my $query = qq|select count(*) from acc_trans where chart_id is NULL|; - my $sth_all_groups = prepare_execute_query($form, $dbh, $query); + my $sth_all_groups = prepare_execute_query($::form, $self->dbh, $query); while (my $hash_ref = $sth_all_groups->fetchrow_hashref()) { # Schleife if ($hash_ref->{count} eq 0){ - # Falls wir keine alte buggy Installation haben, ist es super die + # Falls wir keine alte buggy Installation haben, ist es super die # Gewissheit zu haben, dass kein acc_trans-Eintrag ohne chart_id vorhanden ist push @queries, "ALTER TABLE acc_trans ALTER COLUMN chart_id SET NOT NULL"; } } $sth_all_groups->finish(); my $query = qq|select count(*) from acc_trans where trans_id is NULL|; - my $sth_all_groups = prepare_execute_query($form, $dbh, $query); + my $sth_all_groups = prepare_execute_query($::form, $self->dbh, $query); while (my $hash_ref = $sth_all_groups->fetchrow_hashref()) { # Schleife if ($hash_ref->{count} eq 0){ - # Falls wir keine alte buggy Installation haben, ist es super die + # Falls wir keine alte buggy Installation haben, ist es super die # Gewissheit zu haben, dass kein acc_trans-Eintrag ohne trans_id vorhanden ist push @queries, "ALTER TABLE acc_trans ALTER COLUMN trans_id SET NOT NULL"; } @@ -53,13 +41,12 @@ sub do_update { # if in doubt use brute force ;-) jb foreach my $query (@queries){ - my $sth = prepare_query($form, $dbh, $query); - do_statement($form,$sth,$query); + my $sth = prepare_query($::form, $self->dbh, $query); + do_statement($::form,$sth,$query); $sth->finish(); } - $dbh ->commit(); + $self->dbh ->commit(); return 1; } -return do_update(); - +1; diff --git a/sql/Pg-upgrade2/auth_enable_ct_all_edit.pl b/sql/Pg-upgrade2/auth_enable_ct_all_edit.pl index 0579675cb..040d9b64e 100644 --- a/sql/Pg-upgrade2/auth_enable_ct_all_edit.pl +++ b/sql/Pg-upgrade2/auth_enable_ct_all_edit.pl @@ -2,21 +2,19 @@ # @description: Zusätzliches Recht alle Kunden / Lieferanten editieren, war bisher standardmäßig IMMER so und kann jetzt deaktiviert werden # falls es deaktiviert wird, kann ich den Kunden / Lieferanten nur editieren wenn ich selber als Verkäufer eingetragen bin # @depends: release_2_6_3 -# @charset: utf-8 +package SL::DBUpgrade2::auth_enable_ct_all_edit; -use utf8; use strict; -use Data::Dumper; -die("This script cannot be run from the command line.") unless ($main::form); +use utf8; -sub mydberror { - my ($msg) = @_; - die($dbup_locale->text("Database update error:") . - "
$msg
" . $DBI::errstr); -} +use parent qw(SL::DBUpgrade2::Base); -sub do_update { - my $dbh = $main::auth->dbconnect(); +use SL::DBUtils; + +sub run { + my ($self) = @_; + + $self->dbh($::auth->dbconnect); my $query = <dbh, $query); if (@group_ids) { $query = <dbh, $query); foreach my $id (@group_ids) { - do_statement($form, $sth, $query, $id); + do_statement($::form, $sth, $query, $id); } $sth->finish(); - $dbh->commit(); + $self->dbh->commit(); } return 1; } -return do_update(); - +1; diff --git a/sql/Pg-upgrade2/auth_enable_edit_prices.pl b/sql/Pg-upgrade2/auth_enable_edit_prices.pl index dbe3eb32b..726dd1b9b 100644 --- a/sql/Pg-upgrade2/auth_enable_edit_prices.pl +++ b/sql/Pg-upgrade2/auth_enable_edit_prices.pl @@ -1,21 +1,19 @@ # @tag: auth_enable_edit_prices # @description: Zusätzliches Recht readonly für das Attribut readonly bei Preisen und Rabatten im Textfeld. Das Skript hakt standardmässig dieses Recht an, sodass es keinen Unterschied zu vorhergehenden Version gibt. # @depends: release_2_6_3 -# @charset: utf-8 +package SL::DBUpgrade2::auth_enable_edit_prices; -use utf8; use strict; -use Data::Dumper; -die("This script cannot be run from the command line.") unless ($main::form); +use utf8; -sub mydberror { - my ($msg) = @_; - die($dbup_locale->text("Database update error:") . - "
$msg
" . $DBI::errstr); -} +use parent qw(SL::DBUpgrade2::Base); -sub do_update { - my $dbh = $main::auth->dbconnect(); +use SL::DBUtils; + +sub run { + my ($self) = @_; + + $self->dbh($::auth->dbconnect); my $query = <dbh, $query); if (@group_ids) { $query = <dbh, $query); foreach my $id (@group_ids) { - do_statement($form, $sth, $query, $id); + do_statement($::form, $sth, $query, $id); } $sth->finish(); - $dbh->commit(); + $self->dbh->commit(); } return 1; } -return do_update(); - +1; diff --git a/sql/Pg-upgrade2/auth_enable_sales_all_edit.pl b/sql/Pg-upgrade2/auth_enable_sales_all_edit.pl index c6101e664..2a8595c61 100644 --- a/sql/Pg-upgrade2/auth_enable_sales_all_edit.pl +++ b/sql/Pg-upgrade2/auth_enable_sales_all_edit.pl @@ -1,21 +1,19 @@ # @tag: auth_enable_sales_all_edit # @description: Neues gruppenbezogenes Recht für den Bereich Verkauf hinzugefügt (sales_all_edit := Nur wenn angehakt, können Verkaufsdokumente von anderen Bearbeitern eingesehen werden) Das Skript hakt standardmässig dieses Recht an, sodass es keinen Unterschied zu vorhergehenden Version gibt. # @depends: release_2_6_0 -# @charset: utf-8 +package SL::DBUpgrade2::auth_enable_sales_all_edit; -use utf8; use strict; -use Data::Dumper; -die("This script cannot be run from the command line.") unless ($main::form); +use utf8; -sub mydberror { - my ($msg) = @_; - die($dbup_locale->text("Database update error:") . - "
$msg
" . $DBI::errstr); -} +use parent qw(SL::DBUpgrade2::Base); -sub do_update { - my $dbh = $main::auth->dbconnect(); +use SL::DBUtils; + +sub run { + my ($self) = @_; + + $self->dbh($::auth->dbconnect); my $query = <dbh, $query); if (@group_ids) { $query = <dbh, $query); foreach my $id (@group_ids) { - do_statement($form, $sth, $query, $id); + do_statement($::form, $sth, $query, $id); } $sth->finish(); - $dbh->commit(); + $self->dbh->commit(); } return 1; } -return do_update(); - +1; diff --git a/sql/Pg-upgrade2/background_jobs_3.pl b/sql/Pg-upgrade2/background_jobs_3.pl old mode 100644 new mode 100755 index 0236cd55b..65d07c9ff --- a/sql/Pg-upgrade2/background_jobs_3.pl +++ b/sql/Pg-upgrade2/background_jobs_3.pl @@ -1,13 +1,18 @@ -#!/usr/bin/perl # @tag: background_jobs_3 # @description: Backgroundjob Cleanup einrichten # @depends: emmvee_background_jobs_2 -# @charset: utf-8 +package SL::DBUpgrade2::background_jobs_3; use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); use SL::BackgroundJob::BackgroundJobCleanup; -SL::BackgroundJob::BackgroundJobCleanup->create_job; +sub run { + SL::BackgroundJob::BackgroundJobCleanup->create_job; + return 1; +} 1; diff --git a/sql/Pg-upgrade2/charts_without_taxkey.pl b/sql/Pg-upgrade2/charts_without_taxkey.pl index 5b7893b47..ff95ff0a6 100644 --- a/sql/Pg-upgrade2/charts_without_taxkey.pl +++ b/sql/Pg-upgrade2/charts_without_taxkey.pl @@ -1,64 +1,49 @@ # @tag: charts_without_taxkey # @description: Fügt für jedes Konto, was keinen Steuerschlüssel hat, den Steuerschlüssel 0 hinzu # @depends: -# @charset: UTF-8 +package SL::DBUpgrade2::charts_without_taxkey; -use utf8; use strict; -use SL::Locale; - -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) = @_; +use utf8; - if (!$dbh->do($query)) { - mydberror($query) unless ($may_fail); - $dbh->rollback(); - $dbh->begin_work(); - } -} +use parent qw(SL::DBUpgrade2::Base); +sub run { + my ($self) = @_; -sub do_update { - my ($taxkey0_with_taxes_exists) = $dbh->selectrow_array("SELECT COUNT(*) FROM tax WHERE taxkey=0 AND NOT rate=0;"); + my ($taxkey0_with_taxes_exists) = $self->dbh->selectrow_array("SELECT COUNT(*) FROM tax WHERE taxkey=0 AND NOT rate=0;"); if ($taxkey0_with_taxes_exists > 0){ print_error_message(); return 0; } - my ($taxkey0_exists) = $dbh->selectrow_array("SELECT COUNT(*) FROM tax WHERE taxkey=0"); + my ($taxkey0_exists) = $self->dbh->selectrow_array("SELECT COUNT(*) FROM tax WHERE taxkey=0"); if ($taxkey0_exists == 0){ my $insert_taxkey0 = <db_query($insert_taxkey0); print $::locale->text("taxkey 0 with taxrate 0 was created."); }; - + my $insert_taxkeys = <db_query($insert_taxkeys); return 1; -}; # end do_update +} # end run sub print_error_message { - print $main::form->parse_html_template("dbupgrade/taxkey_update"); -}; + print $::form->parse_html_template("dbupgrade/taxkey_update"); +} -return do_update(); +1; diff --git a/sql/Pg-upgrade2/contacts_add_cp_position.pl b/sql/Pg-upgrade2/contacts_add_cp_position.pl index bd5470777..892284799 100644 --- a/sql/Pg-upgrade2/contacts_add_cp_position.pl +++ b/sql/Pg-upgrade2/contacts_add_cp_position.pl @@ -1,18 +1,19 @@ # @tag: contacts_add_cp_position # @description: Feld 'Funktion/Position' zu Kontakten # @depends: release_3_0_0 -# @charset: utf-8 +package SL::DBUpgrade2::contacts_add_cp_position; -package contacts_add_cp_position; use strict; +use utf8; -die 'This script cannot be run from the command line.' if !$::form; +use parent qw(SL::DBUpgrade2::Base); -my $query = 'ALTER TABLE contacts ADD COLUMN cp_position VARCHAR(75)'; +sub run { + my ($self) = @_; -if (!$dbh->do($query)) { - $dbh->rollback; - $dbh->begin_work; + $self->db_query('ALTER TABLE contacts ADD COLUMN cp_position VARCHAR(75)', 1); + + return 1; } 1; diff --git a/sql/Pg-upgrade2/contacts_add_street_and_zipcode_and_city.pl b/sql/Pg-upgrade2/contacts_add_street_and_zipcode_and_city.pl index f1dde25bf..f830e7c96 100644 --- a/sql/Pg-upgrade2/contacts_add_street_and_zipcode_and_city.pl +++ b/sql/Pg-upgrade2/contacts_add_street_and_zipcode_and_city.pl @@ -1,24 +1,25 @@ # @tag: contacts_add_street_and_zipcode_and_city # @description: Spalten hinzufügen. # @depends: release_2_7_0 -# @charset: utf-8 +package SL::DBUpgrade2::contacts_add_street_and_zipcode_and_city; -use utf8; use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); + +sub run { + my ($self) = @_; -my @queries = ( - 'ALTER TABLE contacts ADD COLUMN cp_street text;', - 'ALTER TABLE contacts ADD COLUMN cp_zipcode text;', - 'ALTER TABLE contacts ADD COLUMN cp_city text;', -); + my @queries = ( + 'ALTER TABLE contacts ADD COLUMN cp_street text;', + 'ALTER TABLE contacts ADD COLUMN cp_zipcode text;', + 'ALTER TABLE contacts ADD COLUMN cp_city text;', + ); -foreach my $query (@queries) { - if ( $dbh->do($query) ) { - next; - } + $self->db_query($_, 1) for @queries; - $dbh->rollback(); - $dbh->begin_work(); + return 1; } -return 1; +1; diff --git a/sql/Pg-upgrade2/contacts_convert_cp_birthday_to_date.pl b/sql/Pg-upgrade2/contacts_convert_cp_birthday_to_date.pl index 2f10670c4..bb45209e2 100644 --- a/sql/Pg-upgrade2/contacts_convert_cp_birthday_to_date.pl +++ b/sql/Pg-upgrade2/contacts_convert_cp_birthday_to_date.pl @@ -1,23 +1,27 @@ # @tag: contacts_convert_cp_birthday_to_date # @description: Umstellung cp_birthday von Freitext auf Datumsfeld # @depends: release_2_7_0 -package contacts_convert_cp_birthday_to_date; +package SL::DBUpgrade2::contacts_convert_cp_birthday_to_date; + use strict; +use utf8; -die 'This script cannot be run from the command line.' if !$::form; +use parent qw(SL::DBUpgrade2::Base); sub convert_to_date { - my ($str) = @_; + my ($self, $str) = @_; return '' if !$str; - my $sth = $dbh->prepare('SELECT ?::date AS date') or return undef; + my $sth = $self->dbh->prepare('SELECT ?::date AS date') or return undef; $sth->execute($str) or return undef; return $sth->fetchrow_hashref->{date}; } -sub update { +sub run { + my ($self) = @_; + my @data = (); my @auto_data = (); my $sql = <prepare($sql) or die $dbh->errstr; - $sth->execute or die $dbh->errstr; + my $sth = $self->dbh->prepare($sql) or die $self->dbh->errstr; + $sth->execute or die $self->dbh->errstr; my $i = -1; while (my $row = $sth->fetchrow_hashref) { $i++; - $row->{cp_birthday} = convert_to_date($::form->{form_submitted} ? $::form->{'cp_birthday_'. $i} : $row->{cp_birthday_old}); + $row->{cp_birthday} = $self->convert_to_date($::form->{form_submitted} ? $::form->{'cp_birthday_'. $i} : $row->{cp_birthday_old}); $row->{row_index} = $i; if ( defined($row->{cp_birthday}) ) { @@ -59,7 +63,7 @@ SQL ALTER TABLE contacts ADD COLUMN cp_birthday date; SQL - $dbh->do($sql); + $self->dbh->do($sql); $sql = <prepare($sql) or die $dbh->errstr; + $sth = $self->dbh->prepare($sql) or die $self->dbh->errstr; foreach (grep { $_->{cp_birthday} ne '' } @auto_data) { - $sth->execute($_->{cp_birthday}, $_->{cp_id}) or die $dbh->errstr; + $sth->execute($_->{cp_birthday}, $_->{cp_id}) or die $self->dbh->errstr; } return 1; } } -return update(); +1; diff --git a/sql/Pg-upgrade2/cp_greeting_migration.pl b/sql/Pg-upgrade2/cp_greeting_migration.pl index 176516572..cb2ed66cf 100644 --- a/sql/Pg-upgrade2/cp_greeting_migration.pl +++ b/sql/Pg-upgrade2/cp_greeting_migration.pl @@ -1,43 +1,30 @@ # @tag: cp_greeting_migration # @description: Migration of cp_greeting to cp_gender # @depends: generic_translations +package SL::DBUpgrade2::cp_greeting_migration; 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 query_result { + my ($self) = @_; # list of all entries where cp_greeting is empty, meaning can't determine gender from parsing Herr/Frau/... # this assumes cp_greeting still exists, i.e. gender.sql was not run yet my ($gender_table, $mchecked, $fchecked); my $sql2 = "select cp_id,cp_givenname,cp_name,cp_title,cp_greeting from contacts where not (cp_greeting ILIKE '%frau%' OR cp_greeting ILIKE '%herr%' or cp_greeting ILIKE '%mrs.%' or cp_greeting ILIKE '%miss%') "; - my $sth2 = $dbh->prepare($sql2) or die $dbh->errstr(); - $sth2->execute() or die $dbh->errstr(); + my $sth2 = $self->dbh->prepare($sql2) or die $self->dbh->errstr(); + $sth2->execute() or die $self->dbh->errstr(); my $i = 1; $gender_table .= ''; $gender_table .= "\n"; while (my $row = $sth2->fetchrow_hashref()) { - if ($main::form->{"gender_$i"} eq "f" ) { + if ($::form->{"gender_$i"} eq "f" ) { $mchecked = ""; $fchecked = "checked"; } else { @@ -52,14 +39,14 @@ sub query_result { $gender_table .= ""; $gender_table .= "
cp_givennamecp_namecp_titlecp_greetingmale/female
"; - $main::form->{gender_table} = $gender_table; + $::form->{gender_table} = $gender_table; my $title_table; my $sql3 = "select cp_id,cp_givenname,cp_name,cp_title,cp_greeting from contacts where not ( (cp_greeting ILIKE '%frau%' OR cp_greeting ILIKE '%herr%' or cp_greeting ILIKE '%mrs.%' or cp_greeting ILIKE '%miss%')) and not (cp_greeting like ''); "; - my $sth3 = $dbh->prepare($sql3) or die $dbh->errstr(); - $sth3->execute() or die $dbh->errstr(); + my $sth3 = $self->dbh->prepare($sql3) or die $self->dbh->errstr(); + $sth3->execute() or die $self->dbh->errstr(); $title_table = ''; @@ -76,32 +63,38 @@ sub query_result { $title_table .= ""; $title_table .= "
cp_givennamecp_namecp_titlecp_greetingcp_title new
"; - $main::form->{title_table} = $title_table; + $::form->{title_table} = $title_table; } sub print_question { - query_result(); + my ($self) = @_; + + $self->query_result; # parse html form in /templates/webpages/dbupgrade/cp_greeting_update_form - print $main::form->parse_html_template("dbupgrade/cp_greeting_update_form"); + print $::form->parse_html_template("dbupgrade/cp_greeting_update_form"); } sub alter_schema_only { + my ($self) = @_; + my $sqlcode = <do($sqlcode); + $self->dbh->do($sqlcode); } -sub do_update { +sub run { + my ($self) = @_; + # main function # Do not ask the user anything if there are no entries in the # contacts table. - my ($data_exists) = $dbh->selectrow_array("SELECT * FROM contacts LIMIT 1"); + my ($data_exists) = $self->dbh->selectrow_array("SELECT * FROM contacts LIMIT 1"); if (!$data_exists) { - alter_schema_only(); + $self->alter_schema_only; return 1; } @@ -110,29 +103,30 @@ sub do_update { # without doing anything my $column_exists = 1; - if (!$dbh->do("SELECT cp_gender FROM contacts LIMIT 1")) { - $dbh->rollback(); - $dbh->begin_work(); + if (!$self->dbh->do("SELECT cp_gender FROM contacts LIMIT 1")) { + $self->dbh->rollback(); + $self->dbh->begin_work(); $column_exists = 0; } return 1 if $column_exists; - if (!$main::form->{do_migrate}) { + if (!$::form->{do_migrate}) { # case 1: first call of page - set_default_greetings(); - print_question(); + $self->set_default_greetings; + $self->print_question; return 2; - } else { - # case 2: submit button was pressed, hidden field do_migrate was set - migrate_data(); } + # case 2: submit button was pressed, hidden field do_migrate was set + $self->migrate_data; + return 1; } sub migrate_data { + my ($self) = @_; my $sqlcode = <{number_of_gender_entries}; $i++ ) { - next unless $main::form->{"cp_id_$i"}; - if ( $main::form->{"gender_$i"} eq "f" ) { - $sqlcode .= "UPDATE contacts SET cp_gender = \'f\' WHERE cp_id = $main::form->{\"cp_id_$i\"};\n"; + for (my $i = 1; $i <= $::form->{number_of_gender_entries}; $i++ ) { + next unless $::form->{"cp_id_$i"}; + if ( $::form->{"gender_$i"} eq "f" ) { + $sqlcode .= "UPDATE contacts SET cp_gender = \'f\' WHERE cp_id = $::form->{\"cp_id_$i\"};\n"; } } - for (my $i = 1; $i <= $main::form->{number_of_title_entries}; $i++ ) { - next unless $main::form->{"cp_id_title_$i"} and $main::form->{"cp_id_$i"}; - $sqlcode .= "UPDATE contacts SET cp_title = \'$main::form->{\"cp_name_$i\"}\' WHERE cp_id = $main::form->{\"cp_id_$i\"};\n"; + for (my $i = 1; $i <= $::form->{number_of_title_entries}; $i++ ) { + next unless $::form->{"cp_id_title_$i"} and $::form->{"cp_id_$i"}; + $sqlcode .= "UPDATE contacts SET cp_title = \'$::form->{\"cp_name_$i\"}\' WHERE cp_id = $::form->{\"cp_id_$i\"};\n"; } $sqlcode .= "ALTER TABLE contacts DROP COLUMN cp_greeting;"; # insert chosen default values - $sqlcode .= "INSERT INTO generic_translations (translation_type, translation) VALUES ('greetings::male','$main::form->{default_male}');"; - $sqlcode .= "INSERT INTO generic_translations (translation_type, translation) VALUES ('greetings::female','$main::form->{default_female}');"; + $sqlcode .= "INSERT INTO generic_translations (translation_type, translation) VALUES ('greetings::male','$::form->{default_male}');"; + $sqlcode .= "INSERT INTO generic_translations (translation_type, translation) VALUES ('greetings::female','$::form->{default_female}');"; my $query = $sqlcode; - do_query($query); + $self->db_query($query); } sub set_default_greetings { + my ($self) = @_; + # add html input boxes to template so user can specify default greetings my $default_male = "Herr"; my $default_female = "Frau"; my $default_greeting_text_male = "
"; my $default_greeting_text_female = "
"; - $main::form->{default_greeting_text_male} = $default_greeting_text_male; - $main::form->{default_greeting_text_female} = $default_greeting_text_female; + $::form->{default_greeting_text_male} = $default_greeting_text_male; + $::form->{default_greeting_text_female} = $default_greeting_text_female; } -return do_update(); - +1; diff --git a/sql/Pg-upgrade2/defaults_datev_check.pl b/sql/Pg-upgrade2/defaults_datev_check.pl index 50772810b..e213e622d 100644 --- a/sql/Pg-upgrade2/defaults_datev_check.pl +++ b/sql/Pg-upgrade2/defaults_datev_check.pl @@ -1,37 +1,22 @@ # @tag: defaults_datev_check # @description: Einstellung für DATEV-Überprüfungen (datev_check) vom Config-File in die DB verlagern. # @depends: release_2_7_0 -# @charset: utf-8 +package SL::DBUpgrade2::defaults_datev_check; use utf8; -use strict; - -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); +use strict; -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 datev_check_on_sales_invoice boolean DEFAULT true|, 1); - do_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_purchase_invoice boolean DEFAULT true|, 1); - do_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_ar_transaction boolean DEFAULT true|, 1); - do_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_ap_transaction boolean DEFAULT true|, 1); - do_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_gl_transaction boolean DEFAULT true|, 1); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_sales_invoice boolean DEFAULT true|, 1); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_purchase_invoice boolean DEFAULT true|, 1); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_ar_transaction boolean DEFAULT true|, 1); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_ap_transaction boolean DEFAULT true|, 1); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN datev_check_on_gl_transaction boolean DEFAULT true|, 1); # check current configuration and set default variables accordingly, so that # kivitendo's behaviour isn't changed by this update @@ -43,12 +28,10 @@ sub do_update { } my $update_column = "UPDATE defaults SET datev_$check = '$check_set';"; - do_query($update_column); + $self->db_query($update_column); } - return 1; } -return do_update(); - +1; diff --git a/sql/Pg-upgrade2/defaults_posting_config.pl b/sql/Pg-upgrade2/defaults_posting_config.pl index 042976efe..c638494f7 100644 --- a/sql/Pg-upgrade2/defaults_posting_config.pl +++ b/sql/Pg-upgrade2/defaults_posting_config.pl @@ -1,33 +1,18 @@ # @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|, 1); # check current configuration and set default variables accordingly, so that # kivitendo behaviour isn't changed by this update @@ -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; diff --git a/sql/Pg-upgrade2/defaults_show_bestbefore.pl b/sql/Pg-upgrade2/defaults_show_bestbefore.pl index cb1966154..44f3cf96d 100644 --- a/sql/Pg-upgrade2/defaults_show_bestbefore.pl +++ b/sql/Pg-upgrade2/defaults_show_bestbefore.pl @@ -1,33 +1,18 @@ # @tag: defaults_show_bestbefore # @description: Einstellung, ob Mindesthaltbarkeitsdatum angezeigt wird, vom Config-File in die DB verlagern. # @depends: release_2_7_0 -# @charset: utf-8 +package SL::DBUpgrade2::defaults_show_bestbefore; -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 show_bestbefore boolean DEFAULT false|, 1); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN show_bestbefore boolean DEFAULT false|, 1); # check current configuration and set default variables accordingly, so that # kivitendo behaviour isn't changed by this update @@ -38,10 +23,9 @@ sub do_update { } my $update_column = "UPDATE defaults SET show_bestbefore = '$show_bestbefore';"; - do_query($update_column); + $self->db_query($update_column); return 1; } -return do_update(); - +1; diff --git a/sql/Pg-upgrade2/emmvee_background_jobs_2.pl b/sql/Pg-upgrade2/emmvee_background_jobs_2.pl index 7d997eff3..a7b9e6dc3 100644 --- a/sql/Pg-upgrade2/emmvee_background_jobs_2.pl +++ b/sql/Pg-upgrade2/emmvee_background_jobs_2.pl @@ -1,13 +1,18 @@ -#!/usr/bin/perl # @tag: emmvee_background_jobs_2 # @description: Hintergrundjobs einrichten # @depends: emmvee_background_jobs -# @charset: utf-8 +package SL::DBUpgrade2::emmvee_background_jobs_2; use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); use SL::BackgroundJob::CleanBackgroundJobHistory; -SL::BackgroundJob::CleanBackgroundJobHistory->create_job; +sub run { + SL::BackgroundJob::CleanBackgroundJobHistory->create_job; + return 1; +} 1; diff --git a/sql/Pg-upgrade2/erzeugnisnummern.pl b/sql/Pg-upgrade2/erzeugnisnummern.pl index 6908a931f..81c024160 100644 --- a/sql/Pg-upgrade2/erzeugnisnummern.pl +++ b/sql/Pg-upgrade2/erzeugnisnummern.pl @@ -1,38 +1,24 @@ # @tag: erzeugnisnummern # @description: Erzeugnisnummern und Artikelnummern sollen eindeutig sein. # @depends: release_3_0_0 -# @charset: utf-8 +package SL::DBUpgrade2::erzeugnisnummern; -use utf8; use strict; -use SL::Locale; - -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); -} +use utf8; -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(); - } -} +sub run { + my ($self) = @_; -sub do_update { - if ( $main::form->{'continued'} ) { + if ( $::form->{'continued'} ) { my $update_query; - foreach my $i (1 .. $main::form->{rowcount}) { - $update_query = qq|UPDATE parts SET partnumber = '| . $main::form->{"partnumber_$i"} . qq|' WHERE id = | . $main::form->{"partid_$i"}; - do_query($update_query); + foreach my $i (1 .. $::form->{rowcount}) { + $update_query = qq|UPDATE parts SET partnumber = '| . $::form->{"partnumber_$i"} . qq|' WHERE id = | . $::form->{"partid_$i"}; + $self->db_query($update_query); print FH $i; } - $dbh->commit(); + $self->dbh->commit(); } my $query = qq|SELECT id, partnumber, description, unit, notes, assembly, ean, inventory_accno_id @@ -43,31 +29,30 @@ sub do_update { > 1 ORDER BY partnumber;|; - my $sth = $dbh->prepare($query); - $sth->execute || $main::form->dberror($query); + my $sth = $self->dbh->prepare($query); + $sth->execute || $::form->dberror($query); - $main::form->{PARTS} = []; + $::form->{PARTS} = []; while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { map {$ref->{$_} = $::locale->{iconv_utf8}->convert($ref->{$_})} keys %$ref; - push @{ $main::form->{PARTS} }, $ref; + push @{ $::form->{PARTS} }, $ref; } - if ( scalar @{ $main::form->{PARTS} } > 0 ) { + if ( scalar @{ $::form->{PARTS} } > 0 ) { &print_error_message; return 2; } $query = qq|ALTER TABLE parts ADD UNIQUE (partnumber)|; - do_query($query); + $self->db_query($query); $query = qq|ALTER TABLE defaults ADD assemblynumber TEXT|; - do_query($query); + $self->db_query($query); return 1; -}; # end do_update - +} # end run sub print_error_message { - print $main::form->parse_html_template("dbupgrade/erzeugnisnummern"); + print $::form->parse_html_template("dbupgrade/erzeugnisnummern"); } -return do_update(); +1; diff --git a/sql/Pg-upgrade2/finanzamt_update_fa_bufa_nr_hamburg.pl b/sql/Pg-upgrade2/finanzamt_update_fa_bufa_nr_hamburg.pl index d0b14dbfa..2f5bc6046 100644 --- a/sql/Pg-upgrade2/finanzamt_update_fa_bufa_nr_hamburg.pl +++ b/sql/Pg-upgrade2/finanzamt_update_fa_bufa_nr_hamburg.pl @@ -1,24 +1,17 @@ # @tag: finanzamt_update_fa_bufa_nr_hamburg -# @description: Aktualisiert die fa_bufa_nr für Hamburg +# @description: Aktualisiert die fa_bufa_nr für Hamburg # @depends: release_2_7_0 -# @charset: utf-8 -package finanzamt_update_fa_bufa_nr_hamburg; -use utf8; +package SL::DBUpgrade2::finanzamt_update_fa_bufa_nr_hamburg; + use strict; +use utf8; -if ( !$::form ) { - die('This script cannot be run from the command line.'); -} +use parent qw(SL::DBUpgrade2::Base); -sub query { - my ($query) = @_; +sub run { + my ($self) = @_; - if ( !$dbh->do($query) ) { - die($dbup_locale->text('Database update error:') .'
'. $query .'
'. $DBI::errstr); - } -} - -my @data = ( + my @data = ( ['02', '41'], ['57', '42'], ['71', '43'], @@ -33,14 +26,17 @@ my @data = ( ['08', '51'], ); -foreach my $entry (@data) { - query(' + foreach my $entry (@data) { + $self->db_query(' UPDATE finanzamt SET fa_bufa_nr = \'22'. $entry->[1] .'\' WHERE fa_land_nr = \'2\' - AND fa_bufa_nr = \'22'. $entry->[0] .'\';'); + AND fa_bufa_nr = \'22'. $entry->[0] .'\''); + } + + return 1; } -return 1; +1; 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 4b1c962eb..f556ff23a 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"; } -do_update(); -return 1; - +1; diff --git a/sql/Pg-upgrade2/globalprojectnumber_ap_ar_oe.pl b/sql/Pg-upgrade2/globalprojectnumber_ap_ar_oe.pl index 608e44207..df31c04e4 100644 --- a/sql/Pg-upgrade2/globalprojectnumber_ap_ar_oe.pl +++ b/sql/Pg-upgrade2/globalprojectnumber_ap_ar_oe.pl @@ -1,28 +1,16 @@ # @tag: globalprojectnumber_ap_ar_oe # @description: Neue Spalte für eine globale Projektnummer in Einkaufs- und Verkaufsbelegen # @depends: release_2_4_1 +package SL::DBUpgrade2::globalprojectnumber_ap_ar_oe; use strict; +use utf8; -die("This script cannot be run from the command line.") unless ($main::form); +use parent qw(SL::DBUpgrade2::Base); -sub mydberror { - my ($msg) = @_; - die($dbup_locale->text("Database update error:") . - "
$msg
" . $DBI::errstr); -} - -sub do_query { - my ($query, $may_fail) = @_; +sub run { + my ($self) = @_; - if (!$dbh->do($query)) { - mydberror($query) unless ($may_fail); - $dbh->rollback(); - $dbh->begin_work(); - } -} - -sub do_update { my @queries = ("ALTER TABLE ap ADD COLUMN globalproject_id integer;", "ALTER TABLE ap ADD FOREIGN KEY (globalproject_id) REFERENCES project (id);", @@ -31,11 +19,10 @@ sub do_update { "ALTER TABLE oe ADD COLUMN globalproject_id integer;", "ALTER TABLE oe ADD FOREIGN KEY (globalproject_id) REFERENCES project (id);"); - do_query("ALTER TABLE project ADD PRIMARY KEY (id);", 1); - map({ do_query($_, 0); } @queries); + $self->db_query("ALTER TABLE project ADD PRIMARY KEY (id);", 1); + map({ $self->db_query($_, 0); } @queries); return 1; } -return do_update(); - +1; diff --git a/sql/Pg-upgrade2/periodic_invoices_background_job.pl b/sql/Pg-upgrade2/periodic_invoices_background_job.pl index 7db1fef84..91b3a61ed 100644 --- a/sql/Pg-upgrade2/periodic_invoices_background_job.pl +++ b/sql/Pg-upgrade2/periodic_invoices_background_job.pl @@ -1,12 +1,18 @@ # @tag: periodic_invoices_background_job # @description: Hintergrundjob zum Erzeugen wiederkehrender Rechnungen # @depends: periodic_invoices -# @charset: utf-8 +package SL::DBUpgrade2::periodic_invoices_background_job; use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); use SL::BackgroundJob::CreatePeriodicInvoices; -SL::BackgroundJob::CreatePeriodicInvoices->create_job; +sub run { + SL::BackgroundJob::CreatePeriodicInvoices->create_job; + return 1; +} 1; diff --git a/sql/Pg-upgrade2/rundungsfehler_korrigieren_BUG1328.pl b/sql/Pg-upgrade2/rundungsfehler_korrigieren_BUG1328.pl index 1e9b00d08..a3f0fd209 100644 --- a/sql/Pg-upgrade2/rundungsfehler_korrigieren_BUG1328.pl +++ b/sql/Pg-upgrade2/rundungsfehler_korrigieren_BUG1328.pl @@ -1,36 +1,24 @@ # @tag: rundungsfehler_korrigieren_BUG1328-2 # @description: Die entsprechende Cent-Abweichung die durch den Rundungsfehler in Bug 1328 behoben wurde, entsprechende für alte Buchungen korrigieren. # @depends: release_2_6_0 -# @charset: utf-8 +package SL::DBUpgrade2::rundungsfehler_korrigieren_BUG1328_2; -use utf8; use strict; -use Data::Dumper; -die("This script cannot be run from the command line.") unless ($main::form); +use utf8; -sub mydberror { - my ($msg) = @_; - die($dbup_locale->text("Database update error:") . - "
$msg
" . $DBI::errstr); -} +use parent qw(SL::DBUpgrade2::Base); -sub do_query { - my ($query, $may_fail) = @_; +use SL::DBUtils; - if (!$dbh->do($query)) { - mydberror($query) unless ($may_fail); - $dbh->rollback(); - $dbh->begin_work(); - } -} +sub run { + my ($self) = @_; -sub do_update { my @queries; my $query = qq|select distinct id,acamount from (select ap.id,ap.amount as apamount, ac.amount*-1 as acamount from ap left join acc_trans ac on (ac.trans_id = ap.id) where ac.chart_id IN (select id from chart where link ='AP' OR link like '%:AP' OR link like 'AP:%')) as foo where apamount + 0.01 = abs(acamount)|; - my $sth_all_groups = prepare_execute_query($form, $dbh, $query); + my $sth_all_groups = prepare_execute_query($::form, $self->dbh, $query); while (my $hash_ref = $sth_all_groups->fetchrow_hashref()) { # Schleife push @queries, "UPDATE ap set amount =" . $hash_ref->{acamount} . " WHERE id = " . $hash_ref->{id}; } @@ -39,9 +27,9 @@ ap.id) where ac.chart_id IN (select id from chart where link ='AP' OR link like my $query = qq|select distinct id,acamount from (select ar.id, ar.amount as aramount, ac.amount*-1 as acamount from ar left join acc_trans ac on (ac.trans_id = ar.id) where ac.chart_id IN (select id from chart where link ='AR' OR link like '%:AR' OR link like 'AR:%')) as foo where aramount + 0.01 = abs(acamount)|; - my $sth_all_groups = prepare_execute_query($form, $dbh, $query); + my $sth_all_groups = prepare_execute_query($::form, $self->dbh, $query); while (my $hash_ref = $sth_all_groups->fetchrow_hashref()) { # Schleife - # Falls wir keine alte buggy Installation haben, ist es super die + # Falls wir keine alte buggy Installation haben, ist es super die # Gewissheit zu haben, dass kein acc_trans-Eintrag ohne trans_id vorhanden ist push @queries, "UPDATE ar set amount =" . $hash_ref->{acamount} . " WHERE id = " . $hash_ref->{id}; } @@ -49,13 +37,12 @@ ar.id) where ac.chart_id IN (select id from chart where link ='AR' OR link like # if in doubt use brute force ;-) jb foreach my $query (@queries){ - my $sth = prepare_query($form, $dbh, $query); - do_statement($form,$sth,$query); + my $sth = prepare_query($::form, $self->dbh, $query); + do_statement($::form,$sth,$query); $sth->finish(); } - $dbh ->commit(); + $self->dbh ->commit(); return 1; } -return do_update(); - +1; diff --git a/sql/Pg-upgrade2/self_test_background_job.pl b/sql/Pg-upgrade2/self_test_background_job.pl index 796c6c960..468b79cc7 100644 --- a/sql/Pg-upgrade2/self_test_background_job.pl +++ b/sql/Pg-upgrade2/self_test_background_job.pl @@ -1,12 +1,18 @@ # @tag: self_test_background_job # @description: Hintergrundjob für tägliche Selbsttests # @depends: release_2_7_0 -# @charset: utf-8 +package SL::DBUpgrade2::self_test_background_job; use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); use SL::BackgroundJob::SelfTest; -SL::BackgroundJob::SelfTest->create_job; +sub run { + SL::BackgroundJob::SelfTest->create_job; + return 1; +} 1; diff --git a/sql/Pg-upgrade2/tax_constraints.pl b/sql/Pg-upgrade2/tax_constraints.pl index 70fe83d35..23d9b84b2 100644 --- a/sql/Pg-upgrade2/tax_constraints.pl +++ b/sql/Pg-upgrade2/tax_constraints.pl @@ -1,30 +1,16 @@ # @tag: tax_constraints # @description: Setzt Fremdschlüssel und andere constraints auf die Tabellen tax und taxkeys # @depends: release_3_0_0 charts_without_taxkey -# @charset: utf-8 +package SL::DBUpgrade2::tax_constraints; -use utf8; use strict; -use SL::Locale; - -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); -} +use utf8; -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(); - } -} +sub run { + my ($self) = @_; -sub do_update { #CHECK CONSISTANCY OF tax #update tax.rate and tax.taxdescription in order to set later NOT NULL constraints my $query= <db_query($query); #check automatic tax accounts $query= <selectrow_array($query); + my ($invalid_tax_account) = $self->dbh->selectrow_array($query); if ($invalid_tax_account > 0){ #list all invalid tax accounts @@ -51,16 +37,16 @@ SQL FROM tax WHERE chart_id NOT IN (SELECT id FROM chart); SQL - my $sth = $dbh->prepare($query); - $sth->execute || $main::form->dberror($query); + my $sth = $self->dbh->prepare($query); + $sth->execute || $::form->dberror($query); - $main::form->{TAX} = []; + $::form->{TAX} = []; while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { - push @{ $main::form->{TAX} }, $ref; + push @{ $::form->{TAX} }, $ref; } $sth->finish; - $main::form->{invalid_tax_account} = 1; + $::form->{invalid_tax_account} = 1; print_error_message(); return 0; } @@ -70,7 +56,7 @@ SQL SELECT count(*) FROM tax WHERE taxkey IS NULL; SQL - my ($taxkey_is_null) = $dbh->selectrow_array($query); + my ($taxkey_is_null) = $self->dbh->selectrow_array($query); if ($taxkey_is_null > 0){ #list all invalid tax accounts @@ -84,16 +70,16 @@ SQL WHERE taxkey IS NULL; SQL - my $sth = $dbh->prepare($query); - $sth->execute || $main::form->dberror($query); + my $sth = $self->dbh->prepare($query); + $sth->execute || $::form->dberror($query); - $main::form->{TAX} = []; + $::form->{TAX} = []; while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { - push @{ $main::form->{TAX} }, $ref; + push @{ $::form->{TAX} }, $ref; } $sth->finish; - $main::form->{taxkey_is_null} = 1; + $::form->{taxkey_is_null} = 1; print_error_message(); return 0; } @@ -108,7 +94,7 @@ SQL OR startdate IS NULL; SQL - do_query($query); + $self->db_query($query); #There are 3 cases for taxkeys.tax_id and taxkeys.taxkey_id #taxkeys.taxkey_id is NULL and taxkeys.tax_id is not NULL: @@ -123,7 +109,7 @@ SQL AND tax_id IS NOT NULL; SQL - do_query($query); + $self->db_query($query); #taxkeys.taxkey_id and taxkeys.tax_id are NULL: @@ -135,7 +121,7 @@ SQL AND tax_id IS NULL; SQL - do_query($query); + $self->db_query($query); #Last case where taxkeys.taxkey_id is not null and taxkeys.tax_id is null @@ -150,13 +136,13 @@ SQL AND tax_id IS NULL; SQL - my $sth = $dbh->prepare($query); - $sth->execute || $main::form->dberror($query); + my $sth = $self->dbh->prepare($query); + $sth->execute || $::form->dberror($query); - $main::form->{TAXID} = []; + $::form->{TAXID} = []; my $rowcount = 0; while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { - push @{ $main::form->{TAXID} }, $ref; + push @{ $::form->{TAXID} }, $ref; $rowcount++; } $sth->finish; @@ -166,22 +152,22 @@ SQL my $tax_id; for my $i (0 .. $rowcount-1){ $query= qq| - SELECT id FROM tax WHERE rate = 0 and taxkey=| . $main::form->{TAXID}[$i]->{taxkey_id} . qq| LIMIT 1 + SELECT id FROM tax WHERE rate = 0 and taxkey=| . $::form->{TAXID}[$i]->{taxkey_id} . qq| LIMIT 1 |; - ($tax_id) = $dbh->selectrow_array($query); + ($tax_id) = $self->dbh->selectrow_array($query); if ( not $tax_id ){ $insertquery=qq| - INSERT INTO tax (rate, taxdescription, taxkey) VALUES (0, '| . $::locale->text('0% tax with taxkey') . $main::form->{TAXID}[$i]->{taxkey_id} . $::locale->text('. Automatically generated.') . - qq|', | . $main::form->{TAXID}[$i]->{taxkey_id} . qq|); + INSERT INTO tax (rate, taxdescription, taxkey) VALUES (0, '| . $::locale->text('0% tax with taxkey') . $::form->{TAXID}[$i]->{taxkey_id} . $::locale->text('. Automatically generated.') . + qq|', | . $::form->{TAXID}[$i]->{taxkey_id} . qq|); |; - do_query($insertquery); - ($tax_id) = $dbh->selectrow_array($query); - $tax_id || $main::form->dberror($query); + $self->db_query($insertquery); + ($tax_id) = $self->dbh->selectrow_array($query); + $tax_id || $::form->dberror($query); } $updatequery = qq| - UPDATE taxkeys SET tax_id= | . $tax_id . qq| WHERE taxkey_id = | . $main::form->{TAXID}[$i]->{taxkey_id} . qq| AND tax_id IS NULL + UPDATE taxkeys SET tax_id= | . $tax_id . qq| WHERE taxkey_id = | . $::form->{TAXID}[$i]->{taxkey_id} . qq| AND tax_id IS NULL |; - do_query($updatequery); + $self->db_query($updatequery); } #The triple taxkey_id, chart_id, startdate in taxkeys has to be unique @@ -195,13 +181,13 @@ SQL AND tk2.startdate = tk1.startdate) > 1; SQL - $sth = $dbh->prepare($query); - $sth->execute || $main::form->dberror($query); + $sth = $self->dbh->prepare($query); + $sth->execute || $::form->dberror($query); - $main::form->{TAXKEYS} = []; + $::form->{TAXKEYS} = []; $rowcount = 0; while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { - push @{ $main::form->{TAXKEYS} }, $ref; + push @{ $::form->{TAXKEYS} }, $ref; $rowcount++; } $sth->finish; @@ -215,12 +201,12 @@ SQL AND tk2.startdate = tk1.startdate) > 1 AND NOT tk1.id = (SELECT id FROM taxkeys - WHERE chart_id = | . $main::form->{TAXKEYS}[$i]->{chart_id} . qq| - AND startdate = '| . $main::form->{TAXKEYS}[$i]->{startdate} . qq|' + WHERE chart_id = | . $::form->{TAXKEYS}[$i]->{chart_id} . qq| + AND startdate = '| . $::form->{TAXKEYS}[$i]->{startdate} . qq|' LIMIT 1) |; - do_query($query); + $self->db_query($query); } #END CHECK OF taxkeys @@ -233,28 +219,28 @@ SQL ALTER TABLE tax ALTER COLUMN rate SET DEFAULT 0; SQL - do_query($query); + $self->db_query($query); #Create NOT NULL constraint for tax.description $query= <db_query($query); #Create foreign key for tax.chart_id to chart.id $query= <db_query($query); #Create NOT NULL constraint for tax.taxkey $query= <db_query($query); #Create NOT NULL constraint for taxkey.chart_id and foreign key for taxkey.chart_id $query= <db_query($query); #Create NOT NULL constraint for taxkey.startdate $query= <db_query($query); #Create NOT NULL constraint for taxkey.taxkey_id $query= <db_query($query); #Create NOT NULL constraint for taxkey.tax_id $query= <db_query($query); #The triple chart_id, taxkey_id, startdate should be unique: $query= <db_query($query); #ALL CONSTRAINTS WERE ADDED return 1; -}; # end do_update +} # end run sub print_error_message { - print $main::form->parse_html_template("dbupgrade/tax_constraints"); + print $::form->parse_html_template("dbupgrade/tax_constraints"); } -return do_update(); +1; diff --git a/sql/Pg-upgrade2/umstellung_eur.pl b/sql/Pg-upgrade2/umstellung_eur.pl index 438d2ee7f..0f7606065 100644 --- a/sql/Pg-upgrade2/umstellung_eur.pl +++ b/sql/Pg-upgrade2/umstellung_eur.pl @@ -1,33 +1,18 @@ # @tag: umstellung_eur # @description: Variable eur umstellen: bitte in doc/dokumentation.pdf das entsprechende Kapitel zur Konfiguration von EUR lesen # @depends: release_2_6_3 -# @charset: utf-8 - -# this script relies on $eur still being set in kivitendo.conf, and the -# variable available in $::lx_office_conf{system}->{eur} +package SL::DBUpgrade2::umstellung_eur; +use strict; 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:") . - "
$msg
" . $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 @@ -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) - do_query(qq|ALTER TABLE defaults ADD COLUMN ${column} TEXT|, 1); + $self->db_query(qq|ALTER TABLE defaults ADD COLUMN ${column} TEXT|, 1); } my $accounting_method; @@ -65,10 +50,9 @@ sub do_update { 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;"; - do_query($update_eur); + $self->db_query($update_eur); return 1; } -return do_update(); - +1; diff --git a/sql/Pg-upgrade2/warehouse.pl b/sql/Pg-upgrade2/warehouse.pl index a9b152f9e..3c9097176 100644 --- a/sql/Pg-upgrade2/warehouse.pl +++ b/sql/Pg-upgrade2/warehouse.pl @@ -1,92 +1,25 @@ # @tag: warehouse # @description: Diverse neue Tabellen und Spalten zur Mehrlagerfähigkeit inkl. Migration # @depends: release_2_4_3 +package SL::DBUpgrade2::warehouse; use strict; +use utf8; -die("This script cannot be run from the command line.") unless ($main::form); - -my $do_sql_migration = 0; -my ($check_sql, $sqlcode); - -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); +use SL::DBUtils; sub print_question { - print $main::form->parse_html_template("dbupgrade/warehouse_form"); -} - -sub do_update { - if (!$main::form->{do_migrate} - && (selectfirst_array_query($main::form, $dbh, $check_sql))[0]) { # check if update is needed - print_question(); - return 2; - } else { - if ($main::form->{do_migrate} eq 'Y') { - # if yes, both warehouse and bin must be given - if (!$main::form->{import_warehouse} || !$main::form->{bin_default}) { - print_question(); - return 2; - } - # flag for extra code - $do_sql_migration = 1; - } - } - my $warehouse = $main::form->{import_warehouse} ne '' ? $main::form->{import_warehouse} : "Transfer"; - my $bin = $main::form->{bin_default} ne '' ? $main::form->{bin_default} : "1"; - - $warehouse = $dbh->quote($warehouse); - $bin = $dbh->quote($bin); - - my $migration_code = <parse_html_template("dbupgrade/warehouse_form"); } +sub run { + my ($self) = @_; - -$sqlcode = < 0;|; + my $sqlcode = <{do_migrate} + && (selectfirst_array_query($::form, $self->dbh, $check_sql))[0]) { # check if update is needed + print_question(); + return 2; + } else { + if ($::form->{do_migrate} eq 'Y') { + # if yes, both warehouse and bin must be given + if (!$::form->{import_warehouse} || !$::form->{bin_default}) { + print_question(); + return 2; + } + # flag for extra code + $do_sql_migration = 1; + } + } + my $warehouse = $::form->{import_warehouse} ne '' ? $::form->{import_warehouse} : "Transfer"; + my $bin = $::form->{bin_default} ne '' ? $::form->{bin_default} : "1"; + + $warehouse = $self->dbh->quote($warehouse); + $bin = $self->dbh->quote($bin); + + my $migration_code = < 0; +UPDATE tmp_parts SET bin = NULL WHERE bin = ''; + +-- Restore old onhand +INSERT INTO bin + (warehouse_id, description) + (SELECT DISTINCT warehouse.id, COALESCE(bin, $bin) + FROM warehouse, tmp_parts + WHERE warehouse.description=$warehouse); +INSERT INTO inventory + (warehouse_id, parts_id, bin_id, qty, employee_id, trans_id, trans_type_id, chargenumber) + (SELECT warehouse.id, tmp_parts.id, bin.id, onhand, (SELECT id FROM employee LIMIT 1), nextval('id'), transfer_type.id, '' + FROM transfer_type, warehouse, tmp_parts, bin + WHERE warehouse.description = $warehouse + AND COALESCE(bin, $bin) = bin.description + AND transfer_type.description = 'stock'); EOF ; -return do_update(); + # do standard code + my $query = $sqlcode; + $query .= $migration_code if $do_sql_migration; + + $self->db_query($query); + + return 1; +} + +1;