Commit graph

5699 commits

Author SHA1 Message Date
Hammat Wele
dc629ea7b5
Bug 12532: Send email to guarantee and guarantor
This patch allows guarantors to receive emails sended to their
guarentees. This patch is a rebase of the previous patches.
I took all the content of previous commit and put it in one commit.

TO TEST:

Before applying:
1) Search, or create, a patron with guarantor.
2) For both guarantors and guarantees:
   - Add an email address
   - Update the 'Patron messaging preferences' section so that an email is sent for item checkouts
3) Checkout an item. An email should be sent only to the guarantee.
4) Apply the patch.
5) Run updatedatabase.pl
6) Run prove t/db_dependent/Members.t and prove t/db_dependent/Letters.t
7) Enable 'RedirectGuaranteeEmail'
8) Run misc/cronjobs/process_message_queue.pl
9) Notice that the email should be sended to both the guarantee AND the
guarantor.

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-10 09:58:46 -03:00
b4f928003e
Bug 34883: Add unit test
prove -v t/db_dependent/Koha/Patrons/Import.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 09:22:34 -03:00
5ee20cba58
Bug 34828: Make normalized_oclc use Koha::Biblio::Metadata::Extractor
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-09 16:41:32 -03:00
d5d2f319df
Bug 34828: Add Koha::Biblio::Metadata::Extractor::MARC
and inherit from it

The new usage is now:

1. With a Koha::Biblio object
my $extractor = Koha::Biblio::Metadata::Extractor->new({biblio => $biblio});
$extractor->get_normalized_upc;

or

2. With a MARC::Record
my $extractor = Koha::Biblio::Metadata::Extractor->new({metadata=> $biblio->metadata->record});
$extractor->get_normalized_upc;

Note that there are "Inconsistent hierarchy during C3 merge of class"
warnings raised by the QA script. We could remove them by replacing the
'use' by 'require' in Koha::Biblio::Metadata::Extractor::MARC (in ->new)
but that's suboptimal.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-09 16:41:31 -03:00
d163bf0b86
Bug 34336: Remove the dependency for Test::DBIx::Class
The module is removed from t.
We only have 01-test_dbic.t and we do not need it any longer.

Test plan:
git grep for Test::DBIx::Class. You should only see release notes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-09 11:41:40 -03:00
3e1d32f9ca
Bug 34549: Strip non-XML chars during TransformHtmlToMarc
This patch strips non-XML characters from inputs during
TransformHtmlToMarc.

To test:
0. Apply patch
1. koha-plack --restart kohadev
2. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl
3. Fill out record and use the text from "Text file containing control characters"
as the title
4. Click Save
5. Note that your record displays without any warnings like the following:
Error: invalid data, cannot decode metadata object
parser error : PCDATA invalid Char value 27

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Squashed the tidy patch. Still needed a few spaces to satisfy qa tools.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-09 11:41:32 -03:00
643e38e835
Bug 34153: (QA follow-up) Tidy code
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 16:40:19 -04:00
7bb4d94930
Bug 34153: Add tests
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 16:40:17 -04:00
Aleisha Amohia
be375ed01c
Bug 34722: Prevent other items from displaying to fill item-level recalls
This patch prevents other items attached to a record from being displayed as 'recalled' by item-level recalls.

To test:
1. Ensure UseRecalls system preference is enabled and circulation rules relevant to recalls are configured. Set 'on shelf recalls allowed' circulation rule 'if any unavailable' for ease of testing.
2. Search for a record that has multiple items, or create one with multiple items. Check out two of the items (Item A and Item B) to a patron, Patron A.
3. Log into the OPAC as another patron, Patron B. Search for the record and place a recall. Choose to recall a specific item and select Item A.
4. Go back to the staff interface and view the catalogue detail page for the record. Notice that every item has a 'recalled by...' message, even though Item A was specifically recalled.
5. Log into the OPAC as another patron, Patron C. Search for the record and place a recall. Choose to recall a specific item, notice every item has a 'recalled by...' message. Select Item B and Confirm.
6. In your terminal, the 'Other items are not returned for item-level recalls' test should fail when running
prove t/db_dependent/Koha/Item.t

7. Apply the patch and restart services

8. Confirm tests at t/db_dependent/Koha/Item.t now pass
9. Refresh the staff interface, confirm only Items A and B have the recalled message and the recall patron information for each item is accurate
10. Log into the OPAC as another patron, Patron D. Search for the record and place a recall. Choose to recall a specific item. Confirm only Items A and B have the recalled message.

Sponsored-by: Toi Ohomai Institute of Technology
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Perltidied new code.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 16:40:17 -04:00
151298709a
Bug 9525: (QA follow-up) Tidy
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 16:40:12 -04:00
Emmi Takkinen
43726e7b94
Bug 9525: Fix tests
To test prove t/db_dependent/Koha/Libraries.t

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 16:40:10 -04:00
Emmi Takkinen
7c22b12240
Bug 9525: Add option to define float groups and rules for float
Bug 22284 introduced ability to create hold groups.
We should have ability to create float groups in
same manner. This patch adds checkbox "Is local
float group" to group creation feature and new return
policy "Item floats by librarygroup".

To test:
1. Add new float group and some libraries to it.
2. From circulation and fine rules, set default
return policy as "Item floats by library group".
3. Check out an item for a patron.
4. Set library as one that belongs in the same
float group.
5. Check in the item.
=> Observe that notice for transfer doesn't pop up.
6. Check out again.
7. This time set library as one that doen's
belong in the same float group.
8. Check in.
=> Observe that notice for transfer pops up.

Experiment this feature by changing return policy
per library, item type etc.

Also prove t/db_dependent/Koha/Libraries.t

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Lisette Scheer <lisettePalouse+Koha@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 16:40:10 -04:00
69841b192a
Bug 33958: Add tests
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 11:08:28 -04:00
f90715782c
Bug 33690: Convert to x-koha-override
This patch converts the existing work to use x-koha-override instead of
introducing an entirely new header and we default to the system
preference value if the override isn't passed.

I believe this is more consistent with our approach in other areas of
koha to date.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 11:07:56 -04:00
6a9b4d9096
Bug 33690: (QA follow-up) Mock C4::Letters subroutines for unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

JD Amended patch: tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 11:07:56 -04:00
79a5509b77
Bug 33690: Add ability to send welcome notice when creating patrons using the REST API
It would be nice to have the ability to send a welcome notice when creating patrons via the API.

Test Plan:
1) Apply this patch
2) Ensure you have a WELCOME notice
3) Create a new patron using the REST API ( api/v1/patrons )
4) Note no welcome notice is sent to the patron ( you can check the
   notices tab for the patron )
5) Repeat step 3, but send the header X-Koha-SendWelcomeEmail with a
   value of 1 as part of the POST
6) Note the welcome message for the patron is in their notices!

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

Bug 33690: Tidy test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 11:07:55 -04:00
6fbed94d45
Bug 34737: (follow-up) Unit test for skipping bad lines
We update the test rules set to include some malformed, empty and
comment lines. No actual tests are added, but the skipping is checked by
all other tests in this way.

Signed-off-by: Toni Ford <Toni.Ford@newcastle.gov.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 11:07:54 -04:00
46bf81d443
Bug 34737: Tidy t/db_dependent/SIP/Transaction.t
Signed-off-by: Toni Ford <Toni.Ford@newcastle.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 11:07:53 -04:00
85fa7b04fb
Bug 34737: Unit tests
This patch adds unit test to prove the multi-field match functionality
added in this patchset.

Signed-off-by: Toni Ford <Toni.Ford@newcastle.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 11:07:52 -04:00
52ae9a3a25
Bug 33245: Add unit test
Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

JD amended patch: Adjust number of tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 11:07:50 -04:00
834365f4b4
Bug 34887: Merge with db_dependent Patron.t
Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

JD amended patch: Fixed QA failures
 FAIL   t/db_dependent/Koha/Patron.t
   FAIL   spelling
                 personnal ==> personal
                 personnal ==> personal
                 personnal ==> personal
                 personnal ==> personal
   WARN   tidiness
                The file is less tidy than before (bad/messy lines before: 361, now: 382)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 09:32:49 -04:00
53377edcc7
Bug 34887: Fix transactions in db dependent Patron.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 09:32:49 -04:00
5fd8317552
Bug 34825: Merge Letters.t into t/db/Letters.t
Test plan:
Run t/db_dependent/Letters.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 09:32:47 -04:00
a408421b9b
Bug 34905: Fix icon
Test plan, on k-t-d:
1) Install FreeForm, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)

2) Create a new FreeForm ILL request:
http://localhost:8081/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=FreeForm

3) Pick a request type and input "42" in cardnumber and select a random library.

4) Notice the "Place request with partners" icon is gone from the top action bar.

5) Apply patch. Repeat.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 09:15:41 -04:00
8d4b10fc84
Bug 34912: Add 14 hours to 1970 date in Account(s).t
This makes those tests pass in whatever timezone.

Test plan:
Do not yet apply patch.
Change timezone on commandline with: export TZ='Etc/GMT-14'
NOTE: GMT-14 is what we also call UTC+14 (sign reversed).
Run prove t/db_dependent/Accounts.t t/db_dependent/Koha/Account.t
This fails now.
Apply patch.
Rerun tests and verify that they pass now.
Bonus: Try some other time zone.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 09:15:39 -04:00
7d93d18548
Bug 34916: Fix wrong borrowernumber in ArticleRequests.t
Simple fix: Send patron to userenv instead of library only.

