Browse Source

added Formular.PPSOnly()

Dmitry Yu Okunev 4 years ago
parent
commit
66df79becf
1 changed files with 7 additions and 1 deletions
  1. 7 1
      formular.go

+ 7 - 1
formular.go

@@ -22,6 +22,7 @@ type Formular struct {
 	AppointmentShortName *string      `reform:"Prof_BriefName" view:"readonly"`
 	WorkStart            *extime.Date `reform:"Start_work"     view:"readonly"`
 	Category             string       `reform:"Category"       view:"readonly"`
+	CategoryCode         int          `reform:"Cod_Catgory"    view:"readonly"`
 	UnitName             string       `reform:"Name_podr"      view:"readonly"`
 	UnitShortName        *string      `reform:"Podr_BriefName" view:"readonly"`
 	UnitCode             string       `reform:"Code"           view:"readonly"`
@@ -41,7 +42,6 @@ type Formular struct {
 	isActiveReady bool `reform:"-"`
 
 	//FormularTypeCode   int     `reform:"Cod_Tip_formular"`
-	//CategoryCode       int     `reform:"Cod_Catgory"`
 	//WorkEnd           *string  `reform:"End_work"`
 	//Profession         int     `reform:"Profession"`
 	//Lastname           string  `reform:"SurName"`
@@ -72,6 +72,12 @@ func (sql Formular) ActiveOnly() *FormularScope {
 func (sql *FormularScope) ActiveOnly() *FormularScope {
 	return sql.Where("(StartDate IS NULL OR StartDate < NOW()) AND (EndDate IS NULL OR EndDate+24*3600 > NOW())")
 }
+func (sql Formular) PPSOnly() *FormularScope {
+	return sql.Scope().PPSOnly()
+}
+func (sql *FormularScope) PPSOnly() *FormularScope {
+	return sql.Where("CategoryCode IN (1, 8)")
+}
 
 // TODO: Remove this "VIEW" from this model
 func (f Formular) View_readTag(fieldName string, parent interface{}, args []interface{}) template.HTML {