Document expiration is a notification system alert that can be used to advise users about 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 is available 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/>');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expirated.reminder.days', 'string', '15');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expirated.reminder.subject', 'string', 'Reminder alert of documents expired');
INSERT INTO OKM_CONFIG (CFG_KEY, CFG_TYPE, CFG_VALUE) VALUES ('expiration.expirated.reminder.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.

Newly uploaded document with expiration

expiration.notification.template

String

Mail body.

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

expiration.expiration.alert.days

Integer

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

15

Default document expiration sets a unique value for all documents. This is the default logic, but you can implement 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/>

expiration.expirated.reminder.days

Integer 

 

Set the number of days for sending reminder notifications for expired documents that expired more than that many days ago.

15

Default document expiration sets a unique value for all documents. This is the default logic, but you can implement your own.

 expiration.expirated.reminder.subject

String

 Mail subject.

Reminder alert for expired documents

 expiration.expirated.reminder.template

 String

 Mail body.

Document ${docUrl} expired at ${date}<br/>

These parameters are set in the Administration > Configuration parameters view.

Register metadata group

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.10//EN" "http://www.openkm.com/dtd/property-groups-3.10.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>
<select label="Notify expirated reminder alert" name="okp:expiration.groupexpiratedreminder" type="multiple" className="com.openkm.plugin.form.values.OptionSelectUserList">
<validator type="req"/>
</select> </property-group> </property-groups>

Crontab tasks

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

InitialNotification.jar

0 */1 * * * *

After a metadata group is added to the node, the "initial notification" email is sent.

The crontab task is executed every minute, looking for new nodes with a metadata group.

AlertExpirationNotification.jar

0 30 0 * * *

Sends a daily alert email for documents that will expire soon.

ExpirationNotification.jar

0 0 0 * * *

Sends a daily alert email for documents that expired today.

This crontab task should be executed before the AlertExpirationNotification task.

AlertExpiredReminderNotification.jar

0 0 1 * * *

Sends a daily alert email for documents that expired x days ago.

More information is available at Crontab.

Register reports

ReportDescription

ValidDocuments.jrxml

Lists all valid documents.

ExpiredDocuments.jrxml

Lists all expired documents.

NextExpirationDocuments.jrxml

Lists documents that will expire soon.

More information is available at Reports.

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