This extensions aims at improving the end-users productivity. It adds a menu to create an item prefilled with information coming from an existing item.
Amongst the possible usages, you can:
Let's use the last example to illustrate the possibilities of the module:
Users have a menu in the Other Actions drop-down menu of a User Request:
Clicking on the menu, opens the standard creation form with prepopulated data:
The user can adjust the values, then create the item. In addition to the standard report, a message indicates that something has been retrofitted back to the source item.
A shortcut is governed by a rule definition.
The menu is visible if a series of conditions are met:
Several rules can coexist for a single source object: there will be as many menus as there are rules that match the conditions.
A rule defines which kind of object to create:
A rule specifies what has to be done to preset or prepopulate the form. This is done by the mean of actions. The following kind of actions are available:
Additionaly, the rule specifies what has to be done to retrofit some information from the created object to the source object.
The following types of attributes are currently not handled and therefore cannot be preset (and no error message is given):
Using apply_stimulus() on the created object does not work. If used in preset, the form is shown with the object id and the relevant buttons depending on the new state but then it fails to “create” the object because it was created already during the stimuli processing
|1.1.9||2017-11-13||Fix error displayed in error message or tooltip, about read-only attributes being set.|
|1.1.8||2017-09-29||Showing action in object details only when target class is writable.|
|1.1.7||2017-04-04||Case logs : when using set on a case log, the entry was set twice, the HTML formatting was lost, and if the log was first copied from the source, it was broken.|
|1.1.6||2017-03-27||With some customizations (preset on ticket dates), the refresh of dependent fields was broken. Regression introduced in iTop 2.3|
|1.1.5||2017-03-23||Fix for XSS vulnerability.|
|1.1.4||2016-08-09||Fix for compatibility with iTop 2.3.0 (still backward compatible): properly handle the breadcrumb + bug fix when using hidden fields and case logs.|
|1.1.3||2015-10-05||Fix for compatibility with iTop 2.2.0 (still backward compatible)|
|1.1.2||2015-09-30||New verb: nullify. Useful for leaving a date or datetime undefined (differs from the verb reset because the default value for such attributes is “now”)|
|1.1.1||2015-07-01||New verb: call_method. Allows any kind of modification on the target object (and/or the source object)|
|1.1.0||2015-02-03||Added placeholders $current_date$ and $current_time$. Added the verb apply_stimulus. Exposed some APIs to allow the reuse of actions in other modules like itop-stencils|
|1.0.3||2014-12-18||Translated the default configuration in french (while keeping the engish version as the default)|
|1.0.2||2014-07-18||Added placeholders for set() and append(): $current_contact_id$ (already documented) and $current_contact_friendlyname$ (new!)|
|1.0.1||2014-04-03||Fixes an issue with linksets: the links were correctly created into the clone, but they were deleted from the source object|
|1.0.0||2014-03-04||First officialy released version|
Copy the folder
itop-object-copier into the
extensions folder of iTop and launch the setup again.
extensionsfolder and all its sub-folders before launching the setup
When prompted to select the extensions to install, check “Object copier” in the list of available extensions.
|source_scope||The OQL to define the source objects. The only parameter available is current_contact_id||“SELECT UserRequest WHERE status = 'assigned'”|
|allowed_profiles||CSV list of profiles allowing the shortcut. The user must have at least one profile to have the shortcut available. Wrong profiles names are ignored. Set as an empty string to allow the shortcut to anybody.||“Administrator,Support Agent”|
|menu_label||Optional: Label or dictionary entry for the new menu entry. It is optional and defaults to “Clone…”|
|form_label||Optional: Label or dictionary entry for the form header. It is optional and defaults to “Cloning %1$s”|
|report_label||Optional: Label or dictionary entry for the report once the object has been created. It is optional and defaults to “Cloned from %1$s”|
|dest_class||Class of the object to create. If empty, it defaults to the class of the source object||“Change”|
|preset||Array of actions to preset the object in the creation form. More information below.||array()|
|retrofit||Array of actions to retrofit some information from the created object to the source object. More information below.||array()|
An action is specified as a string formatted as
The same action can be requested multiple times.
The following verbs are available:
|clone_scalars||<none>||Copy all the scalar attributes|
|clone||attcode1,attcode2, …||Copy the given attributes|
|reset||attcode||Reset the attribute to its default value|
|nullify||attcode||New in 1.1.2 - Reset the attribute to its null value (will appear to be undefined from the end users perspective)|
|copy||att_to_read,att_to_write||Copy from att_to_read to att_to_write|
|append||attcode,string||Append the string to the attribute. The string can contain placeholder like $this->attcode$ (or $current_contact_id$, $current_contact_friendlyname$, $current_date$, $current_time$). Commas must be escaped with a backslash. Newlines (\n) are allowed. The character set must be utf-8.|
|set||attcode,value||Set a value. If the value is a string, it can then contain placeholder like $this->attcode$ (or $current_contact_id$, $current_contact_friendlyname$, $current_date$, $current_time$). Commas must be escaped with a backslash. Newlines (\n) are allowed. The character set must be utf-8.|
|add_to_list||attRead,attWrite,attLink,value||attRead is an external key on the read object, attWrite is a N-N link set on the written object, attLink is an attribute on the link class that will be set to <value>|
|apply_stimulus||stimulus code||Applies the given stimulus (saves the object). To be used in retrofit ONLY. Best practice: It is strongly recommanded to set transition mandatory fields as well, otherwise they will stay empty and could break reporting.|
|call_method||function name||New in 1.1.1 - Calls the provided method on the written object. Its prototype must be “public function xxxx($oSource)”. The function can send exceptions in case of failure. In such a case, the error message gets displayed in the log/error.log file|
'itop-object-copier' => array( 'rules' => array( array( 'source_scope' => 'SELECT UserRequest WHERE status IN ("assigned", "pending")', 'allowed_profiles' => 'Administrator,Support Agent', 'menu_label' => 'Issue a change ticket...', 'form_label' => 'Issue a change from request %1$s. Please review the description before create the change ticket. After creation of the change ticket, the request ticket will be automatically updated.', 'report_label' => 'Issued from the request %1$s. The request has been updated.', 'dest_class' => 'Change', 'preset' => array( 'clone(contacts_list,functionalcis_list,org_id,title,caller_id)', 'set(description,Original description:\n\$this->description\$)', ), 'retrofit' => array( 'copy(id, parent_change_id)', 'set(private_log,Issued change $this->ref$)', ), ), array( 'source_scope' => 'SELECT FunctionalCI', 'allowed_profiles' => '', 'dest_class' => '', 'preset' => array( 'clone_scalars(*)', 'reset(name)', ), 'retrofit' => array( ), ), ), ),
All errors are logged to the file log/error.log
The behavior from the end-user perspective is: