From 4ff0d5a7d01c1db40c9da15188e6f84d668c367b Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 27 Apr 2020 02:36:13 -0300 Subject: [PATCH] Bug 25288: Use the API to list libraries This patch makes the general libraries datatable use the API for rendering. To test: 1. Test the datatable behaviour 2. Apply this patch 3. Repeat your tests => SUCCESS: Things work! Filtering and sorting specially Bonus: Use the browser inspector to notice each interaction with thex datatable triggers an API call with the right query parameters Signed-off-by: Tomas Cohen Arazi --- admin/branches.pl | 5 - .../prog/en/modules/admin/branches.tt | 218 ++++++++++++------ 2 files changed, 149 insertions(+), 74 deletions(-) diff --git a/admin/branches.pl b/admin/branches.pl index 68b9c25ce5..c3eeea7d53 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -147,11 +147,6 @@ if ( $op eq 'add_form' ) { $op = 'list'; } -if ( $op eq 'list' ) { - my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, ); - $template->param( libraries => $libraries, ); -} - $template->param( messages => \@messages, op => $op, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index 68488d79be..3c9ca49923 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -183,69 +183,19 @@ [% IF op == 'list' %]

Libraries

- [% IF libraries.count %] - - - - - - - - - - - - - - [% FOREACH library IN libraries %] - - - - - - - - - - [% END %] - -
NameCodeAddressMARC organization codeIPPickup locationActions
[% library.branchname | html %][% library.branchcode | html %] - [% IF library.branchaddress1 %] - [% library.branchaddress1 | html %][% END %] - [% IF library.branchaddress2 %] -
[% library.branchaddress2 | html %][% END %] - [% IF library.branchaddress3 %] -
[% library.branchaddress3 | html %][% END %] - [% IF library.branchcity %] -
[% library.branchcity | html %][% END %][% IF ( library.branchstate ) %], - [% library.branchstate | html %][% END %] - [% IF library.branchzip %] - [% library.branchzip | html %][% END %] - [% IF library.branchcountry %] -
[% library.branchcountry | html %][% END %] - [% IF library.branchphone %] -
Ph: [% library.branchphone | html %][% END %] - [% IF library.branchfax %] -
Fax: [% library.branchfax | html %][% END %] - [% IF library.branchemail %] -
[% library.branchemail | html %][% END %] - [% IF library.branchurl %] -
[% library.branchurl | html %][% END %] - [% IF library.opac_info %] -
OPAC Info:
[% library.opac_info | $raw %]
[% END %] - [% IF library.branchnotes %] -
Notes: [% library.branchnotes | html %][% END %] -
[% library.marcorgcode | html %][% library.branchip | html %][% IF library.pickup_location %]Yes[% ELSE %]No[% END %] - Edit -
- - - -
-
- [% ELSE %] -
There are no libraries defined. Start defining libraries.
- [% END %] + + + + + + + + + + + + +
NameCodeAddressMARC organization codeIPPickup locationActions
[% END %] @@ -267,12 +217,142 @@