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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format-address.inc (-17 / +31 lines)
Lines 11-17 Link Here
11
            return map;
11
            return map;
12
        }, {});
12
        }, {});
13
13
14
        function member_display_address_style_us(data, line_break) {
14
        function member_display_address_style_us(data, line_break, include_li) {
15
            let address = "";
15
            let address = "";
16
            if ( data.address || data.address2 ) {
16
            if ( data.address || data.address2 ) {
17
                if ( data.address ) {
17
                if ( data.address ) {
Lines 19-32 Link Here
19
                    if ( data.street_type ) {
19
                    if ( data.street_type ) {
20
                        roadtype_desc = roadtypes_map[data.street_type] ? roadtypes_map[data.street_type].street_type : data.street_type;
20
                        roadtype_desc = roadtypes_map[data.street_type] ? roadtypes_map[data.street_type].street_type : data.street_type;
21
                    }
21
                    }
22
                    address += '<li class="patronaddress1">' + escape_str(data.street_number) + ' ' + escape_str(data.address) + ' ' + escape_str(roadtype_desc) + '</li>';
22
                    address += include_li ? '<li class="patronaddress1">' : '';
23
                    address += escape_str(data.street_number) + ' ' + escape_str(data.address) + ' ' + escape_str(roadtype_desc);
24
                    address += include_li ? '</li>' : '';
23
                }
25
                }
24
            }
26
            }
25
            if ( data.address2 ) {
27
            if ( data.address2 ) {
26
                address += '<li class="patronaddress2">' + escape_str(data.address2) + '</li>'
28
                address += include_li ? '<li class="patronaddress2">' : ' ';
29
                address += escape_str(data.address2);
30
                address += include_li ? '</li>' : '';
27
            }
31
            }
28
            if ( data.city || data.postal_code || data.state || data.country ) {
32
            if ( data.city || data.postal_code || data.state || data.country ) {
29
                address += '<li class="patroncity">' + escape_str(data.city);
33
                address += include_li ? '<li class="patroncity">' : ' ';
34
                address += escape_str(data.city);
30
                if ( data.state ) {
35
                if ( data.state ) {
31
                    if ( data.city ) {
36
                    if ( data.city ) {
32
                        address += ', ';
37
                        address += ', ';
Lines 42-54 Link Here
42
                    }
47
                    }
43
                    address += escape_str(data.country)
48
                    address += escape_str(data.country)
44
                }
49
                }
45
                address += '</li>'
50
                address += include_li ? '</li>' : '';
46
            }
51
            }
47
52
48
            return address;
53
            return address;
49
        }
54
        }
50
55
51
        function member_display_address_style_de(data, line_break) {
56
        function member_display_address_style_de(data, line_break, include_li) {
52
            let address = "";
57
            let address = "";
53
            if ( data.address || data.address2 ) {
58
            if ( data.address || data.address2 ) {
54
                if ( data.address ) {
59
                if ( data.address ) {
Lines 56-79 Link Here
56
                    if ( data.street_type ) {
61
                    if ( data.street_type ) {
57
                        roadtype_desc = roadtypes_map[data.street_type] ? roadtypes_map[data.street_type].street_type : data.street_type;
62
                        roadtype_desc = roadtypes_map[data.street_type] ? roadtypes_map[data.street_type].street_type : data.street_type;
58
                    }
63
                    }
59
                    address += '<li class="patronaddress1">' + escape_str(data.address) + ' ' + escape_str(roadtype_desc) + escape_str(data.street_number) + '</li>';
64
                    address += include_li ? '<li class="patronaddress1">' : ' ';
65
                    address += escape_str(data.address) + ' ' + escape_str(roadtype_desc) + escape_str(data.street_number);
66
                    address += include_li ? '</li>' : '';
60
                }
67
                }
61
            }
68
            }
62
            if ( data.address2 ) {
69
            if ( data.address2 ) {
63
                address += '<li class="patronaddress2">' + escape_str(data.address2) + '</li>'
70
                address += include_li ? '<li class="patronaddress2">' : ' ';
71
                address += escape_str(data.address2);
72
                address += include_li ? '</li>' : '';
64
            }
73
            }
65
            if ( data.city || data.postal_code || data.state || data.country ) {
74
            if ( data.city || data.postal_code || data.state || data.country ) {
66
                address += '<li class="patroncity">';
75
                address += include_li ? '<li class="patroncity">' : ' ';
67
                address += escape_str(data.postal_code) + ' ' + escape_str(data.city);
76
                address += escape_str(data.postal_code) + ' ' + escape_str(data.city);
68
                address += data.state   ? line_break + escape_str(data.state)   : '';
77
                address += data.state   ? line_break + escape_str(data.state)   : '';
69
                address += data.country ? line_break + escape_str(data.country) : '';
78
                address += data.country ? line_break + escape_str(data.country) : '';
70
                address += '</li>'
79
                address += include_li ? '</li>' : '';
71
            }
80
            }
72
81
73
            return address;
82
            return address;
74
        }
83
        }
