Difference between revisions of "Unique name"

From OpenKM Documentation
Jump to: navigation, search
(Created page with 'The script generates unique document name based in metadata values each time new document is uploaded. <source lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE prope…')
 
Line 1: Line 1:
 
The script generates unique document name based in metadata values each time new document is uploaded.
 
The script generates unique document name based in metadata values each time new document is uploaded.
  
 +
'''Description:'''
 +
* Property '''okp:data.id''' store unique autoincremental value.
 +
* Property '''okp:data.codigo.proyecto''' store project code value.
 +
* Property '''okp:data.customer''' store customer code.
 +
* Property '''okp:data.description''' store document description.
 +
* When a new document is uploaded user must fill all fields except '''okp:data.id''' which is automatically set by OpenKM.
 +
* When PropertyGroup is changed - event fired - is executed automatic code which generates '''okp:data.id''' and rename document based on projectCode-autonumericId-clientCode-description.documentExtension
 +
 +
'''Property group definition:'''
 
<source lang="xml">
 
<source lang="xml">
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
Line 8: Line 17:
 
     <property-group label="Datos" name="okg:data">
 
     <property-group label="Datos" name="okg:data">
 
<input label="Id" type="text" name="okp:data.id" width="200px" readonly="true"/>
 
<input label="Id" type="text" name="okp:data.id" width="200px" readonly="true"/>
<input label="Código proyecto" type="text" name="okp:data.codigo.proyecto" width="200px">
+
<input label="Project code" type="text" name="okp:data.codigo.proyecto" width="200px">
 
<validator type="req"/>
 
<validator type="req"/>
 
<validator type="num"/>
 
<validator type="num"/>
Line 14: Line 23:
 
<validator type="minlen" parameter="6"/>
 
<validator type="minlen" parameter="6"/>
 
</input>
 
</input>
<select label="Cliente" name="okp:data.cliente" type="simple"  
+
<select label="Customer" name="okp:data.customer" type="simple"  
table="clientes"  
+
table="customer"  
optionsQuery="select $cli_id, $cli_nombre from DatabaseMetadataValue dmv where dmv.table='clientes'">
+
optionsQuery="select $cus_id, $customer_nombre from DatabaseMetadataValue dmv where dmv.table='customer'">
 
<validator type="req"/>
 
<validator type="req"/>
 
</select>
 
</select>
<input label="Descripción" type="text" name="okp:data.description" width="200px">
+
<input label="Description" type="text" name="okp:data.description" width="200px">
 
<validator type="req"/>
 
<validator type="req"/>
 
<validator type="maxlen" parameter="150"/>
 
<validator type="maxlen" parameter="150"/>

Revision as of 12:39, 2 May 2013

The script generates unique document name based in metadata values each time new document is uploaded.

Description:

  • Property okp:data.id store unique autoincremental value.
  • Property okp:data.codigo.proyecto store project code value.
  • Property okp:data.customer store customer code.
  • Property okp:data.description store document description.
  • When a new document is uploaded user must fill all fields except okp:data.id which is automatically set by OpenKM.
  • When PropertyGroup is changed - event fired - is executed automatic code which generates okp:data.id and rename document based on projectCode-autonumericId-clientCode-description.documentExtension

Property group definition:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.1//EN"
"http://www.openkm.com/dtd/property-groups-2.1.dtd">
<property-groups>
    <property-group label="Datos" name="okg:data">
		<input label="Id" type="text" name="okp:data.id" width="200px" readonly="true"/>
		<input label="Project code" type="text" name="okp:data.codigo.proyecto" width="200px">
			<validator type="req"/>
			<validator type="num"/>
			<validator type="maxlen" parameter="6"/>
			<validator type="minlen" parameter="6"/>
		</input>
		<select label="Customer" name="okp:data.customer" type="simple" 
			table="customer" 
			optionsQuery="select $cus_id, $customer_nombre from DatabaseMetadataValue dmv where dmv.table='customer'">
			<validator type="req"/>
		</select>
		<input label="Description" type="text" name="okp:data.description" width="200px">
			<validator type="req"/>
			<validator type="maxlen" parameter="150"/>
		</input>
  </property-group>
</property-groups>