1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-04 13:05:23 +02:00

Specify default categories for new documents

Closes #339

All new documents will be assigned default categories.

Documents created from templates that already have categories take precedence.
This commit is contained in:
HarveyKandola 2019-11-15 14:51:52 +00:00
parent 5c1ad25dc9
commit f117e91bcb
18 changed files with 1284 additions and 1134 deletions

View file

@ -204,12 +204,13 @@ func (h *Handler) processSampleData(data om.SampleData) (err error) {
h.Runtime.Log.Info(fmt.Sprintf("Installing (%d) categories", len(data.Category)))
for i := range data.Category {
_, err = data.Context.Transaction.Exec(h.Runtime.Db.Rebind(`
INSERT INTO dmz_category (c_refid, c_orgid, c_spaceid, c_name, c_created, c_revised)
VALUES (?, ?, ?, ?, ?, ?)`),
INSERT INTO dmz_category (c_refid, c_orgid, c_spaceid, c_name, c_default, c_created, c_revised)
VALUES (?, ?, ?, ?, ?, ?, ?)`),
h.getMappedID("category", data.Category[i].RefID),
data.Context.OrgID,
h.getMappedID("space", data.Category[i].SpaceID),
data.Category[i].Name,
data.Category[i].IsDefault,
data.Category[i].Created,
data.Category[i].Revised)