[Koha-bugs] [Bug 27853] New: POST /patrons doesn't enforce mandatory extended attributes

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Mar 3 18:22:11 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27853

            Bug ID: 27853
           Summary: POST /patrons doesn't enforce mandatory extended
                    attributes
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: REST API
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: tomascohen at gmail.com

If there are extended attributes types that are mandatory, the POST /patrons
route should fail if the request doesn't meet this requirement.

Unfortunately, we have no way (yet) to pass extended attributes on the POST. So
to solve this bug, we need to add a way to pass extended attributes along with
the patron object.

I propose:

POST /patrons
{
    "first_name": "Tomasito",
    ...
    "extended_attributes": {
        "SHOW_BCODE": [ 1 ],
        "COURSES": [ "ALGO1", "DATABASES" ]
    }
}

I choose to force them to be arrays for simplicity (they can be repeatable),
but we can check the data type on the controller (i.e. if (
ref($extended_attributes) eq 'ARRAY') { # loop case } else { # scalar case } ).

I'm open for opinions.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list