X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=sql%2FPg-upgrade2%2Fwarehouse.pl;h=a9b152f9e8bf2c4c652d817ea2ad0c491591da8c;hb=f1c874c3725f159f1b00295bf825b2a270cf57bc;hp=5fad058396f61af682ff687b036cdcd313d03ff2;hpb=5f0a5514943bce086319e6f02b31808874e680eb;p=kivitendo-erp.git
diff --git a/sql/Pg-upgrade2/warehouse.pl b/sql/Pg-upgrade2/warehouse.pl
index 5fad05839..a9b152f9e 100644
--- a/sql/Pg-upgrade2/warehouse.pl
+++ b/sql/Pg-upgrade2/warehouse.pl
@@ -2,9 +2,29 @@
# @description: Diverse neue Tabellen und Spalten zur Mehrlagerfähigkeit inkl. Migration
# @depends: release_2_4_3
+use strict;
die("This script cannot be run from the command line.") unless ($main::form);
-$do_sql_migration = 0;
+
+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();
+ }
+}
+
sub print_question {
print $main::form->parse_html_template("dbupgrade/warehouse_form");
@@ -29,26 +49,28 @@ sub do_update {
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 = < 0;
ALTER TABLE parts DROP COLUMN onhand;
ALTER TABLE parts ADD COLUMN onhand numeric(25,5);