User Tools


Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:extensions:extensions:autonumberprefix [2016/09/10 02:00]
127.0.0.1 external edit
en:extensions:extensions:autonumberprefix [2020/12/27 00:32] (current)
joebordes [Number formatting]
Line 4: Line 4:
 This configuration module permits you to define different increment counters with a prefix for fields in modules and then apply them with conditions using workflows. It will permit you to have various counter/​increment fields on any module or increment differently the same field depending on values in the record being saved. This configuration module permits you to define different increment counters with a prefix for fields in modules and then apply them with conditions using workflows. It will permit you to have various counter/​increment fields on any module or increment differently the same field depending on values in the record being saved.
 \\ \\
----- dataentry ---- +---- dataentry ​ ---- 
-name : tsolucio/​AutoNumberPrefix +name              : tsolucio/​AutoNumberPrefix 
-type : corebos-module +type              : corebos-module 
-description_wiki:​ This configuration module permits you to define different increment counters with a prefix for fields in modules and then apply them with conditions using workflows. It will permit you to have various counter/​increment fields on any module or increment differently the same field depending on values in the record being saved. +description_wiki ​ : This configuration module permits you to define different increment counters with a prefix for fields in modules and then apply them with conditions using workflows. It will permit you to have various counter/​increment fields on any module or increment differently the same field depending on values in the record being saved. 
-keywords_tags : claims,quality,ISO,standards +keywords_tags ​    ​autoincrementidentifierfieldsettings, customnumber,​counter 
-version : 1.0 +version ​          ​: 1.0 
-homepage_url : http://​corebos.org/​documentation/​doku.php?​id=en:​extensions:​extensions:​autonumberprefix +homepage_url ​     : http://​corebos.org/​documentation/​doku.php?​id=en:​extensions:​extensions:​autonumberprefix 
-release_dt : 2015-11-02 +release_dt ​       : 2015-11-02 
-licenses : Vizsage +licenses ​         : Vizsage 
-price : 120eur +price             ​: 120eur 
-buyemail_mail : paypal(at)tsolucio(dot)com +buyemail_mail ​    ​: paypal(at)tsolucio(dot)com 
-distribution : Sale +distribution ​     : Sale 
-authorname : JPL TSolucio, S.L. +authorname ​       : JPL TSolucio, S.L. 
-authoremail_mail : info(at)tsolucio(dot)com+authoremail_mail ​ : info(at)tsolucio(dot)com
 supportemail_mail : info(at)tsolucio(dot)com supportemail_mail : info(at)tsolucio(dot)com
 ---- ----
 +
 +
 \\ \\
  
Line 30: Line 32:
 |Module|module multi-list|This is the module that the counter is for.| |Module|module multi-list|This is the module that the counter is for.|
 |Format|string|[[en:​extensions:​extensions:​autonumberprefix#​number_formatting|see below]]| |Format|string|[[en:​extensions:​extensions:​autonumberprefix#​number_formatting|see below]]|
 +|Workflow Expression|checkbox|Indicates if the Format field contains a Workflow Expression that needs to be evaluated.|
 |Active|checkbox|Indicates if the counter is active or not. Any record marked as inactive will not be used by the extension.| |Active|checkbox|Indicates if the counter is active or not. Any record marked as inactive will not be used by the extension.|
 |Current Value|number|This is the current maximum value of the counter.| |Current Value|number|This is the current maximum value of the counter.|
Line 36: Line 39:
 ===== Install ===== ===== Install =====
  
-Once installed the module normally ​you have to apply the patch autonumwf.diff which you will find inside the module'​s main directory (modules/​AutoNumberPrefix). This patch adds a new function to the workflow system:+Once you have installed the module normally ​using module manager, ​you will see that it adds a new function to the workflow system:
  
 **AutoNumberInc(ANPid)** **AutoNumberInc(ANPid)**
Line 42: Line 45:
 You can now use this function in an Update Field workflow task to assign the next counter value to any field based on any condition in the module. You can now use this function in an Update Field workflow task to assign the next counter value to any field based on any condition in the module.
  
-The **ANPid** number is the internal CRMID of the record you want to use for the sequence. This number can be found by looking in the URL of the Detail View of the record.+{{ :​en:​extensions:​extensions:​autoincmodule:​anpwf.png |}}
  
 +The **ANPid** number is the internal CRMID of the record or the value of the Increment field you want to use for the sequence. This number can be found by looking in the URL of the Detail View of the record.
  
 +{{ :​en:​extensions:​extensions:​autoincmodule:​anpid.png |}}
 ===== Number formatting===== ===== Number formatting=====
  
-The format field accepts ​two forms:+The format field accepts ​three forms:
  
 1.- Number\\ 1.- Number\\
-A string of numbers that indicate both the number of characters and the actual counter that must appear in the result. This is the same as the default ​behaviour ​you can find in the autonumber in **Settings**. For example, with 000001 you will get the sequence:+A string of numbers that indicate both the number of characters and the actual counter that must appear in the result. This is the same as the default ​behavior ​you can find in the autonumber in **Settings**. For example, with 000001 you will get the sequence:
  
 000001, 000002,..., 000022, 000023, ...000101,​...010001.... ​ always with 6 numbers in the counter 000001, 000002,..., 000022, 000023, ...000101,​...010001.... ​ always with 6 numbers in the counter
  
 2.- Date/​Number\\ 2.- Date/​Number\\
-An advanced format ​which accepts any [[http://​php.net/​manual/​en/​function.date.php|PHP supported date conversion letter]] and the special string **%u** for the number.+An advanced format ​that accepts any [[http://​php.net/​manual/​en/​function.date.php|PHP supported date conversion letter]] and the special string **%u** for the number.
  
 The string **%u** accepts the [[http://​php.net/​manual/​en/​function.sprintf.php|PHP sprintf format]]. So to obtain the same sequence as in point 1 above you would use: The string **%u** accepts the [[http://​php.net/​manual/​en/​function.sprintf.php|PHP sprintf format]]. So to obtain the same sequence as in point 1 above you would use:
Line 68: Line 73:
  
 2015-000001,​ 2015-000002,​...,​ 2015-000022,​ 2015-000023,​ ...2015-000101,​...2015-010001.... 2015-000001,​ 2015-000002,​...,​ 2015-000022,​ 2015-000023,​ ...2015-000101,​...2015-010001....
 +
 +3.- Workflow Expression
 +
 +If you activate the "​Workflow Expression"​ checkbox then we will parse the format string through sprintf in order to put the correct number in place and then pass the result to the workflow expression engine with the context of the record triggering the workflow. This will permit you to use any of the workflow expression functions to construct complex formatting combinations.
 +
 +For example, you could have an expression like
 +
 +<​code>​concat(format_date('​y'​),​ '​-',​ duedate)</​code>​
 +
 +or
 +
 +<​code>​concat(duedate,​ '​-%'​.06u'​)</​code>​
 +
 +This is a real example from a coreBOS install:
 +
 +<​code>​concat(format_date(get_date('​now'​),'​ym'​),​ '​_',​ $(code_shop : (cbShop) code_shop) , '​_%'​.04u'​)</​code>​
  
 ====== Fields ===== ====== Fields =====
Line 77: Line 98:
 |Module|module multi-list| | |Module|module multi-list| |
 |Format|string| | |Format|string| |
 +|Workflow Expression|checkbox| |
 |Active|checkbox| | |Active|checkbox| |
 |Current Value|number| | |Current Value|number| |