|
Lines 3-9
Link Here
|
| 3 |
* Format the patron response from a Koha RESTful API request. |
3 |
* Format the patron response from a Koha RESTful API request. |
| 4 |
* @param {Object} patron The patron json object as returned from the Koha RESTful API |
4 |
* @param {Object} patron The patron json object as returned from the Koha RESTful API |
| 5 |
* @param {Object} config A configuration object |
5 |
* @param {Object} config A configuration object |
| 6 |
* Valid keys are: `invert_name`, `display_cardnumber` and `url` |
6 |
* Valid keys are: `invert_name`, `display_cardnumber', `url` |
|
|
7 |
* and `showDiffFirstname` |
| 7 |
* @return {string} The formatted HTML string |
8 |
* @return {string} The formatted HTML string |
| 8 |
*/ |
9 |
*/ |
| 9 |
window.$patron_to_html = function (patron, config) { |
10 |
window.$patron_to_html = function (patron, config) { |
|
Lines 33-38
Link Here
|
| 33 |
preferred_name += " (" + escape_str(patron.other_name) + ")"; |
34 |
preferred_name += " (" + escape_str(patron.other_name) + ")"; |
| 34 |
} |
35 |
} |
| 35 |
|
36 |
|
|
|
37 |
if ( |
| 38 |
config && |
| 39 |
config.showDiffFirstname && |
| 40 |
patron.preferred_name != patron.firstname |
| 41 |
) { |
| 42 |
preferred_name += |
| 43 |
" <em>[" + escape_str(patron.firstname) + "]</em>"; |
| 44 |
} |
| 45 |
|
| 36 |
const nameParts = []; |
46 |
const nameParts = []; |
| 37 |
if (config?.invert_name) { |
47 |
if (config?.invert_name) { |
| 38 |
// Invert: "Surname, Preferred" |
48 |
// Invert: "Surname, Preferred" |