Browse Source

Use pointer instead of copy var value

Vova Tkach 5 years ago
parent
commit
e2295a3493

+ 4 - 4
engine/builder/data_table.go

@@ -38,10 +38,10 @@ func DataTable(
 	if pagination_enabled {
 		if custom_sql_count != nil {
 			num, err = custom_sql_count()
-			wrap.LogCpError(err)
+			wrap.LogCpError(&err)
 		} else {
 			err = wrap.DB.QueryRow("SELECT COUNT(*) FROM `" + table + "`;").Scan(&num)
-			if wrap.LogCpError(err) != nil {
+			if *wrap.LogCpError(&err) != nil {
 				return ""
 			}
 		}
@@ -112,7 +112,7 @@ func DataTable(
 		} else {
 			rows, err = custom_sql_data(limit_offset, pear_page)
 		}
-		if wrap.LogCpError(err) == nil {
+		if *wrap.LogCpError(&err) == nil {
 			values := make([]sql.NullString, len(*data))
 			scan := make([]interface{}, len(values))
 			for i := range values {
@@ -120,7 +120,7 @@ func DataTable(
 			}
 			for rows.Next() {
 				err = rows.Scan(scan...)
-				if wrap.LogCpError(err) == nil {
+				if *wrap.LogCpError(&err) == nil {
 					if !have_records {
 						have_records = true
 					}

+ 4 - 4
engine/fetdata/blog.go

@@ -161,7 +161,7 @@ func (this *Blog) load() *Blog {
 			defer rows.Close()
 			for rows.Next() {
 				var cat_id string
-				if err := rows.Scan(&cat_id); this.wrap.LogCpError(err) == nil {
+				if err := rows.Scan(&cat_id); *this.wrap.LogCpError(&err) == nil {
 					cat_ids = append(cat_ids, cat_id)
 				}
 			}
@@ -282,7 +282,7 @@ func (this *Blog) load() *Blog {
 		`
 	}
 
-	if err := this.wrap.DB.QueryRow(sql_nums).Scan(&this.postsCount); this.wrap.LogCpError(err) == nil {
+	if err := this.wrap.DB.QueryRow(sql_nums).Scan(&this.postsCount); *this.wrap.LogCpError(&err) == nil {
 		if this.category == nil {
 			this.postsPerPage = (*this.wrap.Config).Blog.Pagination.Index
 		} else {
@@ -321,7 +321,7 @@ func (this *Blog) load() *Blog {
 					&ro.A_rgt,
 					&ro.A_depth,
 					&ro.A_parent,
-				); this.wrap.LogCpError(err) == nil {
+				); *this.wrap.LogCpError(&err) == nil {
 					this.posts = append(this.posts, &BlogPost{
 						wrap:     this.wrap,
 						object:   &rp,
@@ -498,7 +498,7 @@ func (this *Blog) preload_cats() {
 					&row.A_rgt,
 					&row.A_depth,
 					&row.A_parent,
-				); this.wrap.LogCpError(err) == nil {
+				); *this.wrap.LogCpError(&err) == nil {
 					this.bufferCats[row.A_id] = &row
 					if _, ok := this.bufferCats[row.A_parent]; ok {
 						this.bufferCats[row.A_parent].A_childs = true

+ 2 - 2
engine/fetdata/blog_category.go

@@ -95,7 +95,7 @@ func (this *BlogCategory) load(cache *map[int]*utils.MySql_blog_category) *BlogC
 				&row.A_rgt,
 				&row.A_depth,
 				&row.A_parent,
-			); this.wrap.LogCpError(err) == nil {
+			); *this.wrap.LogCpError(&err) == nil {
 				this.bufferCats[row.A_id] = &row
 				if _, ok := this.bufferCats[row.A_parent]; ok {
 					this.bufferCats[row.A_parent].A_childs = true
@@ -182,7 +182,7 @@ func (this *BlogCategory) loadById(id int) {
 		&this.object.A_rgt,
 		&this.object.A_depth,
 		&this.object.A_parent,
-	); this.wrap.LogCpError(err) != nil {
+	); *this.wrap.LogCpError(&err) != nil {
 		return
 	}
 }

+ 5 - 5
engine/fetdata/shop.go

@@ -172,7 +172,7 @@ func (this *Shop) load() *Shop {
 			defer rows.Close()
 			for rows.Next() {
 				var cat_id string
-				if err := rows.Scan(&cat_id); this.wrap.LogCpError(err) == nil {
+				if err := rows.Scan(&cat_id); *this.wrap.LogCpError(&err) == nil {
 					cat_ids = append(cat_ids, cat_id)
 				}
 			}
@@ -307,7 +307,7 @@ func (this *Shop) load() *Shop {
 
 	product_ids := []string{}
 
-	if err := this.wrap.DB.QueryRow(sql_nums).Scan(&this.productsCount); this.wrap.LogCpError(err) == nil {
+	if err := this.wrap.DB.QueryRow(sql_nums).Scan(&this.productsCount); *this.wrap.LogCpError(&err) == nil {
 		if this.category == nil {
 			this.productsPerPage = (*this.wrap.Config).Shop.Pagination.Index
 		} else {
@@ -356,7 +356,7 @@ func (this *Shop) load() *Shop {
 					&ro.A_rgt,
 					&ro.A_depth,
 					&ro.A_parent,
-				); this.wrap.LogCpError(err) == nil {
+				); *this.wrap.LogCpError(&err) == nil {
 					product_ids = append(product_ids, utils.IntToStr(rp.A_id))
 					this.products = append(this.products, &ShopProduct{
 						wrap:     this.wrap,
@@ -391,7 +391,7 @@ func (this *Shop) load() *Shop {
 				if err := rows.Scan(
 					&img.A_product_id,
 					&img.A_filename,
-				); this.wrap.LogCpError(err) == nil {
+				); *this.wrap.LogCpError(&err) == nil {
 					product_images[img.A_product_id] = append(product_images[img.A_product_id], &ShopProductImage{wrap: this.wrap, object: &img})
 				}
 			}
@@ -568,7 +568,7 @@ func (this *Shop) preload_cats() {
 					&row.A_rgt,
 					&row.A_depth,
 					&row.A_parent,
-				); this.wrap.LogCpError(err) == nil {
+				); *this.wrap.LogCpError(&err) == nil {
 					this.bufferCats[row.A_id] = &row
 					if _, ok := this.bufferCats[row.A_parent]; ok {
 						this.bufferCats[row.A_parent].A_childs = true

+ 2 - 2
engine/fetdata/shop_category.go

@@ -95,7 +95,7 @@ func (this *ShopCategory) load(cache *map[int]*utils.MySql_shop_category) *ShopC
 				&row.A_rgt,
 				&row.A_depth,
 				&row.A_parent,
-			); this.wrap.LogCpError(err) == nil {
+			); *this.wrap.LogCpError(&err) == nil {
 				this.bufferCats[row.A_id] = &row
 				if _, ok := this.bufferCats[row.A_parent]; ok {
 					this.bufferCats[row.A_parent].A_childs = true
@@ -182,7 +182,7 @@ func (this *ShopCategory) loadById(id int) {
 		&this.object.A_rgt,
 		&this.object.A_depth,
 		&this.object.A_parent,
-	); this.wrap.LogCpError(err) != nil {
+	); *this.wrap.LogCpError(&err) != nil {
 		return
 	}
 }

+ 1 - 1
engine/fetdata/shop_currency.go

@@ -41,7 +41,7 @@ func (this *ShopCurrency) loadById(id int) {
 		&this.object.A_coefficient,
 		&this.object.A_code,
 		&this.object.A_symbol,
-	); this.wrap.LogCpError(err) != nil {
+	); *this.wrap.LogCpError(&err) != nil {
 		return
 	}
 }

+ 2 - 2
engine/fetdata/shop_product.go

@@ -44,7 +44,7 @@ func (this *ShopProduct) load() *ShopProduct {
 			if err := rows.Scan(
 				&img.A_product_id,
 				&img.A_filename,
-			); this.wrap.LogCpError(err) == nil {
+			); *this.wrap.LogCpError(&err) == nil {
 				this.images = append(this.images, &ShopProductImage{wrap: this.wrap, object: &img})
 			}
 		}
@@ -78,7 +78,7 @@ func (this *ShopProduct) load() *ShopProduct {
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if this.wrap.LogCpError(err) == nil {
+			if *this.wrap.LogCpError(&err) == nil {
 				if !utils.InArrayInt(filter_ids, utils.StrToInt(string(values[0]))) {
 					filter_ids = append(filter_ids, utils.StrToInt(string(values[0])))
 				}

+ 1 - 1
engine/fetdata/user.go

@@ -43,7 +43,7 @@ func (this *User) loadById(id int) {
 		&this.object.A_email,
 		&this.object.A_admin,
 		&this.object.A_active,
-	); this.wrap.LogCpError(err) != nil {
+	); *this.wrap.LogCpError(&err) != nil {
 		return
 	}
 }

+ 4 - 4
engine/wrapper/wrapper.go

@@ -93,9 +93,9 @@ func (this *Wrapper) LogError(msg string, vars ...interface{}) {
 	this.l.Log(msg, this.R, true, vars...)
 }
 
-func (this *Wrapper) LogCpError(err error) error {
-	if err != nil {
-		this.LogError("%s", err)
+func (this *Wrapper) LogCpError(err *error) *error {
+	if *err != nil {
+		this.LogError("%s", *err)
 	}
 	return err
 }
@@ -175,7 +175,7 @@ func (this *Wrapper) LoadSessionUser() bool {
 		&user.A_admin,
 		&user.A_active,
 	)
-	if this.LogCpError(err) != nil {
+	if *this.LogCpError(&err) != nil {
 		return false
 	}
 	if user.A_id != this.S.GetInt("UserId", 0) {

+ 5 - 5
modules/module_blog.go

@@ -121,7 +121,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 
 			if err != nil && err != wrapper.ErrNoRows {
 				// System error 500
-				wrap.LogCpError(err)
+				wrap.LogCpError(&err)
 				utils.SystemErrorPageEngine(wrap.W, err)
 				return
 			} else if err == wrapper.ErrNoRows {
@@ -188,7 +188,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 
 			if err != nil && err != wrapper.ErrNoRows {
 				// System error 500
-				wrap.LogCpError(err)
+				wrap.LogCpError(&err)
 				utils.SystemErrorPageEngine(wrap.W, err)
 				return
 			} else if err == wrapper.ErrNoRows {
@@ -440,7 +440,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 					&data.A_content,
 					&data.A_active,
 				)
-				if wrap.LogCpError(err) != nil {
+				if *wrap.LogCpError(&err) != nil {
 					return "", "", ""
 				}
 			}
@@ -458,7 +458,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 					}
 					for rows.Next() {
 						err = rows.Scan(scan...)
-						if wrap.LogCpError(err) == nil {
+						if *wrap.LogCpError(&err) == nil {
 							selids = append(selids, int(values[0]))
 						}
 					}
@@ -626,7 +626,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 					&data.A_lft,
 					&data.A_rgt,
 				)
-				if wrap.LogCpError(err) != nil {
+				if *wrap.LogCpError(&err) != nil {
 					return "", "", ""
 				}
 			}

+ 2 - 2
modules/module_blog_act_modify.go

@@ -109,7 +109,7 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 					).Scan(
 						&catsCount,
 					)
-					if wrap.LogCpError(err) != nil {
+					if *wrap.LogCpError(&err) != nil {
 						return err
 					}
 					if len(catids) != catsCount {
@@ -185,7 +185,7 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 					).Scan(
 						&catsCount,
 					)
-					if wrap.LogCpError(err) != nil {
+					if *wrap.LogCpError(&err) != nil {
 						return err
 					}
 					if len(catids) != catsCount {

+ 2 - 2
modules/module_blog_categories.go

@@ -40,7 +40,7 @@ func (this *Modules) blog_GetCategorySelectOptions(wrap *wrapper.Wrapper, id int
 		parentIdStr := utils.IntToStr(parentId)
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if wrap.LogCpError(err) == nil {
+			if *wrap.LogCpError(&err) == nil {
 				disabled := ""
 				if string(values[0]) == idStr {
 					disabled = " disabled"
@@ -84,7 +84,7 @@ func (this *Modules) blog_GetCategoryParentId(wrap *wrapper.Wrapper, id int) int
 	).Scan(
 		&parentId,
 	)
-	if wrap.LogCpError(err) != nil {
+	if *wrap.LogCpError(&err) != nil {
 		return 0
 	}
 	return parentId

+ 4 - 4
modules/module_blog_categories_act_modify.go

@@ -76,13 +76,13 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 
 		var parentL int
 		var parentR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, utils.StrToInt(pf_parent)).Scan(&parentL, &parentR); wrap.LogCpError(err) != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, utils.StrToInt(pf_parent)).Scan(&parentL, &parentR); *wrap.LogCpError(&err) != nil {
 			return err
 		}
 
 		var targetL int
 		var targetR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, utils.StrToInt(pf_id)).Scan(&targetL, &targetR); wrap.LogCpError(err) != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, utils.StrToInt(pf_id)).Scan(&targetL, &targetR); *wrap.LogCpError(&err) != nil {
 			return err
 		}
 
@@ -100,7 +100,7 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				var row_id int
 				var row_lft int
 				var row_rgt int
-				if err := rows.Scan(&row_id, &row_lft, &row_rgt); wrap.LogCpError(err) == nil {
+				if err := rows.Scan(&row_id, &row_lft, &row_rgt); *wrap.LogCpError(&err) == nil {
 					rows_id = append(rows_id, row_id)
 					rows_lft = append(rows_lft, row_lft)
 					rows_rgt = append(rows_rgt, row_rgt)
@@ -210,7 +210,7 @@ func (this *Modules) RegisterAction_BlogCategoriesModify() *Action {
 				LIMIT 1;`,
 				utils.StrToInt(pf_parent),
 			).Scan(&parentId)
-			if wrap.LogCpError(err) != nil {
+			if *wrap.LogCpError(&err) != nil {
 				wrap.MsgError(err.Error())
 				return
 			}

+ 2 - 2
modules/module_index.go

@@ -74,7 +74,7 @@ func (this *Modules) RegisterModule_Index() *Module {
 		)
 		if err != nil && err != wrapper.ErrNoRows {
 			// System error 500
-			wrap.LogCpError(err)
+			wrap.LogCpError(&err)
 			utils.SystemErrorPageEngine(wrap.W, err)
 			return
 		} else if err == wrapper.ErrNoRows {
@@ -225,7 +225,7 @@ func (this *Modules) RegisterModule_Index() *Module {
 					&data.A_meta_description,
 					&data.A_active,
 				)
-				if wrap.LogCpError(err) != nil {
+				if *wrap.LogCpError(&err) != nil {
 					return "", "", ""
 				}
 			}

+ 1 - 1
modules/module_index_act_first_user.go

@@ -41,7 +41,7 @@ func (this *Modules) RegisterAction_IndexFirstUser() *Action {
 		).Scan(
 			&count,
 		)
-		if wrap.LogCpError(err) != nil {
+		if *wrap.LogCpError(&err) != nil {
 			wrap.MsgError(err.Error())
 			return
 		}

+ 1 - 1
modules/module_index_act_signin.go

@@ -53,7 +53,7 @@ func (this *Modules) RegisterAction_IndexUserSignIn() *Action {
 		)
 
 		if err != nil && err != sqlw.ErrNoRows {
-			wrap.LogCpError(err)
+			wrap.LogCpError(&err)
 			wrap.MsgError(err.Error())
 			return
 		}

+ 13 - 13
modules/module_shop.go

@@ -36,7 +36,7 @@ func (this *Modules) shop_GetCurrencySelectOptions(wrap *wrapper.Wrapper, id int
 		idStr := utils.IntToStr(id)
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if wrap.LogCpError(err) == nil {
+			if *wrap.LogCpError(&err) == nil {
 				selected := ""
 				if string(values[0]) == idStr {
 					selected = " selected"
@@ -96,7 +96,7 @@ func (this *Modules) shop_GetProductValuesInputs(wrap *wrapper.Wrapper, product_
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if wrap.LogCpError(err) == nil {
+			if *wrap.LogCpError(&err) == nil {
 				filter_id := utils.StrToInt(string(values[0]))
 				if !utils.InArrayInt(filter_ids, filter_id) {
 					filter_ids = append(filter_ids, filter_id)
@@ -148,7 +148,7 @@ func (this *Modules) shop_GetFilterValuesInputs(wrap *wrapper.Wrapper, filter_id
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if wrap.LogCpError(err) == nil {
+			if *wrap.LogCpError(&err) == nil {
 				result += `<div class="form-group position-relative"><input class="form-control" type="text" name="value.` + html.EscapeString(string(values[0])) + `" value="` + html.EscapeString(string(values[1])) + `" placeholder="" autocomplete="off" required><button type="button" class="btn btn-danger btn-dynamic-remove" onclick="fave.ShopAttributesRemove(this);">&times;</button></div>`
 			}
 		}
@@ -179,7 +179,7 @@ func (this *Modules) shop_GetAllAttributesSelectOptions(wrap *wrapper.Wrapper) s
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if wrap.LogCpError(err) == nil {
+			if *wrap.LogCpError(&err) == nil {
 				result += `<option title="` + html.EscapeString(string(values[1])) + `" value="` + html.EscapeString(string(values[0])) + `">` + html.EscapeString(string(values[1])) + `</option>`
 			}
 		}
@@ -208,7 +208,7 @@ func (this *Modules) shop_GetAllCurrencies(wrap *wrapper.Wrapper) map[int]string
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if wrap.LogCpError(err) == nil {
+			if *wrap.LogCpError(&err) == nil {
 				result[utils.StrToInt(string(values[0]))] = html.EscapeString(string(values[1]))
 			}
 		}
@@ -241,7 +241,7 @@ func (this *Modules) shop_GetAllProductImages(wrap *wrapper.Wrapper, product_id
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if wrap.LogCpError(err) == nil {
+			if *wrap.LogCpError(&err) == nil {
 				result += `<div class="attached-img" data-id="` + html.EscapeString(string(values[0])) + `"><a href="/products/images/` + html.EscapeString(string(values[1])) + `/` + html.EscapeString(string(values[2])) + `" title="` + html.EscapeString(string(values[2])) + `" target="_blank"><img id="pimg_` + string(values[1]) + `_` + strings.Replace(string(values[2]), ".", "_", -1) + `" src="/products/images/` + string(values[1]) + `/thumb-0-` + string(values[2]) + `" onerror="WaitForFave(function(){fave.ShopProductsRetryImage(this, 'pimg_` + string(values[1]) + `_` + strings.Replace(string(values[2]), ".", "_", -1) + `');});" /></a><a class="remove" onclick="fave.ShopProductsDeleteImage(this, ` + html.EscapeString(string(values[1])) + `, '` + html.EscapeString(string(values[2])) + `');"><svg viewBox="1 1 11 14" width="10" height="12" class="sicon" version="1.1"><path fill-rule="evenodd" d="M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 12H3V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9zm1-10H2V3h9v1z"></path></svg></a></div>`
 			}
 		}
@@ -364,7 +364,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 
 			if err != nil && err != wrapper.ErrNoRows {
 				// System error 500
-				wrap.LogCpError(err)
+				wrap.LogCpError(&err)
 				utils.SystemErrorPageEngine(wrap.W, err)
 				return
 			} else if err == wrapper.ErrNoRows {
@@ -439,7 +439,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 
 			if err != nil && err != wrapper.ErrNoRows {
 				// System error 500
-				wrap.LogCpError(err)
+				wrap.LogCpError(&err)
 				utils.SystemErrorPageEngine(wrap.W, err)
 				return
 			} else if err == wrapper.ErrNoRows {
@@ -868,7 +868,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					&data.A_content,
 					&data.A_active,
 				)
-				if wrap.LogCpError(err) != nil {
+				if *wrap.LogCpError(&err) != nil {
 					return "", "", ""
 				}
 			}
@@ -886,7 +886,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					}
 					for rows.Next() {
 						err = rows.Scan(scan...)
-						if wrap.LogCpError(err) == nil {
+						if *wrap.LogCpError(&err) == nil {
 							selids = append(selids, int(values[0]))
 						}
 					}
@@ -1169,7 +1169,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					&data.A_lft,
 					&data.A_rgt,
 				)
-				if wrap.LogCpError(err) != nil {
+				if *wrap.LogCpError(&err) != nil {
 					return "", "", ""
 				}
 			}
@@ -1289,7 +1289,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					&data.A_name,
 					&data.A_filter,
 				)
-				if wrap.LogCpError(err) != nil {
+				if *wrap.LogCpError(&err) != nil {
 					return "", "", ""
 				}
 			}
@@ -1411,7 +1411,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					&data.A_code,
 					&data.A_symbol,
 				)
-				if wrap.LogCpError(err) != nil {
+				if *wrap.LogCpError(&err) != nil {
 					return "", "", ""
 				}
 			}

+ 2 - 2
modules/module_shop_act_duplicate.go

@@ -100,7 +100,7 @@ func (this *Modules) RegisterAction_ShopDuplicate() *Action {
 				for cat_rows.Next() {
 					var product_id int
 					var category_id int
-					if err := cat_rows.Scan(&product_id, &category_id); wrap.LogCpError(err) == nil {
+					if err := cat_rows.Scan(&product_id, &category_id); *wrap.LogCpError(&err) == nil {
 						cat_sqls = append(cat_sqls, `
 							INSERT INTO shop_cat_product_rel SET
 								product_id = `+utils.Int64ToStr(lastID)+`,
@@ -131,7 +131,7 @@ func (this *Modules) RegisterAction_ShopDuplicate() *Action {
 				for attributes_rows.Next() {
 					var product_id int
 					var filter_value_id int
-					if err := attributes_rows.Scan(&product_id, &filter_value_id); wrap.LogCpError(err) == nil {
+					if err := attributes_rows.Scan(&product_id, &filter_value_id); *wrap.LogCpError(&err) == nil {
 						attributes_sqls = append(attributes_sqls, `
 							INSERT INTO shop_filter_product_values SET
 								product_id = `+utils.Int64ToStr(lastID)+`,

+ 1 - 1
modules/module_shop_act_get_attribute_values.go

@@ -43,7 +43,7 @@ func (this *Modules) RegisterAction_ShopGetAttributeValues() *Action {
 			}
 			for rows.Next() {
 				err = rows.Scan(scan...)
-				if wrap.LogCpError(err) == nil {
+				if *wrap.LogCpError(&err) == nil {
 					options += `<option value="` + html.EscapeString(string(values[0])) + `">` + html.EscapeString(utils.JavaScriptVarValue(string(values[1]))) + `</option>`
 				}
 			}

+ 2 - 2
modules/module_shop_act_modify.go

@@ -148,7 +148,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 					).Scan(
 						&catsCount,
 					)
-					if wrap.LogCpError(err) != nil {
+					if *wrap.LogCpError(&err) != nil {
 						return err
 					}
 					if len(catids) != catsCount {
@@ -256,7 +256,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 					).Scan(
 						&catsCount,
 					)
-					if wrap.LogCpError(err) != nil {
+					if *wrap.LogCpError(&err) != nil {
 						return err
 					}
 					if len(catids) != catsCount {

+ 2 - 2
modules/module_shop_categories.go

@@ -40,7 +40,7 @@ func (this *Modules) shop_GetCategorySelectOptions(wrap *wrapper.Wrapper, id int
 		parentIdStr := utils.IntToStr(parentId)
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if wrap.LogCpError(err) == nil {
+			if *wrap.LogCpError(&err) == nil {
 				disabled := ""
 				if string(values[0]) == idStr {
 					disabled = " disabled"
@@ -84,7 +84,7 @@ func (this *Modules) shop_GetCategoryParentId(wrap *wrapper.Wrapper, id int) int
 	).Scan(
 		&parentId,
 	)
-	if wrap.LogCpError(err) != nil {
+	if *wrap.LogCpError(&err) != nil {
 		return 0
 	}
 	return parentId

+ 4 - 4
modules/module_shop_categories_act_modify.go

@@ -76,13 +76,13 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 
 		var parentL int
 		var parentR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, utils.StrToInt(pf_parent)).Scan(&parentL, &parentR); wrap.LogCpError(err) != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, utils.StrToInt(pf_parent)).Scan(&parentL, &parentR); *wrap.LogCpError(&err) != nil {
 			return err
 		}
 
 		var targetL int
 		var targetR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, utils.StrToInt(pf_id)).Scan(&targetL, &targetR); wrap.LogCpError(err) != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, utils.StrToInt(pf_id)).Scan(&targetL, &targetR); *wrap.LogCpError(&err) != nil {
 			return err
 		}
 
@@ -100,7 +100,7 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				var row_id int
 				var row_lft int
 				var row_rgt int
-				if err := rows.Scan(&row_id, &row_lft, &row_rgt); wrap.LogCpError(err) == nil {
+				if err := rows.Scan(&row_id, &row_lft, &row_rgt); *wrap.LogCpError(&err) == nil {
 					rows_id = append(rows_id, row_id)
 					rows_lft = append(rows_lft, row_lft)
 					rows_rgt = append(rows_rgt, row_rgt)
@@ -210,7 +210,7 @@ func (this *Modules) RegisterAction_ShopCategoriesModify() *Action {
 				LIMIT 1;`,
 				utils.StrToInt(pf_parent),
 			).Scan(&parentId)
-			if wrap.LogCpError(err) != nil {
+			if *wrap.LogCpError(&err) != nil {
 				wrap.MsgError(err.Error())
 				return
 			}

+ 1 - 1
modules/module_users.go

@@ -147,7 +147,7 @@ func (this *Modules) RegisterModule_Users() *Module {
 					&data.A_admin,
 					&data.A_active,
 				)
-				if wrap.LogCpError(err) != nil {
+				if *wrap.LogCpError(&err) != nil {
 					return "", "", ""
 				}
 			}