Skip to content
Snippets Groups Projects
Commit 0cb917fa authored by S.Listl's avatar S.Listl
Browse files

sql fixes

parent 3bf47d1e
No related branches found
No related tags found
No related merge requests found
......@@ -21,9 +21,9 @@ if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.r
var hasSubordinate = db.cell(SqlCondition.begin()
.andPrepareVars("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID", "$field.UID")
.buildSql(
"select count(*) = 0 from AB_ATTRIBUTE", "1=2"
"select count(*) from AB_ATTRIBUTE", "1=2" //TODO: is there a way exists could be used?
)
) != "true";
) != "0";
if (hasSubordinate)
state = neon.COMPONENTSTATE_READONLY;
}
......
......@@ -185,9 +185,9 @@ AttributeUtil.hasRelations = function (pAttributeId)
return db.cell(SqlCondition.begin()
.andPrepare("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", pAttributeId)
.buildSql(
"select count(*) = 0 from AB_ATTRIBUTERELATION", "1=2"
"select count(*) from AB_ATTRIBUTERELATION", "1=2" //TODO: is there a way exists could be used?
)
) != "true";
) != "0";
}
/**
......
......@@ -189,8 +189,8 @@ BulkMailUtils.isRecipient = function (pBulkMailId, pContactId)
return db.cell(SqlCondition.begin()
.andPrepare("BULKMAILRECIPIENT.CONTACT_ID", pContactId)
.andPrepare("BULKMAILRECIPIENT.BULKMAIL_ID", pBulkMailId)
.buildSql("select count(*) = 0 from BULKMAILRECIPIENT")
) != "true";
.buildSql("select count(*) from BULKMAILRECIPIENT") //TODO: is there a way exists could be used?
) != "0";
}
function SerialLetterUtils () {}
......@@ -245,6 +245,6 @@ SerialLetterUtils.isRecipient = function (pSerialLetterId, pContactId)
return db.cell(SqlCondition.begin()
.andPrepare("LETTERRECIPIENT.CONTACT_ID", pContactId)
.andPrepare("LETTERRECIPIENT.SERIALLETTER_ID", pSerialLetterId)
.buildSql("select count(*) = 0 from LETTERRECIPIENT")
) != "true";
.buildSql("select count(*) from LETTERRECIPIENT") //TODO: is there a way exists could be used?
) != "0";
}
\ No newline at end of file
......@@ -456,9 +456,9 @@ ContactUtils.hasCommRestriction = function (pContactId, pMedium, pStartDate)
var query = SqlCondition.begin()
.andPrepare("CONTACT.CONTACTID", pContactId)
.andSqlCondition(ContactUtils.getCommRestrictionCondition(pMedium, false, pStartDate))
.buildSql("select count(*) = 0 from CONTACT", "1=2");
.buildSql("select count(*) from CONTACT", "1=2"); //TODO: is there a way exists could be used?
return db.cell(query) != "true";
return db.cell(query) != "0";
}
/**
......
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