Hello, while cruising on my mojoportal local instance, I discovered a problem when trying to add a new feature. The "addmoduledefinition" is missing a db insert into table mp_sitemoduledefinitions
Here is the patch. Add this code right before last line of code ("return newID;") in addmoduledefinition method:
I should have surrounded the whole function with a transaction, but it works for now. Next move would be to implement the whole insert in a postgreSQL function.
if (siteId > -1)
{
// now add to mp_SiteModuleDefinitions
sqlCommand = new StringBuilder();
sqlCommand.Append("INSERT INTO mp_sitemoduledefinitions (");
sqlCommand.Append("SiteID, ");
sqlCommand.Append("SiteGuid, ");
sqlCommand.Append("FeatureGuid, ");
sqlCommand.Append("ModuleDefID ) ");
sqlCommand.Append(" VALUES (");
sqlCommand.Append(":SiteID, ");
sqlCommand.Append("(SELECT SiteGuid FROM mp_Sites WHERE SiteID = :SiteID LIMIT 1), ");
sqlCommand.Append("(SELECT Guid FROM mp_ModuleDefinitions WHERE ModuleDefID = :ModuleDefID LIMIT 1), ");
sqlCommand.Append(":ModuleDefID ) ; ");
arParams = new NpgsqlParameter[2];
arParams[0] = new NpgsqlParameter("SiteID", NpgsqlTypes.NpgsqlDbType.Integer);
arParams[0].Direction = ParameterDirection.Input;
arParams[0].Value = siteId;
arParams[1] = new NpgsqlParameter("ModuleDefID", NpgsqlTypes.NpgsqlDbType.Integer);
arParams[1].Direction = ParameterDirection.Input;
arParams[1].Value = newID;
NpgsqlHelper.ExecuteNonQuery(
GetWriteConnectionString(),CommandType.Text,
sqlCommand.ToString(),
arParams);
}