base

package module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2021 License: LGPL-3.0 Imports: 47 Imported by: 4

README

Build Status Go Report Card codecov

Base

The kernel of Hexya, needed for all installation.

Documentation

Index

Constants

View Source
const CurrencyDisplayPattern = `(\w+)\s*(?:\((.*)\))?`

CurrencyDisplayPattern is the regexp pattern for displaying a currency

View Source
const (
	// MODULE_NAME is the name of this module
	MODULE_NAME = "base"
)
View Source
const QueueJobHoldDelay = 500 * time.Millisecond

QueueJobHoldDelay is the delay that the system waits before polling the job queue again if it has not seen any job left on the last poll.

View Source
const QueueJobPeriod = 10 * time.Millisecond

QueueJobPeriod is the delay between two polls of the job queue

Variables

View Source
var (
	// WarningMessage gives the possible warning that can be applied to a partner.
	WarningMessage = types.Selection{
		"no-message": "No Message",
		"warning":    "Warning",
		"block":      "Blocking Message",
	}
	// WarningHelp is the help message for the Warning fields.
	WarningHelp = `` /* 204-byte string literal not displayed */

)
View Source
var (
	// GroupSystem is given to users who are allowed to modify general settings
	GroupSystem *security.Group
	// GroupUser is the group for Employees
	GroupUser *security.Group
	// GroupMultiCurrency displays data to work in a multi-currency context
	GroupMultiCurrency *security.Group
	// GroupPartnerManager is given to users who are allowed to manage contacts
	GroupPartnerManager *security.Group
	// GroupMultiCompany displays data to work in a multi-company context
	GroupMultiCompany *security.Group
	// GroupPortal is granted to portal users
	GroupPortal *security.Group
	// GroupPublic is granted to external users
	GroupPublic *security.Group
	// GroupERPManager can modify access rights for other users
	GroupERPManager *security.Group
	// GroupTechnicalFeatures can see and modify technical parameters of the ERP
	GroupTechnicalFeatures *security.Group
)
View Source
var CompanyDependent = models.FieldContexts{
	"company": func(rs models.RecordSet) string {
		companyID := rs.Env().Context().GetInteger("force_company")
		if companyID == 0 {
			companyID = rs.Env().Context().GetInteger("company_id")
		}
		if companyID == 0 {
			return ""
		}
		return fmt.Sprintf("%d", companyID)
	},
}

CompanyDependent is a context to add to make a field depend on the user's current company. If a company ID is passed in the context under the key "force_company", then this company is used instead.

View Source
var QueueJobStates = types.Selection{
	"pending":  "Pending",
	"enqueued": "Enqueued",
	"started":  "Started",
	"done":     "Done",
	"failed":   "Failed",
}

QueueJobStates is the selection for the states of the QueueJob model.

View Source
var SequenceFuncs = map[string]func(time.Time) string{
	"doy": func(t time.Time) string {
		return fmt.Sprintf("%d", t.YearDay())
	},
	"woy": func(t time.Time) string {
		_, woy := t.ISOWeek()
		return fmt.Sprintf("%d", woy)
	},
	"weekday": func(t time.Time) string {
		return fmt.Sprintf("%d", int(t.Weekday()))
	},
}

SequenceFuncs maps Hexya formats to functions that must be applied to a time.Time object

View Source
var Sequences = map[string]string{
	"year": "2006", "month": "01", "day": "02", "y": "06",
	"h24": "15", "h12": "03", "min": "04", "sec": "05",
}

Sequences maps Hexya formats to Go time format

Functions

func CompanyGetUserCurrency

func CompanyGetUserCurrency(env models.Environment) interface{}

CompanyGetUserCurrency returns the currency of the current user's company if it exists or the default currency otherwise

Types

type AuthBackend

type AuthBackend struct{}

AuthBackend is the authentication backend of the Base module Users are authenticated against the User model in the database

func (*AuthBackend) Authenticate

func (bab *AuthBackend) Authenticate(login, secret string, context *types.Context) (uid int64, err error)

Authenticate the user defined by login and secret.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL