You are here

function _uc_file_time_accumulate_equation in Ubercart 8.4

Same name and namespace in other branches
  1. 6.2 uc_file/uc_file.module \_uc_file_time_accumulate_equation()
  2. 7.3 uc_file/uc_file.module \_uc_file_time_accumulate_equation()

Accumulates numeric limits (as of now, download and address).

We follow a couple simple rules here...

If proposing no limit, it always overrides current.

If proposal and current are limited, then replace with the new expiration.

If current is unlimited, then a limited proposal will only overwrite in the case of the forced overwrited explained above.

1 call to _uc_file_time_accumulate_equation()
_uc_file_accumulate_limits in uc_file/uc_file.module
Accumulates limits and store them to the file_user array.

File

uc_file/uc_file.module, line 300
Allows products to be associated with downloadable files.

Code

function _uc_file_time_accumulate_equation(&$current, $proposed, $force_overwrite) {

  // Right side 'unlimited' always succeeds.
  if (!$proposed) {
    $current = NULL;
  }
  elseif ($current && $proposed) {
    $current = $proposed;
  }
  elseif ($force_overwrite && !$current && $proposed) {
    $current = $proposed;
  }
}