View | Details | Raw Unified | Return to bug 32711
Collapse All | Expand All

(-)a/api/v1/swagger/paths/items.yaml (+1 lines)
Lines 426-431 Link Here
426
          type: string
426
          type: string
427
          enum:
427
          enum:
428
            - +strings
428
            - +strings
429
            - biblio
429
        collectionFormat: csv
430
        collectionFormat: csv
430
    consumes:
431
    consumes:
431
      - application/json
432
      - application/json
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-biblio-format.inc (+64 lines)
Line 0 Link Here
1
<script>
2
    (function() {
3
        /**
4
         * Format the biblio response from a Koha RESTful API request.
5
         * @param  {Object}  biblio  The biblio json object as returned from the Koha RESTful API
6
         * @param  {Object}  config  A configuration object
7
         *                           Valid keys are: `link`
8
         * @return {string}          The formatted HTML string
9
         */
10
        window.$biblio_to_html = function(biblio, config) {
11
12
            if (biblio === undefined) {
13
                return ''; // empty string for no biblio
14
            }
15
16
            var title = '<span class="biblio-title">';
17
            if (biblio.title != null && biblio.title != '') {
18
                title += escape_str(biblio.title);
19
            } else {
20
                title += __("No title");
21
            }
22
            title += '</span>';
23
24
            // add subtitle
25
            if (biblio.subtitle != null && biblio.subtitle != '') {
26
                title += ' <span class="biblio-subtitle">' + escape_str(biblio.subtitle) + '</span>';
27
            }
28
29
            // set title as link
30
            if (config && config.link) {
31
                if (config.link === 'marcdetail') {
32
                    title = '<a href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=' + encodeURIComponent(biblio.biblio_id) + '" class="title">' + title + '</a>';
33
                } else if (config.link === 'labeled_marc') {
34
                    title = '<a href="/cgi-bin/koha/opac-labeledMARCdetail.pl?biblionumber=' + encodeURIComponent(biblio.biblio_id) + '" class="title">' + title + '</a>';
35
                } else if (config.link === 'isbd') {
36
                    title = '<a href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=' + encodeURIComponent(biblio.biblio_id) + '" class="title">' + title + '</a>';
37
                } else {
38
                    title = '<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=' + encodeURIComponent(biblio.biblio_id) + '" class="title">' + title + '</a>';
39
                }
40
            }
41
42
            // add medium
43
            if (biblio.medium != null && biblio.medium != '') {
44
                title += ' <span class="biblio-medium">' + escape_str(biblio.medium) + '</span>';
45
            }
46
47
            // add part numbers/names
48
            let part_numbers = (typeof biblio.part_number === 'string') ? biblio.part_number.split("|") : [];
49
            let part_names = (typeof biblio.part_name === 'string') ? biblio.part_name.split("|") : [];
50
            let i = 0;
51
            while (part_numbers[i] || part_names[i]) {
52
                if (part_numbers[i]) {
53
                    title += ' <span class="part-number">' + escape_str(part_numbers[i]) + '</span>';
54
                }
55
                if (part_names[i]) {
56
                    title += ' <span class="part-name">' + escape_str(part_names[i]) + '</span>';
57
                }
58
                i++;
59
            }
60
61
            return title;
62
        };
63
    })();
64
</script>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/checkout.inc (-1 / +3 lines)
Lines 19-24 Link Here
19
                    <thead>
19
                    <thead>
20
                      <tr>
20
                      <tr>
21
                          <th>Barcode</th>
21
                          <th>Barcode</th>
22
                          <th>Title</th>
23
                          <th>Call number</th>
22
                          <th>Due date</th>
24
                          <th>Due date</th>
23
                      </tr>
25
                      </tr>
24
                    </thead>
26
                    </thead>
Lines 26-32 Link Here
26
                    </tbody>
28
                    </tbody>
27
                    <tfoot>
29
                    <tfoot>
28
                      <tr>                    
