BCLibraries / primo-services

MIT License
9 stars 4 forks source link

Support multiple Alma IDs [Breaking change] #13

Closed danmichaelo closed 9 years ago

danmichaelo commented 9 years ago

The problem is that Primo can return an array of Alma IDs like so:

                           "control" : {
                              "sourcerecordid" : "71346309370002201",
                              "sourceformat" : "MARC21",
                              "almaid" : [
                                 "47BIBSYS_NETWORK:71346309370002201",
                                 "47BIBSYS_STAVMUS:214217790002264",
                                 "47BIBSYS_NTNU_UB:2168667910002203",
                                 "47BIBSYS_NB:2192689930002202",
                                 "47BIBSYS_UBO:2175645040002204"
                              ],
                              "recordid" : "BIBSYS_ILS71346309370002201",
                              "sourcesystem" : "Alma",
                              "addsrcrecordid" : "998720037104702201",
                              "sourceid" : "BIBSYS_ILS"
                           },

This causes an array-to-string conversion error in BibComponentTranslator:107 because $group->$field is now an array.

(There is also an example of multiple Alma IDs in brief-search-result-local-02.json)

My suggested fix involves renaming alma_id to alma_ids and making sure it's always an array. Let me know what you think.

Otterfan commented 9 years ago

Looks good. I've merged and bumped the version up.