Commit graph

6912 commits

Author SHA1 Message Date
743fac1fe0
Bug 29523: Remove the FIXME
This patch works through the unit tests and existing code to allow
removal of the FIXME I introduced earlier in the patchset.

We now require the `user` parameter be passed to `is_accessible` which
in turn makes `user` a required parameter for `to_api` in the
`Koha::Patron` case.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-27 16:40:45 -03:00
2c502d320e
Bug 29523: Cache the restricted branches list
This patch introduces a very localised cache of the restricted branches
list in the logged in patron object.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-27 16:40:44 -03:00
1477ffc752
Bug 29523: Pass the logged user around and use for validating
In this patch I add 'user', containing the Koha::Patron object for the
logged in user in the params hash we pass around in to_api. I then use
that in a new 'is_accessible' method added to Koha::Patron.

The new method is really the equivilent of 'search_limited' in the plural
class and could perhaps be renamed 'is_limited' or something clearer for
the singular form 'is_filtered' or 'fitler_for_api' or something?

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-27 16:40:44 -03:00
1fd366ddf7
Bug 29523: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-27 16:40:41 -03:00
c24b46b403
Bug 29523: Add Koha::Object->accessible
This patch introduces a method for checking if an object can be
retrieved by the current user. It depends on the plural class
implementation of the ->search_limited method.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-27 16:40:41 -03:00
Katrin Fischer
2d41825763
Bug 33887: (QA follow-up) Perltidy and fix some formatting issues
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 12:09:53 -03:00
Sam Lau
f471af4b60
Bug 33887: Unit tests
prove -v t/db_dependent/Koha/Checkouts.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 12:09:51 -03:00
d447f6c258
Bug 33970: Fix tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 12:09:46 -03:00
af01b62d2f
Bug 33608: (QA follow-up) Remove ->insert method
Might come back on the subject when resuming with bug 33636.

Test plan:
Run t/db_dependent/Koha/Statistics.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Tidy Koha/Item.pm bit further. Ordered hash keys too.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 11:07:59 -03:00
9aa95001d4
Bug 33608: (QA follow-up) Restore older gt zero tests
See the Bugzilla report. I have been asked to restore the former
tests although I definitely think that they are wrong. Will address
that on bug 34308 separately.

This currently has the side-effect of negative lost values being
interpreted as 'found'. (Do not use negative lost values!)
The added subtest still reflects that now. Added a few TODOs.

Test plan:
[1] Prove t/db_dependent/Koha/Items.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 11:07:58 -03:00
b5eb5520ed
Bug 33608: Move older Stats tests to Koha/Statistics.t
Test plan:
Run t/db_dependent/Koha/Statistics.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

[EDIT} Tidied inline.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 11:07:57 -03:00
917e328341
Bug 33608: Polish Koha::Statistic further
Adding exceptions, removing croaks.
No exception in new for unknown hash keys, store will catch that.
Prepare switching amount parameter to value (db column name).

Test plan:
Run t/db_dependent/Stats.t
Run t/db_dependent/Koha/Items.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

[EDIT] Fixed the mandatory check in Stats.t. Removed key_or_default.
       Additional tidy.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 11:07:56 -03:00
7ceb3959c3
Bug 33608: Redirect UpdateStats to Koha namespace
Moving code to Koha::Statistic->new and ->insert.
Polishing code a bit further in next patch.

Test plan:
Run t/db_dependent/Stats.t
Run t/db_dependent/Koha/Statistics.t
Run t/db_dependent/Koha/Pseudonymization.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

[EDIT] POD headers, use plural module and tidy Koha::Statistic

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 11:07:56 -03:00
4b5a0e6171
Bug 33608: Correct indentation in Stats.t
Test plan:
Run t/db_dependent/Stats.t
Run git diff -w HEAD~1.. t/db_dependent/Stats.t, proving that we
only did whitespace changes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 11:07:55 -03:00
ee33d83a25
Bug 33608: Rearranging Stats.t, removing useless t version
Subtest, modules, license.
The t/Stats.t is as good as empty, can be removed.

Test plan:
Run t/db_dependent/Stats.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 11:07:54 -03:00
358272ebbc
Bug 8838: (follow-up) Rebase, fix typos, and tidy.
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 11:07:49 -03:00
fde91e178d
Bug 8838: Add digest option for HOLD notice
Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Restart all the things!
4) Enable the new digest option for "Hold filled" messages
5) Trap multiple holds for a patron
6) Note a single notices is generated for all the trapped holds!

Signed-off-by: George Williams <george@nekls.org>
Signed-off-by: Laura ONeil <laura@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 11:07:48 -03:00
Katrin Fischer
7082820aee
Bug 10762: (QA follow-up) Perltidy
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 10:35:31 -03:00
Thibaud Guillot
71b84b0f22
Bug 10762: (follow-up) Add tests
Signed-off-by: Johanna Miettunen <johanna.miettunen@haaga-helia.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 10:35:30 -03:00
David Gustafsson
eae494fb33
Bug 31846: Add syspref for serials search results limit
To test:

1) Make sure SerialsSearchResultsLimit syspref is unset or set to 0.
2) Perform an advanced search on serials without any conditions
   and confirm all serials are listed as expected.
3) Set SerialsSearchResultsLimit to a value less the the number
   of total subscriptions, perform the search again, and confirm
   that the number of serials has been limited to the set value.
4) Ensure all tests pass in t/db_dependent/Serials.t

Sponsored-by: Gothenburg University Library
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 10:35:27 -03:00
6a42c85434
Bug 31503: (QA follow-up) Fix number of tests in rebase
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 10:35:25 -03:00
685ac83fa4
Bug 31503: (QA follow-up) Improve count of available_types
Tidied one other line.

Test plan:
Run t/db_dependent/Koha/Patron/Consents.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 10:35:24 -03:00
22651c9c2b
Bug 31503: (follow-up) Remove OPACCustomConsentTypes
This patch removes all trace of the original OPACCustomConsentTypes
preference.  We now use Koha::Plugins->feature_enabled in preference.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 10:35:23 -03:00
3d857d8e95
Bug 31503: (follow-up) Add 'feature_enabled' to Koha::Plugins
This patch adds a 'feature_enabled' accessor to the Koha::Plugins class.
Passing the plugin method name for the plugin feature you're looking for
will return a boolean denoting whether any enabled plugins carry said
method.

Included in the patch is an addition to the TT KohaPlugins plugin to
enable quick access to this function.

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

[EDIT] Tidied t/db_dependent/Koha/Plugins/Plugins.t
[EDIT] Tidied Koha/Template/Plugin/KohaPlugins.pm

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 10:35:22 -03:00
0a471bfeda
Bug 31503: Make opac-patron-consent more generic
Adds $patron->consent and $consents->available_types.
Incorporates them into script/template.
Provides two unit tests.

Note: A follow-up patch helps you test this with an
example plugin.

Test plan:
Run t/db_dependent/Koha/Patron.t
Run t/db_dependent/Koha/Patron/Consents.t
Toggle the value of pref PrivacyPolicyConsent and look at
OPAC account, tab Consents.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-25 10:35:20 -03:00
f5347f4958
Bug 27153: Add filter option to Elasticsearch indexing
This patch uses the filter option from the mappings to add a value_callback
to reord processing for indexing.

Fields defined with 'punctuation' filter will have all punctuation stripped when
conveted to documents.

Tests are updated.

Signed-off-by: Danielle M Elder <danielle.elder@law.utexas.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 15:44:34 -03:00
5c2c6252fa
Bug 35001: Simplify ->is_active in light of activity triggers
The fact that we update lastseen for various triggers now, makes
it a bit easier to let go of those 'hardcoded queries' ;)

Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 15:44:31 -03:00
21315eb8dc
Bug 35030: Add 'article' to patron activity triggers
This patch adds 'article' to the list of triggers available for
tracking patron activity.

Test plan
1) Select 'Placing an article request
   TrackPatronLastActivityTriggers system preference
2) As a staff member, place a hold on any item for a test user
3) Confirm that the borrowers.lastseen field is updated for that
   test borrower

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:26 -03:00
795c60e577
Bug 35027: Add 'hold' to patron activity triggers
This patch adds 'hold' to the list of triggers available for tracking
patron activity.

