Commit graph

8700 commits

Author SHA1 Message Date
97a100d19d
Bug 32280: Export method ImportBreedingAuth from C4::Breeding
In C4::Breeding method ImportBreedingAuth() should be exported to be used for example by plugins.

No test plan needed i bet.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Looks like a harmless and useful enhancement.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-31 18:39:37 +02:00
a18f65cdcc
Bug 31259: Escape infinite loop when lime cannot wrap enough
It seems the wrapping here works with words, not characters. If a line is too long,
or too far over, we can't trim it enough. We need to escape if successive loops are
not changing the line

To test:
 1 - Using sample data, edit the layout to match picture in comment 9
 2 - Add some borrowers to a batch
 3 - Attempt to export batch and save PDF
 4 - Staff client waits
 5 - ps aux | grep card
 6 - Note the job keeps running
 7 - Kill it
 8 - Apply patch
 9 - Restart_all
10 - Export batch again
11 - Success, you get a badly formatted PDF, rather than nothing
12 - Note the PDF does not show "Yakama Nation Library"
13 - Edit layout, male "Lower left X" 20 instead of 220
14 - Export again and note text field 1 shows correctly

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-03-31 13:13:39 +02:00
488e67656f
Bug 18398: (follow-up) Update POD & Unit tests
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-03-31 13:13:35 +02:00
f7cfe3a705
Bug 18398: Update C4::Message enqueue to use $patron->notice_email_address
This patch updates the enque method in C4::Message to expect a
Koha::Patron object in the parameters and then uses that patron object
to select the correct email address for notices as defined by
AutoEmailPrimaryAddress.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-31 13:13:33 +02:00
45cea7c7ba
Bug 13976: Sort popularity numerically in Zebra
To test:
1 - Create a new template at Tools->Marc modification template
2 - Add action: Copy 999$c to 942$0
3 - Create a report:
    SELECT biblionuber FROM biblios
4 - Run report, show all, do a batch modification to all records using template above
5 - Search for 'a' (make sure you are using Zebra)
6 - Sort by popularity
7 - Note records are sorted wrong
8 - Apply patch
9 - Restart all
10 - Reload search results
11 - Success! Sorted correctly

Signed-off-by: Anke <anke.bruns@gwdg.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-31 12:40:00 +02:00
b0767f5eb6
Bug 33159: Simplify ES handling and fix zebra handling
Before this patch we used two indexes for the thesaurus values, we can
simply index both needed fields into a single index and just form the
search correctly.

This patch also ensures we pass the 'thesaurus' vlaue for the heading
directly to the query builder - for zebra it goes through, and for ES
we convert it to the expected code.

This patch also moves the necessary mappings out of the user definable
mappings and hardcodes them. There is precedent for this with
'match-heading', it ensures matching works as expected

To test:
1 - Follow previous test plan in Zebra and ES

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-31 11:56:53 +02:00
297a07f5f8
Bug 33159: Correctly form thesaurus term for non-subject headings
Bug 30280 fixed things for subject heading, but didn't take into account
that all non-subject headings are considered LCSH - this means we can't
really handle different thesauri for controlled headings outside of
subjects - maybe a topic for a new bug, but we should fix matching for
them now

To test:
 1 - Set sysprefs:
    RequireChoosingExistingAuthority - don't require
    AutoCreateAuthorities - generate
    CatalogModuleRelink - Do
    AutoLinkBiblio - Do
    LinkerModule - first match
 2 - Find a record with an author attached to an authority, I used
  biblionumber 3 "Introduction to Attic Greek"
 3 - Edit in advanced editor
 4 - Delete the $9 link
 5 - Save the record
 6 - It generates a new number
 7 - Repeat 4-5, it does it again
 8 - Apply patch and restart all
 9 - Repeat 4-5
10 - It links to the original authority

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-31 11:56:52 +02:00
be8a3ee830
Bug 29234: Transit on checking
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-31 11:56:50 +02:00
10d12f999f
Bug 33341: Address some perlcritic errors in 5.36
Some old-style code is making our tests fail when run in Debian Testing.

This patch addresses this.

To test:
1. Launch bookworm KTD:
   $ KOHA_IMAGE=master-bookworm ktd up -d
2. Run:
   $ ktd --shell
  k$ prove t/00-testcritic.t
=> FAIL: It fails!
3. Apply the patch
4. Repeat 2
=> SUCCESS: Tests now pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-28 14:50:33 +02:00
a63b0d0030
Bug 33309: Index items after renewal transaction completes
This patch ensures a record is indexed only after the renewal transaction
has completed successfully. Otherwise the job cannot be found by the background process
worker, becaue it was not yet in the DB

