Function Description
user() Returns current user
user_status(user) Returns the user status (free, busy, dinner, break)
Example
user_status(order.getManager()) # free
user_online_status(user) Returns the user online status (true or false)
Example
user_online_status(order.getManager()) # true
hash(algo, data) Executes a one-way hashing of data with usage of specified hash-function (md5, sha1, sha256). The value returns as hex-tring lower case.
Example
hash("md5", "test") # 098f6bcd4621d373cade4e832627b4f6
last_run(interval, triggerCode, findByEntity) Returns information about the last start of trigger; if trigger starts for the first time the function returns null , more details. Available only in triggers.
rand(min, max) Returns random whole number of specified range [min, max]
rand_string(length, alphabet) Returns random symbols sequence of specified length, containing only symbols of the specified set (alphabet). By default there is used set containing only english letters lower case and numbers.
Example
rand_string(3)
rand_string(3, "a") # aaa
local_time(source, default) Local time according to current settings. Parameter source can be equals to CustomerAddress, CustomerPhone, OrderDeliveryAddress, StoreAddress or phone number as string.
Example
local_time(customer.getAddress())
local_time(order.getPhone())
is_working_time(dateTime) Function checks whether the dateTime value is working time and returns result (true or false). As a dateTime the function can take DteTime object or string, whose format corresponds to php format of strtotime function. By default the current date and time is used.
Example
is_working_time()
is_working_time('2015-01-01 10:00:00')
is_working_time(date('2015-01-01 10:00:00'))
is_working_time(order.getCreatedAt())
round(value, precision, method) Returns a rounded value with specified precision.
The first value is the number to be rounded, the second is the rounding precision (0, if to the whole), the third is the rounding mode (common is the usual mode, ceil always rounds up, floor always rounds down)
Example
round(12.3456) # 12
round(12.3456, 2) # 12.35
round(12.3456, 2, "floor") # 12.34
round(12.3456, 0, "ceil") # 13.0
round(-1.5, 0, "ceil") # -1.0
is_valid_email(email) Checks validity of an e-mail address. Returns true or false.
Example
is_valid_email("user@mail.com") # true
is_valid_email("user") # false