This class is a shell for a single table record. It has few basic properties that define title, table(s), fields, etc.
This is configuration array for an item. Exact configuration parameters list is:
public $conf = array(
'title' => 'The Item'
, 'titleLocal' => 'Штуковина'
, 'name' => 'item'
, 'prefix' => 'itm'
, 'table' => 'tbl_item'
, 'form' => 'item_form.php'
, 'list' => 'item_list.php'
, 'flagFormShowAllFields' => false
);
Category: Configuration
Unique identity of the item.
Category: Data Handling
The array with item data. To be filled inside eiseItem::getData().
Usually and by default this array consists of single table record data obtainted with mysqli::fetch_assoc() function.
Example: $title = $objThing->item['thnTitle'];
Category: Data Handling
The array with the table information. To be filled inside eiseItem::getData().
Category: Configuration
eiseIntra object that’s been used on item creation. To be set in constructor.
Category: Configuration
eiseSQL object that’s been used on item creation. Normally obtained from eiseIntra, but it could be overridden with $conf['sql]. Set inside the constructor.
Category: Configuration
Class constructor. Can be called without any paramemters. Constructor obtains info on table, obtains data and entity configuration.
Parameters:
Category: Configuration
This function gets PK (primary key) values from GET or POST query strings.
Category: Data Handling
This function returns SQL search condition basing on primary keys.
Parameters:
Category: Data Handling
This function returns URI for a form basing on primary keys.
Parameters:
Category: Data Handling
Reads record from database table $conf[‘table’] associated with current $pk.
Parameters:
Category: Data Handling
Calls $this->getData() so refreshes $this->item property.
Category: Data Handling
Returns form HTML. By default it contains DataAction and Primary Keys inputs.
Parameters:
Category: Data Display
Returns HTML for hidden fields that correspond to PK
Category: Data Handling
Returns HTML with fields to be displayed on the form
Parameters:
Category: Data Display
Returns HTML for buttons (submit, delete)
Category: Data Display Events and Actions
To be triggered on DataAction=insert or REST POST/PUT query. Current function does nothing with the data, it just set some headers for web user to be returned to item form. Normally it should be overridden.
Parameters:
Category: Data Handling
To be triggered on DataAction=update or REST POST/PUT query. Current function does nothing with the data, it just set some headers for web user to be returned to item form. Normally it should be overridden.
Parameters:
Category: Data Handling
To be triggered by default on DataAction=delete or REST DELETE query. Current function DELETEs the record and set some headers for web user to be returned to item list.
Category: Data Handling
This function prevents recursive hooks when object instances are created within existing hook (e.g. when you create the object inside the object with some DataAction like ‘insert’ or ‘update’). Function should be called right after hook function starts.
Parameters:
Category: Data Handling
This function transforms data from the input array into UPDATE SQL and runs it. SQL for data fields is obtained from eiseItem::getSQLFields(). Also it calculates delta and returns it.
Parameters:
Category: Data Handling
This function calculates difference between two associative arrays using array_diff_assoc(). All numeric data is converted to double data type.
Parameters:
Category: Data Handling
This function fixes the situation when booelan (checkbox) field presents on the form but being unchecked, it doesn’t appear in $nd ($_POST) array of data. This function returns fixed array of $nd, where unchecked elements are present with value of ‘0’ (string zero). So eiseItem::updateTable() function updates these fields with 0 values. Function convertBooleanData() should be called prior to updateTable().
Parameters:
Returns: array - updated $nd, all unchecked and therefore missing boolean fields presents there with ‘0’ (string with zero symbol) values.
Category: Data Handling
This function attaches a set of files uploaded by end user via web interface. NOTE: If you want to use it with REST API, you should overrride global $_FILES array to behave closely to original.
Function attachFile() saves the file to a disk and adds a record to ‘stbl_file’. Uploaded files will be saved in the directory specified in ‘stpFilesPath’ settings variable, combined with ‘YYYY/mm’ and file GUID. Example: /mnt/wwwfiles/somesystem/2023/10/18/0000938b-8fe5-11ec-a765-000d3ad81bf0. If ‘stpFilesPath’ set to ‘/dev/null’ file will not be actually saved but record will be created.
Each file input on the web form should be named as “attachment[]”: <input name="attachment[]">. This name can not be overridden.
If you need more control on file attachemnt process you can redefine class functions eiseItem::beforeAttachFile() and eiseItem::afterAttachFile().
After completion this function returns the list of files (list of records from stbl_file with linked to current entity item).
Parameters:
Category: Files
Function deleteFile() detaches file from current entity instance: it removes stbl_file record and unlinks the file on a disk.
For more control on detachment process you can redefine eiseItem::beforeDeleteFile() function.
Parameters:
Category: Files
beforeAttachFile() is allowed to trow exceptions in case when uploaded file has wrong type, etc. So wrong file can be excluded from upload routine.
@category Files
Parameters:
afterAttachFile() runs when upload routine in completed for given file: file is copied and database record created. The best for post-processing.
Parameters:
Category: Files
This function can be used both to prevent file deletion (with an exception) and post-delete file hanling.
Parameters:
Category: Files
This function obtains file list for current entity item - just an array of records from stbl_file.
Parameters:
Returns: string - JSON with file list.
Category: Files
This function obtains file path from stbl_file for given file GUID and then it echoes file contents with eiseIntra::file() function.
Parameters:
Category: Files
This function returns HTML for file upload/file list dialog.
Returns: string - HTML, normally hidden, to be shown with JS.
Category: Files Data Display
This function returns HTML for message send/message list form. Noramlly hidden on the form, to be shown with JS.
Returns: string - HTML.
Category: Messages Data Display
This function obtains message list for current entity item - just an array of records from stbl_message.
Returns: string - JSON with message list.
Category: Messages
This function does not actually send a message, it just adds a record to stbl_message (message queue). Then this table is being scanned with eiseItem::sendMessages() and any unsent messages will be physically sent and marked as ‘sent’ afterwards.
Parameters:
Category: Messages
This function scans stbl_message and sends any unsent message. It uses eiseMail library for send routines.
Parameters:
$conf['login'] and $conf['password'] for SMTP authentication. In other cases it uses ‘usrID’ and ‘msgPassword’ for authentication.This class incapsulates base functionality of single entity item.
Uses: eiseItem
eiseAction
Package: eiseIntra
This property is used to store the entity properties of the item. It is being filled in init() method.
Category: Configuration
$staID is the current status ID of the item. It is set after the item is created or loaded.
Category: Events and Actions
This property is used to store the current action that is being performed on the item. It is set when the item is updated, deleted or any other action is performed.
Category: Events and Actions
This property is used to specify which data should be obtained when the item is loaded. It is used in the getAllData() method to specify which data should be retrieved from the database.
Default values are:
protected $defaultDataToObtain = array('Text', 'ACL', 'STL', 'files', 'messages');
Category: Data Handling
This property is used to store the configuration of the item object. It is set in the constructor and can be overridden by passing a configuration array to the constructor.
private $conf_default = array(
'flagDontCacheConfig' => false, // if set to true, the configuration will not be cached in the session
'aExcludeReads' => array(), // array of read methods to exclude from the item object
'aExcludeActions' => array(), // array of action methods to exclude from the item object
'entID' => null, // entity ID of the item that this object will represent
'entTable' => null, // entity table name, e.g. 'stbl_entity_item'
'entTitle' => null, // entity title, e.g. 'Entity Item'
'entTitleLocal' => null, // entity title in local language, e.g. 'Entity Item Local'
'entTitleMul' => null, // entity title for multiple items, e.g. 'Entity Items'
'entTitleLocalMul' => null, // entity title in local language for multiple items, e.g. 'Entity Items Local'
'entPrefix' => null, // entity prefix, e.g. 'ent'
'radios' => array(), // array of radio buttons to be shown in the item form
'CHK' => array(), // checklists data
);
Category: Configuration
This constructor initializes the item object. If $id is not set, this will create an empty object with functionality that can be used to obtain list, craet new item etc.
The constructor requires $entID to be set in the configuration array. This is the entity ID of the item that this object will represent. Entity item configuration is obtained from the database and merged with the configuration array passed to the constructor.
Also this constructor defines Intra’s DataAction and DataRead methods for the item object, so that it can be used to perform actions and read data from the database and pass it to the user.
Parameters:
Category: Configuration
This method does the same as original method from eiseItem class: it updated the item in the database.
In addition to that, it updates the master table, updates unfinished actions, updates roles virtual and performs the action.
$nd is normally the $_POST array or it could be artificially created array with data to update the item with. It may contain the following sections:
stbl_action_log table.Parameters:
Category: Data Handling Events and Actions
Function updateTable updates the master table with data from the array $nd. It also converts some attributes to foreign keys if they are of type ‘ajax_dropdown’, ‘combobox’ or ‘radio’.
Parameters:
Category: Data Handling
This method is called when the item is updated with full edit form. It updates the master table and updates unfinished actions.
Parameters:
Category: Data Handling
Suparaction is a special action that allows to put the item into any state. It is used for administrative purposes, e.g. to change the status of the item, add comments, etc.
Parameters:
Category: Events and Actions
This method undoes the last action performed on the item. It is used to revert the item to the state before the last action was performed.
It removes the last action from the action log, updates the item data with the data from the last action, and updates the status of the item to the status before the last action.
Record items from status log are also removed, so that the item is in the state before the last action was performed.
Parameters:
Category: Events and Actions
This method updates multiple items of given class in the database when user submits multi-edit form on item list. Non-filled fields are ignored, so that only fields that are filled in the form are updated.
After item update it just dies, so this function should be called from the batch processing script.
Parameters:
| $nd (array) - Array of data to update the items with. It should contain the primary key list of the items to update in the format ‘ID1 | ID2 | ID3’, where ID1, ID2, ID3 are the IDs of the items to update. |
Uses: eiseIntraBatch
Category: Data Handling
Method delete() deletes the item from the database. It also deletes all related action and status logs, if configured to do so.
Normally it triggers for ‘delete’ Data Action when user clicks ‘Delete’ button on the item form. It is also can be called from the batch processing script when user selects ‘Delete’ action on the selected item list.
If you need to run multiple deletes in a single transaction, you should set $this->conf['flagNoDeleteTransation'] to true before calling this method. This will prevent the method from starting a new transaction and will allow you to run multiple deletes in a single transaction and roll it back completely when something went wrong.
If you need to delete other item-related data, you should do it in the delete() method of the item class derived from the eiseItemTraceable.
Category: Data Handling
This function calculates the roles that are allowed to perform actions on the item based on the matrix defined in the entity configuration. It iterates through each action and checks the matrix conditions against the item’s attributes. If the conditions are met, it allows role members to run the action.
The matrix is defined in entMarix field of stbl_entity table. This is JSON string which contains conditions for some special attributes of the item, and the roles that are allowed to perform the action if the conditions are met.
These values are to be set for each action on eiseAdmin’s action configuration form.
Matrix is loaded upon item initialization and then cached in user session.
Category: Events and Actions
This function returns a list of items based on the entity configuration and the current status ID. It uses the intra component to create a list object and adds columns to it based on the entity’s attributes, actions, and status.
Parameters:
Returns: eiseList
Uses: eiseList
Category: Data Display
This is placeholder function for obtaining new item ID. It is used in the newItem() method to set the ID of the new item being created.
Parameters:
| Returns: string | int - new item ID to be used as the primary key of the new item record in the database. |
Category: Data Handling
This function creates a new item in the database based on the provided data array. It generates a new item ID, prepares the SQL fields for insertion, and executes the SQL query to insert the new item into the database. After the insertion, it appends action log entry for the “Create” action (actID=1).
Parameters:
Category: Data Handling
This function inserts a new item into the database within a transaction. It starts a transaction, calls the newItem() method to create the item, updates the virtual roles associated with the item, and then commits the transaction. After that, it calls the parent insert() method to perform any additional actions defined in the parent class.
Parameters:
Category: Data Handling
This function executes the provided action object, which is an instance of eiseAction. It sets the current action to the provided action object, executes it, and then unsets the current action. After executing the main action, it also executes any extra actions that have been added to the extraActions array.
Parameters:
Uses: eiseAction
Category: Events and Actions
This function updates the roles associated with the item based on the virtual roles defined in the entity configuration. It deletes existing role-item-user associations for the item and then inserts new associations for each virtual role member.
This function is called after item update in order to re-assign virtual roles to users related to the item.
Category: Events and Actions
This function returns user list for virtual role members in a dictionary-like array of usrID=>null.
This is also the placeholder for the virtual roles that are defined in the entity configuration for other entities derived from this class. So when you are about to override this function be sure to call the parent function first to get the default virtual role members.
Default roles are:
Parameters:
Returns: array
Category: Events and Actions
This function updates unfinished actions for the item based on the provided data array. It iterates through the ACL (Action Control List) of the item and updates each action that is not yet completed (i.e., has an action phase less than 2).
Parameters:
| array | null $nd - The data array to update the actions with. If null, it uses the $_POST data. |
Category: Events and Actions Data Handling
This function updates a specific action data in the Action Log (ACL) of the item. It creates a new eiseAction object with the provided ACL data and the additional data from the $nd array, and then calls the update() method on that action object to perform the update.
Parameters:
Category: Events and Actions Data Handling
This function retrieves the data for the item based on its ID. It first calls the parent getData() method to obtain the basic data, then it removes the ‘Master’ entry from the defaultDataToObtain array if it exists. Finally, it calls the getAllData() method to retrieve all additional data and returns the item data.
Retrieved data is stored in the $this->item property, which is an associative array containing all relevant information about the item. See the getAllData() method for details on what data is retrieved.
Parameters:
| int | null $id - The ID of the item to retrieve data for. If null, it uses the current item’s ID. |
Returns: array - The item data with all retrieved information.
Category: Data Handling
This function retrieves all data related to the item based on the provided parameters. It retrieves the necessary data based on the specified parameters, and returns the complete item data including attributes, status, action log, checklists, status log, comments, files and messages.
It can retrieve specific data based on the $toRetrieve parameter, or if it is null, it retrieves all default data defined in the defaultDataToObtain property. The function also handles archived items by decoding the JSON data stored in the {$this->entPrefix}Data field.
Data obtained is to be stored in the following fields of the $this->item associative array:
{$this->entPrefix}ID, {$this->entPrefix}Number, etc.) will be stored as is_text suffix (e.g., {$this->entPrefix}StatusID_text, atrID_text etc)Parameters:
| array | string | null $toRetrieve - The data to retrieve. If null, it retrieves all default data. |
Returns: array - The complete item data.
Category: Data Handling
An alias for the getAllData() method.
Category: Data Handling
This function creates a backup of the current item data in JSON format. It retrieves all data using the getAllData() method, prepares the data for backup, and then either returns the JSON string or sends it as a downloadable file based on the $q['asFile'] parameter.
Parameters:
Category: Backup and Restore
Function restore() restores an item from a backup file or a JSON string. It starts a transaction, reads the backup data, creates or updates the item in the database, and restores related data such as attributes, status, and action log. It also handles batch processing if specified.
Parameters:
Category: Backup and Restore
This function is called before action is “planned”, i.e. record is added to the Action Log. It is usable to modify action data before it is occured in the database.
Parameters:
Category: Events and Actions
This function is called after action is “planned”, i.e. record is added to the Action Log. In case when something went wrong it should throw an exception.
Parameters:
Category: Events and Actions
This function is called after action is “started”, i.e. Action Log record has changed its aclActionPhase=1. In case when something went wrong it should throw an exception.
Parameters:
Category: Events and Actions
This function is called after action is “finished”, i.e. Action Log record has changed its aclActionPhase=2. In case when something went wrong it should throw an exception.
Parameters:
Category: Events and Actions
This function is called on event when action is “cancelled”, i.e. Action Log record has changed its aclActionPhase=3. In case when something went wrong it should throw an exception and cancellation will be prevented.
Parameters:
Category: Events and Actions
This function is called when user would like to undo given action, before anything’s restored. In case when something went wrong it should throw an exception.
Parameters:
Category: Events and Actions
This function is called when item arrives to given status. In case when something went wrong it should throw an exception.
Parameters:
Category: Events and Actions
This function is called when item departs from given status. In case when something went wrong it should throw an exception.
Parameters:
Category: Events and Actions
This function processes checkmarks for the item based on the provided action data. It checks if the item has any checkmarks defined, and if so, it counts how many checkmarks are required and how many are completed. If a checkmark is not completed but is set to be checked by the action, it updates the checkmark in the database.
Parameters:
Category: Events and Actions
This function generates the HTML form for the item, including hidden fields for the entity ID, old and new status IDs, action ID, ACL GUID, ToDo, and comments. It also includes the status field and the fields defined in the entity configuration.
The form can be customized with additional configuration options such as whether to add JavaScript, show messages, or include files.
Parameters:
Returns: string - The generated HTML form.
Category: Data Display
This function generates the HTML form to be used for multiple item editing, including fields for setting data and action buttons. It uses the getFields() method to retrieve the fields and displays them in a fieldset. If there are radio buttons defined in the configuration, it also includes a fieldset for actions with a submit button.
Returns: string - The generated HTML form for listing multiple items.
Category: Data Display
This function generates the HTML for the status field, which displays the current status of the item. Normally it is being shown in upper left corner of the form It can be configured to be clickable (with AJAX load of item action log) or non-clickable based on the provided configuration options.
Parameters:
Returns: string - The generated HTML for the status field.
Category: Data Display
This function generates the HTML skeleton for the Action Log, which is a table that displays the action log entries for the item. It includes a template row for displaying action titles, finish by information, and action times. It also includes a row for displaying traced data and comments, as well as a spinner and a message for when no events are found.
Parameters:
Returns: string - The generated HTML skeleton for the Action Log.
Category: Data Display
This function generates the HTML skeleton for the Checklist, which is a table that displays checklist items for the item. It includes a template row for displaying checkmarks, titles, and descriptions. It also includes a row for displaying a message when no events are found and a spinner for loading.
Parameters:
Returns: string - The generated HTML skeleton for the Checklist.
Category: Data Display
This function retrieves the action log for the item based on the provided query parameters. It checks if the ACL data is already loaded, and if not, it retrieves all ACL data. It then processes each action log entry, filtering out certain actions based on the query parameters, and formats the data into an array of action log entries.
The function returns an array of action log entries, each containing information such as action ID, old and new status IDs, action titles, comments, and timestamps. If the action log entry has traced data, it also includes the traced HTML representation of the data. Array keys are just sequential numbers, starting from 0, and the array is ordered by the action log entry date in descending order.
It can return action log in reverse order if the query parameter order is set to reverse. It also filters out actions that are not relevant based on the flagFull query parameter, which determines whether to include all actions or skip ‘Edit/Update’ actions (actID=2).
Array to be returned is normally used as JSON data for asynchronous loading of the Action Log in the UI.
Parameters:
Returns: array - The formatted action log entries.
Category: Data Display
This function retrieves the fields for the item based on the provided configuration and status ID. It checks if the fields should be shown based on the configuration and status, and returns an array of fields that can be used in a form or display.
Parameters:
| array | null $aFields - An optional array of fields to retrieve. If null, it will use the default fields based on the configuration. |
Returns: array - An array of fields to be displayed or used in a form.
Category: Data Display
This function generates the HTML for the attribute fields of the item based on the provided fields and configuration. It checks if the item has the specified fields and generates the corresponding HTML input elements for each field, including options for comboboxes, selects, and AJAX dropdowns. It also handles attributes such as href, suffix, and write permissions.
Parameters:
| array | null $item - The item data to use for generating the fields. If null, it will use the current item. |
Returns: string - The generated HTML for the attribute fields.
Category: Data Display
This function generates an array of action buttons based on the current status ID and user permissions. It retrieves the actions defined for the current status, checks if the user has permission to perform each action, and formats the actions into an array of buttons with titles, actions, IDs, datasets, and classes.
Returns: array - An array of action buttons with titles, actions, IDs, datasets, and classes.
Category: Data Display Events and Actions
This function generates the HTML for the action buttons based on the actions defined in the configuration. It iterates through the array of action buttons, creating a button for each action with its title, ID, and dataset. The buttons are wrapped in a div with a class for styling and are returned as a string.
Returns: string - The generated HTML for the action buttons.
Category: Data Display Events and Actions
Alias for the showActionButtons() method
Parameters:
Category: Data Display
This function generates the HTML for the radio buttons based on the actions defined in the configuration. It iterates through the actions for the current status, checking user permissions and generating radio buttons for each action. The radio buttons include attributes for the old and new status IDs, and they are formatted with labels that include titles and status changes.
Returns: string - The generated HTML for the action radio buttons.
Category: Data Display
This function generates the HTML for the status log of the item, displaying the status entries with their titles, timestamps, and associated actions. It iterates through the status log entries, formatting each entry with its title, timestamps, and any associated actions. The function also handles the visibility of draft statuses based on the provided configuration.
Parameters:
Returns: string - The generated HTML for the status log.
Category: Data Display
This function generates the HTML for unfinished actions based on the ACL data of the item. It iterates through the ACL entries, checking if the action phase is less than 2 (indicating it is unfinished). For each unfinished action, it displays the action information and provides buttons to start, finish, or cancel the action if the user has write permissions.
Returns: string - The generated HTML for unfinished actions.
Category: Data Display
This function generates the HTML for displaying action information based on the provided ACL GUID and configuration options. It retrieves the action details from the ACL and ACT arrays, formats the action title, timing, and attributes, and returns the generated HTML. It also handles full edit mode and additional callbacks if specified in the configuration.
Parameters:
Returns: string - The generated HTML for the action information.
Category: Data Display
This function retrieves the traced data for an ACL item. It checks if the traced data is already stored in the ACL item, and if not, it queries the log table to retrieve the tracked fields based on the configuration. It returns an associative array of traced data, including any dropdown text for fields that are of type combobox, select, or ajax_dropdown.
Parameters:
Returns: array - An associative array of traced data for the ACL item, including field values and dropdown text if applicable.
Category: Data Display
This function retrieves the details of an action based on the provided query parameters. It checks if either an action ID or an ACL GUID is provided, retrieves the corresponding action and ACL data, and returns them in a JSON response along with the attribute definitions.
Parameters:
Returns: void - It throws a JSON response with action and ACL details.
Category: Data Display
Events and Actions
Throws: Exception - If neither action ID nor ACL GUID is provided, or if the provided ACL GUID is invalid.
This function retrieves the action data based on the provided ACL GUID and an optional ACL record. It fetches the action log entry, merges it with the configuration data for statuses, and returns the action data including old and new status information.
Parameters:
| array | null $rwACL - An optional array containing the ACL record. If not provided, it will fetch the ACL data from the database. |
Returns: array - An associative array containing the action data, including old and new status information.
Category: Data Display Events and Actions
This function retrieves the text for a dropdown field based on the provided attribute array and value. It checks if the attribute type is a combobox and retrieves the options either from the programmer reserved data or from the data source. If the value exists in the options, it returns the corresponding text; otherwise, it returns a default text if specified.
Data source can be a PHP array defined as Array(), a JSON string, or a database object like table or view. The fields where it could be stored are:
atrProgrammerReserved - a PHP array defined as Array() (legacy)atrDataSource - a JSON string or a PHP array defined as Array() or name of database table or viewIn case when it is table or view, the function will retrieve the text from the common views using the getDataFromCommonViews method. If you need to specify a prefix or extra parameters, you can use the atrProgrammerReserved field to define them, pipe-delimited, e.g. ‘prx |
123’ |
Parameters:
| Returns: string | null - The text corresponding to the value in the dropdown options, or a default text if the value is not found. |
Category: Data Display
This function retrieves the “Who’s Next” status information for the current status ID as a handle for Data Read event ‘get_whos_next’. It calls the getWhosNextStatus method to get the next status information and formats it into an HTML structure. The function returns a div containing the “Who’s Next” status information.
Parameters:
Returns: string - The generated HTML for the “Who’s Next” status information.
Category: Data Display Events and Actions
This function retrieves the next bigger status ID based on the current status ID. It checks the actions defined for the current status and finds the next status that is greater than the current one, returning the maximum status ID if no larger status is found.
Parameters:
Returns: int - The ID of the next bigger status, or the maximum status ID if no larger status is found.
Category: Data Display Events and Actions
This function generates the HTML for the “Who’s Next” status based on the provided status ID and counter.
It goes status by status in upcoming order, displaying the status title, description, and available actions. It also lists the users and roles associated with each action, highlighting default actions and disabled roles.
Parameters:
Returns: string - The generated HTML for the “Who’s Next” status information, including status title, description, actions, and associated users and roles.
Category: Data Display Events and Actions
This function initializes item configuration and entity properties. Being called for the first time, it reads entity configuration from the database and fills in the item properties with it. It also reads roles, attributes, actions and status information for the entity.
After the configuration is read, it is stored in the session for later use. If the configuration is already stored in the session, it is read from there.
For debug purposes you can comment line if($_SESSION[$sessKey] && !$this->conf['flagDontCacheConfig']){ and uncomment line if(false){. This will force the configuration to be read from the database every time the item is created, instead of reading it from the session. This is useful for debugging purposes, but it will slow down the application significantly.
Category: Configuration
This class handles actions on traceable items. Actions can be performed both by users and programmatically. Actions are defined in stbl_action table and linked to statuses in stbl_status table. Action can change status of the item, update some fields and trace item data defined by item configuration.
Object created as class instance defines single action to be performed on the item. Action is executed by execute() method. Execution means that action is added to action log (stbl_action_log) and, if required, item data is updated in the master table. If action is not set to autocomplete, it should be started and finished separately.
Actions can be planned for forecasting purposes without execution. Planned actions are stored in stbl_action_log table with action phase set to 0. Planned actions can be started and finished later.
System can trace ETA/ETD/ATA/ATD timestamps for both actions, depending on action configuration options. These timestamps can be set programmatically or as actual timestamps when start or finish actions.
Variable: array $conf Associative array defining action configuration as obtained from stbl_action table.
Might contain aclGUID key if action has been obtained from stbl_action_log table.
Constructor of eiseAction class
Parameters:
Category: Events and Actions
This function “executes” the action. If action is set to autocomplete, it is added to action log and finished in one go. If not, it is just added to action log and should be started and finished later.
Returns: string Returns aclGUID of the action just executed
Category: Events and Actions
This function updates action log record with new data. It can be used to update traced fields, comments and timestamps.
Parameters:
Returns: void
Category: Events and Actions
Function adds new action to action log. aclActionPhase is set to 0 (planned). Action should be started and finished later unless it’s set to autocomplete.
Function also updates $arrAction property of the class instance with data just inserted to action log.
Being executed it triggers beforeActionPlan and onActionPlan hooks of the item.
Returns: string Returns aclGUID of the action just added
Category: Events and Actions
Function starts the action previously added to action log. aclActionPhase is set to 1 (started).
Being executed it triggers onActionStart hook of the item.
Category: Events and Actions
This function validates if action can be performed. It does not check if user has permissions to run the action, this should be done separately.
It checks following:
In case of any problem, it throws an Exception with description of the problem.
Category: Events and Actions
This function finishes the action previously started. aclActionPhase is set to 2 (completed). If action changes status, status log entry is added and master table is updated.
Being executed it triggers onActionFinish hook of the item.
Returns: void
Category: Events and Actions
This function cancels the action previously added to action log. If action was in phase 0 (planned), it is deleted from action log. If it was started (phase 1), it is marked as cancelled (phase 3).
Returns: void
Category: Events and Actions
This function checks if action timeline is correct, i.e. ATA is not less than previous ATA and not less than ATD.
In case of any problem, it throws an Exception with description of the problem.
Category: Events and Actions
This function checks if all mandatory fields defined for the action are filled and if all fields defined as “to change” are actually changed.
In case of any problem, it throws an Exception with description of the problem.
Category: Events and Actions
This function checks if user has permissions to run the action.
It checks following:
In case of any problem, it throws an Exception with description of the problem.
Category: Events and Actions