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.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 above||array()|
|retrofit||Array of actions to retrofit some information from the created object to the source object. More information above||array()|
An action is specified as a string having formatted as “verb(arg1[,arg2[…]])”
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|
|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$ or $current_contact_friendlyname$). 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$ or $current_contact_friendlyname$). 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>|
'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: