Commit Graph

56536 Commits

Author SHA1 Message Date
Tomas Cohen Arazi 2d91c1e0eb
Bug 36365: Add a way for compare_es_to_db.pl to fix problems
This patch adds a new option switch `--fix` (or `-f`) to make the script
try to fix the problems it found.

Bonus: `--help` option switch added.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ perl -MKoha::SearchEngine -MKoha::SearchEngine::Indexer -e 'my $i = Koha::SearchEngine::Indexer->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); $i->delete_index([1]);'
=> SUCCESS: Bibliographic record #deleted from ES index
3. Run:
  k$ koha-mysql kohadev
   > DELETE FROM biblio WHERE biblionumber=2 OR biblionumber=3;
=> SUCCESS: Bibliographic records 2 and 3 deleted directly from the
database, no reindex triggered by Koha.
4. Run:
  k$ perl misc/maintenance/compare_es_to_db.pl
=> SUCCESS: The results from (2) and (3) are explained. [1]
5. Run:
  k$ perl misc/maintenance/compare_es_to_db.pl --fix
=> SUCCESS: It says it is gonna fix things
6. Repeat 4
=> SUCCESS: The problems we generated are no longer reported! They've
been fixed!
7. Sign off :-D

[1] Note KTD ships some broken records on purpose so devs need to deal
with a not-perfect DB everyday, and catch misses in the code.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3669cb0eed)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:29 +02:00
Julian Maurice b4d6c538b7
Bug 37286: Add tests for REST authentication through Mojo apps
Amended-by: Jonathan Druart
Add +x

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 58f6d7d73d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:29 +02:00
Julian Maurice 3ae15a34cd
Bug 37286: Fix REST API authentication when using Mojo apps
Koha::REST::V1::Auth checks the request URL path and do various things
depending on how it looks.
For instance, it allows everyone to access paths starting with
"/api/v1/oauth/"

But because of how Koha::REST::V1 was written, when using mojolicious
applications Koha::App::Intranet and Koha::App::Opac, paths had to add a
path prefix ("/api"), which means the final path as seen by
Koha::REST::V1::Auth looked like this: "/api/api/v1/oauth".

I said "had to", but actually there is another way that does not require
this path manipulation and that's what this patch does:

Koha::REST::V1 now accepts a configuration parameter that allows to
change the base path for API routes, which allows
Koha::App::Plugin::RESTV1 (used by Koha::App::Intranet and
Koha::App::Opac) to generate the right routes.

This configuration parameter defaults to "/api/v1", so when outside of
Koha::App::Intranet and Koha::App::Opac (when using
debian/templates/plack.psgi for instance), the behavior is unchanged.

Test plan:
1. Do not apply the patch yet
2. Run `bin/intranet daemon -l http://*:8080`
3. Run `curl -i -d{} http://127.0.0.1:8080/api/v1/oauth/token`
   It should return a 403 error, with an error message "Authentication
   failure".
4. Stop `bin/intranet daemon -l http://*:8080` by hitting Ctrl-C on the
   terminal you started it
5. Apply the patch
6. Run `bin/intranet daemon -l http://*:8080` again
7. Run `curl -i -d{} http://127.0.0.1:8080/api/v1/oauth/token`
   This time it should return a 400 error with an error message saying
   the "grant_type" property is missing.
   This error is normal as we did not send any data in the POST request
   body, and seeing this means Koha allowed us to use that route because
   it recognized '/api/v1/oauth/' at the start of the URL path
8. You can do the same test with `bin/opac`

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised. See Bugzilla for notes from testing.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 751391cc5c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:28 +02:00
Jonathan Druart ccbe38128c
Bug 38104: Always update when hea cronjob is run
If the cronjob is configured to run every month we don't need to add
another test on the delay in the script itself.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c26a989c64)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:27 +02:00
Brendan Lawlor 9285dddcef
Bug 38174: Fix self checkout alerts for non batch checkouts
This patch adds a check for batch_checkouts_allowed to SCO.

If not using batch checkout, only the most recent chekout should be
rendered as an alert, instead of all the new issues for the session.

This makes the input box consitently render in the same position.

To replicate:
1. Login as self_checkout to localhost:8080/cgi-bin/koha/sco/sco-main.pl
2. Login as a patron to make self checkouts
3. Check many items out and notice an additional alert is rendered
    for each checkout, eventually pushing the barcode input off screen.

To test:
1. Apply patch and restart_alll
2. Login as a patron to make self checkouts
3. Check many items out
4. Notice only the most recent checkout is rendered as an info alert
5. Confirm the Checkouts table below still loads all checkouts
6. In Admin set BatchCheckouts to 'Allow'
7. Set SCOBatchCheckoutsValidCategories to 'Select all'
8. Login to sco as a patron and enter a newline delimited list of barcodes
9. Confirm that an alert is rendered for each checkout in the batch

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit db120bb6e5)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:27 +02:00
phette23 0896db1dc2
Bug 29238: Cataloging cron jobs are not logged
Testing plan:

1. set CronjobLog to "Log"
2. Run the three cron jobs
   `perl misc/link_bibs_to_authorities.pl; perl misc/cronjobs/merge_authorities.pl -b; perl misc/migration_tools/remove_unused_authorities.pl --confirm`
3. Visit the log viewer /cgi-bin/koha/tools/viewlog.pl, select the "Cron jobs" module, & note it's empty
4. apply the patch
5. Repeat steps 2 & 3 but note the cron logs aren't empty

squash

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 97c2437bb3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:26 +02:00
Tomas Cohen Arazi 60c9d227f7
Bug 38932: Make adding a credit return the Location header
This patch makes the `POST /patrons/:patron_id/account/credits` endpoint
return a valid `Location` header. Tests are added.

Bonus: the debits counterpart already returned the header, but pointed
to a non-existent endpoint (now added by bug 38931) and it gets tests
added.

To test:
1. Apply the regression tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> FAIL: The behavior is not implemented for credits.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4d6aef19cc)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:25 +02:00
Tomas Cohen Arazi 820bc96fae
Bug 38932: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit fcced47c2b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:25 +02:00
Jonathan Druart 2b418426ad
Bug 38929: Add 2 exceptions
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ff0919ec19)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:24 +02:00
Jonathan Druart 36dd17c544
Bug 38929: Add xt test to enforce REST3.4.1 POST
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a5f3859c5c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:23 +02:00
Tomas Cohen Arazi e037d855dd
Bug 38929: (follow-up) Replace SWAGGER -> REST in the tests
The wiki now uses `REST*` for the rule names instead of `SWAGGER*` some
tests have their descriptions correct, but most don't.

This is a follow-up to an editorial decision made on the Wiki (probably
at a dev meeting too, I don't remember).

QA tests will probably not pass, but I refrain from tidying it because
there's a major tidy on its way to main.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d597123789)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:23 +02:00
Tomas Cohen Arazi a6c5884a7d
Bug 38929: Make POST endpoints return the `Location` header
This patch makes the POST endpoints missing the Location header return
it.

Some endpoints I skipped:

* /patrons/account/credits (doesn't have a GET route to point to)
* /patrons/account/debits (doesn't have a GET route to point to)

To test:
1. Apply the regression tests
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/authorities.t \
           t/db_dependent/api/v1/biblios.t \
           t/db_dependent/api/v1/clubs_holds.t \
           t/db_dependent/api/v1/holds.t \
           t/db_dependent/api/v1/ill_batchstatuses.t \
           t/db_dependent/api/v1/import_batch_profiles.t \
           t/db_dependent/api/v1/transfer_limits.t
=> FAIL: Tests fail! The endpoints don't return the header!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit eab06ab69b)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:22 +02:00
Tomas Cohen Arazi 58f5996df8
Bug 38929: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit de1b28d2f6)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:21 +02:00
Owen Leonard 2fc8ae7929
Bug 38958: Search history deletion broken in the staff interface
There is some JS on the staff interface search history page which uses a
jQuery selector that doesn't seem to work after the DataTables upgrade.
This patch fixes it.

To test, apply the patch and enable EnableSearchHistory if necessary.

- In the staff interface, perform a few catalog searches if necessary.
- Choose "Search history" from the user menu in the upper right.
- In the table of searches, check the checkbox next to one or more
  search history entries.
- The delete button at the top of the table should become enabled.
- Clicking the delete button should work correctly to delete your
  selected searches.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b6709f2984)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:21 +02:00
Jonathan Druart 88da97fb0e
Bug 38854: Remove 'class' property from ToolbarButton
We never use another value than the default one.
We can simply remove this property.

Test plan:
Rebuild the dist files using `yarn js:build` and confirm that the
buttons in the toolbar of the ERM and Preservation modules still appears
and are styled like before.

Signed-off-by: William Lavoie <william.lavoie@inLibro.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a575d38770)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:20 +02:00
Phil Ringnalda d1e1052f67
Bug 38921: Remove unused href from Cancel hold link
The trashcan icon to cancel a hold from the list of holds on a bib record has
a leftover href attribute from before the bug 34478 CSRF protection changes.
It has an 'op=cancel' which does nothing since there's only a cud-cancel op,
so it just falls through to the view case and redisplays the page if you open
it in a new tab, and doesn't get used at all if you click the trashcan, when
JavaScript builds up a form that you can POST.