Test plan
1) Select 'Placing a hold on an item' in the
   TrackPatronLastActivityTriggers system preference
2) As a staff member, place a hold on any item for a test user
3) Confirm that the borrowers.lastseen field is updated for that test
   borrower

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:25 -03:00
e1a4284258
Bug 15504: Fix tests count
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:25 -03:00
b46b614b6c
Bug 15504: Remove PatronLastActivity preference
This patch removes the older PatronLastActivity preference opting to
replace it by the new PatronLastActivityTriggers preference. The feature
can now be disabled by simply not selecting any triggers

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:22 -03:00
a377be6afe
Bug 15504: (follow-up) Rename cache key
I agree, it's better to use borrowernumber for the cache key and I also
take the oportunity to rename it to more clearly reflect the function
(it's no longer 'login' only, it's now 'activity')

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:19 -03:00
305a221112
Bug 15504: (follow-up) Fix is_active test
Bug 33245 introduced a new is_active patron method and the corresponding
tests included calls to the method we depreacte in this patchset

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:18 -03:00
2d8dfd89c2
Bug 15504: (follow-up) Tidy 'lastseen' section of unit test
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:17 -03:00
91b7799c96
Bug 15504: (follow-up) Add Triggers mock to unit tests
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:17 -03:00
b30d32a571
Bug 15504: (follow-up) Unit tests
This patch removes, moves and updates the existing unit tests for
track_login_daily and track_login to all sit under Koha::Patron and
update_lastseen.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:15 -03:00
dff2fc82d7
Bug 15504: Add unit test
prove -v t/db_dependent/Auth.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:14 -03:00
2db5afffa1
Bug 15504: Remove update_lastseen method
This patch removes update_lastseen which has been replaced by a call to track_login_daily

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-24 10:05:13 -03:00
cc69c69614
Bug 33547: (QA follow-up) Tidy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-23 11:33:53 -03:00
10649d4921
Bug 33547: Add print slip
Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: BULAC - http://www.bulac.fr/
Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>
Signed-off-by: Laurence Rault <laurence.rault@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-23 11:33:51 -03:00
a5d75c47e7
Bug 28166: (QA follow-up) Fix and tidy tests and code
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-23 11:33:50 -03:00
0bc2990b00
Bug 31383: (bug 29691 follow-up) Remove get_opac_news_by_id
We can simply use get here

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-23 10:45:34 -03:00
Laura Escamilla
d742f29d77
Bug 34954: Fixed typo to 'dateexpiry'
To test:

1. In KTD use grep -rn --exclude=*.po "datexpiry" *
2. Notice that the four locations below are showing the typo:
    1. git add koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt
    2. git add misc/release_notes/release_notes_18_05_00.html
    3. git add misc/release_notes/release_notes_18_05_00.md
    4. git add t/db_dependent/Koha/Patrons/Import.t
3. Apply patch. Repeat step 1.
4. Notice that no results show. All instances of the typo have been fixed to dateexpiry.
5. Sign off and have a great day :)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-20 17:22:02 -03:00
5b18fa1fc2
Bug 25393: (QA follow-up) Tidy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-20 16:31:24 -03:00
fb4a40c34d
Bug 25393: Update Circulation.t
prove t/db_dependent/Circulation.t

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-20 16:31:22 -03:00
758cf9be9b
Bug 25393: Tests - Variable renaming
issue_4 is an auto_renew issue, rename to auto_renew_issue

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-20 16:31:22 -03:00
472e38f9ad
Bug 14092: (QA follow-up) Avoid fiddling with the hash in the template
prove t/db_dependent/Acquisition.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-20 16:31:15 -03:00
5bab527644
Bug 31383: (QA follow-up) Tidy
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-20 14:44:03 -03:00
44d1ebece8
Bug 31383: Adjust and add tests
Sponsored-by: Rijksmuseum, Netherlands
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-20 14:43:57 -03:00
5282a9c4ce
Bug 33947: Remove GetAllIssues
No more occurrences of GetAllIssues, remove it!

Test plan:
  git grep is your friend

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-20 11:03:03 -03:00