Skip to content

Commit

Permalink
prevent label and sqlValue db column creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ubaldus committed May 16, 2024
1 parent 3436675 commit 74559f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions db/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func Fields(ownerId int64, moduleId int64, actionType string, values map[string]

// FieldAdd adds a new field to the specified table with the given name and type.
func FieldAdd(tableName string, fieldName string, fieldType string) error {
if fieldType == "label" || fieldType == "sqlValue" {
return nil
}

check, err := TableExists(tableName)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion db/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func SearchQuery(ownerId int64, tableName string, values map[string]string) (str

sql = append(sql, "SELECT ejaId")

rows, err := Rows("SELECT * FROM ejaFields WHERE ejaModuleId=? ORDER BY powerList", moduleId)
rows, err := Rows("SELECT * FROM ejaFields WHERE ejaModuleId=? AND type NOT IN ('label') ORDER BY powerList", moduleId)
if err != nil {
return "", nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion web/assets/templates/Edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ <h6 class="text-center mt-5">
{{else if eq .Type "view"}}
<div class="col-md-4 mt-3">
<label for="ejaValues[{{.Name}}]" class="form-label">{{.Label}}</label>
<div id="ejaValues[{{.Name}}]" class="form-control" readonly>{{.$fieldValue}}</div>
<div id="ejaValues[{{.Name}}]" class="form-control" readonly>{{$fieldValue}}</div>
</div>
{{else if eq .Type "sqlValue"}}
<div class="col-md-4 mt-3">
Expand Down

0 comments on commit 74559f4

Please sign in to comment.