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 array $options additional user data * * @return true if no errors, else array of errors * @access public * @static */ 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; } }