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