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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc (-1 / +46 lines)
Line 0 Link Here
0
- 
1
<!-- js-patron-title.inc -->
2
<script>
3
    (function() {
4
        window.$patron_to_html = function( patron, config ) {
5
6
            if ( patron === undefined ) {
7
                return ''; // empty string for no patron
8
            }
9
10
            var title = null;
11
            if ( patron.title != null ) {
12
                title = '<span class="patron-title">' + escape_str(patron.title) + '</span>';
13
            }
14
15
            var name;
16
            var firstname = escape_str(patron.firstname);
17
            var surname   = escape_str(patron.surname);
18
19
            if ( patron.other_name != null ) {
20
                firstname += ' (' + escape_str(patron.other_name) + ')';
21
            }
22
            if ( config && config.invert_name ) {
23
                name = surname + ', ' + firstname;
24
            }
25
            else {
26
                name = firstname + ' ' + surname;
27
            }
28
29
            if ( config && config.display_cardnumber ) {
30
                name = name + ' (' + escape_str(patron.cardnumber)  + ')';
31
            }
32
33
            if (config && config.url) {
34
                if ( config.url === 'circulation_reserves' ) {
35
                    name = '<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber='+ encodeURIComponent(patron.patron_id) +'#reserves">' + name + '</a>';
36
                }
37
                else {
38
                    name = '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber='+ encodeURIComponent(patron.patron_id) +'">' + name + '</a>';
39
                }
40
            }
41
42
            return name;
43
        };
44
    })();
45
</script>
46
<!-- / js-patron-title.inc -->

Return to bug 29275