koha.git
8 months agoBug 34645: (follow-up) save sort1 and sort2 in order
Nick Clemens [Mon, 25 Sep 2023 13:12:40 +0000 (13:12 +0000)]
Bug 34645: (follow-up) save sort1 and sort2 in order

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>
8 months agoBug 34645: always use discount, sort1, and sort2 from MarcFieldsToOrder
Nick Clemens [Mon, 18 Sep 2023 16:32:10 +0000 (16:32 +0000)]
Bug 34645: always use discount, sort1, and sort2 from MarcFieldsToOrder

These values are stored at the order level, not per item. This patch simply sets the order values from the values retrieved from MarcFieldsToOrder even inf MarcItemFields to order is being used for other fields

To test:
Setup -- Set systempreferences below

MarcFieldsToOrder:
price: 949$g
quantity: 949$k
budget_code: 949$l
discount: 949$m
sort1: 949$n
sort2: 949$q

MarcItemFieldsToOrder:
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
price: 949$g
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l

Stage the attached bib-303.marcxml file
Add to basket from the staged file
Note that discount and sort1 and sort2 are not populated per the Marc
Apply patch, restart all
Stage and add to basket again
Confirm discount and sort1 and sort2 are populated correctly

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>
8 months agoBug 34911: Test files from HEAD instead of 'master'
Jonathan Druart [Tue, 26 Sep 2023 08:27:57 +0000 (10:27 +0200)]
Bug 34911: Test files from HEAD instead of 'master'

Since bug 34303 the test suite (when ran on jenkins) is no longer testing Perl::Critic

koha_1       | fatal: Not a valid object name master
koha_1       | [14:58:14] t/00-testcritic.t

We are not cloning the whole repo and "master" is not available. Additionally we do not want to test master's files on stable branches anyway...

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34932: Patron.t - Pass borrowernumber of manager to userenv
Marcel de Rooy [Wed, 27 Sep 2023 12:48:27 +0000 (14:48 +0200)]
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>
9 months agoBug 34967: Move to db_dependent
Marcel de Rooy [Fri, 29 Sep 2023 16:02:46 +0000 (16:02 +0000)]
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>
9 months agoBug 34967: Add sample biblios and tidy some lines
Marcel de Rooy [Fri, 29 Sep 2023 16:01:13 +0000 (16:01 +0000)]
Bug 34967: Add sample biblios and tidy some lines

Test plan:
Run t/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>
9 months agoBug 34967: Remove Test::DBIx::Class
Marcel de Rooy [Fri, 29 Sep 2023 15:52:35 +0000 (15:52 +0000)]
Bug 34967: Remove Test::DBIx::Class

Move everything in one subtest

Test plan:
Run t/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>
9 months agoBug 34801: Fix incorrect use of __() in .tt and .inc files (bug 34038 follow-up)
Matt Blenkinsop [Fri, 15 Sep 2023 10:27:39 +0000 (10:27 +0000)]
Bug 34801: Fix incorrect use of __() in .tt and .inc files (bug 34038 follow-up)

__() should be used in .js files, not .tt files

To test, apply the patch and update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, in this case
  misc/translator/po/fr-FR-staff-prog.po
- Confirm that the strings are now in the .po file for translation. You
  should find the lines in the commit

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34917: Fix default sort column of table in suggestion.tt
Jacob O'Mara [Tue, 26 Sep 2023 14:19:45 +0000 (15:19 +0100)]
Bug 34917: Fix default sort column of table in suggestion.tt

Test plan:
1. Navigate to Acquisitions and load the suggestions management page
2. Ensure that there are some suggestions in the table
3. Observe that the default sort is on the "Suggester Category" column
4. Apply Patch
5. Observe that the default sort is now on the "Suggested on" column
   instead

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34389: Fix inconsistencies in debit types titles, breadcrumbs, and header
Owen Leonard [Mon, 2 Oct 2023 15:43:29 +0000 (15:43 +0000)]
Bug 34389: Fix inconsistencies in debit types titles, breadcrumbs, and header

This patch fixes a couple of inconsistencies in the debit types
administration page, making sure the page title, breadcrumb
navigation, and page headers are consistent with each other.

To test, apply the patch and go to Administration -> Debit types. Test
each variation of the page:

- Main page
- New debit type
- Modify debit type

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>
9 months agoBug 34391: Fix inconsistencies in cash registers titles, breadcrumbs, and headers
Owen Leonard [Mon, 2 Oct 2023 16:14:21 +0000 (16:14 +0000)]
Bug 34391: Fix inconsistencies in cash registers titles, breadcrumbs, and headers

Fix inconsistencies in cash register page titles, breadcrumbs, and
header

This patch fixes a couple of inconsistencies in the cash register
administration page, making sure the page title, breadcrumb
navigation, and page headers are consistent with each other.

To test, apply the patch and go to Administration -> Cash register. Test
each variation of the page:

- Main page
- New cash register
- Modify cash register

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>
9 months agoBug 34942: Fix typo - 'brower' to 'browser'
David Nind [Sat, 30 Sep 2023 09:03:06 +0000 (09:03 +0000)]
Bug 34942: Fix typo - 'brower' to 'browser'

This fixes a typo in a message used in the advanced cataloguing
editor when macros are converted from being stored in the browser to
being stored in the database (bug 17268 - Advanced cataloging editor
- rancor - macros are lost when browser storage cleared).

Test plan:
1. Search for 'brower' in the codebase - there should be one occurance:
   grep -rn --exclude=*.po brower *
2. Apply the patch.
3. Run the search in step 1 again, there should now be no occurances.
4. Review the diff for the patch a nd make sure that the change makes
   sense.
5. Sign off! 8-)

Signed-off-by: David Nind <david@davidnind.com>
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>
9 months agoBug 27634: Fix self_registration.t
Jonathan Druart [Tue, 26 Sep 2023 09:35:45 +0000 (11:35 +0200)]
Bug 27634: Fix self_registration.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29145: DBRev 23.06.00.027
Tomas Cohen Arazi [Tue, 3 Oct 2023 13:05:50 +0000 (09:05 -0400)]
Bug 29145: DBRev 23.06.00.027

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29145: (QA follow-up) Add +x to atomicupdate file
Katrin Fischer [Fri, 29 Sep 2023 13:57:28 +0000 (13:57 +0000)]
Bug 29145: (QA follow-up) Add +x to atomicupdate file

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29145: (QA follow-up) Fix tests removing 'unblessed'
Katrin Fischer [Fri, 29 Sep 2023 13:49:47 +0000 (13:49 +0000)]
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>
9 months agoBug 29145: Perltidy files and added code
Katrin Fischer [Fri, 21 Jul 2023 16:31:53 +0000 (16:31 +0000)]
Bug 29145: Perltidy files and added code

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29145: Replace GetDebarments in unit tests
Katrin Fischer [Fri, 21 Jul 2023 16:05:11 +0000 (16:05 +0000)]
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>
9 months agoBug 29145: (QA follow-up) Remove debugging line
Kyle M Hall [Fri, 27 Jan 2023 14:37:28 +0000 (14:37 +0000)]
Bug 29145: (QA follow-up) Remove debugging line

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29145: (QA follow-up) Use objects instead of straight SQL queries
Kyle M Hall [Fri, 27 Jan 2023 14:36:40 +0000 (14:36 +0000)]
Bug 29145: (QA follow-up) Use objects instead of straight SQL queries

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29145: (QA follow-up) Rename has_debarring_overdues to has_restricting_overdues
Kyle M Hall [Fri, 27 Jan 2023 14:22:59 +0000 (09:22 -0500)]
Bug 29145: (QA follow-up) Rename has_debarring_overdues to has_restricting_overdues

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29145: (QA follow-up) Fix typo
Kyle M Hall [Fri, 27 Jan 2023 11:28:13 +0000 (11:28 +0000)]
Bug 29145: (QA follow-up) Fix typo

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29145: (QA follow-up) Add missing POD and don't return undef
David Gustafsson [Fri, 4 Nov 2022 14:16:17 +0000 (15:16 +0100)]
Bug 29145: (QA follow-up) Add missing POD and don't return undef

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29145: (QA follow-up) Fix missing bug number in database update and typos
Katrin Fischer [Sun, 30 Oct 2022 10:54:20 +0000 (10:54 +0000)]
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>
9 months agoBug 29145: Fix conditions for patron debarring overdues
David Gustafsson [Thu, 13 Oct 2022 11:20:12 +0000 (13:20 +0200)]
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>
9 months agoBug 29145: Add tests and modify sysprefs
David Gustafsson [Wed, 21 Sep 2022 14:09:51 +0000 (16:09 +0200)]
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>
9 months agoBug 29145: use overdues restrict delays when removing overdues restriction upon return
Stefan Berndtsson [Thu, 8 Feb 2018 14:54:44 +0000 (15:54 +0100)]
Bug 29145: use overdues restrict delays when removing overdues restriction upon return

How to test:
1) Run tests in t/db_dependent/Circulation/MarkIssueReturned.t

Sponsored by: Gothenburg University Library

Signed-off-by: Michaela <michaela.sieber@kit.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34918: Fix userenv for safe_to_delete tests
Marcel de Rooy [Wed, 27 Sep 2023 10:43:04 +0000 (10:43 +0000)]
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>
9 months agoBug 34918: Fix hardcoded borrowernumber 42
Marcel de Rooy [Tue, 26 Sep 2023 14:42:08 +0000 (14:42 +0000)]
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>
9 months agoBug 34930: Change timezone in Koha/Object.t where tests assume it
Marcel de Rooy [Wed, 27 Sep 2023 11:57:49 +0000 (13:57 +0200)]
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>
9 months agoBug 34489: Fix timezone problem in Patrons.t
Marcel de Rooy [Wed, 27 Sep 2023 12:13:45 +0000 (14:13 +0200)]
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>
9 months agoBug 34934: Remove the use of event attributes from OPAC lists page
Owen Leonard [Wed, 27 Sep 2023 15:42:26 +0000 (15:42 +0000)]
Bug 34934: Remove the use of event attributes from OPAC lists page

This patch removes the use of event attributes (onclick, onchange) from
the OPAC lists template. These events are defined now along with the
other in-page JS.

The patch also removes a "delete list" button which was only shown
when viewing an empty list and which was redundant.

To test, apply the patch and log into the OPAC.

- Go to Lists -> New list.
- Change the category to "Private" and the "Allow changes" dropdown to
  "Staff only."
  - You should see a message, 'The "Staff only" permission has no actual
    effect while this list is strictly private'
- Change the category to "Public." The message should disappear.

- View the contents of a list.
  - Click the "Send list" button at the top of the table of titles.
  - It should trigger the "Sending your list" popup window.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34936: Remove the use of event attributes from OPAC detail page
Owen Leonard [Wed, 27 Sep 2023 16:26:03 +0000 (16:26 +0000)]
Bug 34936: Remove the use of event attributes from OPAC detail page

This patch removes the use of event attributes (onclick) from the OPAC's
bibliographic detail page template. These events are defined now along
with the other in-page JS.

The patch also adjusts the global "Dopop" function so that the popup
window is a litte bigger. The comments form did not fit well.

In checking for use of the "Dopop" function I found that it was being
redefined in opac-topissues.tt for no reason so I removed it.

To test you must have the OPACComments system preference enabled.

- Log in to the OPAC, locate a bibliographic record, and view the detail
  page.
- Under the "Comments" tab, click the "Post your comments on this title"
  link. It should trigger a popup window.
  - Submit your comment. When the detail page reloads, return to the
    "Comments" tab and click the "Edit" link on your comment. The same
    popup window should be triggered.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33074: Take ReservesControlBranch into account in opac-reserve.pl
Julian Maurice [Mon, 27 Feb 2023 09:05:44 +0000 (10:05 +0100)]
Bug 33074: Take ReservesControlBranch into account in opac-reserve.pl

Test plan:
1. Set system preferences:
   - Disable OPACAllowUserToChooseBranch
   - Set ReservesControlBranch to "item's home library"
   - Enable UseBranchTransferLimits
   - Set BranchTransferLimitsType to "item type"
   - Enable canreservefromotherbranches
   - Disable IndependantBranches
