Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-14028

api required field check should allow value of 0

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.3
    • Fix Version/s: 4.4.4
    • Component/s: CiviCRM API
    • Labels:
      None

      Description

      Eileen –
      we ran into a situation where we wanted to be able to save a tag with a value of "0" (the "name" column).
      the code originated with some of our customizations, so it ran through the tag api. it failed with the mandatory field check in the api utils because the current code checks for the existence of the array key and uses empty() to check for the value existence – which treats 0 as empty.

      I think we should change that to allow for the special case of 0.

      see this commit (the modules/civicrm/api/v3/utils.php modification only – the other two files are specific to us):
      https://github.com/nysenate/Bluebird-CRM/commit/d7f9b74e715f80638f848786fe74c36ba7dcd23a

      I think we should continue using empty as the basis, as it will prevent values with just spaces, but allow the exception of 0.

      assigning to you for review/consideration.

        Attachments

          Activity

            People

            • Assignee:
              colemanw Coleman Watts
              Reporter:
              lcdweb Brian Shaughnessy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: