_uc_file_number_accumulate_equation
Drupal 7 _uc_file_number_accumulate_equation(&$current, $proposed, $force_overwrite)
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 accumulate, but only if it wasn't a forced overwrite. (Think on the user account admin page where you can set a download limit to '2'... you wouldn't then next time set it to '4' and expect it to accumulate to '6' . You'd expect it to overwrite with your '4'.)
If current is unlimited, then a limited proposal will only overwrite in the case of the forced overwrite explained above.
1 call to _uc_file_number_accumulate_equation()
File
- sites/
all/ modules/ ubercart/ uc_file/ uc_file.module, line 965 - Allows products to be associated with downloadable files.
Code
function _uc_file_number_accumulate_equation(&$current, $proposed, $force_overwrite) {
// Right side 'unlimited' always succeeds.
if (!$proposed) {
$current = NULL;
}
// Right side and left side populated
elseif ($current && $proposed) {
// We don't add forced limits...
if ($force_overwrite) {
$current = $proposed;
}
else {
$current += $proposed;
}
}
// If it's a force (not a purchase e.g. user account settings), only then
// will a limit succeed 'unlimited'.
elseif ($force_overwrite && !$current && $proposed) {
$current = $proposed;
}
}