2. Create two libraries: ITEM_LIB and PATRON_LIB
3. Set circulation rules:
   - Remove all circulation rules (DELETE FROM circulation_rules)
   - Set a default rule that allow some holds and with "OPAC item level
     holds" = "force". Allow "on shelf" holds for easier testing.
   - In the rules for ITEM_LIB, under "Default checkout, hold and return
     policy",
     - set "Hold policy" to "From any library"
     - set "Hold pickup library match" to "item's home library"
   - In the rules for PATRON_LIB, under "Default checkout, hold and
     return policy",
     - set "Hold policy" to "From any library",
     - set "Hold pickup library match" to "any library"
4. In "Library transfer limits" disable all transfers from ITEM_LIB to
   PATRON_LIB for an item type (let's say "BOOK")
5. Create a biblio with an item:
   - item type must be the same as in previous step ("BOOK")
   - home branch and holding branch must be ITEM_LIB
6. Create a patron at PATRON_LIB, give it a password so it can log in.
7. Go to OPAC, and login with this patron
8. Try to place a hold for the new item. You should be allowed to place
   a hold, but when doing it, no holds will be created.
9. Apply patch, restart Koha
10. Try to place a hold for the new item. This time the hold should be
    created

Signed-off-by: Jessie Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Merged tidy patch and switch to Koha::Policy::Holds here.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34842: Fix Illrequest/Config.t if DB upgraded twice
Jonathan Druart [Fri, 22 Sep 2023 12:59:54 +0000 (14:59 +0200)]
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>
9 months agoBug 34836: Add patron check to isbd and marc detail pages
Pedro Amorim [Mon, 25 Sep 2023 10:21:36 +0000 (10:21 +0000)]
Bug 34836: Add patron check to isbd and marc detail pages

Test plan:
- Go to circulation rules and set On shelf holds allowed to If all unavailable
- Log out
- Visit a MARC detail or ISBD detail bib record on OPAC:
http://localhost:8080/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=76
http://localhost:8080/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=76
- Notice it blows up with error 500, on both occasions
- Apply patch. Repeat.

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>
9 months agoBug 34369: Fix 'Did you mean'
Jonathan Druart [Thu, 3 Aug 2023 08:01:32 +0000 (10:01 +0200)]
Bug 34369: Fix 'Did you mean'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34369: Pass csrf token from syspref API client (for Vue app)
Jonathan Druart [Tue, 1 Aug 2023 07:12:10 +0000 (09:12 +0200)]
Bug 34369: Pass csrf token from syspref API client (for Vue app)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34369: Require CSRF token for updating system preferences
David Cook [Tue, 1 Aug 2023 06:56:23 +0000 (06:56 +0000)]
Bug 34369: Require CSRF token for updating system preferences

This patch adds the requirements that updating a system preference
requires a CSRF token. (Also, adding and deleting local system preferences.)

0. Apply patch
1. koha-plack --reload kohadev
2. Add local system preference
3. Update local system preference
4. Delete local system preference
5. Update normal system preference
6. Note no errors

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34761: Prevent XSS for searches and saved search filters
David Cook [Wed, 13 Sep 2023 01:33:43 +0000 (01:33 +0000)]
Bug 34761: Prevent XSS for searches and saved search filters

</script> tags are interpreted in JSON strings as HTML, which can
lead to XSS attacks.

This patch puts HTML escaped JSON in the value of a hidden HTML element.
The Javascript then takes the value as a string, parses it as JSON,
and is able to use it to save search filters without triggering a
XSS attack.

This patch also adds DataTable's built-in HTML escaping for the query
and limits on the admin UI for the search filters.

Test plan:
0. Apply patch
1. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=SavedSearchFilters
2. Enable the system preference
3. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=e
4. Click "Save search as filter"
5. Checkbox "Show in staff interface?"
6. Type "E-TEST" into box and click 'Save'
7. Go to
http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=e
8. Click "E-TEST" under "Custom search filters"
9. Note that you see search results
10. Go to
http://localhost:8081/cgi-bin/koha/admin/search_filters.pl
11. Note that for "E-TEST" you see a "Query" like
{"operators":[],"operands":["e"],"indexes":[]}
12. Note that for "E-TEST" you see a "Limits" like
{"limits":[]}

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34349: Validate/escape inputs for task scheduler
David Cook [Mon, 24 Jul 2023 04:31:15 +0000 (04:31 +0000)]
Bug 34349: Validate/escape inputs for task scheduler

This change validates and escapes inputs for task scheduler.

Test plan:
0. Apply patch
1. koha-plack --reload kohadev
2. Go to http://localhost:8081/cgi-bin/koha/tools/scheduler.pl
3. Input a time a minute in the future and leave the date blank
4. Choose an existing report and output format
5. Type a malicious string which is also a valid email address
into the Email field
6. Click "Save"
7. Note that the job is added but the Email is wrapped in single
quotes
8. Try using a non-malicious email address with a single quote.
9. Note that the single quote is escaped, so that it will still
be used by runreport.pl

JD amended patch: tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Removed pars for $email =~ regex, removed old commented lines.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34513: (QA follow-up) Tidy
Nick Clemens [Thu, 24 Aug 2023 18:19:37 +0000 (18:19 +0000)]
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>
9 months agoBug 34513: Add checkauth unit test for resetting auth state when changing users
David Cook [Wed, 16 Aug 2023 02:51:43 +0000 (02:51 +0000)]
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>
9 months agoBug 34513: Add end-to-end test for authorization check after first failed authorization
David Cook [Wed, 16 Aug 2023 02:21:40 +0000 (02:21 +0000)]
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>
9 months agoBug 34513: Set auth state correctly when changing auth sessions
David Cook [Fri, 11 Aug 2023 03:03:01 +0000 (03:03 +0000)]
Bug 34513: Set auth state correctly when changing auth sessions

This patch sets the $auth_state to failed when changing auth sessions,
so that the new login attempt gets processed correctly (instead
of skipping the authorization step).

Test plan:
0. Apply the patch
1. koha-plack --reload kohadev
2. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=baseurl
3. Log in as an OPAC user with 0 permissions
4. Note the auth screen "Error: You do not have permission to access this page"
5. Click "Log in"
6. Note that you're still shown a login screen (and that you've been logged out of
your previous authenticated session)

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>
9 months agoBug 34653: Make koha-foreach return the correct status code
Evan Giles [Fri, 1 Sep 2023 06:42:45 +0000 (18:42 +1200)]
Bug 34653: Make koha-foreach return the correct status code

I think the correct behavior for this script should be that koha-foreach
will return 0 (success) if all the commands it tried to run succeeded, but
1 (failure) if any of the commands failed.

To test:
1. $ koha-create --create-db test
2. $ vi test.sh
if [ $USER = 'kohadev-koha' ]; then
    echo "FAILED";
    exit 1;
else
    echo "SUCCESS";
    exit 0;
fi

3. $ debian/scripts/koha-foreach sh test.sh
FAILED
kohadev: 1 status returned by "sh test.sh"
SUCCESS
4. $ echo $?
5. Note that the exit status is 0 (success)

6. Apply patch

7. $ debian/scripts/koha-foreach sh test.sh
FAILED
kohadev: 1 status returned by "sh test.sh"
SUCCESS
8. $ echo $?
9. Note that the exit status is 1 (failure)

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>
9 months agoBug 30843: Add unit test for Koha::Auth::TwoFactorAuth::verify
David Cook [Fri, 8 Sep 2023 01:53:38 +0000 (01:53 +0000)]
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>
9 months agoBug 30843: Add mfa_range configuration option for TOTP
David Cook [Wed, 6 Sep 2023 05:12:50 +0000 (05:12 +0000)]
Bug 30843: Add mfa_range configuration option for TOTP

This change adds a mfa_range configuration option for TOTP
to koha-conf.xml, and overrides the "verify" method from
Auth::GoogleAuth in order to provide a new default for "range"

Test plan:
0. Apply the patch
1. koha-plack --restart kohadev
2. Go to
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=TwoFactorAuthentication
3. Change the syspref to "Enable"
4. Go to
http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51
5. Click "More" and "Manage two-factor authentication"
6. Register using an app
7. In an Incognito window, go to
http://localhost:8081/cgi-bin/koha/mainpage.pl
8. Sign in with the "koha" user
9. Note down a code from your Authenticator app
10. Wait until after 60 seconds and try it
11. Note it says "Invalid two-factor code"
12. Try a new code from the app
13. Note that it works

14. Add <mfa_range>10</mfa_range> to /etc/koha/sites/kohadev/koha-conf.xml
15. Clear memcached and koha-plack --restart kohadev
16. Sign in with the "koha" user
17. Note down a code from your Authenticator app
18. Wait 4 minutes and then try it
19. Note that it works

20. Disable your two-factor authentication and click to re-enable it
21. Use a code older than 60 seconds when registering for the two
factor authentication
22. Note that the code works

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>
9 months agoBug 33926: Add ability to specify fields allowed in a response
Kyle M Hall [Tue, 6 Jun 2023 16:16:22 +0000 (12:16 -0400)]
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>
9 months agoBug 28449: Add column with invoice number to basket summary page
Katrin Fischer [Fri, 8 Sep 2023 15:34:33 +0000 (15:34 +0000)]
Bug 28449: Add column with invoice number to basket summary page

At the moment it's quite a lot of clicks to get from the basket
summary to the invoice something was received in. This adds a nice
shortcut by creating a new column for the invoicenumber in the basket
summary table.

To test:
* Make sure you have a basket with some received and unreceived
  order lines
* Verify that the (received) shows for your received lines
* Verify no invoice number or link to it in sight
* Apply patch
* Verify that there is now a column for the Invoice containing
  the invoice number as a link to the invoice
* Test with a staff patron, that doesn't have edit_invoices permission
* Verify that now instead of a link you see the invoice number as text

Be happy, sign off ;)

Note: this doesn't change the CSV export. The way the CSV is built is
quite different to the summary table, so it would be better handled
in a separate bug/patch. The columns are already quite different!

Sponsored-by: The Research University in the Helmholtz Association (KIT)
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Émily-Rose Francoeur <emily-rose.francoeur@inLibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34618: Add sort 1 and 2 fields to basket in acquisitions
Owen Leonard [Tue, 29 Aug 2023 14:53:03 +0000 (14:53 +0000)]
Bug 34618: Add sort 1 and 2 fields to basket in acquisitions

This patch adds the option to display sort1 and sort2 columns in the
view of the contents of a basket in acquisitions. The columns are
labeled "Statistic 1" and "Statistic 2" to match the labels in the
order creation/edit form.

The fields are hidden by default in the updated table configuration.

To test, apply the patch and restart services.

- Go to acquisitions and create a basket if necessary:
  - Search for a vendor and click New -> Basket from the vendor
    toolbar on the vendor search results screen.
  - Create a basket, then click "Add to basket" from the basket details
    page.
  - Add an order to the basket.
- With at least one order in the basket, check the table of orders in
  the basket.
- The columns should be unchanged.
- The table configuration button should show the two statistics fields
  as hidden. Test that they can be displayed.

- Go to Administration -> Table settings.
  - Under Acquisitions -> basket, try changing the settings for the
    Statistic 1 and Statistic 2 fields, and check that your changes are
    reflected in the basket view.

- Test with a vendor which has an EDI account:
  - Enable the EDIFACT system preference.
  - Go to Administration -> EDI accounts and create an account for your
    vendor.
  - Confirm that the table of orders in your basket still displays
    correctly now that the "Supplier report" column is present.

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Ray Delahunty <r.delahunty@arts.ac.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33428: (follow-up): Default to searching 'standard' fields
Nick Clemens [Fri, 18 Aug 2023 11:16:44 +0000 (11:16 +0000)]
Bug 33428: (follow-up): Default to searching 'standard' fields

Before this patch set, a search for patrons from article requests or
reserves would search the attributes by default. They were not considered
'standard' searches, however.

This patch simply defaults to searching the 'standard' fields unless a value is passed

To test:
1 - Apply other patches
2 - Have patrons with searchable attributes
3 - From a title, click the holds or artickle requests tab
4 - Search for the attribute values and confirm patrons are not returned
5 - Apply this patch
6 - Search again, patrons are now returned

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33428: (QA follow-up) Fix escaping in a split call
Martin Renvoize [Thu, 17 Aug 2023 10:41:47 +0000 (11:41 +0100)]
Bug 33428: (QA follow-up) Fix escaping in a split call