Test plan:
1. Place a hold on any item.
2. On the list of holds, right-click the Cancel hold trashcan icon, and
   select Open in new tab
3. In the new tab, note that the URL in the browser address bar shows all
   sorts of things about op=cancel and borrowernumber and biblionumber and
   reserveid, but nothing changed, your hold wasn't deleted
4. Close that pointless tab, and apply patch
5. Reload the page with the list of holds, and again right-click the
   Cancel hold trashcan and select Open in new tab
6. In the new tab, note that the URL just has the biblionumber and a #, no
   other extraneous things
7. In the original tab, left-click the trashcan, confirm cancellation in the
   popup, and make sure that cancelling still does work.

Sponsored-by: Chetco Community Public Library
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 22c5a1ea6f)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:19 +02:00
Jonathan Druart 708d0a5458
Bug 38954: Hide checkout type using colvis
This is not the correct way to hide a column, we should use the DT's column
visibility plugin.

Test plan:
Have some checkouts for a patron, go to the checkout history page
Without this patch notice the "shift" => the table does not take the
whole available width.

Apply this patch, restart_all, remove localStorage entries

=> The table is now displayed properly

You can also play with on-site checkouts.

Before:
https://snipboard.io/uTWYit.jpg
https://snipboard.io/qxZE35.jpg

After:
https://snipboard.io/2L0F3Q.jpg
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5a6f89f3f0)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:19 +02:00
Jonathan Druart f2ae545902
Bug 36163: Chomp country list
I found the same code in preferences.tt, actually we don't need to trim
if the list is properly generated (ie. without extra spaces)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3a644175f2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:18 +02:00
Janusz Kaczmarek cf3a3124f5
Bug 36163: Usage statistics - Not possible to select a country
Site: .../cgi-bin/koha/admin/usage_statistics.pl

If you try to select a country, you get an error:
==
The value of your system preference 'UsageStatsCountry' is not valid (Germany). Please select a valid one.
==

It doesn't matter which country you chose, no country is valid.

Test plan:
==========
1. Select a country for UsageStatsCountry system preference.
2. Go to http://<your addr>:8081/cgi-bin/koha/admin/usage_statistics.pl
3. Confirm the issue.
4. Apply the patch ; restart_all.
5. Repeat p. 2.
6. Confirm that the issue has been solved.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3d844e774d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:17 +02:00
Tomas Cohen Arazi 1619c3c87e
Bug 38679: (follow-up) Fix old typos in column names
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 804394e530)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:17 +02:00
Tomas Cohen Arazi 5e36f23859
Bug 38679: Add attribute mappings Koha::Old::Biblioitem
This trivial patch replicates the mappings in Koha::Biblioitem.

