From b4e608b9f51d12ccbbc9100b299e73e6583825d7 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Wed, 17 Apr 2019 13:26:28 +0200 Subject: [PATCH] Sql-Fehler, wenn value undefined --- .../_____LANGUAGE_de/_____LANGUAGE_de.aod | 75 +++++++------------ process/PostalAddress_lib/process.js | 13 +++- process/Sql_lib/process.js | 5 ++ 3 files changed, 43 insertions(+), 50 deletions(-) diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 8f7b2ea57a1..4e4b91ca87a 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -18,10 +18,6 @@ <key>Company</key> <value>Firma</value> </entry> - <entry> - <key>Open tasks</key> - <value>Offene Aufgaben</value> - </entry> <entry> <key>Picture</key> <value>Bild</value> @@ -30,10 +26,6 @@ <key>Office staff</key> <value>Innendienst</value> </entry> - <entry> - <key>Overdue tasks</key> - <value>Überfällige Aufgaben</value> - </entry> <entry> <key>Confirm password</key> <value>Passwort prüfen</value> @@ -42,10 +34,6 @@ <key>Human Resources</key> <value>Personal</value> </entry> - <entry> - <key>Imminent appointments for today</key> - <value>Bevorstehende Termine für heute </value> - </entry> <entry> <key>Entrydate (Day)</key> <value>Eingangsdatum (Tag)</value> @@ -94,10 +82,6 @@ <key>${ADDRESS_STATE}</key> <value>Staat</value> </entry> - <entry> - <key>New tasks</key> - <value>Neue Aufgaben</value> - </entry> <entry> <key>New module</key> <value>Neuanlage</value> @@ -3025,7 +3009,6 @@ </entry> <entry> <key>Group</key> - <value>Gruppe</value> </entry> <entry> <key>Combobox</key> @@ -3694,87 +3677,87 @@ <key>Would you like to clear the forecast and set the state to \"%0\"?</key> </entry> <entry> - <key>[%0]the tableName is not a string after interpreting</key> + <key>Au�er Haus</key> </entry> <entry> - <key>[%0]%1 has to be a string or array but it is %2</key> + <key>C�te d'Ivoire</key> </entry> <entry> - <key>[%0]has now an incorrect length; estimated 2 elements but got %1</key> + <key>Cura�ao</key> </entry> <entry> - <key>[%0]the columnName is not a string after interpreting</key> + <key>Benutzer ausw�hlen</key> </entry> <entry> - <key>[%0]%1 is an object but seems not to be a valid array or array-like</key> + <key>Best�tigt</key> </entry> <entry> - <key>Responsible</key> - <value>Verantwortlich</value> + <key>Zur�ckgestellt</key> </entry> <entry> - <key>Analyses</key> + <key>�land Islands</key> </entry> <entry> - <key>Imminent appointments for today </key> + <key>Kein Weitergeben von privaten Aufgaben m�glich!</key> </entry> <entry> - <key>To-Do</key> + <key>Documentmanagement</key> </entry> <entry> - <key>My Tasks</key> + <key>Saint Barth�lemy</key> </entry> <entry> - <key>Calendar</key> + <key>R�union</key> </entry> <entry> - <key>${SQL_LIB_UNDEFINED_VALUE} field: %0</key> - <value>Der Wert für das Feld %0 ist undefined.</value> + <key>Bitte Datumseingabe pr�fen!</key> </entry> <entry> - <key>Au�er Haus</key> + <key>Schl�sselwort</key> </entry> <entry> - <key>C�te d'Ivoire</key> + <key>Vorl�ufig</key> </entry> <entry> - <key>Cura�ao</key> + <key>erledigt / zur�ckgestellt</key> </entry> <entry> - <key>Benutzer ausw�hlen</key> + <key>[%0]the tableName is not a string after interpreting</key> </entry> <entry> - <key>Best�tigt</key> + <key>[%0]%1 has to be a string or array but it is %2</key> </entry> <entry> - <key>Zur�ckgestellt</key> + <key>[%0]has now an incorrect length; estimated 2 elements but got %1</key> </entry> <entry> - <key>�land Islands</key> + <key>[%0]the columnName is not a string after interpreting</key> </entry> <entry> - <key>Kein Weitergeben von privaten Aufgaben m�glich!</key> + <key>[%0]%1 is an object but seems not to be a valid array or array-like</key> </entry> <entry> - <key>Documentmanagement</key> + <key>Responsible</key> + <value>Verantwortlich</value> </entry> <entry> - <key>Saint Barth�lemy</key> + <key>Analyses</key> </entry> <entry> - <key>R�union</key> + <key>Imminent appointments for today </key> </entry> <entry> - <key>Bitte Datumseingabe pr�fen!</key> + <key>To-Do</key> </entry> <entry> - <key>Schl�sselwort</key> + <key>My Tasks</key> </entry> <entry> - <key>Vorl�ufig</key> + <key>Calendar</key> </entry> <entry> - <key>erledigt / zur�ckgestellt</key> + <key>${SQL_LIB_UNDEFINED_VALUE} field: %0</key> + <value>Der Wert für das Feld %0 ist undefined.</value> </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> diff --git a/process/PostalAddress_lib/process.js b/process/PostalAddress_lib/process.js index bee94a606c9..71de1bb3d79 100644 --- a/process/PostalAddress_lib/process.js +++ b/process/PostalAddress_lib/process.js @@ -118,12 +118,17 @@ AddressUtils.getAddressById = function(pAddressId) { } var type = ContactUtils.getContactTypeByContactId(address[0]); - - var names = db.array(db.ROW, SqlCondition.begin() + + if (address[0]) + { + var names = db.array(db.ROW, SqlCondition.begin() .andPrepare("CONTACT.CONTACTID", address[0]) - .buildSql("select ORGANISATION.NAME, FIRSTNAME, LASTNAME, TITLE from CONTACT left join PERSON on PERSONID = PERSON_ID left join ORGANISATION on ORGANISATIONID = ORGANISATION_ID" + .buildSql("select ORGANISATION.NAME, FIRSTNAME, LASTNAME, TITLE from CONTACT left join PERSON on PERSONID = PERSON_ID left join ORGANISATION on ORGANISATIONID = ORGANISATION_ID" , "1=0")); - return AddressUtils.formatAddress(type, address[1], address[2], address[3], address[4], names[0], names[1], names[2], names[3]); + return AddressUtils.formatAddress(type, address[1], address[2], address[3], address[4], names[0], names[1], names[2], names[3]); + } + + return ""; } /** diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index 4c68f069fb8..082ba83b99f 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -376,6 +376,11 @@ SqlCondition.prototype._checkVars = function(variable) { * @ignore */ SqlCondition.prototype._prepare = function(field, value, cond, fieldType) { + if (value == undefined) + { + throw new Error(translate.withArguments("${SQL_LIB_UNDEFINED_VALUE} field: %0", [field])); + } + if (cond == undefined) { cond = "# = ?" } -- GitLab