Document expiration is a notification system alert which can be used to advice users nearly document expiration and expired documents.

This option is only available if you have enabled the Document expiration feature.

Document expiration is based on:

  • Metadata group feature.
  • Crontab feature.
  • Report feature.

More information at Document expiration extension.

Configuration

Download the expiration files document_expiration_7.zip.

Register parameters

Execute SQL from Administration > Tools > Database query.

-- NOTIFICATION PARAMETERS
DELETE FROM OKM_CONFIG WHERE CFG_KEY LIKE '%expiration.%';
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.date.pattern','string','dd-MM-yyyy HH:mm:ss');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expiration.alert.days','string','15');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.notification.subject','string','New uploaded document with expiration');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.notification.template','text','New document uploaded<br/>${docUrl}<br/>Expiration date:${date}<br/>');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.alert.subject','string','Alert documents will expire');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.alert.template','text','Document ${docUrl} will expire at ${date}<br/>');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expired.subject','string','Documents expired');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expired.template','text','Document ${docUrl} expired at ${date}<br/>');

More information at Database query.

Configure parameters

Field / PropertyTypeDescription

expiration.date.pattern

String

Set the date pattern.

dd-MM-yyyy HH:mm:ss

expiration.notification.subject

String

Mail subject.

New uploaded document with expiration

expiration.notification.template

String

Mail body.

New document uploaded<br/>${docUrl}<br/>Expiration date:${date}<br/>

expiration.expiration.alert.days

Integer

Set the number of days before expiration when it will be send the expiration alert message.

15

Default document expiration set an unique value for all document. This is the default logic but can be implemented your own.

expiration.alert.subject

String

Mail subject.

Alert documents will expire

expiration.alert.template

String

Mail body.

Document ${docUrl} will expire at ${date}<br/>

These parameters are set at Administration > Configuration parameters view.

Register metadata group

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.7//EN" "http://www.openkm.com/dtd/property-groups-2.7.dtd">
<property-groups>
  <property-group label="Expiration" name="okg:expiration">
    <input label="Expiration date" name="okp:expiration.date" type="date">
      <validator type="req"/>
    </input>
    <select label="State" name="okp:expiration.state" type="simple">
      <option label="Notify" value="notify" selected="true"/>
      <option label="Valid" value="valid"/>
      <option label="Expired" value="expired"/>
      <validator type="req"/>
    </select>					 
    <select label="Notify" name="okp:expiration.groupnotify" type="multiple" className="com.openkm.plugin.form.values.OptionSelectUserList">
      <validator type="req"/>
    </select>
    <select label="Notify expiration alert" name="okp:expiration.groupalert" type="multiple" className="com.openkm.plugin.form.values.OptionSelectUserList">
      <validator type="req"/>
    </select>
    <select label="Notify expirated" name="okp:expiration.groupexpired" type="multiple" className="com.openkm.plugin.form.values.OptionSelectUserList">
      <validator type="req"/>
    </select>
  </property-group>
</property-groups>

Crontab task

  • Copy jar files into the $TOMCAT_HOME/plugins folder.
  • Restart OpenKM ( that will register crontab tasks ).
TaskExpressionDescription

InitialNotificationation.jar

0 */1 * * * *

After is added metadata group to the node is sent the "initial notification" mail.

The crontab task is executed each minute looking for new nodes with metadata group.

AlertExpirationNotificationation.jar

0 30 0 * * *

Sent daily mail alert for documents expire soon.

ExpirationNotificationation.jar

0 0 0 * * *

Sent daily mail alert for documents expired today.

This crontab task should be executed before AlertExpirationNotificationation task.

More information at Crontab.

Register reports

ReportDescription

ValidDocuments.jrxml

List all valid documents.

ExpiredDocuments.jrxml

List all expired documents.

NextExpirationDocuments.jrxml

List documents what will expire soon.

More information at Reports.

See also Profiles for configuring reports in user interface menu view.