To test:
1 - Make sure you are using ES, and the es indexer is running
2 - tail -f /var/log/koha/kohadev/*.log
3 - Issue an item to a patron and renew it
4 - Note error in es-indexer-output.log like:
    [2023/03/21 12:22:36] [WARN] No job found for id=157 main:: /kohadevbox/koha/misc/workers/es_indexer_daemon.pl (129)
5 - Apply patch
6 - Renew again
7  There should be no error
8 - Search for the record and confirm items info displays correctly
9 - View the background jobs in admin, confirm the most recent job has completed

Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-27 11:45:48 +02:00
48b1f230e8
Bug 33019: Make sure ES records are indexed the first time
This patch ensures records are indexed when they are created.
Previously, we were launching the indexer inside of of a transaction.
This meant that the job was being enqueued, but not being found by the
worker, becaue it was not yet in the DB

This patch skips record indexing in the transaction, and moves the indexing
command after

To test:
1 - Make sure you are using ES, and the es indexer is running
2 - tail -f /var/log/koha/kohadev/*.log
3 - Create a new record
4 - Note error in es-indexer-output.log like:
    [2023/03/21 12:22:36] [WARN] No job found for id=157 main:: /kohadevbox/koha/misc/workers/es_indexer_daemon.pl (129)
5 - Apply patch
6 - Create another record
7  There should be no error
8 - Search for the record and confirm it can be found
9 - View the background jobs in admin, confirm the most recent job has completed

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-27 11:29:57 +02:00
bf8e0a394f
Bug 32804: (QA follow-up) Typo ahs and fix ImportBatch.t
Resolve:
    #   Failed test 'Item's biblioitemnumber has not changed'
    #   at t/db_dependent/ImportBatch.t line 407.
    #
    #          got: '4261'
    #     expected: '2371'

Do not compare $item1->biblionumber with $original_biblioitemnumber :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-17 09:59:12 -03:00
eeb115440a
Bug 32804: Do not adjust biblionumber when replacing items during import
This patch adjust the item matching at import to confirm that for a duplicate itemnumber or barcode
matches an existing item in the DB and uses the original biblionumber when updating the item.

When ordering in a consortium the items may be moved around, duplicate biblios added, and various matches found.
We should not allow importing of items to move them from 1 biblio to another, but  we should allow the imports
to succeed and assume itemnumber or barcode matches are authoritative. The responsibility for correct matching of items to biblio should fall on the creator of the files

To test:
 1 - Be using the sample data in koha testing docker
 2 - Stage the sample file on this report
 3 - Match on KohaBiblio(999$c) / Item processing: replace
 4 - Note the biblio match is "The complete novels / Austen, Jane"
 5 - View the staged marc, note the barcode 39999000004090 in an item
 6 - Search for that barcode
 7 - You find biblio "Five novels : complete and unabridged / Gustave Flaubert"
 8 - Import the file
 9 - Check the db:
     SELECT * FROM items WHERE biblionumber != biblioitemnumber;
10 - Note the mismatch
11 - Fix the item and set it as 'Music' type
     UPDATE items SET biblionumber = biblioitemnumber, itype='MU' WHERE biblionumber != biblioitemnumber;
12 - Apply patch, restart all
13 - Stage and import the file with the same settings
14 - Confirm the item is modified on its original biblio (99) and that item type is Book again
15 - Change itemnumber to avoid itemnumber match and reset type
     UPDATE items SET itype='MU', itemnumber=999 WHERE itemnumber=212;
16 - Stage and import with the same setttings
17 - Confirm the marcode match worked and item is updated to book on original record
18 - Delete the original item
19 - Stage and import the file with the same settings
20 - The item is successfully created
21 - Stage and import, but item processing option is 'add'
22 - Confirm 1 item ignored
23 - Check the db
     SELECT * FROM import_items WHERE barcode=39999000004090
24 - Confirm there is a line with 'error' and duplicate_barcode

JD amended patch
-        # We assume that when replaicing tiems we do not want to move them - the onus is on the importer to
+        # We assume that when replacing items we do not want to move them - the onus is on the importer to

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-17 09:59:11 -03:00
928a4cb465
Bug 33100: Remove all punctuation at end of record
This could potentially be overkill - if you have two records that only
differ in ending punctuation, you might get a false result - I don't
know how likely that is ( as I have mentioned before '!!!' is a band )

This seems a reasonable fix

To test:
1 - Set sysprefs as in bug 33159
2 - Edit a record, biblionumebr 3 is fine
3 - Add a comma to end of author subfield a
4 - Save and note relinked
5 - Apply patch, restart all
6 - Save again
7 - Linked to original record

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-17 09:59:07 -03:00
4628d2e81c
Bug 33183: Error inserting matchpoint_components when creating record matching rules with MariaDB 10.6
The word "offset" is now a keyword. At the very least we need to escape the fieldname with backticks.
It would be nice to switch to Koha::Objects for this module eventually.

C4::Matcher::_store_matchpoint(): DBI Exception: DBD::mysql::st execute failed: You have an error in
your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax
to use near 'offset, length) VALUES ('27', '1', '999'...' at line 2 at /usr/share/koha/lib/C4/Matcher.pm
line 314

Test Plan:
1) Set up Koha with MariaDB 10.6
2) Attempt to create a matching rule
3) Note the error screen
4) Apply this patch
5) Restart all the things!
6) Attempt to create another matching rule
7) No errors this time

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-16 16:23:01 -03:00
042cba5db1
Bug 32878: (follow-up) Exclude non_priority holds
This patch filters out non_priorty holds in the on_reserve condition.

Test plan
1) Run t/db_dependant/Holds.t
2) Note it fails without this patch
3) Apply patch
4) Re-run the above test, note it now passes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-16 16:10:54 -03:00
Petro Vashchuk
32c15887d8
Bug 32878: Make it impossible to renew the item if it has active item level hold
introduced in:
73c3c5d2f1
Bug 31112: (QA follow-up) Reduce database queries

started from:
8ba1a9a534
Bug 31112: Remove unnecessary if-clause

Currently, you can renew the item even if someone already made an item level
hold on that item. This patch changes that, making it not possible to do so.

To reproduce:
1. Checkout an item, and make another item level hold on that specific item.
2. Renew it using the "Renew" checkbox, it should get renewed without any problems.
3. Apply the patch.
4. Checkbox should be gone and replaced with "On Hold" link that leads to the hold that doesn't allow you to renew the item again.
5. "Renew all" button should not work either.

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-14 10:55:24 -03:00
557c09b466
Bug 32057: (QA follow-up) Remove pretty flag
Not needed for storage. You can always display pretty in the
interface (on a follow-up report).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-14 08:49:34 -03:00
cf1a43e2a1
Bug 32057: Replace insert query with use of Koha::ActionLogs
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-03-14 08:49:33 -03:00
1942dbe881
Bug 32057: Add optional stack trace to action logs
It can be useful to know where in Koha a particular logged action was generated from, and how. We should add the ability to attach a syspref controlled basic stack trace with the caller depth controlled via the syspref. We can the call caller() until the specified depth has been reached.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
4) Restart all the things!
5) Set the new syspref ActionLogsTraceDepth to a number ( e.g. 3 )
6) Update a syspref or trigger another enabled log action
7) Query the database: SELECT * FROM action_logs WHERE trace IS NOT NULL
8) Note the stack trace was created!

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-03-14 08:49:32 -03:00
e630624e5e
Bug 32684: (QA follow-up) Move too_many_lost to Patron
Alternative implementation outside sub new.

Test plan:
Run t/db_dependent/SIP/Message.t

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-14 08:49:29 -03:00
877f8ed898
Bug 32684: Implement SIP patron status field "too many items lost"
The SIP patron status and information responses always return false foe "too many items lost". It would be reasonable to check the count of lost items still checked out to the patron and compare that to a threshold set in the sip config file. Though not all libraries operate in this way, it seems like a good and reasonable implementation as long is it is properly documented.

This patch adds the ability to set the SIP "too many items lost" flag
for a patron based on the number of lost checkouts the patron has where
the lost flag on those items is greater than the given flag value.

For example, one could specify that the flag be set if the patron has
more than 2 items checked out where itemlost is greater than 3.

By default the feature is disabled to retain the existing functionality.
If enabled, the default itemlost minimum flag value is 1 unless
specified.

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

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-03-14 08:49:29 -03:00
52315d60f3 Bug 33214: (follow-up) Consistency on key names
This patch makes GetAuthorisedValueDesc used cache keys match what we
discussed on the bug, which seems to have been lost on some rebase and
highlighted by failing tests.

I also add some more cache flushes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-13 16:42:33 -03:00
e6c49d642f
Bug 30624: Add loggedinlibrary permission and DB update
To test:
1. Apply patch, updatedatabase, restart_all
2. Have a user with superlibrarian privileges ( User1 )
3. Have a user who has staff access and circulate privileges but is not a super librarian. ( User2 ) Make note of this users home library
4. Turn on the system preference 'CircSidebar'.

-MAIN log in ( auth.tt )
5. As User1, go to the main login screen and try logging in. You should be able to log in AND you should be able to properly chnage your branch BEFORE logging in.
6. As User2, to to the main login screnn amd try logging in. You should be able to but if you try and switch your libraray to anything beside the user's home branch it will not work. You will be logged in at your home branch.
7. For User2, set the new top level permission 'Allow staff to change logged in library (loggedinlibrary).
8. Now you should be able to successfully switch libraries before log in.
9. Turn the 'loggedinlibrary' permission back off for User2.

-AFTER log in-
10. With User1, click on your name/branch in the top right, you should see the the link 'Set library' at the top. If you turn on 'UseCirculationDesks' the link will be 'Set library and desk'.
11. With User2, click on your name/branch in the top right. If you have 'UseCirculationDesks' on, you should see 'Set desk', otherwise you should see nothing.
12. Repeat step 7.
13. NOw if you click on your name/branch in the top right, you should see the the link 'Set library' at the top. If you turn on 'UseCirculationDesks' the link will be 'Set library and desk'.
14. Repeat Step 9.

-CircSideBar-
15. With 'CircSideBar' turned on, go to any ciculation page (Holds queue, Holds to pull, Holds awaiting pickup) with User1. You will see the 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set library and desk'.
16. Try with User2 and you will not see a 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set desk' link.
17. Repeat step 7.
18. For with User2 you go to any ciculation page (Holds queue, Holds to pull, Holds awaiting pickup). You will see the 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set library and desk'.
19. Repeat step 9.

-Set library page-
20. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User1. You will see a dropdown for 'Set library'. Make sure you can change your library successfully.
21. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User2. You should NOT see see a dropdown for 'Set library'.
22. Repeat step 7.
23. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User2. Now you should see a dropdown for 'Set library'.

Signed-off by: Bob Bennhoff/AspenCat Team

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-13 15:22:59 -03:00
4e8d76d6f9
Bug 30920: (follow-up) Cleanup warning from C4::Biblio::GetAuthorisedValueDesc
We simply return early and empty if $value is not passed

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-13 15:11:49 -03:00
7d9d795669
Bug 30920: (follow-up) Cache key fixes
We missed a few places, namely the flushes, when renaming the cache
keys.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-13 15:11:39 -03:00
dde86f08fc
Bug 30920: (follow-up) Add missing use
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-13 15:11:29 -03:00
ab866f040d
Bug 30920: Add caching to GetAuthorizedValueDesc
This patch adds caching to C4::Biblio::GetAuthorisedValueDesc for performance.

We cache each hash involved in the method use for description lookup and
we're careful to clear said caches appropraitely on changes.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-13 15:11:24 -03:00
Alex Arnaud
09ceb26b57
Bug 31858: add TT syntax for ACQORDER notices
Test Plan:
    1) Set your ACQORDER notice content to:
        [%- USE Price -%]
        [% bookseller.name %]
        [% FOREACH order IN orders %]
        Ordernumber [% order.ordernumber %] ([% order.biblio.title %] - [% order.biblio.biblioitem.publicationyear %]) (quantity: [% order.quantity %]) ($[% order.listprice | $Price %] each).
        [% END %]
        Thank you,
        [% branch.branchname %]
    2) Set up a vendor with an email, set contact for email so the "E-mail
        order" button shows on a basket for that vendor
    3) E-mail the basket
    4) Check the content is correct

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-10 11:15:15 -03:00
7fd9a1ae0b Bug 25655: Store invoice price and currency even if no currency change
We could need these info to be stored even if the currency is the same
as the active one, for statistic purpose for instance.

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 13:57:53 -03:00
f4b74f6c1f Bug 25655: Add tests
And fix a bug they caught. We need to undef if a modification is made
and invoice_currency is removed.

Sponsored-by: The Research University in the Helmholtz Association (KIT)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 13:57:53 -03:00
fb0e6a20f8 Bug 25655: Save values from ModOrderReceive
Sponsored-by: The Research University in the Helmholtz Association (KIT)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 13:57:53 -03:00
ad67b88d28 Bug 31028: (follow-up) Move html_helpers into notices
This patch removes the addition of html_helpers out of C4::Letters and
into the relevant notice templates where it belongs.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 11:23:17 -03:00
dcf7688b94 Bug 31028: Add catalog concern management page to staff
This patch adds a catalog concern management page to the staff client
accessible via the cataloging home page and a new 'Pending catalog
concerns' link on the front page.

This includes added the requisit ticket_updates api endpoints and notice
triggers and templates for notifying patrons of changes to their
reported concerns.

Test plan
1) Enable the `OpacCatalogConcerns` system preference
2) Catalog concern management is tied to your users ability to edit the
   catalog, `editcatalogue`.
3) Confirm that you can see 'Catalog concerns' listed on the cataloging
   home page if you have the `editcatalogue` permission and not if you
   do not.
4) Add a new concern as an opac user.
5) Confirm that once a concern is present in the system you see a count
   of 'catalog concerns pending' on the intranet main page if you have
   the `editcatalogue` permission.
6) Click through either the cataloging home page or pending concerns
   link on the main page to view the new concerns management page.
7) Confirm the table displays as one would expect.
8) Confirm clicking on details or the concern title exposes a 'details'
   modal with the option to add an update or resolve the concern.
9) Verify that if selecting 'notify' when updateing or resolving a
   concern triggers a notice to be sent to the opac user who first
   reported the issue.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Helen Oliver <HOliver@tavi-port.ac.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 11:23:17 -03:00
bf28d6b1c8 Bug 31028: Add acknowledgement notice
This patch adds an acknowledgement notice that will be sent to the opac
user upon submission of a catalog concern report.

Test plan
1) Confirm that a new notice template is added to the notices management
   page.
2) If using a sandbox, check the 'email log' from the management UI to
   see the resultant notice has been 'sent'

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Helen Oliver <HOliver@tavi-port.ac.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 11:23:17 -03:00
2dafd6f749
Bug 31471: Send multiple ISBN with 'OR' for FindDuplicate
When a record has multiple ISBNs the database stores them seperated by a
pipe

Zebra interprets a string like "isbn:1600213510 | 9781600213519" as an 'OR' search, but for
Elasticsearch we need to explicitly send "OR" - and Zebra support this
as well

To test:
1 - Make sure you are using Elasticsearch
2 - Cataloging->Add a new record from Z3950
3 - Choose target: LOC
4 - Search for: Control number: 14455023
5 - Import and save
6 - Search for the record again
7 - Import and save - duplicate check isn't been triggered
8 - Apply patch
9 - restart_all
10 - repeat 2-7
11 - this time you should get a duplicate notification
12 - Sitch SearchEngine syspref to 'Zebra'
13 - repeat 2-7
14 - Ensure you still get duplicate notification

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 09:51:45 -03:00
b3c945dd09
Bug 31453: Add ability to filter messages to process using process_message_queue.pl via a command line parameter
It would be very useful to be able to tell process_message_queue.pl to skip processing some messages. This is particularly useful where a plugin handles sending some message using the before_send_messages hook, but while that plugin is processing, more messages meant for the plugin might be queued. At that point, control moves back to the script and SendQueuedMessages is called, and those messages end up being processed there instead of by the plugin.

Test Plan:
1) Apply this patch
2) Queue two messages, each with a unique word
3) Run process_message_queue --where "content NOT LIKE '%WORD%'"
   where WORD is a unique word in one of the two message
4) Note the message containing "WORD" was not processed
5) prove t/db_dependent/Letters.t

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-02 09:37:44 -03:00
6c5c35aa32
Bug 33055: (bug 32624 follow-up) Don't send a screen message if not blocked
To test:
0 - Apply first patch
1 - prove -v t/db_dependent/SIP/Patron.t
2 - It fails
3 - Apply second patch
4 - prove -v t/db_dependent/SIP/Patron.t
5 - It passes!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-02 09:37:39 -03:00
60e7c99165
Bug 32205: Remove unnecessary syspref template params for failed OPAC auth
This patch removes some unnecessary syspref template params for
failed OPAC auth. The templates handle these syspref using the
Koha.Preference() TT plugin function, so they're completely redundant
and just make checkauth() longer than it needs to be.

Test plan:
1) Apply patch
2) Enable OpacCloud, OpacBrowser, and OpacTopissue sysprefs
3) koha-plack --restart kohadev
4) Log out of Koha if you're logged in
5) Go to http://localhost:8080/cgi-bin/koha/opac-user.pl
6) Note that you can see the Cart as well as links for the following:
Browse by hierarchy, Authority search, Tag cloud, Subject cloud,
Most popular

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-27 11:38:33 -03:00
e36e393c7d
Bug 33032: Remove alternateholdings_count
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-27 11:35:53 -03:00
d9d473d339
Bug 32687: Get server version in Context::get_versions
Test plan:
Run t/db_dependent/Context.t
Check About/Server information/MySQL version.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-24 17:52:28 -03:00
14b2c2f0b2
Bug 32805: Update location when recording a localuse in statistics table
To test:
1. Create a statistical patron and checkout, checkin to them.
2. Notice in the statistics table that the location is NULL
3. Apply patch
4. Try steps 1-2 again
5. The location should be correctly recorded in statistics.location

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-24 17:02:19 -03:00
c90f60adfc
Bug 30642: Make renewal_type an enum in spec and add test
This patch makes the renewal_type an enum, to match the change on the
DB. A test is added to account the fact the API is always setting
'Manual' request type.

Bonus: small portion of code gets a tidy, should've been asked by QA.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-10 11:08:00 -03:00
e8c232fcf7
Bug 30642: (QA follow-up) Do not rely on script names in modules, add unit test
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: Kyle, stop impersonating John Doe
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-10 11:07:59 -03:00
5045da59f1
Bug 30642: Record renewal type
A requirement has been requested to record whether a renewal was done manually or automatically. A column has been added to the checkout_renewals table in the database to record this and a check is now in place to determine whether the renewal was manual or automatic. The API has also been updated to reflect this new column and return the data when requested. The renewals modal view has also been updated to show what type the renewal was.

Test plan:
1) In the database shell run "show columns from checkout_renewals;" and observe that there is currently no column for recording the type of renewal
2) Apply patch
3) In the shell run "dbic" and "perl installer/data/mysql/updatedatabase.pl" to update the database schema with the new column.
4) Create some checkouts
5) Renew some checkouts manually and observe in the database that there is now a column called "renewal_type" that will have recorded these as "Manual"
6) Create some checkouts that can be automatically renewed
7) Run the cron script in automatic_renewals.pl and observe that there are now also entries with a renewal_type of "Automatic"
8) Send a GET request to http://localhost:8081/api/v1/checkouts/1/renewals and observe that the renewal_type is now returned in the response
9) In the Item Details tab for a record, there is the "Current renewals" option which has a button to view renewals. Click on this and observe that the modal now displays the new information.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-10 11:07:57 -03:00
c6c2fe81a2
Bug 32624: Don't include guarantee or guarantor fines in BV (fines amount) in SIP messages
This patch chanegs the code to report only the patron's personal fines, and to report a block
from other fines in the screen message

This is to prevent overpayment on accounts from SIP machines

To test:
1 - prove t/db_dependent/SIP/Patron.t

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-02-09 10:21:27 -03:00
d0abe773e8
Bug 32612: (QA follow-up) Add POD and fix typo
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-07 15:30:29 -03:00
d00d07cae7
Bug 32612: (QA follow-up) Add BINMODE method to C4::SIP::Trapper
The module Log::Log4perl::Appender::Screen is attempting to change
binmode during unit tests for SIPServer and is failing because of
our tie in SIPServer.pm for reasons unknown.

This patch implements the perltie method TIEHANDLE which allows the
binmode to be handled in the C4::SIP::Trapper package.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-07 14:22:58 -03:00
e5f251a709
Bug 15869: Change framework on overlay
This patch allows for selection of framework to use when overlaying
records - by default it is set to keep the initial framework

To test:
 1 - Create some records using one framework
 2 - Export the records
 3 - Edit the records to add fields not in original framework
 4 - Stage records using a rule that will find matches
 5 - Import
 6 - Note records contain new fields on display, but they are lost on edit
 7 - Apply patch
 8 - Stage records again
 9 - Select a framework that contains the new fields on import
10 - Import records
11 - Note records now use selected framework and are displayed/edited
correctly

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-07 10:32:22 -03:00
Katrin Fischer
abbcf684c2
Bug 32027: Fix 'librarian interface' to use 'staff interface' in Pages/HTML customizations/News
This changes all occurences of "librarian interface" to the
correct term "staff interface"

To test:
* Create a new Page
* Verify that the pull down for location has "librarian interface"
* Save your page
* Verify that the list of existing pages has "Librarian interface" as
  label for the link
* Verify that when you hover over on those links the titles read
  "librarian interface" as well
* Apply patch
* All those should read correctly now.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-07 10:31:29 -03:00
Katrin Fischer
7b3f3ac211
Bug 32222: Fix capitalization in various "id is invalid"
ID is an abbreviation and should be written with capitals.

See: https://www.oxfordlearnersdictionaries.com/definition/english/identification

This fixes all occurences of "id is invalid" to read "ID is invalid"

To test:
* As some are hard to trigger warnings, the best way here is to review the patch.

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-02-07 10:29:35 -03:00
ed30887924
Bug 32455: Use from_email_address for 'from' field for hold notices
This patch updates two occurrences where the inbound library email is
used as the from address

To test:
 1 - Set a unique 'Email' and 'Reply to' address for a library
 2 - Find a patron of that library, ensure they have an email
 3 - Ensure their messaging preference for holds is 'email'
 4 - Set system preference ReservesMaxPickupDelay to -1
 5 - Set system preference  ExpireReservesMaxPickUpDelay to Allow
 6 - Set system preference ExpireReservesAutoFill to Do
 7 - Place and fill a hold for that patron at that library
 8 - Check the patron's notification tab, confirm the from address is the 'Reply to'
 9 - Place a hold for another patron on the same item
10 - Run the expired holds cronjob:
     perl misc/cronjobs/holds/cancel_expired_holds.pl --reason=whatever
11 - Check the message_queue - notice the from address is the 'reply to'
12 - Apply patch
13 - Repeat 1-11, confirm the from addresses are correct now

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-02-07 10:26:02 -03:00
30fcbb4437
Bug 32515: Ignore no-block flag in check-in message
Bug 12225 changed the templates to correctly pass through the no-block flag,
however, we don't have a no-block routine for checkins

This patch restore previous behaviour of performing a normal checkin when
no block was requested - it adds a new FIXME

To test:
1 - See bug 32537
    https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32537
2 - Repeat test plan on that bug, noting that there is no response when no-block = Y
3 - Apply this patch
4 - Repeat the tests and confirm no-block = Y has a standard checkin response

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Blou <philippe.blouin@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-06 11:10:11 -03:00
494a63f9e8
Bug 32442: (bug 28739 follow-up) Ensure txn is rollbacked
If the TT process call is returning false and so the croak is raised,
then the txn is not rollbacked and the txn is not commited either.

We need to ensure the txn will be correctly rollbacked.

Test plan:
1. Go to any notice and create some invalid Template Toolkit:

[% IF ( 1 == 1 %]
test
[% END %]

2. Save and continue

3. Logout of Koha and attempt to log back in
=> Without this patch you got
Transaction aborted: DBIx::Class::Storage::DBI::mysql::_exec_svp_release(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_4 does not exist at /kohadevbox/koha/Koha/Object.pm line 170
. Rollback failed: DBIx::Class::Storage::DBI::mysql::_exec_svp_rollback(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_3 does not exist at /kohadevbox/koha/Koha/Patron.pm line 363 at /kohadevbox/koha/Koha/Patron.pm line 363
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
=> With this patch applied the login works successfully

QA Note: The test is not testing that the txn is rolledback, I didn't
manage to test that.

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-01-31 10:49:37 -03:00
Matthias Meusburger
60e6844bf0
Bug 25812: Fines can be displayed on SIP checkin/checkout
Test plan:

 - Enable show_outstanding_amount in SIPconfig.xml

 - Check that the total outstanding amout for the patron is displayed on SIP
   checkout (if it exists), for example:
   Patron has fines - You owe $10.00.

 - Check that the outstanding amout for a given item is displayed on SIP
   checkin (if it exists), for example:
   "You owe $10.00 for this item."

 - Check that it is not displayed when show_outstanding_amount is disabled.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-31 10:21:52 -03:00
0f15a74853
Bug 31095: Remove GetDebarments from Circulation.pm
This patch removes GetDebarments from Circulation.pm replacing them with
calls to $patron->restrictions and filtering using a chained search
call.

Test plan
1. Confirm that t/db_dependant/Circulation.t continues to pass

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-31 10:19:38 -03:00
Matthias Meusburger
909a3f5612
Bug 32431: Display expiry date on SIP checkout when patron is expired
Test plan:

 - Set up an expired patron
 - Do a SIP checkout
 - Check that the message is "Patron expired"
 - Apply the patch
 - Check that the message is "Patron expired on <correctly_formatted_date>"
 - Prove t//db_dependent/SIP/Transaction.t

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-30 15:07:37 -03:00
e19aa35f39
Bug 22042: Block all return actions when BlockReturnOfWithdrawn items is set to block
Currently this syspref only bokcs the literal 'return' from a patron, i.e. the checkin

It still processes transfers, refunds lost items, updates NotForLoan status etc.

We should block all of these things

To test:
1 - Set BlockReturnOfWithdrawn to block
2 - Set an item as lost and withdrawn
3 - Check it in
4 - Item is found
5 - Apply patch
6 - Repeat 1-3
7 - Checkin is blocked, item still lost

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2023-01-18 15:44:23 +00:00
Shi Yao Wang
a05bb1e36d
Bug 14784: Fix checkin message for restricted patrons
Test plan:
Before

1) Select a user with active indefinite or definite restrictions (manual restriction works)
2) Make sure finedays=0 for the user category. See [1]
3) Checkout and return an item (not overdue)
   A previous restriction reminder will appear
4) Checkout and return an overdue item (change the date at checkout)
   No previous restriction reminder will appear

After applying patch:
Same steps, but a reminder should appear for step 4)

[1] The "finedays" setting is called "Suspension in days" in the web interface, if you're searching for it like I did...

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2023-01-17 09:29:27 +00:00
16ce9086e3
Bug 32208: Adjust Auth.pm for relogin without perms
If a second login on top of a current session fails on
permissions, we should not grant access without context.

Test plan:
[1] Run t/db../Auth.t, it should pass now.
[2] Test interface with/without this patch:
    Pick two users: A has perms, B has not.
    Put two staff login forms in two tabs.
    Login as A in tab1. Login as B in tab2.
    Without this patch, B gets in and crashes.
    With this patch, B does not get in ('no perms').
    Bonus: Go to opac if on same domain. You are still
    logged in as B.

NOTE: I added a FIXME here, since you could argue about filling
the session info or otoh deleting the session. We present an
authorization failure; people may not realize that they are
still logged in (see test plan - bonus).

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-10 18:19:55 -03:00
43c7607fa1
Bug 31908: Resolve second login with another userid
Somewhere the line undef $userid got removed.
We need it to resolve the second login situation.

Test plan:
Login in staff with user missing privileges.
On the login form login again with another staff user.
Note that you do no longer crash.

Run t/db../Auth.t
Run t/db../Koha/Auth/TwoFactorAuth.t

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-10 18:19:01 -03:00
c70977f5fe
Bug 31908: Replace an exit by a safe_exit in Auth.pm L1314
No change in user experience. But since we can mock safe_exit,
we can enhance test results.

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

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-10 18:18:56 -03:00
2255d42abd
Bug 32456: Preserve date accessioned if a date is not explicitly passed
To test:
 1 - Edit an item record to have a blank date accessioned
 2 - Save the record as marcxml from the detail page
 3 - Edit the item to have an accession date
 4 - Stage and import the file - matching in KohaBiblio and replacing items
 5 - Import the file
 6 - Confirm the date accessioned is cleared
 7 - Apply patch
 8 - Provide an accession date for the item
 9 - Stage and import the file again
10 - Confirm the date remained
11 - Edit the item to remove the date
12 - Confirm you can manually blank the field

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-27 10:47:05 -03:00
aa13c1a9d1
Bug 20596: (QA follow-up) perltidy
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-15 09:52:17 -03:00
b2a23149bd
Bug 20596: Join authority queries together with OR
This patch joins authority queries together with OR like Elasticsearch.

To the best of the author's knowledge, this code only gets triggered
when using record matching rules, but there may be other situations
where it's used.

Authority search in cataloguing plugins use a different path, and
authority search in authority home doesn't allow multiple queries,
so they'll never trigger this OR joining of queries.

Test plan:
0. Apply patch and koha-plack --restart kohadev
1. Create a record matching rule with the following:
Matching rule code: NID
Description: NormdatenID
Match threshold: 100
Record type: Authority record
Search index: Any
Score: 101
Tag: 035
Subfields: a
Offset: 0
Length: 0
Normalization rule: None

Click "Remove this match check"

2. Stage gnd.xml (from BZ 20596 attachments)
- Choose "MARCXML" for "Format"
- Choose "Authority" for "Record type"
- Choose "NID" for "Record matching rule"
- Click "Stage for import"
3. Note the job gets to "100% Finished"
(Before this patch, it would say "0% Failed")

4. View the batch
5. Import the record
6. Repeat steps 2-4 and note that the record matching rule
worked

7. Go to http://localhost:8081/cgi-bin/koha/authorities/authorities-home.pl
8. Search for "e"
9. Note that the search works

10. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=
11. Click tab 6
12. Click on the tag editor next to "a Personal Name"
13. Type "e" into each box and click "Search"
14. Note that the search works

Signed-off-by: Jan Kissig <jan.kissig@th-wildau.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-15 09:52:16 -03:00
7502f520a4
Bug 32247: Exit holds queue builder if there are no holds on the biblio
update_queue_for_biblio currently
1 - gets the holds on a bib
2 - gets the items available to fill any holds
3 - combines these to build the queue, exiting if there are no holds or items

If there are no holds at step 1, we don't need to do step 2 or 3
This patch simply deletes the queue for this biblio, then exits if there are no holds

To test:
prove -v t/db_dependent/Reserves.t t/db_dependent/Koha/Item.t t/db_dependent/Koha/Hold.t t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t t/db_dependent/Koha/BackgroundJobs/BatchDeleteBiblio.t t/db_dependent/HoldsQueue.t t/db_dependent/Circulation_holdsqueue.t t/db_dependent/Biblio_holdsqueue.t t/db_dependent/Biblio.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-15 09:49:53 -03:00
Agustin Moyano
937b7114d0
Bug 32178: (follow-up) Transform 'staff' interface to 'intranet'
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-15 18:43:50 -03:00
Agustin Moyano
ca57674700
Bug 32178: Remove security breach introduced in bug 31378
This patch removes a security breach in C4::Auth::check_api_auth introduced by bug 31378, where when someone called an api with the parameters userid and auth_client_login, check_api_auth would automatically asume the user calling was that userid.

This patch also introduces C4::Auth::create_basic_session(), a function that creates a session and adds the minimum basic parameters.

Signed-off-by: David Cook <dcook@prosentient.com.au>

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>
2022-11-15 18:43:45 -03:00
Emmi Takkinen
a02813fb5b
Bug 31447: Use holds pick up branch in "Please confirm checkout" message
When one tries to check out item which has hold in it,
"Please confirm checkout" message uses patrons home library
instead of holds pick up library. It would be more logical
to use latter here.

To test:
1. Find record with holds.
2. For first priority hold, change it's pick up library to differ from patrons homebranch if needed.
3. Check out records item for a different patron.
=> Note that notice reads: "Item ... has been on hold for ... at [patrons homebranch] since ...".
4. Apply this patch.
5. Repeat steps 2 and 3.
=> Notice should now read: "Item ... has been on hold for ... at [holds pick up branch] since ...".

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Axelle Clarisse <axelle.clarisse@univ-amu.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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>
2022-11-14 09:25:10 -03:00
cc1502033c
Bug 32151: Resolve uninitialized warn in numeric ne in C4::Ris
We should not write:
    if ($kwfield != undef) {

Test plan:
Pick record with UTF8 chars.
Download via cart or shelf in RIS format.
Check your logs.

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>
2022-11-11 14:27:59 -03:00
Agustin Moyano
208b9b5ba7
Bug 31378: Add the API-based auth mechanism to C4::Auth::check_api_auth
Signed-off-by: Lukasz Koszyk <lukasz.koszyk@kit.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 14:30:46 -03:00
ef2977fd51
Bug 24860: Skip non-matching item group holds in HoldsQueue
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:39:57 -03:00
8cc9c705b1
Bug 24860: Skip non-matching item group holds in CheckReserves
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:39:56 -03:00
8efe22b770
Bug 24860: Add ability to select an item group when placing a hold
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:39:55 -03:00
9670e71b00
Bug 24860: Implement reserves.item_group_id
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:39:55 -03:00
Katrin Fischer
30efad72a4
Bug 31517: (QA follow-up) Fix indentation
Also removes commented out Data::Dumper.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:30:56 -03:00
Joonas Kylmälä
a8fdb3cfc4
Bug 31517: Remove unused get_tag function
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>
2022-11-04 19:30:56 -03:00
Joonas Kylmälä
e2b0387a2b
Bug 31517: Replace raw SQL queries in C4::Tags with Koha object accesses
To test:
 1) Create a few new tags to any biblio by visiting the biblio's detail
 page on OPAC
 2) The visit http://localhost:8080/cgi-bin/koha/opac-tags.pl and try
 deleting those tags.

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>
2022-11-04 19:30:56 -03:00
3fb5e43296
Bug 31889: Remove exported ghost routine from Biblio module
It has been moved to a Koha object.

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

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>
2022-11-04 19:21:20 -03:00
0f9fcb1087
Bug 29102: Remove ignore_found_holds
If not counting patrons holds, found or unfound, we no longer need this option
introduced by bug 28078

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>
2022-11-04 19:20:25 -03:00
689958b37b
Bug 29102: Do not count patron's own hold against limits
This patch makes three changes:
1 - The borrower's own holds are not counted towards HighHolds limit
2 - We exclude all hold counts from CanItemBeReserved
3 - Static mode should only decrease hold when over the decreaseLoanHighHoldsValue, not when equal

Previously a patron's hold could put the count over the threshhold, and
if the patron is only allowed 1 hold per record, and the hold wasn't found before
the checkout, it would make all items unholdable, thus lowering the theshhold for
dynamic HighHolds

To test:
 1 - Set sysaprefs:
     decreaseLoanHighHolds  - enable
     decreaseLoanHighHoldsDuration - 1
     decreaseLoanHighHoldsValue - 1
     decreaseLoanHighHoldsControl - "over the number of holdable items on the record" / dynamic
     decreaseLoanHighHoldsIgnoreStatuses - blank
 2 - Set circ rules to allow 1 hold per record and loan period of 5
 3 - Find/create a record with 3 items
 4 - Place a title level hold for two different patrons
 5 - Attempt to checkout item - note warning about high holds
 6 - Cancel checkout
 7 - Set decreaseLoanHighHoldsControl - "on the record" / static
 8 - Attempt checkout - note warning about high holds
 9 - Apply patch
10 - Checkout item - no warning
11 - checkin item, replace hold
12 - Set decreaseLoanHighHoldsControl - "over the number of holdable items on the record" / dynamic
13 - Checkout item - no warning
14 - prove t/db_dependent/DecreaseLoanHighHolds.t

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>
2022-11-04 19:20:24 -03:00
Joonas Kylmälä
8a63d78c4b
Bug 27259: Add HomeOrHoldingBranch checks where it was missing from
The TooMany() function and fine calculation functions were incorrectly
hard coded to use homebranch for fetching the circulation rules. Those
ignored completely the syspref HomeOrHoldingBranch where the user
might have set it to holdingbranch and therefore the fines and whether
patron has too many checkouts (TooMany()) were counted using the
unintended branch's rules. This problem only arises in the cases where
there are branch specific circulation rules defined.

Test plan:
1. Make sure following tests pass:
   $ prove t/db_dependent/Circulation/_CalculateAndUpdateFine.t
   $ prove t/db_dependent/Circulation/TooMany.t

Test plan for fines.pl:
1. Add branch specific fine rules for branches A and B. A having a
   fine of 1 per day and B having a fine of 0 per day.
2. Set sysprefs:
   CircControl = the library the items is from
   finesMode = Calculate and charge
   HomeOrHoldingBranch = holdingbranch
3. Create an item with home and holding branch of A
4. Checkout the item with a due date in the past (the past due date can be
   specified by clicking "Checkout settings" in the checkout page) and
   make sure the branch you are checking from is B.
5. Run perl /usr/share/koha/bin/cronjobs/fines.pl
6. Notice that fines have popped up now to the patron incorrectly
7. Apply patch
8. Pay fines, Check-in the item and check it out again
9. Run perl /usr/share/koha/bin/cronjobs/fines.pl
10. Notice that fine is now 0. This means that the branch
    B (holdingbranch of the checked-out item) specific rule is used.

Test plan for staticfines.pl:
1. Add branch specific fine rules for branches A and B. A having a
   fine of 1 per day and B having a fine of 0 per day.
2. Set sysprefs:
   CircControl = the library the items is from
   finesMode = Calculate and charge
   HomeOrHoldingBranch = holdingbranch
3. Create an item with homebranch A and holding branch of A
4. Checkout the item with a due date in the past (the past due date can be
   specified by clicking "Checkout settings" in the checkout page) and
   make sure the branch you are checking from is B.
5. Run perl staticfines.pl --library A --library B --category <PATRONS_CATEGORYCODE>
   and notice that now there is inccorectly fines
6. Apply patch
7. Pay fines, Check-in the item and check it out again
8. Run perl staticfines.pl --library A --library B --category <PATRONS_CATEGORYCODE>
    and notice the fines are now not generated

Rebased-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:04:18 -03:00
68d5b50c62
Bug 32066: Check 2FA pref in check_cookie_auth
Test plan:

Without this patch:
1. Set the syspref TwoFactorAuthentication (enforce or enabled)
2. Configure 2FA for a patron
3. Logout
4. Authenticate but don't enter the 2FA code
5. Switch off the syspref (disabled) [via another browser or so]
6. Patron is stuck on the [original] login screen. [Only removing
   the session cookie would resolve it.]

With this patch:
1. Follow the steps above again. But note that you can refresh
   your browser window to get in now.
2. Verify that Auth.t passes now too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:02:38 -03:00
Aleisha Amohia
e1a02dde8f
Bug 31963: Only show hold fee msg on OPAC if patron will be charged
This patch ensures HoldFeeMode is considered when displaying a message
to patrons on the OPAC that says they'll be charged a hold fee when
placing or collecting the hold.

When HoldFeeMode is set to not_always or "only if all items are checked
out and the record has at least one hold already" then the hold fee
message should only show if all items on the record are checked out, AND
the record has at least one hold already - both of these conditions must
be met.

To test:
1. Go to Administration -> Patron categories
2. Edit your patron category and give a hold fee of $1.
3. Go to Administration -> System preferences and search for
HoldFeeMode. Set to 'only if all items are checked out and the record
has at least one hold already' if not already set. Keep this tab open.
4. In another tab, open the OPAC.
5. Search the OPAC for a record with one item which is NOT checked out.
6. Go to place a hold on this record. Confirm you see a message saying
that you will be charged a hold fee, even though not all items are
checked out and the record does not have a hold --> This is the bug.

7. Apply patch and restart services.

Items available, no holds placed

8. Repeat steps 5-6. This time, you should NOT see the hold fee message.

Items available, holds placed

9. In your staff interface tab, find the same record.
10. Place a hold for a different patron on this record.
11. In your OPAC tab, find this record again and go to place a hold. You
should NOT see the hold fee message.

No items available, no holds placed

12. In your staff interface tab, cancel the hold placed on this record.
13. Check out the item to a different patron.
14. In your OPAC tab, find this record again and go to place a hold. You
should NOT see the hold fee message.

No items available, holds placed

15. In your staff interface tab, keep the item checked out to another
patron.
16. Place a hold for a third patron on this record.
17. In your OPAC tab, find this record again and go to place a hold. You
SHOULD see the hold fee message.

Multiple holds

18. Search the OPAC for a record. Make sure your search will return more
than one result, including our test record.
19. Check the checkbox for our test record, plus another record where
the item is not checked out.
20. Click the Place hold button to place holds on all of our selected
records. You should only see the hold fee message above our test record.

21. In your staff interface tab, test setting HoldFeeMode to the other
values and confirm the hold message shows on the OPAC as expected.
22. Confirm tests pass t/db_dependent/Reserves/GetReserveFee.t

Sponsored-by: Horowhenua Libraries Trust

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>
2022-11-02 19:40:23 -03:00
Emmi Takkinen
89e2f5bc22
Bug 30407: Add ability to syspref UpdateNotForLoanStatusOnCheckin to show only the notforloan values description
This can be used to instruct staff how the item should handled when
it's checked in. For example items notforloan status has been
changed as "Invoiced item" while item has been on loan. When it's
checked in staff sees that they should put item aside for further
processing.

To test:
1. Apply patch and update database if needed
2. Set items notforloan status as -1 (or create new one)
3. Add line "-1: ONLYMESSAGE" to UpdateNotForLoanStatusOnCheckin
4. Check item out for patron.
5. Check item in.
=> Description of notforloan status should be displayed.
=> Confirm notforloan status hasn't changed.

Also prove t/db_dependent/Circulation/issue.t

Sponsored-by: Koha-Suomi Oy

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-27 13:26:04 -03:00
Aleisha Amohia
d4556b786d
Bug 23012: Apply processing fee return policy when lost item found
This enhancement gives the ability to set a policy for the lost item
processing fee that may get charged additional to the lost item
replacement cost. The processing fee can be:
- refunded
- refunded if unpaid
- kept

To test:

Set-up

1. Find an item, Item A. Go to Administration -> Item types and edit the
item type for Item A. Add a default replacement cost and a processing
fee and Save.
2. Go to Administration -> system preferences and set the following:
- WhenLostChargeReplacementFee: Charge
- BlockReturnOfLostItems: Don't block
3. Scroll down to the default lost item fee refund on return policy. Set
the refund lost item replacement fee policy to 'refund lost item charge'.
4. Edit Item A and set a replacement cost.

Reproduce

5. Check out Item A to Patron A.
6. Click the barcode to view Item A's information. Edit Item A and set
the Lost status to 'lost'.
7. Go back to Patron A's checkouts. The item should now be checked in
with two new charges applied - a lost item fee (the item's replacement
cost) and a lost item processing fee (set in item types).
8. Check in Item A to mark it as found.
9. Go back to Patron A's account. Notice the lost item fee has been
refunded, but the processing fee remains.
10. Manually pay or write off the processing fee. This enhancement
removes the need for this manual step.

11. Apply the patch and restart services

Test with lost item - refund

12. Go to Administration -> circulation and fines rules. Scroll down to
the default lost item fee refund on return policy. Notice there is now a
refund lost item processing fee policy. Set this to 'refund lost item
processing charge'.
13. Repeat steps 6 to 9.
14. Go back to Patron A's account. Both the lost item fee and processing
fee should have been refunded.

15. Repeat steps 6 to 8 (do not check it yet).
16. Go back to Patron A's account. Pay the processing fee.
17. Repeat step 9.
18. Go back to Patron A's account. Both the lost item fee and processing
fee should have been refunded (you'll now be in a credit because the
paid processing fee was also refunded).

Test with lost item - refund_unpaid

19. Go to Administration -> circulation and fines rules. Scroll down to
the default lost item fee refund on return policy. Notice there is now a
refund lost item processing fee policy. Set this to 'refund lost item
processing charge (only if unpaid)'.
20. Repeat steps 6 to 9.
21. Go back to Patron A's account. Both the lost item fee and processing
fee should have been refunded.

22. Repeat steps 16 to 19.
23. Go back to Patron A's account. The lost item fee should have been
refunded but not the processing fee, as this was already paid.

Test with lost item - leave

24. Go to Administration -> circulation and fines rules. Scroll down to
the default lost item fee refund on return policy. Notice there is now a
refund lost item processing fee policy. Set this to 'leave lost item
processing charge'.
25. Repeat steps 6 to 9.
26. Go back to Patron A's account. The lost item fee and processing fee
should have been refunded but not the processing fee.

Other tests

27. Confirm tests pass
- t/db_dependent/Koha/Item.t
- t/db_dependent/Koha/CirculationRules.t

Sponsored-by: Auckland University of Technology

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>
2022-10-24 17:43:29 -03:00
54d7f8b174
Bug 31495: Allow opac-page when enforcing GDPR policy
Test plan:
Add some page under Additional contents.
Enforce GDPR policy.
Test with user that has no consent (yet or anymore).
Check if you can reach additional contents with opac-page.pl.

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

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-24 17:29:45 -03:00
d7d33744ba
Bug 19693: (QA follow-up) Replace changed tag test
The test
  $MARCfrom->field('1..', '2..'))[0]->tag ne ($MARCto->field('1..', '2..'))[0]->tag
is not completely consistent with following code in sub merge.
I decided to get the authtype code from the old record that comes
from Koha and should include the type.
Remaining changes refer to indentation/comments.

Test plan:
Run t/db_dependent/Authority/Merge.t
Note: The test actually could be extended a bit for mocking MARC
flavor, but needs some additional framework support to work.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-24 17:20:26 -03:00
Janusz Kaczmarek
03da66ce20
Bug 19693: Update of an authority record creates inconsistency when the heading tag is changed
In those rare cases when authorities are updated by an external agency (or
even internally, by reviewing and correcting an exported authority file)
when the heading tag will be changed (seems odd but happens:

111 Congress ==> 110 Corporate body.Congress ;
100 Person ==> 110 Corporate body (a company named with person's name ;
151 City--object ==> 150 Object (city) etc.)

and then the authority record in Koha database will be updated with
bulkmarcimport or by calling directly ModAuthority from a custom script,
the merge function "doesn't know" that the change to the authority type
has been made and, consequently, doesn't adequately change the tag in
related fields in biblio records (as it would if two different records
with different authtypecode were merged with Koha interface).

This is because at the moment when merge function is being called
by ModAuthority:
Koha::Authority::Types->find($autfrom->authtypecode)
Koha::Authority::Types->find($authto->authtypecode)
both have the same value (because $mergefrom == $mergeto).

Therefore in case when $mergefrom == $mergeto and the heading tag changes,
$authtypefrom and $authfrom calculated in merge in the ordinar way are
misleading and should not be taken unto consideration.

Test plan:
==========

1. run t/db_dependent/Authority/Merge.t
2. you should see problems in "Test update A with modified heading tag
   (changing authtype)"
3. apply the patch
4. run t/db_dependent/Authority/Merge.t again
5. the test should pass

Alternatively:

1. have an authority record used in biblio;
   export it to file;
   change 1XX heading tag to a different (but reasonable) value
   and possibly change also the content of the heading
   (one can delete also 942 but it doesn't matter);
   make bulkmarcimport.pl -a -update -file <modified_auth_file> and
   see that the tag in biblio record has not been changed (whereas
   the type of authority record did change);

2. make orders in database (so that the authority type and the tag of
   the field in biblio record correspond); apply the patch;

3. repeat the test from 1.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-24 17:20:25 -03:00
77eba5d1b2
Bug 31115: Add additional_attributes support to GetInvoices
This patch adds support for searching additional_fields when retrieving
invoices using C4::Acquisition::Invoices.

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

Sponsored-by: The Research University in the Helmholtz Association (KIT)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-24 14:11:07 -03:00
ad6530b914
Bug 30588: (QA follow-up) Clear waiting-for-2FA-setup in session
If we do not clear this session, the first login directly after setup
does not really enhances user experience ;)

Test plan:
Make sure 2FA is enforced.
Test the above. Disable your 2FA, logout and login.
Verify that you can access pages with this patch now. Without this
patch you could not.
Run these tests to provide more confidence:
t/db_dependent/Auth.t
t/db_dependent/api/v1/two_factor_auth.t
t/db_dependent/Koha/Auth/TwoFactorAuth.t

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:37:02 -03:00
316355e8d5
Bug 30588: (QA follow-up) Auth - remove two warns and second logout
Resolves:
Use of uninitialized value $request_method in string eq at /usr/share/koha/C4/Auth.pm line 1122.
Use of uninitialized value $return in numeric gt (>) at /usr/share/koha/C4/Auth.pm line 1155.

We also remove the double logout from Auth.t

Test plan:
Run t/db_dependent/Auth.t
Check if you do not see the warns anymore.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:37:00 -03:00
b93e15c235
Bug 30588: Add the option to require 2FA setup on first staff login
Bug 28786 added the ability to turn on a two-factor authentication,
using a One Time Password (OTP).
Once enabled on the system, librarian had the choice to enable or
disable it for themselves.
For security reason an administrator could decide to force the
librarians to use this second authentication step.

This patch adds a third option to the existing syspref, 'Enforced', for
that purpose.

QA notes: the code we had in the members/two_factor_auth.pl controller
has been moved to REST API controller methods (with their tests and
swagger specs), for reusability reason. Code from template has been
moved to an include file for the same reason.

Test plan:
A. Regression tests
As we modified the code we need first to confirm the existing features
are still working as expected.
1. Turn off TwoFactorAuthentication (disabled) and confirm that you are not able to
enable and access the second authentication step
2. Turn it on (enabled) and confirm that you are able to enable it in your account
3. Logout and confirm then that you are able to login into Koha

B. The new option
1. Set the pref to "enforced"
2. You are not logged out, logged in users stay logged in
3. Pick a user that does not have 2FA setup, login
4. Notice the new screen (UI is a bit ugly, suggestions welcomed)
5. Try to access Koha without enabling 2FA, you shouldn't be able to
access any pages
6. Setup 2FA and confirm that you are redirected to the login screen
7. Login, send the correct pin code
=> You are fully logged in!

Note that at 6 we could redirect to the mainpage, without the need to
login again, but I think it's preferable to reduce the change to
C4::Auth. If it's considered mandatory by QA I could have a look on
another bug report.

Sponsored-by: Rijksmuseum, Netherlands

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:36:57 -03:00
8511750de9
Bug 30588: Adjust existing occurrences of TwoFactorAuthentication
We need to replace 0 with 'disabled', and 1 with 'enabled'

Sponsored-by: Rijksmuseum, Netherlands

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:36:56 -03:00
f5271d1a74
Bug 17170: Add the ability to create 'saved searches' for use as filters when searching the catalog
This patch alters the code in the ES QueryBuilder. Reflecting
how things are handled in build_query_compat we clean the query,
but not the limits. In Zebra we simply recursivly call buildQuery,
but the ES query structure

This patchset adds a new ability to save searches on the staff client, and display them in the results
page on staff or opac as a new filter.

New filters can be added from the results page after a search, and there is an admin page for updating
deleting and renaming filters

There is a new permission to control management of these filters

New filters can be added that are not displayed along with facets, this allows for building custom links
using these filters to keep URLs shorter

Due to bug 30528 testing in ES is recommended

To test:
 1 - Apply patches and update database and restart all
 2 - Enable new system preference 'SavedSearchFilters'
 3 - As superlibrarian perform a search in staff client, something broad like 'a'
 4 - Note new 'Save search as filter' link on results page
 5 - Click it, save search as new filter, check 'Staff client' visibility
 6 - Perform another search
 7 - Note the filter now appears above facets
 8 - Click to it filter results
 9 - Note results are limited by the new filter, and it is checked in the facets
10 - Confirm click the [x] removes the filter
11 - Go to administration->search filters
12 - Confirm the filter appears
13 - Edit and mark as OPAC visible
14 - Test OPAC to ensure it shows and can be applied/removed
15 - Copy URL with filter applied
16 - In adminsitration mark filter as not visible on staff or opac
17 - Confirm link above still works
18 - Create a new staff with catalogue and search filters permission
19 - Ensure they can access/save filters
20 - Remove filter permission and ensure they cannot
21 - Disable system preference
22 - Confirm links to search filters page are removed from admin home and admin sidebar
23 - Confirm filters do not appear on results and cannot be created
24 - Enable pref
25 - Create a filter
26 - From search filters page, click 'Edit search'
27 - Confirm you are taken to advanced search page letting you know which filter you are editing
28 - Confirm you can change searhc options and save
29 - Confirm you can perform the search from this page

Sponsored-by: Sponsored by: Round Rock Public Library [https://www.roundrocktexas.gov/departments/library/]

Signed-off-by: Michal Urban <michalurban177@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:15:18 -03:00
a97a6b28d2
Bug 17170: Handle search filters in query builders
This patch updates the query building code to expand filters when searching
and pass them back as part of the cgi and descriptive search strings

Sponsored-by: Sponsored by: Round Rock Public Library [https://www.roundrocktexas.gov/departments/library/]

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:15:16 -03:00
de4255e928
Bug 28375: (follow-up) Use C4::Context->interface
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-20 11:50:53 -03:00
1dc979af7c
Bug 28375: (follow-up) Remove guessed interface parameter - always pass
Previous patch added interface parameter passed on each call. There was an
existing one that 'guessed' - this patch removes that

Fixes missing comma

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-20 11:50:53 -03:00
70325d48a0
Bug 28375: Inefficiencies in fetching COinS
This patchset adds an 'interface' parameter to XSLTParseForDisplay to avoid fetching
coins when not needed

Additionally we move some logic from the scripts to searchResults to avoid an extra fetch fo the biblio object

To test:
1 - Enable  COinSinOPACResults syspref
2 - Also enable  OPACShowOpenURL  and  OPACOpenURLItemTypes  - adding an itemtype that you can find
3 - Perform a search on the OPAC and confirm coins are included and openurl shown
4 - Perform a search on staff client and confirm openurls do not show
5 - Apply patch
6 - Results should be the same

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-20 11:50:53 -03:00
9bc996be91
Bug 31626: Add letter id to the message queue table
It can be useful to know exactly what template was used to generate a notice. To this end, it would be useful to store the letter id as a foreign key in the message queue table.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Restart all the things!
4) Run an action that will send a notice to a patron
5) Note the letter id is now in the message_queue table for that notice!

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-18 09:41:41 -03:00