Skip to content

Commit

Permalink
Add extra fields value update exception when launching scripts from t…
Browse files Browse the repository at this point in the history
…he command line - refs BT#12885
  • Loading branch information
ywarnier committed Jul 11, 2017
1 parent e495589 commit 7388313
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions main/inc/lib/extra_field_value.lib.php
Expand Up @@ -106,12 +106,20 @@ public function saveFieldValues($params, $showQuery = false)

// Parse params.
foreach ($extraFields as $fieldDetails) {
if ($fieldDetails['visible_to_self'] != 1 && !api_is_platform_admin(true, true)) {
continue;
}

$field_variable = $fieldDetails['variable'];

// if the field is not visible to the user in the end, we need to apply special rules
if ($fieldDetails['visible_to_self'] != 1) {
//only admins should be able to add those values
if (!api_is_platform_admin(true, true)) {
// although if not admin but sent through a CLI script, we should accept it as well
if (PHP_SAPI != 'cli') {
continue; //not a CLI script, so don't write the value to DB
}
}
}

if (isset($params['extra_'.$field_variable])) {
$value = $params['extra_'.$field_variable];
} else {
Expand Down

0 comments on commit 7388313

Please sign in to comment.