Test plan:
Do not apply patch.
Remove borrowernumber 51.
Run t/db_dependent/Koha/ArticleRequests.t. (FAIL)
Apply patch, rerun test (PASS)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-04 09:15:39 -04:00
ca4da5e17e
Bug 34932: Patron.t - Pass borrowernumber of manager to userenv
Test plan:
Make sure that you do not have borrowr 51.
Run t/db_dependent/Koha/Patron.t.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:51 -04:00
1628a576c4
Bug 34967: Move to db_dependent
No further changes.

Test plan:
Run t/db_dependent/Prices.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:50 -04:00
68e141893c
Bug 27634: Fix self_registration.t
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:45 -04:00
855a18f8ab
Bug 29145: (QA follow-up) Fix tests removing 'unblessed'
This fixes issues with the tests caused by:
Bug 32496: Reduce unnecessary unblessings of objects in Circulation.pm

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:44 -04:00
51ec5d8a62
Bug 29145: Perltidy files and added code
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:43 -04:00
da81704cf2
Bug 29145: Replace GetDebarments in unit tests
GetDebarments was removed and replaced by $patron->restrictions.
The tests needed some adjustments to reflect that change.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:42 -04:00
388762ae0b
Bug 29145: (QA follow-up) Remove debugging line
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:42 -04:00
56d1ff05ff
Bug 29145: (QA follow-up) Fix typo
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:40 -04:00
Katrin Fischer
0a66a4879a
Bug 29145: (QA follow-up) Fix missing bug number in database update and typos
Fixes some typos in test and update message that were highlighted
by the QA tools.

Add missing bug number to the atomic update file.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:39 -04:00
David Gustafsson
4678505e1e
Bug 29145: Fix conditions for patron debarring overdues
Signed-off-by: Michaela <michaela.sieber@kit.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:38 -04:00
David Gustafsson
ee8ef4b174
Bug 29145: Add tests and modify sysprefs
Add tests, remove ODueDebarmentRemovalAllowUnrestricted syspref and instead
modify AutoRemoveOverduesRestrictions to have a third option

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 09:24:38 -04:00
f8233f44a5
Bug 34918: Fix userenv for safe_to_delete tests
Instead of the fallback to 51, we pass a borrower that has
permission for editing items.

Test plan:
Do not apply patch.
Run test without a borrower 51 in db. (FAIL)
Apply patch.
Run test again. (PASS)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 08:51:16 -04:00
3298b27985
Bug 34918: Fix hardcoded borrowernumber 42
Test plan:
Run t/db_dependent/Koha/Item.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 08:51:15 -04:00
0fb84e424e
Bug 34930: Change timezone in Koha/Object.t where tests assume it
This is the case for subtest: attributes_from_api() tests.

Test plan:
export TZ='Europe/Amsterdam'
prove t/db_dependent/Koha/Object.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 08:51:15 -04:00
6109a41ca6
Bug 34489: Fix timezone problem in Patrons.t
See also bug 34930. Using same approach.

Test plan:
export TZ='Europe/Amsterdam'
prove t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 08:51:14 -04:00
97307b881d
Bug 34842: Fix Illrequest/Config.t if DB upgraded twice
Not sure this is correct, but I think it is!

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-03 08:51:12 -04:00
332b95b250
Bug 34513: (QA follow-up) Tidy
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-25 18:18:37 -03:00
abbbc5924d
Bug 34513: Add checkauth unit test for resetting auth state when changing users
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-25 18:18:37 -03:00
bb581fe78b
Bug 34513: Add end-to-end test for authorization check after first failed authorization
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-25 18:18:36 -03:00
7ac91b24cf
Bug 30843: Add unit test for Koha::Auth::TwoFactorAuth::verify
This change adds a unit test to test Koha::Auth::TwoFactorAuth::verify

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-09-25 10:53:52 -03:00
120b991529
Bug 33926: Add ability to specify fields allowed in a response
At this time, we can specify fields to hide in SIP response at the login level. From a security perspective, it would be useful to also be able to specify which fields are allowed in a response.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/SIP/Message.t

Signed-off-by: Sam Lau <samalau@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-25 10:53:50 -03:00
47a2029161
Bug 33428: Adjust Unit Tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-25 10:53:47 -03:00
bfcdbeb9a8
Bug 29822: Update unit tests
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-09-25 10:53:43 -03:00
Aleisha Amohia
b1126cfcef
Bug 34016: Tests for fulfilling recalls via SIP
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-09-25 10:53:39 -03:00