To test:
1. Pick a sample record ID
2. Fetch is using the API with your favourite tool:
   GET /api/v1/biblios/<the ID>
   Accept: application/json
3. Save the output for later
4. Delete the record
5. Fetch the deleted biblio using the API:
   GET /api/v1/deleted/biblios/<the ID>
   Accept: application/json
6. Compare the results
=> FAIL: Attributes like `volumedate` are not mapped!
7. Apply this patch
8. Repeat 5
=> SUCCESS: Attributes are mapped!
9. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Leo Stoyanov <leo.stoyanov@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 980890517f)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:16 +02:00
Owen Leonard ce8a5562aa
Bug 38870: Remove overflow scroll from batch patron modification
This patch removes the <div> surrounding batch patron modification
results with the style "overflow:auto". Also removed is the DataTable
option "scrollX". This eliminates the horizontal scrolling for the table
itself, and causes the whole page to scroll horizontally instead. This
is consistent with other pages in Koha.

This fix lets us avoid bugs which are associated with the overflow
scrolling and our DataTables implementation. (see Bug 37730).

To test, apply the patch and go to Tools -> Batch patron modification

- Submit a batch of patrons for modification.
- On the screen showing the patrons which will be modified, the page
  will probably have a horizontal scrollbar already. If not, resize your
  browser to confirm that the whole page scrolls, not just the table.
- Confirm that the table header "sticks" to the top of the screen when
  you scroll down, and that the header continues to be aligned correctly
  when you scroll horizontally.

Sponsored-by: Athens County Public Libraries
Signed-off-by: William Lavoie <william.lavoie@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 39cd514642)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:15 +02:00
Owen Leonard 6ecef5e28b
Bug 38783: (follow-up) Remove obsolete .badge-pill class
.badge-pill is from a previous version of Bootstrap. .rounded-pill is
the current version, but I think it looks better without.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0c1a2f54b6)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:15 +02:00
Leo Stoyanov cc82fd0996
Bug 38783: Added "Checked out" badge for checked out items in the circulation history table.
To test:
1. Make some checkout to a patron so they have a circulation history,
   with some items checked in and some still on loan.
2. Look at the patron's "Circulation history" table. There are four
   possible background colors for each row: #ffffff, #f3f4f4, #F9FAE0,
   and #FFFFCC.
3. Apply the patch, update the CSS (yarn build), and restart everything
   (restart_all).
4. Repeat steps 1-2, if needed. An orange/gold badge will appear under
   the "Return date" column of the table for items that have been
   checked out, and there will no longer be alternating, pale yellow rows.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised. I agree that it looks better now than before, and
that it is easier to tell the checked out items from the returned items.
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9c76bda202)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:14 +02:00
Tomas Cohen Arazi ec322648b6
Bug 38926: Make POST /biblios return 400 if AddBiblio fails
We don't have proper exceptions in the `C4::Biblio::AddBiblio` method,
but we at least know `$biblio_id` will be `undef` in the even of an
error processing the call.

This patch makes the controller handle this situation so (at least) it
is obvious that something bad happened.

To test:
1. Apply the regression tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> FAIL: Tests fail! The endpoint returns 200 even on error!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! The endpoint returns a 400 with a reasonable
message!
5. Sign off :-D

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a98760a994)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:13 +02:00
Tomas Cohen Arazi 9f21b316de
Bug 38926: Regression tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 384b869ccd)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:13 +02:00
Tomas Cohen Arazi 8a7cc55474
Bug 38927: Only call FindDuplicate if required
This patch makes the code call `FindDuplicate` only if
`x-confirm-not-duplicate` is not passed. This makes sense, as having it
passed makes it override any duplicate found.

This patch doesn't change any end user behavior, just makes the code
more efficient.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass, no behavior change
4. Sign off :-D

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d6a4637ff6)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:12 +02:00
Baptiste Wojtkowski d09a7f3cdf
Bug 8425: Increment the barcode on each call of set_barcode()
Duplicate barcodes are generated when placing an Order in Acquisitions when AcqCreateItem = "placing an order" and Autobarcode is turned on.

