|
@@ -8,6 +8,7 @@ import (
|
|
|
"github.com/revel/revel"
|
|
|
"github.com/xaionaro-go/extime"
|
|
|
"html/template"
|
|
|
+ "strings"
|
|
|
)
|
|
|
|
|
|
//reform:formular
|
|
@@ -58,6 +59,13 @@ type Formular struct {
|
|
|
//ExtraVacDays *int `reform:"ExtraVacDays"`
|
|
|
}
|
|
|
|
|
|
+func (f *Formular) AfterFind() error {
|
|
|
+ if f.UnitShortName != nil {
|
|
|
+ *f.UnitShortName = strings.Trim(*f.UnitShortName, " ")
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
func (sql Formular) ActiveOnly() *FormularScope {
|
|
|
return sql.Scope().ActiveOnly()
|
|
|
}
|
|
@@ -142,7 +150,7 @@ func (f *Formular) PrepareIsActive() *Formular {
|
|
|
|
|
|
func (f Formular) IsActive() bool {
|
|
|
if !f.isActiveReady {
|
|
|
- panic("formular is not ready for method IsActive: it's required to call PrepareIsReady method, first")
|
|
|
+ panic("formular is not ready for method IsActive: it's required to call PrepareIsActive method, first")
|
|
|
}
|
|
|
return f.isActive
|
|
|
}
|
|
@@ -183,6 +191,10 @@ func (formulars Formulars) GetEmpGUIDs() (empGUIDs []int) {
|
|
|
func (formulars Formulars) PreparePeople() Formulars {
|
|
|
ids := formulars.GetEmpGUIDs()
|
|
|
|
|
|
+ if len(ids) == 0 {
|
|
|
+ return formulars
|
|
|
+ }
|
|
|
+
|
|
|
people, err := PersonSQL.Select("EmpGUID IN (?)", ids)
|
|
|
if err != nil && err != sql.ErrNoRows {
|
|
|
panic(err)
|