You are here

function legal_version in Legal 6.8

Same name and namespace in other branches
  1. 8 legal.module \legal_version()
  2. 7.2 legal.admin.inc \legal_version()
  3. 7 legal.admin.inc \legal_version()
  4. 2.0.x legal.module \legal_version()

Determine version ID of T&C. If it's new version determine next version id, if it's a revision return the ID of the current version increment revision ID by 1.

1 call to legal_version()
legal_administration_submit in ./legal.admin.inc

File

./legal.admin.inc, line 284
Administration functions for the Legal module.

Code

function legal_version($version_handling, $language) {
  $version = db_result(db_query_range("SELECT version FROM {legal_conditions} ORDER BY version DESC", 0, 1));

  // Make new version.
  if ($version_handling == 'version') {
    $versioning['version'] = empty($version) ? 1 : $version + 1;
    $versioning['revision'] = 1;
  }

  // Make new revision.
  if ($version_handling == 'revision') {
    $revision = db_result(db_query_range("SELECT revision FROM {legal_conditions} WHERE version = %d AND language = '%s' ORDER BY revision DESC", $version, $language, 0, 1));
    $versioning['version'] = $version;
    $versioning['revision'] = empty($revision) ? 1 : $revision + 1;
  }
  return $versioning;
}