X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FGeneric%2FSetvalue.php;h=be0553354b44757f5411e414676e0118447e6625;hb=3838662faff56daff7b4fbbd25c60a4b7242a484;hp=abe405a5eea6a30e53ea57771953e3ced2f0bde6;hpb=730507f70920a6ae9077976fd501e5ccac2fb4b7;p=civicrm-core.git diff --git a/api/v3/Generic/Setvalue.php b/api/v3/Generic/Setvalue.php index abe405a5ee..be0553354b 100644 --- a/api/v3/Generic/Setvalue.php +++ b/api/v3/Generic/Setvalue.php @@ -26,7 +26,10 @@ function civicrm_api3_generic_setValue($apiRequest) { } $def = $fields[$field]; - if (array_key_exists('required', $def) && CRM_Utils_System::isNull($value)) { + // Disallow empty values except for the number zero. + // TODO: create a utility for this since it's needed in many places + // if (array_key_exists('required', $def) && CRM_Utils_System::isNull($value)) { + if (array_key_exists('required', $def) && empty($value) && $value !== '0' && $value !== 0) { return civicrm_api3_create_error(ts("This can't be empty, please provide a value"), array("error_code" => "required", "field" => $field)); }