|
@@ -221,6 +221,10 @@ func (u Unit) GetFormulars() Formulars {
|
|
|
}
|
|
|
|
|
|
func (units Units) PrepareFormulars(activeOnly bool) Units {
|
|
|
+ if len(units) == 0 {
|
|
|
+ return units
|
|
|
+ }
|
|
|
+
|
|
|
ids := units.GetUnitIds()
|
|
|
nums := units.GetPersNumbers()
|
|
|
|
|
@@ -230,6 +234,10 @@ func (units Units) PrepareFormulars(activeOnly bool) Units {
|
|
|
scope = scope.ActiveOnly()
|
|
|
}
|
|
|
|
|
|
+ if len(nums) == 0 && len(ids) == 0 {
|
|
|
+ return units
|
|
|
+ }
|
|
|
+
|
|
|
if len(nums) > 0 {
|
|
|
scope = scope.Where("PersNumber IN (?) OR OrgDiv IN (?)", nums, ids)
|
|
|
} else {
|