CRM-14015 - Fix setvalue to work with required boolean fields
authorColeman Watts <coleman@civicrm.org>
Tue, 24 Dec 2013 05:06:09 +0000 (21:06 -0800)
committerColeman Watts <coleman@civicrm.org>
Mon, 6 Jan 2014 19:10:41 +0000 (11:10 -0800)
api/v3/Generic/Setvalue.php

index 72cd6d41eb75d11dd522f3e1664d492cc14c401b..abe405a5eea6a30e53ea57771953e3ced2f0bde6 100644 (file)
@@ -26,7 +26,7 @@ function civicrm_api3_generic_setValue($apiRequest) {
   }
 
   $def = $fields[$field];
-  if (array_key_exists('required', $def) && empty($value)) {
+  if (array_key_exists('required', $def) && CRM_Utils_System::isNull($value)) {
     return civicrm_api3_create_error(ts("This can't be empty, please provide a value"), array("error_code" => "required", "field" => $field));
   }