Function Description
user() Returns current user
user_status(user = null) Returns the user status (free, busy, dinner, break)
Example
user_status(order.getManager()) # free
user_online_status(user = null) Returns the user online status (true or false)
Example
user_online_status(order.getManager()) # true
hash(function, data) Executes a one-way hashing of data with usage of specified hash-function (md5, sha1. The value returns as hex-tring lower case.
Example
hash("md5", "test") # 098f6bcd4621d373cade4e832627b4f6
last_run(interval = null, triggerCode = null, findByEntity = null) 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 = 0, max = 100) Returns random whole number of specified range [min, max]
rand_string(length, alphabet = '0123456789abcdefghijklmnopqrstuvwxyz') 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 = null) 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())
converted(parent = null) Returns information (true or false) about the trigger conversion. Available only in triggers.
Possible parameters:
If parameter is not specified, then conversion of the current trigger is been checked within order or customer.
Also it is possible to set parent variable as the parameter, it will point at the context of trigger, after which the current trigger is been running.
If the parameter is string, it will be perceived as the trigger code, for which it is necessary to check the conversion for current context of order or customer.
Example
converted(parent)
converted("trigger_code")
converted() # conversion for current trigger

is_working_time(dateTime = null) 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 = 0) Returns a rounded value with specified precision.
Example
round(12.3456) # 12
round(12.3456, 2) # 12.35
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