Revision 6ec6983b
Von Moritz Bunkus vor etwa 18 Jahren hinzugefügt
sql/Pg-upgrade/Pg-upgrade-2.2.0.25-2.2.0.26.pl | ||
---|---|---|
118 | 118 |
my ($query, $sth, $ref); |
119 | 119 |
|
120 | 120 |
if ($table eq "parts") { |
121 |
$query = "SELECT unit, inventory_accno_id FROM parts " . |
|
121 |
$query = "SELECT unit, inventory_accno_id, assembly FROM parts " .
|
|
122 | 122 |
"WHERE NOT ((unit = '') OR unit ISNULL OR " . |
123 | 123 |
" unit IN (SELECT name FROM units))"; |
124 | 124 |
|
... | ... | |
133 | 133 |
$sth->execute() || mydberror($query); |
134 | 134 |
|
135 | 135 |
while ($ref = $sth->fetchrow_hashref()) { |
136 |
if ($ref->{"inventory_accno_id"}) { |
|
136 |
if ($ref->{"inventory_accno_id"} || $ref->{"assembly"}) {
|
|
137 | 137 |
$unknown_dimension_units{$ref->{"unit"}} = 1; |
138 | 138 |
|
139 | 139 |
} else { |
... | ... | |
227 | 227 |
if ($table eq "parts") { |
228 | 228 |
$query = "UPDATE $table SET unit = " . |
229 | 229 |
$dbh->quote($form->{"default_dimension_unit"}) . " " . |
230 |
"WHERE ((unit ISNULL) OR (unit = '')) AND (inventory_accno_id > 0)"; |
|
230 |
"WHERE ((unit ISNULL) OR (unit = '')) AND " . |
|
231 |
"(assembly OR (inventory_accno_id > 0))"; |
|
231 | 232 |
} else { |
232 | 233 |
$query = "UPDATE $table SET unit = " . |
233 | 234 |
$dbh->quote($form->{"default_dimension_unit"}) . " " . |
234 | 235 |
"WHERE ((unit ISNULL) OR (unit = '')) AND " . |
235 |
"parts_id IN (SELECT id FROM parts WHERE (inventory_accno_id > 0))"; |
|
236 |
"parts_id IN (SELECT id FROM parts WHERE " . |
|
237 |
"(assembly OR (inventory_accno_id > 0)))"; |
|
236 | 238 |
} |
237 | 239 |
|
238 | 240 |
$dbh->do($query) || mydberror($query); |
... | ... | |
241 | 243 |
$query = "UPDATE $table SET unit = " . |
242 | 244 |
$dbh->quote($form->{"default_service_unit"}) . " " . |
243 | 245 |
"WHERE ((unit ISNULL) OR (unit = '')) AND " . |
244 |
"(inventory_accno_id ISNULL) OR (inventory_accno_id = 0)"; |
|
246 |
"((inventory_accno_id ISNULL) OR (inventory_accno_id = 0)) AND " . |
|
247 |
"NOT assembly"; |
|
245 | 248 |
} else { |
246 | 249 |
$query = "UPDATE $table SET unit = " . |
247 | 250 |
$dbh->quote($form->{"default_service_unit"}) . " " . |
248 | 251 |
"WHERE ((unit ISNULL) OR (unit = '')) AND " . |
249 | 252 |
"parts_id IN (SELECT id FROM parts " . |
250 |
"WHERE (inventory_accno_id ISNULL) OR (inventory_accno_id = 0))"; |
|
253 |
"WHERE ((inventory_accno_id ISNULL) OR (inventory_accno_id = 0)) " . |
|
254 |
"AND NOT assembly)"; |
|
251 | 255 |
} |
252 | 256 |
|
253 | 257 |
$dbh->do($query) || mydberror($query); |
Auch abrufbar als: Unified diff
Fixes für Erzeugnisse.