addField('modified_date', array('type' => 'hidden', 'id' => 'modified_date', 'label' => '')); } /** * Ensure that modified_date has not changed in the underlying DB. * * @param array $fields * The input form values. * @param array $files * The uploaded files if any. * @param int $contactID * * @return bool|array * true if no errors, else array of errors */ public static function formRule($fields, $files, $contactID = NULL) { $errors = array(); $timestamps = CRM_Contact_BAO_Contact::getTimestamps($contactID); if ($fields['modified_date'] != $timestamps['modified_date']) { // Inline buttons generated via JS $open = sprintf("", $timestamps['modified_date']); $close = ""; $errors['modified_date'] = $open . ts('This record was modified by another user!') . $close; } return empty($errors) ? TRUE : $errors; } }