https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27353
--- Comment #7 from Tomás Cohen Arazi <[email protected]> --- Comment on attachment 115059 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115059 Bug 27353: Set X-Base-Total-Count header for REST API >diff --git a/Koha/REST/V1/Checkouts.pm b/Koha/REST/V1/Checkouts.pm >index 93feeaeb24..1dd68d264d 100644 >--- a/Koha/REST/V1/Checkouts.pm >+++ b/Koha/REST/V1/Checkouts.pm >@@ -90,13 +90,13 @@ sub list { > > # Perform search > my $checkouts = $checkouts_set->search( $filtered_params, $attributes > ); >+ my $total = $checkouts_rs->search->count; $checkouts_set vs. $checkouts_rs. >diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm >index 5eba4bdee3..ad67243cf1 100644 >--- a/Koha/REST/V1/Patrons.pm >+++ b/Koha/REST/V1/Patrons.pm >@@ -82,14 +82,15 @@ sub list { > if $restricted; > > my $patrons = $patrons_rs->search( $filtered_params, $attributes ); >- if ( $patrons_rs->is_paged ) { >- $c->add_pagination_headers( >- { >- total => $patrons->pager->total_entries, >- params => $args, >- } >- ); >- } This looks like an actual bug in the original code! >+ my $total = $orders_rs->search->count; >+ >+ $c->add_pagination_headers( >+ { >+ total => ($patrons->is_paged ? >$patrons->pager->total_entries : $patrons->count), >+ base_total => $total, >+ params => $args, >+ } >+ ); $orders_rs looks like a copy and paste error. Overall: I like the implementation. Besides this minor glitches, I think we could have unit tests for the changes to Patrons.pm and Checkouts.pm. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
