Skip to content
Snippets Groups Projects
Commit 558cfdea authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

fix offer index sql

parent 502eec38
No related branches found
No related tags found
No related merge requests found
import("system.result");
import("system.vars");
import("system.calendars");
import("system.db");
import("Keyword_lib");
import("Sql_lib");
import("KeywordRegistry_basic");
var sqlQuery, sqlHelper, queryCondition, affectedIds;
queryCondition = "";
if (vars.exists("$local.idvalue")) {
affectedIds = vars.get("$local.idvalue");
queryCondition = "where OFFERID in ('" + affectedIds.map(function (v){return db.quote(v);}).join("', '") + "')";
//TODO: refactor this for incremental indexer (injections?)
}
sqlHelper = new SqlMaskingUtils();
sqlQuery = "select OFFERID, "
+ sqlHelper.concat(["OFFERCODE", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.offerStatus(), "OFFER.STATUS")], " | ")
+ " as TITLECOLUMN, "
+ sqlHelper.concat(["ORGANISATION.NAME", "'| Kd-Nr.: '", "CUSTOMERCODE"])
+ " as DESCCOLUMN, OFFERCODE, ORGANISATION.NAME, CUSTOMERCODE "
+ " from OFFER "
+ " join CONTACT on OFFER.CONTACT_ID = CONTACTID "
+ " join ORGANISATION on ORGANISATIONID = CONTACT.ORGANISATION_ID "
+ queryCondition + " order by OFFERCODE ";
import("system.result");
import("system.vars");
import("system.calendars");
import("system.db");
import("Keyword_lib");
import("Sql_lib");
import("KeywordRegistry_basic");
var sqlQuery, sqlHelper, queryCondition, affectedIds;
queryCondition = "";
if (vars.exists("$local.idvalue")) {
affectedIds = vars.get("$local.idvalue");
queryCondition = "where OFFERID in ('" + affectedIds.map(function (v){return db.quote(v);}).join("', '") + "')";
//TODO: refactor this for incremental indexer (injections?)
}
sqlHelper = new SqlMaskingUtils();
sqlQuery = "select OFFERID, "
+ sqlHelper.concat(["cast(OFFERCODE as CHAR(10)) ", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.offerStatus(), "OFFER.STATUS")], " | ")
+ " as TITLECOLUMN, "
+ sqlHelper.concat(["ORGANISATION.NAME", "'| Kd-Nr.: '", "CUSTOMERCODE"])
+ " as DESCCOLUMN, OFFERCODE, ORGANISATION.NAME, CUSTOMERCODE "
+ " from OFFER "
+ " join CONTACT on OFFER.CONTACT_ID = CONTACTID "
+ " join ORGANISATION on ORGANISATIONID = CONTACT.ORGANISATION_ID "
+ queryCondition + " order by OFFERCODE ";
result.string(sqlQuery);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment