From 0ea1512ee64260000cb9128ed4064e5c3b538e38 Mon Sep 17 00:00:00 2001 From: Ilhan Yesil Date: Wed, 13 Jul 2022 11:44:17 +0200 Subject: [PATCH] Mininam solution to edit telephone number without automatical addition of prefix (089). --- .../document/commands/DocumentCommand.java | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/de/muenchen/allg/itd51/wollmux/document/commands/DocumentCommand.java b/core/src/main/java/de/muenchen/allg/itd51/wollmux/document/commands/DocumentCommand.java index ca3199605..65b479161 100644 --- a/core/src/main/java/de/muenchen/allg/itd51/wollmux/document/commands/DocumentCommand.java +++ b/core/src/main/java/de/muenchen/allg/itd51/wollmux/document/commands/DocumentCommand.java @@ -46,6 +46,7 @@ import de.muenchen.allg.itd51.wollmux.document.VisibilityElement; import de.muenchen.allg.itd51.wollmux.slv.PrintBlockCommand; import de.muenchen.allg.itd51.wollmux.util.L; +import de.muenchen.allg.itd51.wollmux.WollMuxFiles; /** * A document command with its properties like visibility, execution state and groups. @@ -1162,12 +1163,19 @@ public InsertValue(ConfigThingy wmCmd, Bookmark bookmark) throws InvalidCommandE currentSep = sep; } - try + if(dbSpalte.compareToIgnoreCase("Telefon")==0 && isTelefonManually()) { - trafo = wmCmd.get("WM").get("TRAFO").toString(); - } catch (NodeNotFoundException e) + + } + else { - // TRAFO is optional + try + { + trafo = wmCmd.get("WM").get("TRAFO").toString(); + } catch (NodeNotFoundException e) + { + // TRAFO is optional + } } } @@ -1203,6 +1211,39 @@ protected boolean insertsTextContent() { return true; } + /** + * Check if Telephone number can be set manually, e.g by a mobile number. + * + * @return True if Telephone number can be set manually. + */ + protected boolean isTelefonManually() + { + ConfigThingy wmConf = WollMuxFiles.getWollmuxConf(); + if (wmConf == null || wmConf.count() == 0) + { + return false; + } + + ConfigThingy log = wmConf.query("SetTelefonManually"); + if (log.count() > 0) + { + try + { + String mode = log.getLastChild().toString(); + + if (mode.compareToIgnoreCase("true") == 0 ) + { + return true; + } + } catch (NodeNotFoundException x) + { + LOGGER.error("", x); + } + } + + return false; + } + } /**