Custom functions to validate specific fields |
Since LCM 0.7.0, it is possible to use plugins in order to add functions to validate the data entered by users into LCM, without modifying the program’s core. It is still in development, and will be considered stable in the LCM 0.8.0 release.
Examples of validations:
Validate that clients contacts, such as phone numbers, are in a valid format in a specific country;
Validate clients citizen numbers (i.e. the correct number of digits, format, matches with the client’s gender, etc.);
Validate the case title (if your organisation has specific requirements);
Validate the cross-reference ID numbers for a case (via keywords);
All of these examples are very specific to either one country or to one organisation. Yet, it should be possible to do such validation tasks.
The current architecture has 3 aims:
Allow programmers to write validation functions without having to modify the software core;
Allow programmers to publish/share their validation functions in the form of a plugin (allows "approval" and review process);
Allow administrators to download the plugins and use them locally;
A new space will be created on the LCM website, so that administrators and programmers can browse the available plugins. (not ready yet)
For more information, contact us: legalcase-devel@lists.sf.net
The information that follows is aimed at software developers with basic knowledge in PHP and MySQL.
Client validating functions
Client name (first, middle, last)
In this example, we check whether each name starts with a capital letter. The $id_client may be 0 if it is a new client. The $field is one of "first, middle or last" and $value is the value of the name (ex: John).
Name of the file: custom/validation/validate_client_name.php
Client citizen number, civil status, income and gender may be validated using a class in the following format:
Name of the file: custom/validation/validate_client_citizen_number.php
For more information, see the validate() function in "inc/inc_obj_client.php".
Contact validating functions
To document.
For more information, see the "add" and "update" functions in "inc/inc_contact.php".
Case validating functions
Not implemented yet.
For more information, see the validate() function in "inc/inc_obj_case.php".
Organisation validating functions
Not implemented yet.
For more information, see the validate() function in "inc/inc_obj_org.php".