addElement('hidden', 'modified_date', '', array('id' => 'modified_date')); } /** * Ensure that modified_date hasn't changed in the underlying DB * * @param array $fields * The input form values. * @param array $files * The uploaded files if any. * @param int $contactID * * @return true if no errors, else array of errors * @static */ 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; } }