We'd missed an escape case in one of the calls to .split for the pipe
delimited split operations.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33428: Adjust Unit Tests
Nick Clemens [Fri, 11 Aug 2023 12:28:15 +0000 (12:28 +0000)]
Bug 33428: Adjust Unit Tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33428: Parse search fields in buildPatronSearchQuery
Nick Clemens [Thu, 10 Aug 2023 18:58:55 +0000 (18:58 +0000)]
Bug 33428: Parse search fields in buildPatronSearchQuery

This patch moves the parsing of standard search_field into the buildPatronQuery subroutine
and adds a check for 'standard' field before adding attributes to the search

To test:
1 - Add a new attribute type and make it searchable
2 - Add a value to a patron
3 - Search for this value using 'Standard' fields, confirm you get the patron
4 - Search for the value using 'Cardnumber' field, confirm you get the patron - BAD!
5 - Apply patch
6 - Repeat cardnumebr search, confirm patron not found - Yay!
7 - Search standard, confirm patron is found
8 - Add a new field to 'DefaultPatronSearchFields
9 - Confirm it appears in patron search dropdown
10 - Confirm a search of this field with the attribute value does not return the patron

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34748: DBRev 23.06.00.026
Tomas Cohen Arazi [Mon, 25 Sep 2023 13:14:08 +0000 (10:14 -0300)]
Bug 34748: DBRev 23.06.00.026

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34748: Fix column name in columns configuration for basket table
Katrin Fischer [Tue, 19 Sep 2023 21:33:00 +0000 (21:33 +0000)]
Bug 34748: Fix column name in columns configuration for basket table

The first column was named basket_number, but it's actually the
order_line.

To test:
* Edit column configuration for acquisition > basket
* Make sure to set at least one checkbox for 'basket_number'
* Apply patch, run database update
* Verify that the first column is now 'order_line', but your
  settings have been preserved

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>
9 months agoBug 29822: DBRev 23.06.00.025
Tomas Cohen Arazi [Mon, 25 Sep 2023 13:11:03 +0000 (10:11 -0300)]
Bug 29822: DBRev 23.06.00.025

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29822: (QA follow-up) Use pipe for all field separators
Nick Clemens [Fri, 11 Aug 2023 11:31:24 +0000 (11:31 +0000)]
Bug 29822: (QA follow-up) Use pipe for all field separators

- Tidy atomic update

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 29822: Update unit tests
Martin Renvoize [Fri, 10 Feb 2023 15:50:44 +0000 (15:50 +0000)]
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>
9 months agoBug 29822: Database and Preference description updates
Martin Renvoize [Fri, 10 Feb 2023 15:39:32 +0000 (15:39 +0000)]
Bug 29822: Database and Preference description updates

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>
9 months agoBug 29822: Update code to reference by pipe
Martin Renvoize [Fri, 10 Feb 2023 15:22:04 +0000 (15:22 +0000)]
Bug 29822: Update code to reference by pipe

Moving to modalselect also has the effect of moving from comma delimited
to pipe delimitation for the preference contents

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>
9 months agoBug 29822: Use the modal
Martin Renvoize [Thu, 9 Feb 2023 17:32:19 +0000 (17:32 +0000)]
Bug 29822: Use the modal

As requested by Katrin.. switch to the modal and expose all fields from
the borrowers database table

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>
9 months agoBug 29822: Update 'DefaultPatronSearchFields' to a select list
Martin Renvoize [Fri, 23 Dec 2022 11:05:01 +0000 (11:05 +0000)]
Bug 29822: Update 'DefaultPatronSearchFields' to a select list

This patch updates the `DefaultPatronSearchFields` preference from
freetext expecting a comma delimited list of borrower fields to a
multi-select with a sensible list of fields available.

I opted to not use the Modal approach with all borrower fields listed as
I felt it made more sense to only expose a more limited subset of the
fields available to us.

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>
9 months agoBug 34016: Manage recalls via SIP
Aleisha Amohia [Thu, 15 Jun 2023 05:21:37 +0000 (17:21 +1200)]
Bug 34016: Manage recalls via SIP

This enhancement allows SIP to better handle recalled items - preventing the check-out of recalled items if they have been allocated to another patron, or fulfilling recalls if the item was recalled and allocated to this patron.

To test:

1. Run test `prove t/db_dependent/SIP/Transaction.t`
2. Confirm the test fails when trying to fulfill the recall
3. Apply the patch and restart services
4. Run test again `prove t/db_dependent/SIP/Transaction.t`
5. Confirm tests pass

Sponsored-by: Auckland University of Technology
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>
9 months agoBug 34016: Tests for fulfilling recalls via SIP
Aleisha Amohia [Thu, 15 Jun 2023 05:21:21 +0000 (17:21 +1200)]
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>
9 months agoBug 34114: Replace the use of jQueryUI sortable
Owen Leonard [Thu, 13 Jul 2023 11:57:02 +0000 (11:57 +0000)]
Bug 34114: Replace the use of jQueryUI sortable

This patch adds a replacement for jQueryUI sortable, a standalone
library called Sortable. The patch updates pages which previously used
jQueryUI for sorting.

The patch updates the style of most sortable elements to use the
"grip-vertical" Font Awesome icon.

To test, apply the patch and test the following pages, confirming that
sortable elements are sortable and that the newly sorted state is saved
correctly:

- Administration -> System prefernces -> I18N/L10N
  - With multiple languages installed, test that languages listed in the
    'language' and 'OPACLanguages' preferences can be sorted and that
    after saving your changes the interface relfects your changes: In
    the footer and header of the OPAC and in the footer of the staff
    interface.
- Administration -> MARC bibliographic framework -> MARC structure ->
  Edit subfields of a tag.
  - Test using a tag with multiple subfields, e.g. MARC21 245.
    - Test that you can click and drag to reorder the tabs in the
      subfield edit view.
    - Test that when you save your changes, including changes to the
      "New" tab position, that fields are ordered correctly both in the
       display on this page and in the basic MARC editor.
  - Perform the same tests on Authorities: Administration -> Authority
    types -> MARC structure -> Edit subfields of a tag.
- Authorities -> New (or edit) authority
  - Multiple subfields of a tag should be sortable.
  - Multiple copies of the same tag should be sortable relative to each
    other.
  - Confirm that your changes are saved correctly and that the detail
    view of your updated authority record is correct.
  - Perform the same tests on Cataloging -> New (or edit) record in the
    basic MARC editor.
- Enable the StockRotation system preference if necessary.
  - Go to Cataloging -> Stock rotation
    - If necessary, create a new rota and add multiple stages
      - In the "Manage stages" view you should be able to click and drag
        to reorder stages. The new position should be saved immediately
        via AJAX.

Signed-off-by: paul <paul.poulain@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 21828: build $bib_heading_fields only once per invocation
Andreas Roussos [Tue, 1 Aug 2023 18:49:55 +0000 (20:49 +0200)]
Bug 21828: build $bib_heading_fields only once per invocation

In UNIMARC instances, the run time of link_bibs_to_authorities.pl
can be reduced by up to 80% and the number of DBI calls
can be reduced by up to 90% with a very simple fix that
optimises the constructor of the C4::Heading::UNIMARC object.

Currently, the constructor resets the $bib_heading_fields hash
*in each invocation* (i.e. for every field the bibliographic
record contains), then populating it again with the results
fetched from the database! This is inefficient.

The patch/fix is trivial: we take advantage of the fact that
$bib_heading_fields is declared at the top of the
C4::Heading::UNIMARC module and is thus a package variable
that is in scope for the entire execution of the program
(more info here: https://stackoverflow.com/q/75317862).

Placing the section that generates the $bib_heading_fields
hash inside a "unless ( defined $bib_heading_fields )" code
block is enough to cause a significant reduction in the
number of "expensive" SQL SELECT queries that must be run.

Test plan:

0) Have a UNIMARC instance with some sample data (the KTD one
   will do just fine for this experiment).

1) Run the following commands:

    $ ktd --shell
   k$ DBI_PROFILE=1 ./misc/link_bibs_to_authorities.pl -t

   Observe the output from the script and the DBI profiling info.
   [You may want to play with different DBI_PROFILE levels (such as
   2, 4, 6, 8, etc.) to see what's going on under the hood DBI-wise,
   for reference see: https://metacpan.org/pod/DBI::Profile]

2) Apply this patch.

3) Rerun the script from step 1), it should run a lot faster!

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>
9 months agoBug 34302: (bug 28653 follow-up) Do not refresh the table if an error happened
Jonathan Druart [Thu, 27 Jul 2023 13:01:24 +0000 (15:01 +0200)]
Bug 34302: (bug 28653 follow-up) Do not refresh the table if an error happened

If checkin or renew failed, we should not refresh the table or it will
hide the error message.

Test plan:
Apply the DO NOT PUSH patch
Do a renew
=> No error in the table
Apply this patch
Do a renew
=> You see the error
Revert the DO NOT PUSH patch
Do a renew
=> The table is refreshed

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34835: Highlight logged-in library in patron searches fix for new staff interface
Fridolin Somers [Tue, 19 Sep 2023 22:20:43 +0000 (12:20 -1000)]
Bug 34835: Highlight logged-in library in patron searches fix for new staff interface

Since Bug 30952 the feature from Bug 10902 does not work anymore.
The class "currentlibrary" is there but no background color in CSS.
Bug 30952 removed it :
-    background-color: #E6FCB7;

This patch restores this rule plus '!important' that is used by
class 'ac-currentlibrary'

Test plan:
1) Perform a patrons search
2) Check you see green background color for patrons with same branch as
   currently logged in.

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>
9 months agoBug 33948: Replace GetAllIssues with Koha::Checkouts - staff
Jonathan Druart [Thu, 8 Jun 2023 07:36:35 +0000 (09:36 +0200)]
Bug 33948: Replace GetAllIssues with Koha::Checkouts - staff

This patch replace GetAllIssues in readingrec.pl which is the only
occurrence in the staff code.

To test this patch you will need several items in your checkout history
in order to confirm that the display is the same before and after the
patch.

However there is one change! And it's a bug fix (or an enhancement, it
depends on how you see things). It includes checkouts with deleted items, which is
a long standing bug (see bug 8483).

Performance will be compared as well.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33499: (QA follow-up) Open external links in new tab
Katrin Fischer [Tue, 19 Sep 2023 20:36:19 +0000 (20:36 +0000)]
Bug 33499: (QA follow-up) Open external links in new tab

Adds target="_blank" to the vendor website and interface URLs,
as we can expect them to be external sites.

Also changes mark-up a little so that the URL is shown without
an additional space in front, lining up with the other fields.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33499: Make interface URL clickable on vendor details
Owen Leonard [Tue, 19 Sep 2023 10:57:52 +0000 (10:57 +0000)]
Bug 33499: Make interface URL clickable on vendor details

This patch adds markup around the vendor details interface URL so that
it is a clickable link.

To test, apply the patch and go to Acquisitions.

- Search for a vendor
- If you don't have a vendor with interfaces defined, edit one
  - Under Interfaces -> Interface details, fill out the form, including
    the URI field.
  - Add more than one interface
- Save your changes and then view the vendor details page
- In the Interfaces section the interfaces you defined should have
  clickable links.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 32496: Fix tests
Jonathan Druart [Fri, 22 Sep 2023 14:55:59 +0000 (16:55 +0200)]
Bug 32496: Fix tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 30825: Move holds_control_library to Koha::Policy::Holds
Jonathan Druart [Wed, 7 Jun 2023 12:28:42 +0000 (14:28 +0200)]
Bug 30825: Move holds_control_library to Koha::Policy::Holds

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 30825: Remove GetReservesControlBranch in favour of Koha::Item->holds_control_library
Tomas Cohen Arazi [Fri, 20 May 2022 14:48:28 +0000 (11:48 -0300)]
Bug 30825: Remove GetReservesControlBranch in favour of Koha::Item->holds_control_library

This patch removes the GetReservesControlBranch method, and replaces its
uses with the newly introduced method.

To test:
1. Apply this patch
2. Verify that placing holds from the OPAC works
=> SUCCESS: Things work as expected
3. Run:
   $ kshell
  k$ prove t/db_dependent/Reserves* \
           t/db_dependent/Hold* \
           t/db_dependent/Koha/Hold* \
           t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass!
4. 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: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 30825: Add Koha::Item->holds_control_library
Tomas Cohen Arazi [Fri, 20 May 2022 14:46:12 +0000 (11:46 -0300)]
Bug 30825: Add Koha::Item->holds_control_library

This simple method takes care of calculating the control branch for an
item and a patron, depending on a syspref.

It targets replacing C4::Reserves::GetReservesControlBranch

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Item.t
=> SUCCESS: Tests pass!
3. 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: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 30825: Add unit tests
Tomas Cohen Arazi [Fri, 20 May 2022 14:45:54 +0000 (11:45 -0300)]
Bug 30825: Add unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 32496: (follow-up) Fix t/db_dependent/SIP/Message.t
Tomas Cohen Arazi [Fri, 22 Sep 2023 14:32:19 +0000 (11:32 -0300)]
Bug 32496: (follow-up) Fix t/db_dependent/SIP/Message.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34720: DBRev 23.06.00.024
Tomas Cohen Arazi [Fri, 22 Sep 2023 14:13:44 +0000 (11:13 -0300)]
Bug 34720: DBRev 23.06.00.024

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34720: Say if syspref has been inserted
Jonathan Druart [Fri, 22 Sep 2023 06:30:35 +0000 (08:30 +0200)]
Bug 34720: Say if syspref has been inserted

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34720: Fix bug 30403 atomic update
Emmi Takkinen [Thu, 21 Sep 2023 08:49:12 +0000 (11:49 +0300)]
Bug 34720: Fix bug 30403 atomic update

Bug 30403 had wrong syspref name in its
atomic update file. This patch fixes this in
db_rev 221200018.pl and adds new atomic
update file.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34848: (QA follow-up) Resolve warn on useless constant
Marcel de Rooy [Fri, 22 Sep 2023 08:51:59 +0000 (08:51 +0000)]
Bug 34848: (QA follow-up) Resolve warn on useless constant

Useless use of a constant ("Dies if sip user cannot be found") in void context at t/db_dependent/SIP/Message.t line 582.

We should remove the comma..

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34848: Fix SIP/Message.t if DB has been upgraded
Jonathan Druart [Wed, 20 Sep 2023 14:00:08 +0000 (16:00 +0200)]
Bug 34848: Fix SIP/Message.t if DB has been upgraded

There were a lot of failures (in the context of bug 34841)

t/db_dependent/SIP/Message.t .. 2/16
    #   Failed test 'Found AH field as timestamp in response'
    #   at t/db_dependent/SIP/Message.t line 820.

    #   Failed test 'Found AH field as SQL date in response'
    #   at t/db_dependent/SIP/Message.t line 825.
    # Looks like you failed 2 tests of 8.
t/db_dependent/SIP/Message.t .. 3/16

    #   Failed test 'Desensitize flag was set for patron category not in inhouse_patron_categories'
    #   at t/db_dependent/SIP/Message.t line 1133.
    #          got: 'N'
    #     expected: 'Y'

    #   Failed test 'Desensitize flag was set for empty inhouse_patron_categories'
    #   at t/db_dependent/SIP/Message.t line 1139.
    #          got: 'N'
    #     expected: 'Y'

Because renewalsallowed is 0 for upgraded DB, when it's 5 for new
install.

We need to set the value.

This patch also adds some missing transaction

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>
9 months agoBug 34843: DBRev 23.06.00.023
Tomas Cohen Arazi [Fri, 22 Sep 2023 14:12:00 +0000 (11:12 -0300)]
Bug 34843: DBRev 23.06.00.023

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34843: Fix database comment inconsistency on toc_request
Marcel de Rooy [Fri, 22 Sep 2023 07:33:57 +0000 (07:33 +0000)]
Bug 34843: Fix database comment inconsistency on toc_request

Bug 29093 had a dbrev without comment, but added comment to
kohastructure.

Test plan:
Check (or remove) comment on article_requests.toc_request.
Run dbrev.
Check if comment was added (if you removed).
Run t/db/Koha/Database/Commenter.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>
9 months agoBug 34215: Introduce a ToolbarButton Vue component
Jonathan Druart [Thu, 6 Jul 2023 08:17:20 +0000 (10:17 +0200)]
Bug 34215: Introduce a ToolbarButton Vue component

Our toolbar component is not flexible enough, we cannot:
* have something else than a router-link
* have a link outside of the app (it needs to be a Vue route)

This patch adds a ToolbarButton component that is used for existing
button. But other buttons can be added without being a router-link.

Test plan:
No change in behaviour here! Test the buttons in the 4 existing toolbar
(in the ERM module)

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34453: Update background of quick spine label pop-up
Owen Leonard [Fri, 4 Aug 2023 13:26:22 +0000 (13:26 +0000)]
Bug 34453: Update background of quick spine label pop-up

This patch updates the quick spine label popup so that the footer uses
the same markup as the recently updated Z39.50 popup window in
cataloging.

To test, apply the patch and rebuild the staff interface CSS.

Go to Cataloging -> Quick spine label creator.

 - Test the form with both an existing barcode and a non-existent
   barcode.
   - In the pop-up window, confirm that the footer looks correct and
     that the buttons in the footer, in both cases, work correctly.

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34383: Fix inconsistencies in Patron attributes page titles, breadcrumbs, and...
Owen Leonard [Fri, 18 Aug 2023 10:40:49 +0000 (10:40 +0000)]
Bug 34383: Fix inconsistencies in Patron attributes page titles, breadcrumbs, and header

This patch makes changes to the patron attribute types administration
template so that the page title, breadcrumb navigation, and page headers
are more consistent with each other and with other parts of Koha.

To test, apply the patch and go to Administration -> Patron attribute
types. Test these versions of the page to confirm that the breadcrumbs
and page title are consistent with each other:

- Main view
- New patron attribute type
- Edit patron attribute type
- Confirm deletion of attribute type

Signed-off-by: Christian Nelson <christian.nelson@uwasa.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34553: Update send list and send cart popup footers
Owen Leonard [Thu, 17 Aug 2023 07:14:26 +0000 (07:14 +0000)]
Bug 34553: Update send list and send cart popup footers

This patch updates the templates behind the "send cart" and "send list"
pop-ups in order to make the style of the footer consistent with some
recently-updated similar examples, like the catalog's Z39.50 search
popup.

