add edit func sample station
This commit is contained in:
@@ -198,6 +198,10 @@ func (ss *MDSampleStationServices) EditMDSampleStation(id string, code string, n
|
||||
logger, _ := zap.NewProduction()
|
||||
var ret models.MDSampleStation
|
||||
|
||||
if strings.ToUpper(group) == "LAB" {
|
||||
group = " "
|
||||
}
|
||||
|
||||
// cek existeing code & name
|
||||
var count int
|
||||
var prmCode = "%" + code + "%"
|
||||
@@ -209,7 +213,7 @@ func (ss *MDSampleStationServices) EditMDSampleStation(id string, code string, n
|
||||
AND T_SampleStationIsActive = 'Y'
|
||||
AND T_SampleStationID <> ?
|
||||
`
|
||||
err := dbx.Handlex.Get(count, q, prmCode, prmName, id)
|
||||
err := dbx.Handlex.Get(&count, q, prmCode, prmName, id)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("cek duplicate", zap.Any("code", code), zap.Any("name", name))
|
||||
@@ -218,7 +222,7 @@ func (ss *MDSampleStationServices) EditMDSampleStation(id string, code string, n
|
||||
if count > 0 {
|
||||
defer logger.Sync()
|
||||
logger.Error("duplicate data", zap.Any("code", code), zap.Any("name", name))
|
||||
return ret, fmt.Errorf("query failed")
|
||||
return ret, fmt.Errorf("duplicate kode atau nama")
|
||||
}
|
||||
|
||||
// update data
|
||||
|
||||
Reference in New Issue
Block a user