User Tools

Site Tools


extensions:request-templates

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
extensions:request-templates [2019/10/08 10:35]
vdumas
extensions:request-templates [2020/04/15 14:17] (current)
Line 4: Line 4:
 description_wiki : Define personalized request forms based on the service catalog. Add extra fields for a given type of request. description_wiki : Define personalized request forms based on the service catalog. Add extra fields for a given type of request.
 index_hidden ​    : yes index_hidden ​    : yes
-version ​         : 2.0.14 +version ​         : 2.1.2 
-release_dt ​      : ​2019-01-24+release_dt ​      : ​2020-03-27
 itop-version-min : 2.3.2 itop-version-min : 2.3.2
 +download_hidden ​ : http://​www.combodo.com/​itop-extensions/​combodo-customized-request-forms-2.1.0-542.zip
 code             : combodo-customized-request-forms code             : combodo-customized-request-forms
 state            : stable state            : stable
 product_hidden ​  : included product_hidden ​  : included
-download_url ​    : http://​www.combodo.com/​itop-extensions/​ 
 alias-code_hidden : request-templates alias-code_hidden : request-templates
 alternate-name ​  : Request Templates alternate-name ​  : Request Templates
-module-lists_hidden : templates-base/​3.0.17, itop-request-template/​2.0.5, itop-request-template-portal/​1.0.0+module-lists_hidden : templates-base/​3.1.2, itop-request-template/​2.0.6, itop-request-template-portal/​1.0.0
 diffusion ​       : iTop Hub diffusion ​       : iTop Hub
 ---- ----
  