The patch also makes a minor change to our global JavaScript include so
we can get away from using the "close" class as a trigger for closing a
pop-up window. Bootstrap has a built-in "close" class that we always
have to override. "close_window" is added as another class to use, and
the other instances can be cleaned up overy time.

To test, apply the patch and perform a catalog search in the staff
interface.

 - Add one or more items to the cart.
 - Open the cart popup and click the "Send" button.
 - In the pop-up window, confirm that the footer looks correct.
 - Test the process of using the tab key between input fields and
   submit/cancel buttons. All controls should be accessible.
 - Test the "Cancel" button to confirm that it closes the window.
 - Reopen the window and test sending the email.
 - On the confirmation page, confirm that the footer looks correct and
   that the "Close window" button works.

 - Test the same processes in the Lists module: View a list in the staff
   interface and test the process of sending a list.

Signed-off-by: Andrew Auld <andrew.auld@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34199: Add full title information to subscription detail page
Katrin Fischer [Fri, 7 Jul 2023 15:27:42 +0000 (15:27 +0000)]
Bug 34199: Add full title information to subscription detail page

Show the full title information, including part_name and part_number
on the subscription detail page.

To test:
* Add a subscription linked to a record with 245$abnp set
* Verify only 245$ab will show up on the subscription detail page
* Apply patch
* Verify that the full title information shows up on the detail page

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34230: Add part_name and part_number to subscription search results
Katrin Fischer [Fri, 7 Jul 2023 16:10:30 +0000 (16:10 +0000)]
Bug 34230: Add part_name and part_number to subscription search results

This adds biblio.part_name and biblio.part_number to the SELECT of
SearchSubscriptions in order to be able to display the information in
the results list. It does not affect search.

To test:
* Add one or more subscriptions
* Make sure at least one is linked to a title with 245$abnp
* Verify that the result list only shows 245$ab
* Apply patch
* Verify full title information is now shown

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34446: (QA follow-up) Add colons on delete confirm page
Katrin Fischer [Thu, 21 Sep 2023 21:37:08 +0000 (21:37 +0000)]
Bug 34446: (QA follow-up) Add colons on delete confirm page

This adds the missing colon on the 'confirm deletion' page.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34446: Added missing colon to Can be guarantee
Laura Escamilla [Thu, 21 Sep 2023 20:59:13 +0000 (20:59 +0000)]
Bug 34446: Added missing colon to Can be guarantee

To test:

1. Go to Administration > patron categories and edit or create a new category. Notice that “Can be guarantee” does not have a colon.
2. Apply patch and refresh the page.
3. Can be guarantee now has a colon — yay!
4. Sign off and have a great day. :)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34054: Allow to embed biblio on GET /items
Jonathan Druart [Tue, 25 Apr 2023 10:06:07 +0000 (12:06 +0200)]
Bug 34054: Allow to embed biblio on GET /items

Test plan:
Request the /items REST API endpoint and ask for the biblio's info to be
embeded into the response passing x-koha-embed

curl -u koha:koha --request GET 'http://localhost:8081/api/v1/items' --header "x-koha-embed: biblio" --header "Content-Type: application/json"

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Andreas Roussos <a.roussos@dataly.gr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34054: Add tests
Jonathan Druart [Mon, 19 Jun 2023 07:49:08 +0000 (09:49 +0200)]
Bug 34054: Add tests

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Andreas Roussos <a.roussos@dataly.gr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 34885: Improve confusing pref description for OPACHoldsIfAvailableAtPickup
Marcel de Rooy [Fri, 22 Sep 2023 13:07:51 +0000 (13:07 +0000)]
Bug 34885: Improve confusing pref description for OPACHoldsIfAvailableAtPickup

Changes pref description and sysprefs.sql.
The change is not important enough for a dbrev.

Test plan:
Look at the changed text in Systempreferences.

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>
9 months agoBug 33911: Move variables into strings
Katrin Fischer [Thu, 21 Sep 2023 21:27:57 +0000 (21:27 +0000)]
Bug 33911: Move variables into strings

This has the advantage that translators can tell the full
context and are also able to move the variable if needed
for better grammar.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
9 months agoBug 33911: Improve translation of title tags: Catalog, basket, and lists
Owen Leonard [Tue, 6 Jun 2023 15:10:37 +0000 (15:10 +0000)]
Bug 33911: Improve translation of title tags: Catalog, basket, and lists

This patch updates catalog, basket, and lists templates so that title
tags can be more easily translated.

To test, apply the patch and confirm that the following pages have the
correct title tags:

 - Advanced search
   - Search results
     - Bibliographic details
       - MARC preview
       - Image viewer (with local cover images)
       - MARC details
       - Labeled MARC details
       - ISBD details
       - Items
       - Checkout history
       - Rota
   - Add titles to the cart and view the cart
     - Send cart
 - Item search
 - Lists
   - View list
   - New list
   - Edit list
   - Send list

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>
9 months agoBug 33927: Improve translation of title tags: Tools
Owen Leonard [Fri, 15 Sep 2023 19:17:45 +0000 (19:17 +0000)]
Bug 33927: Improve translation of title tags: Tools

This patch modifies tools templates so that title tags can be
more easily translated. The patch also makes some modifications to
titles, breadcrumb navigation, and page headers in order to make them
more consistent with each other and with other similar pages.

To test, apply the patch and go to Tools. Test each of the following
pages and each variation of the page to confirm that titles,
breadcrumbs, and page headers look correct.

- Tools home page
- Import patrons
  - Import results
- Notices and slips
  - Main page
    - Main page filtered by library
    - New notice
    - Edit notice
      - Preview notice: With a CHECKIN, CHECKOUT, or HOLD_SLIP notice,
        fill in the "Data for preview" box in the "Email" section.
        Although the template loads in a modal window which doesn't show
        the page title, you can confirm that there are no errors.
- Overdue notice/status triggers
- Batch patron deletion
  - Confirmation page
- Batch patron modification
- Batch extend due dates
- Upload patron images

Print notices: With useDischarge enabled, log into the OPAC as a
user with no checkouts. Go to the "Ask for a discharge" tab and click
"Ask for a discharge."

Locate the patron's record in the staff interface and click "Discharges"
in the left-hand sidebar menu. Click "Generate discharge." Open the
resulting PDF file in a browser. The page title should be "Print notices
for [date]."

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>