30
                      <tr>                    
29
                        <td colspan="2" class="text-right"><span id="checkoutsCount"></span> items checked out</td>
31
                        <td colspan="4" class="text-right"><span id="checkoutsCount"></span> items checked out</td>
30
                      </tr>
32
                      </tr>
31
                    </tfoot>
33
                    </tfoot>
32
                </table>
34
                </table>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (+1 lines)
Lines 295-300 $(document).ready(function() { Link Here
295
});
295
});
296
</script>
296
</script>
297
[% INCLUDE 'js-date-format.inc' %]
297
[% INCLUDE 'js-date-format.inc' %]
298
[% INCLUDE 'js-biblio-format.inc' %]
298
[% PROCESS jsinclude %]
299
[% PROCESS jsinclude %]
299
[% IF ( Koha.Preference('OPACUserJS') ) %]
300
[% IF ( Koha.Preference('OPACUserJS') ) %]
300
    <script>
301
    <script>
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/global.js (+14 lines)
Lines 27-32 function formatstr(str, col) { Link Here
27
    });
27
    });
28
};
28
};
29
29
30
var HtmlCharsToEscape = {
31
    '&': '&amp;',
32
    '<': '&lt;',
33
    '>': '&gt;'
34
};
35
String.prototype.escapeHtml = function() {
36
    return this.replace(/[&<>]/g, function(c) {
37
        return HtmlCharsToEscape[c] || c;
38
    });
39
};
40
function escape_str(s){
41
    return s != null ? s.escapeHtml() : "";
42
}
43
30
function confirmDelete(message) {
44
function confirmDelete(message) {
31
    return (confirm(message) ? true : false);
45
    return (confirm(message) ? true : false);
32
}
46
}
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/modals/checkout.js (-6 / +18 lines)
Lines 55-62 $(document).ready(function() { Link Here
55
        // Display checkouts table if not already visible
55
        // Display checkouts table if not already visible
56
        $('#checkoutsTable').show();
56
        $('#checkoutsTable').show();
57
        // Add checkout to checkouts table
57
        // Add checkout to checkouts table
58
        $('#checkoutsTable > tbody').append('<tr><td>' + current_item.external_id +'</td><td>'+ $date(checkout.due_date) +'</td></tr>');
58
        $("#checkoutsTable > tbody").append(
59
        $('#checkoutsCount').html(++checkouts_count);
59
            "<tr><td>" +
60
                current_item.external_id +
61
                "</td><td>" +
62
                $biblio_to_html(current_item.biblio, { link: 0 }) +
63
                "</td><td>" +
64
                current_item.callnumber +
65
                "</td><td>" +
66
                $date(checkout.due_date) +
67
                "</td></tr>"
68
        );
69
        $("#checkoutsCount").html(++checkouts_count);
60
        // Reset to submission
70
        // Reset to submission
61
        $('#checkoutConfirm').replaceWith('<button type="submit" id="checkoutSubmit" class="btn btn-primary">Submit</button>');
71
        $('#checkoutConfirm').replaceWith('<button type="submit" id="checkoutSubmit" class="btn btn-primary">Submit</button>');
62
    };
72
    };
Lines 108-116 $(document).ready(function() { Link Here
108
118
109
        let item_id;
119
        let item_id;
110
        let items = $.ajax({
120
        let items = $.ajax({
111
            url: '/api/v1/public/items?external_id=' + external_id,
121
            url: "/api/v1/public/items?external_id=" + external_id,
112
            dataType: 'json',
122
            headers: {
113
            type: 'GET'
123
                "x-koha-embed": "biblio",
124
            },
125
            dataType: "json",
126
            type: "GET",
114
        });
127
        });
115
128
116
        $('#availabilityResult').replaceWith('<div id="availabilityResult"></div>');
129
        $('#availabilityResult').replaceWith('<div id="availabilityResult"></div>');
117
- 

Return to bug 32711