- +<​note ​tip>Check the upgrade process, if you upgrade from a version ​before ​2.1.0 of this extension</​note>​
-<​note ​warning>**Compatibility issue**: for iTop version ​lower than 2.4.0, there is a [[installation#​itop_before_240|special installation/​upgrade process]].</​note>​ +
- +
- +
-<note warning>​For iTop versions older than 2.3.2 use a previous version ​of this component</​note>​+
  
 <​related_components>​Other versions of this component:</​related_components>​ <​related_components>​Other versions of this component:</​related_components>​
  
 +===== Features =====
  
-This module provides the capability to add additional fields ​(depending ​on the selected Service / Service subcategory) for a User Request in order to better qualify it. +This module provides the capability to add dynamically ​additional fields on a User Request in order to better qualify it. 
-For instance define ​the number of CPUs, the quantity of RAM and the type of OS when a user asks for creating a new virtual machine.+The additional fields proposed will be different based on the selected Service / Service Subcategory.
  
 +For instance when a user asks for a "new virtual machine",​ then we may want him to provide the number of CPUs, the quantity of RAM and the type of OS in structured fields rather than hoping that the user will provide them by himself, in the ''​Description''​ field.
  
-===== Features =====+You just have to define your template and then when a user creates a ticket, the additional fields will appear in the ticket edition form, based on the selected service subcategory.
  
-This module supports ​the following types of additional fields:+A request template is related to a service subcategory. A request template can add one or multiple additional fields to User Requests. 
 +The additional fields can be of the following types:
  
   * Date and Date Time   * Date and Date Time
Line 41: Line 40:
   * Duration   * Duration
   * Readonly/​hidden fields   * Readonly/​hidden fields
- 
-A request template is related to a service subcategory. 
- 
-You just have to define your templates: when a user creates a ticket, the additional fields will appear in the ticket edition form, depending on the selected service subcategory. 
  
  
Line 50: Line 45:
 ===== Revision History ===== ===== Revision History =====
 ^  Release Date  ^  Version ​ ^  Comments ​ ^ ^  Release Date  ^  Version ​ ^  Comments ​ ^
 +|  2020-03-26 ​ |  2.1.1  | - Fix regression when submitting with transition form \\ - Fix remove TemplateFieldValue on object deletion |
 +|  2019-12-04 ​ |  2.1.0  | - Request template fields are now queryable \\ - Fix missing menus on request template view  \\ - Update DE translations |
 |  2019-01-30 ​ |  2.0.14 ​ | Fix regression introduced in 2.0.10: custom date formats no longer working | |  2019-01-30 ​ |  2.0.14 ​ | Fix regression introduced in 2.0.10: custom date formats no longer working |
 |  2018-12-19 ​ |  2.0.13 ​ | - Fix unnecessary error messages popping on the screen when a DoCheckToWrite fails \\ - Fix execution notice (check array existence) \\ - Update spanish translations (thanks to Miguel Turrubiates!) | |  2018-12-19 ​ |  2.0.13 ​ | - Fix unnecessary error messages popping on the screen when a DoCheckToWrite fails \\ - Fix execution notice (check array existence) \\ - Update spanish translations (thanks to Miguel Turrubiates!) |
-| 2018-06-27 | 2.0.12 | Add DE translation | + 2018-06-27 ​ | 2.0.12 | Add DE translation | 
-| 2018-06-26 | 2.0.11 | ES + BR translations,​ default search attributes |+ 2018-06-26 ​ | 2.0.11 | ES + BR translations,​ default search attributes |
 |  2018-01-26 ​  ​| ​ 2.0.10 ​ | Ticket fields can now be used in customized forms. \\ Also fixed 2 bugs for usage in notifications templates ($service_details$) : \\ - N°1079 When the user leaves it undefined, then this is shown as an error message in the email: "​Custom field error: Wrong format: missing template_data"​ ; \\ - N°1080 When a field aims at selecting an object, the email body shows the id of the selected object. | |  2018-01-26 ​  ​| ​ 2.0.10 ​ | Ticket fields can now be used in customized forms. \\ Also fixed 2 bugs for usage in notifications templates ($service_details$) : \\ - N°1079 When the user leaves it undefined, then this is shown as an error message in the email: "​Custom field error: Wrong format: missing template_data"​ ; \\ - N°1080 When a field aims at selecting an object, the email body shows the id of the selected object. |
 |  2018-01-05 ​  ​| ​ 2.0.9  | Customized forms are now compatible with Incident | |  2018-01-05 ​  ​| ​ 2.0.9  | Customized forms are now compatible with Incident |
Line 60: Line 57:
 |  2017-03-01 ​ |  2.0.6  | Added module setting to reset template fields value when changing to a different template that contains fields with same codes | |  2017-03-01 ​ |  2.0.6  | Added module setting to reset template fields value when changing to a different template that contains fields with same codes |
 |  2016-12-13 ​ |  2.0.5  | Fixed issues when used in cunjunction with the legacy portal. Requires iTop > 2.3.2 for the date/time pickers to work fine | |  2016-12-13 ​ |  2.0.5  | Fixed issues when used in cunjunction with the legacy portal. Requires iTop > 2.3.2 for the date/time pickers to work fine |
-|  2016-11-29 ​ |  2.0.4  | Implemented placeholders (e.g. $this->​html(service_details)$. Requires iTop > 2.3.1 for the placeholders to work fine. |+|  2016-11-29 ​ |  2.0.4  | Implemented placeholders (e.g. <​nowiki>​$this->​html(service_details)$</​nowiki>​. Requires iTop > 2.3.1 for the placeholders to work fine. |
 |  2016-09-08 ​ |  2.0.3  | Added validation pattern to Date and DateTime fields. Fixed a PHP Warning when launching the cron manually. | |  2016-09-08 ​ |  2.0.3  | Added validation pattern to Date and DateTime fields. Fixed a PHP Warning when launching the cron manually. |
 |  2016-09-02 ​ |  2.0.2  | Hidden and Read-only fields are now rendered like multiline strings (like a textarea, though it is read-only) - Note that this will work fine in the console with iTop 2.3.0+, but requires iTop > 2.3.1 to take advantage of this enhancement in the enhanced customer portal (no change in the legacy portal!) | |  2016-09-02 ​ |  2.0.2  | Hidden and Read-only fields are now rendered like multiline strings (like a textarea, though it is read-only) - Note that this will work fine in the console with iTop 2.3.0+, but requires iTop > 2.3.1 to take advantage of this enhancement in the enhanced customer portal (no change in the legacy portal!) |
Line 78: Line 75:
 ===== Installation & upgrade ===== ===== Installation & upgrade =====
  
-  * Download ​the package and expand its content into the "**extensions**" directory of iTop. +Use the [[extensions:​installation|Standard ​installation process]] ​for this extension
-<note warning>​**Compatibility issue**for iTop version lower than 2.4.0, there is a [[installation#​itop_before_240|special ​installation/​upgrade ​process]].</​note>​ + 
-  ​* If you have already installed iTopmake sure that the configuration file ''​config-itop''​ in ''​conf/production''​ is NOT read-only+__Upgrade__: ​ In order to be able to search for old User Requests which do have a particular value set in a request template, the iTop administrator need to run once a special page which explode every (//User Request//) template data into new tables, so it can be queried with OQL. 
-  ​* Point your web browser to ''​<​nowiki>​http(s)://<your_itop_root>/setup</​nowiki>​''​ and follow the wizard instructions. Make sure that you select the option to "Upgrade an existing iTop instance":​ {{ :​extensions:​email-upgrade-screenshot1.png?​direct&​300 |}} {{ :​extensions:​email-upgrade-screenshot2.png?​direct&​300 |}} + 
-  * Finally check the module "​Request ​template" in the list of extensions at the end of the interactive wizard. Then complete the installation.+  ​php populateTemplateFieldValue.php --append 
 + 
 +You can either use "<​nowiki>​--</nowiki>​append"​ or "<nowiki>--</​nowiki>​reset", same results, might differ in execution time. 
 +  * <​nowiki>​--</​nowiki>​reset recomputes from scratch 
 +  * <​nowiki>​--</​nowiki>​append explode only the template ​data which have not been exploded yet 
  
-{{ :​extensions:​itop-request-template-install-module.png?​direct&​300 |}} 
  
 ===== Configuration ===== ===== Configuration =====
Line 133: Line 134:
 | Initial value | Used to set an initial value for text or text area fields | xyz | | Initial value | Used to set an initial value for text or text area fields | xyz |
 | Format | Allows you to define a regular expression for validating text fields | ''​^[a-zA-Z]$''​ | | Format | Allows you to define a regular expression for validating text fields | ''​^[a-zA-Z]$''​ |
 +
 +
 +<note warning>​When providing "​Values"​ in **CSV: write all values in one line**, without carriage return</​note> ​
 +<note warning>​When providing "​Values"​ in OQL: **do not use friendlyname** in the OQL query.</​note> ​
 +
 +| To limit to ... | use this regex within ''​Format''​ |
 +| an email | [a-zA-Z0-9._&'​-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,​} |
 +| a phone number | <​nowiki>​^\+?​[0-9\ ]{8,​20}$</​nowiki>​ |
 +| a url | <​nowiki>​https?,​ftp)\://​([a-zA-Z0-9+!*(),;?&​=\$_.-]+(\:​[a-zA-Z0-9+!*(),;?&​=\$_.-]+)?​@)?​([a-zA-Z0-9-.]{3,​})(\:​[0-9]{2,​5})?​(/​([a-zA-Z0-9%+\$_-]\.?​)+)*/?​(\?​[a-zA-Z+&​\$_.-][a-zA-Z0-9;:​[\]@&​%=+/​\$_.-]*)?​(#​[a-zA-Z_.-][a-zA-Z0-9+\$_.-]*)?​ </​nowiki>​ |
  
  
Line 165: Line 175:
  
 {{ :​extensions:​itop-request-template-console.png?​direct&​500 |}} {{ :​extensions:​itop-request-template-console.png?​direct&​500 |}}
 +
 +
  
 ==== Template placeholders ==== ==== Template placeholders ====
Line 177: Line 189:
  
 When a template value corresponds to an object selected into iTop, the returned value will be the friendly name of the object. When a template value corresponds to an object selected into iTop, the returned value will be the friendly name of the object.
 +
 +
 +===== Questions & Answers =====
 +
 +**Question: Can I get the UserRequest which do not have a associated Request Template** \\
 +Answer: Yes & No.
 +
 +Query like this will fails
 +<code SQL> SELECT UserRequest WHERE ISNULL(service_details) = 1</​code>​
 +
 +While such query will work, with the limitation that if you have added or removed Request Template to service subcategories after the creation of User Request using those service Subcategories,​ then the result will be wrong.
 +<code SQL>
 +SELECT u,rt FROM UserRequest AS u
 +JOIN ServiceSubcategory AS ss ON u.servicesubcategory_id=ss.id
 +JOIN RequestTemplate AS rt ON rt.servicesubcategory_id=ss.id
 +WHERE ISNULL(rt.name) = 1
 +</​code>​
 +
 +**Question: Can I search for UserRequest which do have a particular value in a field of the associated Request Template** \\
 +Answer: Yes with a recent enough version (above 2.1.0)
 +
 +<code SQL Searching for a value>
 +SELECT UserRequest AS u 
 +  JOIN TemplateFieldValue AS v ON v.obj_key=u.id
 +  WHERE v.template_name="​Laptop ordering"​
 +    AND field_code='​size' ​
 +    AND field_value='​wide'​
 +</​code>​
 +
 +You must specify the name (or id) of the Request Template, as the ''​field_code''​ may not be sufficient to identify uniquely a particular template, the same code could be used on multiple Templates.
 +
 +<code SQL Searching for a related object>
 +SELECT u,m FROM UserRequest AS u 
 +  JOIN TemplateFieldValueLnk AS v ON v.obj_key=u.id
 +  JOIN Model AS m ON v.field_target_key = m.id
 +  WHERE v.template_name="​Desktop ordering details"​
 +    AND field_code='​model' ​
 +    AND field_target_class='​Model'​
 +</​code>​
 +
 +**Question: I have installed version 2.1, but OQL queries does not return old User Request.** \\
 +Answer: With version 2.1.0 or above of this extension, if you want to perform queries over User Requests made prior to the deployement of this version, you have to launch once, a cli script which will explode the data created before into the new queryable objects.
 +
 +The command requires to be on iTop server using the ''​web''​ user:
 +<code bash>
 +cd /​path/​to/​itop/​
 +cd env-production/​templates-base/​
 +php populateTemplateFieldValue.php --append
 +</​code>​
 +This command explodes not-yet-exploded CustomAttribute data into new objects TemplateFieldValue and TemplateFieldValueLnk.
 +
 +Note: An alternate mode is ''​php populateTemplateFieldValue.php --reset''​ which empty the new tables and rebuild them from scratch. Just after the upgrade to 2.1, the 2 modes are pretty similar.
 +
 +<note important>​Always run this kind of heavy script on your integration environment first, with a copy of your production data</​note>​
 +<note important>​You should run this command with your webserver user, otherwise you may have difficulties to access cache files inside data/​cache-production/</​note>​
 +
extensions/request-templates.1570523730.txt.gz · Last modified: 2019/10/08 10:35 by vdumas

";