|
@@ -230,7 +230,13 @@ func (units Units) PrepareFormulars(activeOnly bool) Units {
|
|
|
scope = scope.ActiveOnly()
|
|
|
}
|
|
|
|
|
|
- formulars, err := scope.Select("PersNumber IN (?) OR OrgDiv IN (?)", nums, ids)
|
|
|
+ if len(nums) > 0 {
|
|
|
+ scope = scope.Where("PersNumber IN (?) OR OrgDiv IN (?)", nums, ids)
|
|
|
+ } else {
|
|
|
+ scope = scope.Where("OrgDiv IN (?)", ids)
|
|
|
+ }
|
|
|
+
|
|
|
+ formulars, err := scope.Select()
|
|
|
if err != nil && err != sql.ErrNoRows {
|
|
|
panic(err)
|
|
|
}
|