[Koha-bugs] [Bug 24043] New: ILL module can't show requests from more than one backend

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Nov 14 11:10:12 CET 2019


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

            Bug ID: 24043
           Summary: ILL module can't show requests from more than one
                    backend
 Change sponsored?: ---
           Product: Koha
           Version: 18.11
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: ILL
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: magnus at libriotech.no

A customer has 6 requests created with the FreeForm backend and 10 with the
Libris backend. The table of requests tries to display a mix of these, but
shows this error in the dev tools console:

Uncaught TypeError: Cannot read property 'name' of undefined
    at createStatus (ill-requests.pl:714)
    at jquery.dataTables.min_18.1105000.js:18
    at Object.b.fnGetData (jquery.dataTables.min_18.1105000.js:12)
    at B (jquery.dataTables.min_18.1105000.js:16)
    at Ia (jquery.dataTables.min_18.1105000.js:14)
    at mb (jquery.dataTables.min_18.1105000.js:66)
    at T (jquery.dataTables.min_18.1105000.js:30)
    at ia (jquery.dataTables.min_18.1105000.js:48)
    at HTMLTableElement.<anonymous> (jquery.dataTables.min_18.1105000.js:95)
    at Function.each (jquery-2.2.3.min_18.1105000.js:2)

The code around ill-requests.pl line 714 looks like this:

        var createStatus = function(data, type, row, meta) {
            var origData = meta.settings.oInit.originalData;
            if (origData.length > 0) {
                var status_name =
meta.settings.oInit.originalData[0].capabilities[
                    row.status
                ].name;
                switch( status_name ) {
                    case "New request":
                        return _("Ny förfrågan");
                    case "Requested":
                        return _("Begärd");

Now if I manipulate Koha/REST/V1/Illrequests.pm line 56 to look like this:

    # Get all requests
    my @requests = Koha::Illrequests->as_list;
    # @requests = @requests[6..9];

I can choose which requests to display in the table, by changing the numbers in
the brackets. Displaying only the FreeForm requests works fine, and displaying
only the Libris requests works fine. So it looks like the problem is to display
a mix. 

I am not sure I completely understand the JS here, but I have a hunch that
meta.settings.oInit.originalData[0].capabilities[ means we are trying to use
the metadata and the capabilities of the first ([0]) request returned to
display *all* the requests. And the backends have different statuses, so trying
to look up a Libris status in the set of FreeForm statuses fails?

-- 
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