The problem is that you can accidentally attach 3 items to an order, but only 1 will be saved to the database. When you go to receive your order, you can only receive 1 item as the other two were never made, since the barcode wasn't unique.

In 3.8.0, a software error comes up which prevent any item creation, I believe, but master (3.9.x) doesn't throw any warnings or errors.

Yes.. This tries and solve a bug from 3.8.0 /o/

Test plan:
1 - set syspref "autoBarcode" to generated in the form <branchcode> yymm001
2 - set the barcode field to "barcode.pl" in marc structure
3 - create a new basket
4 - add one item to this basket
5 - click on the barcode field -> it should have a barcode
6 - click on add item and click on the new barcode fiels, it should have
 the same value
 APPLY PATCH:
7 - click on the barcode field -> it should have a barcode
8 - click on add item and click on the new barcode fields, it should have
  an higher barcode.

Note : The barcode is incremented each time the barcode with an empty
value is clicked on. Therefore, if the
librarian removes the value from barcode and click again, they could get
another barcode. I do not know if it is an issue.
Note: This patch is not splitted in two parts anymore

Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Followed the test plan, works as advertised.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b7ed38413a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:11 +02:00
Andrew Fuerste Henry 4ae68a17ed
Bug 38894: Use HomeOrHoldingBranch with longoverdue cronjob
To test:
1: Add 4 items, 2 with homebranch = Library A and 2 with homebranch = Library B
2: Logged into Library A, check out 1 Library A item and 1 Library B item, both with due dates in the past enough for the longoverdue cron
3: Set yourself to Library B, check out 1 Library A item and 1 Library B item, both with due dates in the past enough for the longoverdue cron
4: Run longoverdue cron with --verbose, without --confirm, and without --Library. see that it would act on all 4 items
5: Set CircControl to "the library the item is from"
6: Set HomeOrHoldingBranch to "the item's home library"
7: Run longoverdue cron with --verbose and --library="A" (where A is the code for your Library A), wihout --confirm
8: See the cron wants to act on the items with homebranch = A
9: Set HomeOrHoldingBranch to "the item's holding library"
10: Run longoverdue cron with --verbose and --library="A" (where A is the code for your Library A), wihout --confirm
11: See the cron is still trying to act on the two items with homebranch = A
12: Apply patch, restart all
13: Run longoverdue cron with --verbose and --library="A" (where A is the code for your Library A), wihout --confirm
14: See the cron is now trying to act on the two items with holdingbranch = A
15: Set HomeOrHoldingBranch to "the item's home library"
16: Run longoverdue cron with --verbose and --library="A" (where A is the code for your Library A), wihout --confirm
17: See the cron wants to act on the items with homebranch = A

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 562dd9e2c9)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:10 +02:00
Jonathan Druart 369898cccf
Bug 38872: Fix the missing occurrences
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 511ba0e4d8)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:10 +02:00
Jonathan Druart aed43db878
Bug 38872: Parse all 'a' element, not only the first one
Test plan:
Apply the "Add test" commit
% prove t/template_filters.t
=> Fail
Apply this patch
% prove t/template_filters.t
=> Success
% prove xt/find-missing-filters.t
=> Fail
Apply the last patch "Fix occurrences"
% prove xt/find-missing-filters.t
=> Success

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3e5fa21f85)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:09 +02:00
Jonathan Druart e3b5d1415f
Bug 38872: Add a test
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7fdf2983a9)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:08 +02:00
Matt Blenkinsop 16a0ad092c
Bug 36836: (follow-up) Fix incorrect syntax
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 78c4bc89b1)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:08 +02:00
Matt Blenkinsop 809590b921
Bug 36836: Amend translation fixes
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ea6a4db1b6)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:07 +02:00
Katrin Fischer 8804634de3
Bug 36836: Fix translation issues in ERM module
This tries to fix multiple translation issues in the ERM module.
This includes:

* Making strings translatable
* Using double quotes instead of single around strings according to
  coding guidelines
* Fixing some translations where the variable was marked for translation,
  but not the strings themselves:  ...>{{ $__(item.tab_name) }}</a

