|
Lines 423-435
Link Here
|
| 423 |
[% END %] |
423 |
[% END %] |
| 424 |
[% SET order_column_index = 0 %] |
424 |
[% SET order_column_index = 0 %] |
| 425 |
[% SET embed = ['extended_attributes','library'] %] |
425 |
[% SET embed = ['extended_attributes','library'] %] |
| 426 |
patrons_table = $("#[% table_id | html %]").kohaTable({ |
426 |
let table_node = $("#[% table_id | html %]"); |
|
|
427 |
patrons_table = table_node.kohaTable({ |
| 427 |
"ajax": { |
428 |
"ajax": { |
| 428 |
"url": patron_search_url, |
429 |
"url": patron_search_url, |
| 429 |
"dataSrc": function ( json ) { |
430 |
"dataSrc": function ( json ) { |
| 430 |
[% IF redirect_if_one_result %] |
431 |
[% IF redirect_if_one_result %] |
| 431 |
// redirect if there is only 1 result. |
432 |
// redirect if there is only 1 result. |
| 432 |
// Do not redirect if state has been loaded |
433 |
// Do not redirect if state has been loaded |
|
|
434 |
let loaded_from_state = table_node.data('loaded_from_state'); |
| 433 |
if ( !loaded_from_state && first_draw && json.recordsFiltered == 1 ) { |
435 |
if ( !loaded_from_state && first_draw && json.recordsFiltered == 1 ) { |
| 434 |
let url = '[% redirect_url | url %]'.indexOf("?") != -1 |
436 |
let url = '[% redirect_url | url %]'.indexOf("?") != -1 |
| 435 |
? '[% redirect_url | url %]&borrowernumber=' + json.data[0].patron_id |
437 |
? '[% redirect_url | url %]&borrowernumber=' + json.data[0].patron_id |
|
Lines 777-784
Link Here
|
| 777 |
parent_block.find(".searchpattern").parent().hide(); |
779 |
parent_block.find(".searchpattern").parent().hide(); |
| 778 |
}); |
780 |
}); |
| 779 |
|
781 |
|
| 780 |
let table_dt = patrons_table.DataTable(); |
782 |
let loaded_from_state = patrons_table.data('loaded_from_state'); |
| 781 |
let loaded_from_state = table_dt.settings()[0].loaded_from_state; |
|
|
| 782 |
if ( !defer_loading || loaded_from_state ) { |
783 |
if ( !defer_loading || loaded_from_state ) { |
| 783 |
patron_search_form.submit(); |
784 |
patron_search_form.submit(); |
| 784 |
} |
785 |
} |
|
Lines 882-888
Link Here
|
| 882 |
$("#[% table_id | html %]_search_results").show(); |
883 |
$("#[% table_id | html %]_search_results").show(); |
| 883 |
|
884 |
|
| 884 |
let table_dt = patrons_table.DataTable(); |
885 |
let table_dt = patrons_table.DataTable(); |
| 885 |
let loaded_from_state = table_dt.settings()[0].loaded_from_state; |
886 |
let loaded_from_state = patrons_table.data('loaded_from_state'); |
| 886 |
if ( !loaded_from_state ) { |
887 |
if ( !loaded_from_state ) { |
| 887 |
table_dt.search("").columns().search(""); |
888 |
table_dt.search("").columns().search(""); |
| 888 |
[% FOR c IN columns %] |
889 |
[% FOR c IN columns %] |
|
Lines 898-904
Link Here
|
| 898 |
[% END %] |
899 |
[% END %] |
| 899 |
[% END %] |
900 |
[% END %] |
| 900 |
} |
901 |
} |
| 901 |
table_dt.settings()[0].loaded_from_state = false; |
902 |
patrons_table.data('loaded_from_state', false); |
| 902 |
first_draw = 1; // Only redirect if we are coming from here |
903 |
first_draw = 1; // Only redirect if we are coming from here |
| 903 |
table_dt.draw(); |
904 |
table_dt.draw(); |
| 904 |
[% IF display_search_description %] |
905 |
[% IF display_search_description %] |