75
84
76
        function member_display_address_style_fr(data, line_break) {
85
        function member_display_address_style_fr(data, line_break, include_li) {
77
            let address = "";
86
            let address = "";
78
            if ( data.address || data.address2 ) {
87
            if ( data.address || data.address2 ) {
79
                if ( data.address ) {
88
                if ( data.address ) {
Lines 81-98 Link Here
81
                    if ( data.street_type ) {
90
                    if ( data.street_type ) {
82
                        roadtype_desc = roadtypes_map[data.street_type] ? roadtypes_map[data.street_type].street_type : data.street_type;
91
                        roadtype_desc = roadtypes_map[data.street_type] ? roadtypes_map[data.street_type].street_type : data.street_type;
83
                    }
92
                    }
84
                    address += '<li class="patronaddress1">' + escape_str(data.street_number) + ' ' + escape_str(roadtype_desc) + escape_str(data.address) + '</li>';
93
                    address += include_li ? '<li class="patronaddress1">' : '';
94
                    address += escape_str(data.street_number) + ' ' + escape_str(roadtype_desc) + escape_str(data.address);
95
                    address += include_li ? '</li>' : '';
85
                }
96
                }
86
            }
97
            }
87
            if ( data.address2 ) {
98
            if ( data.address2 ) {
88
                address += '<li class="patronaddress2">' + escape_str(data.address2) + '</li>'
99
                address += include_li ? '<li class="patronaddress2">' : ' ';
100
                address += escape_str(data.address2);
101
                address += include_li ? '</li>' : '';
89
            }
102
            }
90
            if ( data.city || data.postal_code || data.state || data.country ) {
103
            if ( data.city || data.postal_code || data.state || data.country ) {
91
                address += '<li class="patroncity">';
104
                address += include_li ? '<li class="patroncity">' : ' ';
92
                address += escape_str(data.postal_code) + ' ' + escape_str(data.city);
105
                address += escape_str(data.postal_code) + ' ' + escape_str(data.city);
93
                address += data.state   ? line_break + escape_str(data.state)   : '';
106
                address += data.state   ? line_break + escape_str(data.state)   : '';
94
                address += data.country ? line_break + escape_str(data.country) : '';
107
                address += data.country ? line_break + escape_str(data.country) : '';
95
                address += '</li>'
108
                address += include_li ? '</li>' : '';
96
            }
109
            }
97
110
98
            return address;
111
            return address;
Lines 100-109 Link Here
100
113
101
        window.$format_address = function(data, options) {
114
        window.$format_address = function(data, options) {
102
            let line_break = options && options.no_line_break ? ' ' : '<br/>';
115
            let line_break = options && options.no_line_break ? ' ' : '<br/>';
116
            let include_li = options && options.include_li;
103
            [%~ IF Koha.Preference( 'AddressFormat' ) ~%]
117
            [%~ IF Koha.Preference( 'AddressFormat' ) ~%]
104
                return member_display_address_style_[% Koha.Preference( 'AddressFormat' ) | html %](data, line_break);
118
                return member_display_address_style_[% Koha.Preference( 'AddressFormat' ) | html %](data, line_break, include_li);
105
            [%~ ELSE ~%]
119
            [%~ ELSE ~%]
106
                return member_display_address_style_us(data, line_break);
120
                return member_display_address_style_us(data, line_break, include_li);
107
            [%~ END ~%]
121
            [%~ END ~%]
108
        }
122
        }
109
123
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc (+1 lines)
Lines 28-33 Link Here
28
[% Asset.js("js/staff-global.js") | $raw %]
28
[% Asset.js("js/staff-global.js") | $raw %]
29
[% INCLUDE 'js-date-format.inc' %]
29
[% INCLUDE 'js-date-format.inc' %]
30
[% INCLUDE 'js-patron-get-age.inc' %]
30
[% INCLUDE 'js-patron-get-age.inc' %]
31
[% INCLUDE 'js-patron-format-address.inc' %]
31
[% Asset.js("js/patron-autocomplete.js") | $raw %]
32
[% Asset.js("js/patron-autocomplete.js") | $raw %]
32
33
33
[% INCLUDE 'validator-strings.inc' %]
34
[% INCLUDE 'validator-strings.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-4 / +4 lines)
Lines 438-444 Link Here
438
                                "orderable": true,
438
                                "orderable": true,
439
                                 "render": function( data, type, row, meta ) {
439
                                 "render": function( data, type, row, meta ) {
440
                                    let r = '<div class="address"><ul>';
440
                                    let r = '<div class="address"><ul>';
441
                                    r += $format_address(row, { no_line_break: 1 });
441
                                    r += $format_address(row, { no_line_break: true, include_li: true });
442
                                    r += '</div></ul>';
442
                                    r += '</div></ul>';
443
                                    return r;
443
                                    return r;
444
                                }
444
                                }
Lines 450-456 Link Here
450
                                "orderable": true,
450
                                "orderable": true,
451
                                "render": function( data, type, row, meta ) {
451
                                "render": function( data, type, row, meta ) {
452
                                    let r = '<div class="address"><ul>';
452
                                    let r = '<div class="address"><ul>';
453
                                    r += $format_address(row, { no_line_break: 1 });
453
                                    r += $format_address(row, { no_line_break: true, include_li: true });
454
                                    r += '</div></ul>';
454
                                    r += '</div></ul>';
455
                                    r += " " + escape_str(libraries_map[row.library_id].branchname);
455
                                    r += " " + escape_str(libraries_map[row.library_id].branchname);
456
                                    return r;
456
                                    return r;
Lines 471-477 Link Here
471
                                    [% END %]
471
                                    [% END %]
472
                                    r += '<br/>';
472
                                    r += '<br/>';
473
                                    r += '<div class="address"><ul>';
473
                                    r += '<div class="address"><ul>';
474
                                    r += $format_address(row, { no_line_break: 1 });
474
                                    r += $format_address(row, { no_line_break: true, include_li: true });
475
475
476
                                    if ( row.email ) {
476
                                    if ( row.email ) {
477
                                        r += "<li>" + _("Email: ") + "<a href='mailto:" + encodeURIComponent(row.email) + "'>" + escape_str(row.email) + "</a></li>";
477
                                        r += "<li>" + _("Email: ") + "<a href='mailto:" + encodeURIComponent(row.email) + "'>" + escape_str(row.email) + "</a></li>";
Lines 496-502 Link Here
496
                                    [% END %]
496
                                    [% END %]
497
                                    r += '<br/>';
497
                                    r += '<br/>';
498
                                    r += '<div class="address"><ul>';
498
                                    r += '<div class="address"><ul>';
499
                                    r += $format_address(row, { no_line_break: 1 });
499
                                    r += $format_address(row, { no_line_break: true, include_li: true });
500
500
501
                                    if ( row.email ) {
501
                                    if ( row.email ) {
502
                                        r += "<li>" + _("Email: ") + "<a href='mailto:" + encodeURIComponent(row.email) + "'>" + escape_str(row.email) + "</a></li>";
502
                                        r += "<li>" + _("Email: ") + "<a href='mailto:" + encodeURIComponent(row.email) + "'>" + escape_str(row.email) + "</a></li>";
(-)a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js (-5 / +1 lines)
Lines 106-115 function patron_autocomplete(node, options) { Link Here
106
                          + ")</span>,"
106
                          + ")</span>,"
107
                        : ""
107
                        : ""
108
                    ) + " "
108
                    ) + " "
109
                    + ( item.address     ? item.address.escapeHtml() : "" )     + " "
109
                    + $format_address(item, { no_line_break: true, include_li: false }) + " "
110
                    + ( item.city        ? item.city.escapeHtml() : "" )        + " "
111
                    + ( item.zipcode     ? item.zipcode.escapeHtml() : "" )     + " "
112
                    + ( item.country     ? item.country.escapeHtml() : "" ) + " "
113
                    + ( !singleBranchMode
110
                    + ( !singleBranchMode
114
                        ?
111
                        ?
115
                              "<span class=\"ac-library\">"
112
                              "<span class=\"ac-library\">"
116
- 

Return to bug 26967