To test:
* Apply patch
* Run yarn build
* Make sure you have a clean work space in git
* Run gulp po:update lang de-DE (or another language)
* Verify the strings from the patch set now appear in the po files

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

Amended-by: Jonathan Druart
-                                        {{ $__("Uploaded on:") }}
+                                        {{ $__("Uploaded on") }}:
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit beb8770bc9)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:06 +02:00
Owen Leonard 85e5051fbf
Bug 38502: Use Bootstrap alert info class for messages on table settings page
This patch updates the table settings template to add style to
informational messages.

To test, apply the patch and go to Administration -> Table settings.

- Go to Catalog -> detail -> holdings_table. Above the table's settings
  you should see a message, "Please not that if a field..." It should
  have the standard Bootstrap "info" style.
- Go to Cataloging -> additem. You should see a similarly styled
  message, "Changes made below..."

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 020f709d64)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:06 +02:00
Jonathan Druart 545b7d5db5
Bug 38461: (follow-up 2) Do not rely on biblio_id=1
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 665f9a50ad)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:05 +02:00
Jonathan Druart 27709dcfe0
Bug 38461: (follow-up) Do not rely on biblio_id=1
19:05:50 koha_1       |   "error": "Basic authentication disabled"

We don't need to pass the auth in this request, we are authenticated
already.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 51aa5ab6b0)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:04 +02:00
Jonathan Druart a3406f10a7
Bug 38461: Do not rely on biblio_id=1
It might not exist!

This code is not trivial and should ideally be moved to somewhere it
could be reused easily. But good enough for now to fix the failing tests.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bb2e88a1e3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:03 +02:00
Victor Grousset/tuxayo 64e8c285e4
Bug 38461: Fix multiple case changes that broke variables
Amended-by: Jonathan Druart
-                        "x-base-total-count": baseTotalCount,
-                        "x-total-count": baseTotalCount,
+                        "X-Base-Total-Count": baseTotalCount,
+                        "X-Total-Count": baseTotalCount,

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bfd7d533f0)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:03 +02:00
Jonathan Druart 9206cd62d1
Bug 38461: Add tests for catalogue/detail/holdings_table
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b2ec4e6dd4)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:02 +02:00
Jonathan Druart ac327713ff
Bug 38461: Bypass the clipboard for tests
There are known bugs with Cypress trying to play with the clipboard, and
I don't manage to make the tests pass consistently (also tried realClick
from cypress-real-events)

Here I am suggesting to not click on the button, but simply retrieve the
url (which needs a bit of work in the existing code).

We don't test the "Copied!" tooltip and the behaviour of the button, but
at least the tests pass!

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 12e0d722c4)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:01 +02:00
Jonathan Druart 325d88f3ce
Bug 38461: Fix random failures
All this is weird.
I found this and implemented it:
https://stackoverflow.com/questions/69425289/javascript-prompt-cause-document-is-not-focused
It was still not enough to reduce the failures.
The wait and adding the focus to the window seems ok.
If I remove one of those 3 hacks, I still get failures...

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit aab60455b5)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:01 +02:00
Jonathan Druart 5f3c15600c
Bug 38461: Jump to the configuration page
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 79bc770baa)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:02:00 +02:00
Jonathan Druart eddef24852
Bug 38461: Shareable link
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7e9ce66bed)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:01:59 +02:00
Jonathan Druart fd9727ff50
Bug 38461: Refactoring - mock_table_settings
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3d6210552c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:01:59 +02:00
Jonathan Druart 211576422f
Bug 38461: Refactoring - build_libraries
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f5a7c307da)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:01:58 +02:00
Jonathan Druart 18c8c36a8b
Bug 38461: Save state ON/OFF
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a55281fbca)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:01:57 +02:00
Jonathan Druart 9e25b97101
Bug 38461: Columns - All, is_hidden by default, then shown by user
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9544cbf977)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:01:57 +02:00
Jonathan Druart fcdc0754f9
Bug 38461: Use buildSampleObjects
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6438b1e0e2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-04-22 23:01:56 +02:00