Bug 29084: Update article requests-related Koha::Biblio methods to use relationships
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 22 Sep 2021 19:19:21 +0000 (16:19 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 7 Oct 2021 08:54:59 +0000 (10:54 +0200)
commitf968a65793b877e3118fa347cba542e629acde9d
treefa1ae2d7f1fd9d43079bd8f5174cf0de98ab121b
parent02db36b95ce3611f818fb2fd2c3d37632e2b5d10
Bug 29084: Update article requests-related Koha::Biblio methods to use relationships

This patch makes Koha::Patron->article_requests use the underlying DBIC
relationship and _new_from_dbic instead of a plain search. It also
refactors 'article_requests_current' and 'article_requests_finished' to
use ->article_requests, as well as the new methods introduced by bug
29082 for filtering.

No behavior change should take place.

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t \
           t/db_dependent/ArticleRequests.t
=> SUCCESS: Tests pass!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 29084: Unit tests

This patch adds missing tests for Koha::Biblio->article_requests and
reorganizes (and extends) the tests for 'article_requests_current' and
'article_requests_finished' that were originally in ArticleRequests.t
into Koha/Biblio.t as we do now.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/ArticleRequests.t \
           t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 29084: Remove article_requests_finished and article_requests_current

This patch removes those methods that are not really needed. Templates
are adjusted to use the expected combination of
->article_requests->filter_by_current.

To test:
1. Apply this patch
2. Visit a biblio with article requests
=> SUCCESS: All works
3. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass, less tests.
4. Sign off :-D

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Biblio.pm
koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt
t/db_dependent/ArticleRequests.t
t/db_dependent/Koha/Biblio.t