Unique name
From OpenKM Documentation
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>