Revision 76c486e3
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
sql/Pg-upgrade2/warehouse.pl | ||
---|---|---|
2 | 2 |
# @description: Diverse neue Tabellen und Spalten zur Mehrlagerfähigkeit inkl. Migration |
3 | 3 |
# @depends: release_2_4_3 |
4 | 4 |
|
5 |
use strict; |
|
5 | 6 |
|
6 | 7 |
die("This script cannot be run from the command line.") unless ($main::form); |
7 | 8 |
|
9 |
# import vars from caller |
|
10 |
our ($dbup_locale, $dbup_myconfig, $dbh, $iconv); |
|
11 |
my $do_sql_migration = 0; |
|
12 |
my ($check_sql, $sqlcode); |
|
13 |
|
|
8 | 14 |
sub mydberror { |
9 | 15 |
my ($msg) = @_; |
10 | 16 |
die($dbup_locale->text("Database update error:") . |
... | ... | |
21 | 27 |
} |
22 | 28 |
} |
23 | 29 |
|
24 |
$do_sql_migration = 0; |
|
25 | 30 |
|
26 | 31 |
sub print_question { |
27 | 32 |
print $main::form->parse_html_template("dbupgrade/warehouse_form"); |
... | ... | |
57 | 62 |
UPDATE tmp_parts SET bin = NULL WHERE bin = ''; |
58 | 63 |
|
59 | 64 |
-- Restore old onhand |
60 |
INSERT INTO bin
|
|
61 |
(warehouse_id, description)
|
|
62 |
(SELECT DISTINCT warehouse.id, COALESCE(bin, $bin)
|
|
63 |
FROM warehouse, tmp_parts
|
|
65 |
INSERT INTO bin |
|
66 |
(warehouse_id, description) |
|
67 |
(SELECT DISTINCT warehouse.id, COALESCE(bin, $bin) |
|
68 |
FROM warehouse, tmp_parts |
|
64 | 69 |
WHERE warehouse.description=$warehouse); |
65 |
INSERT INTO inventory
|
|
70 |
INSERT INTO inventory |
|
66 | 71 |
(warehouse_id, parts_id, bin_id, qty, employee_id, trans_id, trans_type_id, chargenumber) |
67 | 72 |
(SELECT warehouse.id, tmp_parts.id, bin.id, onhand, (SELECT id FROM employee LIMIT 1), nextval('id'), transfer_type.id, '' |
68 | 73 |
FROM transfer_type, warehouse, tmp_parts, bin |
69 | 74 |
WHERE warehouse.description = $warehouse |
70 |
AND COALESCE(bin, $bin) = bin.description
|
|
75 |
AND COALESCE(bin, $bin) = bin.description |
|
71 | 76 |
AND transfer_type.description = 'stock'); |
72 | 77 |
EOF |
73 | 78 |
; |
Auch abrufbar als: Unified diff
Und wieder ein Schwung strict.