20.457
Bearbeitungen
Keine Bearbeitungszusammenfassung |
(Adresse() subobject optimiert) |
||
| Zeile 3: | Zeile 3: | ||
local dev = require("Modul:Development") | local dev = require("Modul:Development") | ||
local str = require("Modul:String") | local str = require("Modul:String") | ||
local smw = require("Modul:SMW") | |||
local geo = require("Modul:Geo") | local geo = require("Modul:Geo") | ||
local wik = require("Modul:Wiki") | local wik = require("Modul:Wiki") | ||
| Zeile 21: | Zeile 22: | ||
fail = true | fail = true | ||
else | else | ||
-- subobject-Name | -- subobject-Name | ||
local subobject = {} | local subobject = {"Adresse"} | ||
table.insert(subobject, attr["Adressart"]) | table.insert(subobject, attr["Adressart"]) | ||
table.insert(subobject, attr["Straße"]) | table.insert(subobject, attr["Straße"]) | ||
table.insert(subobject, attr["Hausnummer"]) | table.insert(subobject, attr["Hausnummer"]) | ||
table.insert(subobject, attr["Kommentar"]) | |||
subobject = table.concat(subobject, " ") | subobject = table.concat(subobject, " ") | ||
subobject = smw.subobjectIdCleaner(subobject) | |||
if subobject == "" then -- subobject-Name fehlerhaft? | if subobject == "" then -- subobject-Name fehlerhaft? | ||
fail = true | fail = true | ||
| Zeile 33: | Zeile 35: | ||
-- SubObjektTyp setzen | -- SubObjektTyp setzen | ||
attr["SubObjektTyp"] = "Adresse" | attr["SubObjektTyp"] = "Adresse" | ||
-- Straße/Hausnummer auswerten | -- Straße/Hausnummer auswerten | ||
if attr["Straße"] ~= nil then | if attr["Straße"] ~= nil then | ||
| Zeile 44: | Zeile 45: | ||
fail = true -- Fehler Hausnummer ohne Straße | fail = true -- Fehler Hausnummer ohne Straße | ||
end | end | ||
-- Postleitzahl ermitteln | -- Postleitzahl ermitteln | ||
if attr["Straße"] ~= nil then | if attr["Straße"] ~= nil then | ||
| Zeile 52: | Zeile 52: | ||
end | end | ||
end | end | ||
-- VonObjekt erstellen | -- VonObjekt erstellen | ||
if attr["StraßeHnr"] ~= nil then | if attr["StraßeHnr"] ~= nil then | ||
| Zeile 65: | Zeile 64: | ||
end | end | ||
end | end | ||
-- subobject setzen | -- subobject setzen | ||
mw.smw.subobject(attr, subobject) | mw.smw.subobject(attr, subobject) | ||
-- Plausibilitätsprüfung von/bis | -- Plausibilitätsprüfung von/bis | ||
if attr["AdresseVon"] ~= nil and attr["AdresseBis"] ~= nil and | if attr["AdresseVon"] ~= nil and attr["AdresseBis"] ~= nil and | ||
| Zeile 74: | Zeile 71: | ||
fail = true | fail = true | ||
end | end | ||
end -- Ende if subobject-Name fehlerhaft? | end -- Ende if subobject-Name fehlerhaft? | ||
end -- Ende if not attr_empty | end -- Ende if not attr_empty | ||
-- Wartungsmeldung Adresse fehlerhaft | -- Wartungsmeldung Adresse fehlerhaft | ||
if fail then | if fail then | ||
mw.smw.set{["Wartungsmeldung"]="Adresse fehlerhaft"} | mw.smw.set{["Wartungsmeldung"]="Adresse fehlerhaft"} | ||
end | end | ||
-- mw.logObject(t, "t") | -- mw.logObject(t, "t") | ||
return t | return t | ||