Commit Graph

3245 Commits

Author SHA1 Message Date
Matt Blenkinsop 01f5214f0f
Bug 26355: Add the class methods and endpoint to handle renewal
This is part of a sponsored piece of development from one of our customers. There was a specification of requirements but I was conscious of the ideas already discussed on this bug and wanted to try and develop a solution that would balance both sets of requirements. The concept works as follows:
- Self-renewal can be enabled and controlled at a category level
    - The window within which it is available is customisable (both pre and post-expiry)
        - Defaults to the NotifyBorrowerDeparture syspref
    - The amount in fines that block self-renewal is customisable
        - Defaults to the category level charges and then the noissescharge preference
    - The message to display if renewal fails is customisable
- Libraries can also add information to display to the patron at the start of the process.
- The self-renewal process will also respect the OPACPatronDetails and AutoApprovePatronProfileSettings sysprefs. If OPACPatronDetails is enabled, the renewal will redirect the patron to the OPAC details form and ask them to confirm their details are still correct. Any changes will be logged as patron modifications and approved in line with the auto approval syspref
- Renewal happens regardless of whether OPACPatronDetails is enabled, only the details changes are logged as modification requests
- Notifications are sent to the patron in line with their messaging preferences

Test plan:
1. Apply all patches and reset_all
2. In the intranet, navigate to patron categories and edit the ‘Patron’ category
3. Scroll to the bottom, there should be a section called ‘Account expiry and self-renewal’
4. Set ‘Allow self-renewal’ to Yes
5. Set Self-renewal availability period to be 10 days
6. Set Self-renewal availability post-expiry’ to also be 10 days and save
7. In system preferences, set the OPACPatronDetails preference to ‘Don’t allow’
8. Choose a patron that has the ‘Patron’ type category
9. Edit that patron so that you can log into the OPAC and set their expiry date to be yesterday’s date
10. Log into the OPAC as that patron (it may be easiest to do this in incognito as we will be swapping between the intranet and OPAC throughout the test plan and it will remove the need to keep logging out and in)
11. You should see a message that says “You are eligible for self-renewal. Please click here to renew your account.”
12. Click that link - you will be presented with a modal that says “Are you sure you want to renew your account?”
13. Click “Close” - we don’t want to complete renewal yet as there is more functionality available to test
14. Navigate to the patron category again, set ‘Self-renewal availability post-expiry’ to be 0
15. Refresh the OPAC, the self-renewal link should not be there as we are now outside the patron self-renewal window
16. Undo that change in the patron category, the link should reappear when refreshing the OPAC
17. Now set the patron’s expiry date to be tomorrow
18. In the category, set ‘Self-renewal availability period’ to be blank
19. Refresh the OPAC, it should still show the link as it is defaulting to NotifyBorrowerDeparture
20. Set NotifyBorrowerDeparture to 0
21. Refresh the OPAC, the link should vanish
22. In the category, restore ‘Self-renewal availability period’ to 10 days
23. Refresh the OPAC, the link should reappear
24. In the intranet, set the patron to be debarred using a manual restriction
25. In the OPAC refresh the page - self-renewal should no longer be available
26. Remove the restriction - the renewal link will be visible again
27. Set a fine on the patron record of 6 USD
28. Refresh the OPAC, the self-renewal link will be gone because we are over the global ‘noissuescharge’ preference value of 5
29. In the category, set ‘Checkout charge limit’ to 7
30. Refresh the OPAC, the link will be visible because we are now under the category charge
31. Add an additional fine of 2 to the patron account
32. Refresh the OPAC, the self-renewal link is gone
33. In the category, set ‘Self-renewal charge limit’ to be 10
34. Refresh the OPAC, the link will be visible again
35. In the category, set ‘Self-renewal failure message’ to be whatever you want
36. In the OPAC, refresh the page and then click into the self-renewal process
37. This time, click “No” - you should see the failure message you have just set
38. Click “Close” and refresh the page to reset this message
39. In the category, set a message in the “Self-renewal information message”
40. In the OPAC, refresh the page and then click the renewal link again
41. You should be met with the modal, this time displaying the information message we just set up in the patron attributes
42. Click “Yes” - you should see the “Are you sure you want to renew your account?” message again
43. This time when prompted with the “Are you sure” message, click “Yes”
44. The page should refresh and display a confirmation with the new expiry date.
45. In the intranet, view the patron’s record - the date should have been updated
46. In the Modification log tab, there should be a log entry for “Membership renewed”
47. Change the patron’s expiry date again, this time to be yesterday’s date
48. In the OPAC, click on “Personal detail”, the new expiry date should show there
49. Now set the OPACPatronDetails syspref to be “Allow”
50. Click on “Summary” again, the self-renewal link should be there again
51. Click into the self-renewal process and click “Yes” on your verification step
52. This time you should be met with a message that says “Confirm your account details”
53. Click “Continue” - you will be redirected to the OPAC details form
54. There should be a message at the top that says “Please verify your details to proceed with your self-renewal.”
55. Update a field somewhere on the patron form
56. Scroll to the bottom - the button should say “Submit renewal request”
57. Click this button
58. You will be shown the renewal confirmation message
59. In the intranet, on the homepage you should now see a modification request
60. Check the request, it should match the fields you changed - don’t approve or deny for now
61. Set ‘AutoApprovePatronProfileSettings’ in sysprefs to “Enable”
62. Reset your patron’s expiry date to today’s date
63. In the OPAC, click into Personal details and then back into Summary again (we need to do this to remove the success parameter from the URL)
64. The renewal link will be visible again - go through the process again
65. On the form, you should see an alert that you have already sent a modification request
66. This time, change a different field to the previous attempt
67. Submit the form
68. In the intranet there should be no modification this time and the change should be visible in the patron record as it has been automatically approved and handled as per the syspref
69. prove t/db_dependent/Koha/Patron.t
70. prove t/db_dependent/api/v1/patrons_self_renewal.t
71. yarn cypress run --spec t/cypress/integration/Islands/SelfRenewal.ts
72. Sign off!

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 09:30:00 -06:00
Jonathan Druart d533f2bbff
Bug 42185: Remove C4::Context::_new_dbh
This looks trivial at first, but it's not, because of forking and the
comment in C4::Context
I don't think the comment makes sense, we need to retrieve a new dbh,
and so passing the 'new' parameters to C4::Context->dbh should do the
same.

Test plan:
Try rebuild_zebra.pl and confirm there is no error
 % perl misc/migration_tools/rebuild_zebra.pl --processes 2 -b

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-29 09:08:59 -06:00
Raphael Straub 43d32f77d6
Bug 41062: Add an option to erm_run_harvester.pl to specify provider IDs
This patch adds a new option to define the providers in cronjob erm_run_harvester.pl
that are used to run the SUSHI harvesting for COUNTER Reports in the ERM module.
Use parameter --provider-id or -p
The parameter provider_id is repeatable.
If the parameter for provider_id is not used all active providers will be harvested (as before).
The script will check if these providers are active (as before).

Script to run on ktd: perl misc/cronjobs/erm_run_harvester.pl --begin-date 2025-09-01 --end-date 2025-09-30

To test:
- Run the script and make sure that all active providers are harvested.
- Apply patch.
- Run the script with only one provider-id.
- Run the script with two provider-ids by using -p 1 -p 2
- Run the script without the parameter.
- Make sure that in all cases only active providers are harvested.
- Sign off :-).

Sponsored-by: Karlsruhe Institute of Technology (KIT)
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-23 09:24:47 -06:00
Martin Renvoize a1b7017588
Bug 35267: (follow-up) Fix PrintSlipCSS accordion and CSS in HTML output
- Add missing PrintSlipCSS accordion panel to the notice editor
- Pass AllNoticeCSS and PrintNoticeCSS to gather_print_notices.pl HTML output
- Include inline <style> blocks in print-notices.tt template

Signed-off-by: Marion Durand <marion.durand@biblibre.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:09 -06:00
Emily Lamancusa 29caec496b
Bug 41851: (QA follow-up) Log completion before exiting
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:03 -06:00
Nick Clemens 18ffe25210
Bug 41851: Add logging to edi cron job
To test:
1 - Enable cronjob logging:
    http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=CronjobLog
2 - Enable EDIFACT
    http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EDIFACT
3 - perl misc/cronjobs/edi_cron.pl
4 - Check action logs for cronjobs:
    http://localhost:8081/cgi-bin/koha/tools/viewlog.pl?src=&user=&modules=CRONJOBS&actions=&object=&info=&interfaces=&from=&to=&output=screen&basename=Export&report_name=&do_it=1
5 - No log
6 - Apply patch
7 - perl misc/cronjobs/edi_cron.pl
8 - Refresh the action logs screen
9 - Success! Start and end logged

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-17 09:18:02 -06:00
Ayoub Glizi-Vicioso 0c2ef0e6b4
Bug 41967: Ensure --cards argument accepts an integer in cleanup_database.pl
Test plan (for --cards arguments) :

1. Initial Setup:
    a) Go to Tools > Patron card creator > New > Card batch
    b) Create two different batches (Batch 1 and Batch 2) using the 'Add by borrowernumber(s):' option.
        If using **KTD** you can use the following borrowernumbers for both batches:
            15
            29
            47
        else you will need to create your own patrons and enter their borrowernumber.
    c) In your terminal, set the timestamps manually:
        --OPTION A (KTD users):
            ktd --shell
            koha-mysql kohadev

        --OPTION B:
            Access your database

        Then:
            UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1';
            UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2';

    Note: your batch_id may differ.

2. Before Applying the Patch:
    a) Run the following cleanup script:
        ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose
    b) Error in console output
    c) Nothing is deleted even though one batch was older than 15 days
        SELECT * FROM creator_batches;

3. Apply The Patch

4. After Applying The Patch:
    a) Redo step 1 (Initial Setup).
    b) Run again the following cleanup script:
        ./misc/cronjobs/cleanup_database.pl --cards 15 --confirm --verbose
    c) Check that the console output says: "Purging ... more than 15 days ago"
    d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success!
        SELECT * FROM creator_batches;

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:07 -06:00
Ayoub Glizi-Vicioso 9e05ca0e19
Bug 41967: Ensure --labels argument accepts an integer in cleanup_database.pl
Test plan :

1. Initial Setup:
    a) Go to Cataloging > Label creator > New > Label batch
    b) Create two different batches (Batch 1 and Batch 2) using the 'Add by barcodes or itemnumbers' option.
        If using **KTD** you can use those barcodes for the two batches:
            39999000010114
            39999000010138
            39999000010152
        else you will need to create your own records with items and enter their barcodes.
    c) In your terminal (in a ktd --shell), set the timestamps manually:
        --OPTION A (KTD users):
            ktd --shell
            koha-mysql kohadev

        --OPTION B:
            Access your database

        Then:
            UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 30 DAY) WHERE batch_id = '1';
            UPDATE creator_batches SET timestamp = DATE_SUB(NOW(), INTERVAL 5 DAY) WHERE batch_id = '2';

    Note: your batch_id may differ.

2. Before Applying the Patch:
    a) Run the following cleanup script:
        ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose
    b) Check that the console output says: "Purging ... more than 1 days ago"
    c) Check database and notice that it is now empty, even though one set was less than 15 days old.
        SELECT * FROM creator_batches;

3. Apply The Patch

4. After Applying The Patch:
    a) Redo step 1 (Initial Setup).
    b) Run again the following cleanup script:
        ./misc/cronjobs/cleanup_database.pl --labels 15 --confirm --verbose
    c) Check that the console output says: "Purging ... more than 15 days ago"
    d) Batch 1 is deleted, but Batch 2 (5 days old) is STILL PRESENT. Success!
        SELECT * FROM creator_batches;

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-16 15:54:06 -06:00
Victor Grousset/tuxayo 5fed11a14c
Bug 41216: (QA follow-up): fix path of xt/author/tt_valid.t in comment
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-10 09:48:11 -06:00
Jonathan Druart 952933c31e
Bug 41216: Restore tt_valid.t
HTML1 is gone. Almost...
The previous rule said that we could not have TT tags within HTML tags
because it caused problems with the translation.
It was incorrect.
Bug 38720 removed that rule, and stated that the only problematic use
was a IF with ">".
It was also incorrect.

This one bug states that we cannot have TT tags to construct HTML tags
IF one of the attribute contains a translatable string.
The list of translatable attributes are listed in tmpl_process3.pl.

This patch restores xt/tt_valid.t (and move it to xt/author) and adjust
slightly the test to take into account this last statement.

Test plan:
0. Apply only this first patch
1. Run xt/author/tt_valid.t
=> It fails on mana-subscription-search-result.inc
2. Update po for your prefered language
=> The string "This resource has been reported more than" is not in the
po files

3. Apply the second patch, repeat 1 and 2
=> It still fails: adding a space between the TT tag and the attribute is not enough here
=> The string is picked now! but... install the template and open the
translated version =>

4. Apply the third patch, repeat 1 and 2
=> The tests pass!
=> The string is still picked, install => The template looks good!
Now if you are familiar with Mana you can try to see the translated
string on the UI

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-10 09:48:07 -06:00
Tadeusz „tadzik” Sośnierz 0bcf87df38
Bug 42302: Fix xgettext.pl's STDOUT output
xgettext.pl tries to produce output to STDOUT by default, but fails
because of an error in the code. It should go to the actual STDOUT
instead of a file named '&STDOUT'.

Test plan:
1. Run xgettext.pl:
     echo koha-tmpl/opac-tmpl/bootstrap/en/includes/serial-status.inc > transfiles
     ./misc/translator/xgettext.pl -vaf transfiles
2. Observe no standard output, and the existence of a file
   called `&STDOUT`. Output to the screen is:
     echo koha-tmpl/opac-tmpl/bootstrap/en/includes/serial-status.inc > transfiles
     kohadev-koha@kohadevbox:koha(main)$ ./misc/translator/xgettext.pl -vaf transfiles
     ./misc/translator/xgettext.pl: Outputting to STDOUT...
     ./misc/translator/xgettext.pl: Opening input file list "transfiles"
     ./misc/translator/xgettext.pl: Processing file "./koha-tmpl/opac-tmpl/bootstrap/en/includes/serial-status.inc"
3. Apply the patch.
4. Run again.
5. Observe that information is output to the screen (see example of
   outpunt in the bug comment).

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-04-09 08:27:36 -06:00
Martin Renvoize 58b560d9f9
Bug 23415: (QA follow-up) Fix spelling: oweing -> owing
Standardizes error code spelling across the codebase:
- Changes 'too_much_oweing' to 'too_much_owing'
- Changes 'auto_too_much_oweing' to 'auto_too_much_owing'

The word "owing" is the correct spelling in English.

Files updated:
- C4/Circulation.pm
- C4/SIP/Sip/MsgType.pm
- circ/renew.pl
- koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt
- koha-tmpl/intranet-tmpl/prog/js/checkouts.js
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
- misc/cronjobs/automatic_renewals.pl
- opac/opac-reserve.pl
- opac/opac-user.pl
- t/db_dependent/Circulation.t

All tests should pass successfully.

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-22 23:15:45 +01:00
Jonathan Druart d331c7aba8
Bug 40744: Ignore --del-exp-selfreg if pref is not set
If PatronSelfRegistration we should ignore (i.e. do nothing) if
--del-exp-selfreg is passed to cleanup_database.pl

It prevents the script to warn that the pref is not set.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-20 11:54:31 +00:00
David Cook 90f173ac6a
Bug 38365: Add context to Koha::Devel::Files in add_csp_nonces.pl
The add_csp_nonces.pl file should use the exceptions in
Koha::Devel::Files.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:41 +01:00
David Cook e011f2f6e1
Bug 38365: Make tidy.pl compatible with script elements with attributes
tidy.pl will still tidy whitespace around script elements that have
attributes like "nonce"

Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:38 +01:00
Jonathan Druart bba61e6bc9
Bug 38365: Use Koha::Devel::Files->ls_tt_files in add_csp_nonces.pl
Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:35 +01:00
David Cook f80451023e
Bug 38365: Add <style to add_csp_nonces.pl to add nonce to style elements
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>
Signed-off-by: David Cook <dcook@prosentient.com.au>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:16 +01:00
Martin Renvoize e8d11cc102
Bug 38365: Add script to insert CSP nonces into templates
Add misc/devel/add_csp_nonces.pl which automatically adds CSP nonce
attributes to inline <script> tags in Koha templates.

The script:
- Finds all .tt and .inc files in koha-tmpl/
- Adds nonce="[% Koha.CSPNonce | $raw %]" to inline scripts
- Skips external scripts (those with src= attribute)
- Skips scripts that already have nonce= attribute
- Skips third-party library files in lib/ and vendor/

Usage:
  perl misc/devel/add_csp_nonces.pl          # Dry run
  perl misc/devel/add_csp_nonces.pl --apply  # Apply changes

This script enables easy backporting of CSP nonce support to older
Koha versions by running it against their template directories.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>
Signed-off-by: David Cook <dcook@prosentient.com.au>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:14 +01:00
Nick Clemens 036d92e654
Bug 41316: Use patrons homelibrary for selecting overdues that should be sent
Currently the patron homelibrary option for OverdueNoticeFrom will select overdues for a branches triggers
based on the issuing branch

The other two options select the trigger/overdues based on the selection

This patch alters the selection of overdues to match only for the patrons branch

To test:
1 - Apply 41315 and follow the plan there
2 - Apply this bug and run the overdues script, assuming CPL is branch A:
    perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v
3 - No overdues should be triggered
4 - Run the script for one of the patrons home libraries, in my case MPL
    perl misc/cronjobs/overdue_notices.pl --triggered --library MPL --test --nomail -v -v
5 - Note only overdues for patrons from that branch are triggered

Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-03-05 08:33:54 -07:00
Kyle M Hall 5779eec49b
Bug 39749: RestrictPatronsWithFailedNotices should not trigger for DUPLICATE_MESSAGE failures
Koha is built to prevent sending duplicate notices. Notices with static language ( e.g. "You have one or more holds ready to pick up" ) will easily trigger this filter.

RestrictPatronsWithFailedNotices should ignore these notices because they do not indicate any problem with contacting the patron.

Test Plan:
1) Enable RestrictPatronsWithFailedNotices
2) Enqueue to identical notices for a patron
3) Run process message queue to send one and fail the other as a
   duplicate ( alternately, just modify them in the database )
4) Run restrict_patrons_with_failed_notices.pl
5) Note the restriction
6) Remove the restriction
7) Apply this patch
8) Run restrict_patrons_with_failed_notices.pl
9) Note that no restriction was created!

Signed-off-by: Marion Durand <marion.durand@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-03-05 08:33:52 -07:00
Lucas Gass fde40177fa
Bug 23260: Update cron to exit if AnonymousPatron is not set
Signed-off-by: Peter Moore <peter@mrcpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-03-05 08:33:48 -07:00
Andrew Fuerste Henry f0d4240ee2
Bug 23260: (QA follow-up) Prevent use of cronjob when AnonymousPatron not set
To test:
1 - configure StoreLastBorrower but not AnonymousPatron
2 - perl misc/cronjobs/anonymize_last_borrowers.pl -c
3 - the cron tells 'Preference 'AnonymousPatron' must be enabled to anonymize item's last borrower'
4 - put a value in AnonymousPatron
5 - repeat 2
6 - cron runs good

Signed-off-by: Peter Moore <peter@mrcpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-03-05 08:33:47 -07:00
Lucas Gass 7eda8d23fa
Bug 23260: Add a confirm flag
To test the confirm flag:
1. Run perl misc/cronjobs/batch_anonymise.pl --days 1
2. Notice the warning about needing a confirm flag
3. Run perl misc/cronjobs/batch_anonymise.pl --days 1 --confirm
4. The script runs

Signed-off-by: Peter Moore <peter@mrcpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-03-05 08:33:46 -07:00
Nick Clemens ecfd85ebb8
Bug 23260: Add cronjob anonymize_last_borrowers.pl
This patch adds the feature to anonymize patrons from items_last_borrower table. This code is run from batch_anonymize script, which is triggered from a new cron job anonymize_last_borrowers.pl

To test:
 1) apply this patch and the previous ones
 2) perl installer/data/mysql/updatedatabase.pl
 3) set StoreLastBorrower preference to Allow.
 4) set AnonymousPatron preference to a valid patron id
 5) Create a Check out followed by a Check in.
    CHECK => a row should appear in items_last_borrower table with the borrower and the item number.
 6) In mysql, update created_on of items_last_borrower and returndate of old_issues to two days earlier.
 7) perl misc/cronjobs/anonymize_last_borrowers.pl
    CHECK => borrower number in items_last_borrower is not anonymized yet.
 8) Repeat step 5 and 6 but instead of two days earlier, set the new entry in items_last_borrower to three days earlier.
 9) set AnonymizeLastBorrower to 'Anonymize' and AnonymizeLastBorrowerDays to 2 days.
10) perl misc/cronjobs/anonymize_last_borrowers.pl
    SUCCESS => borrower number in items_last_borrower changed to AnonymousPatron id
11) repeat step 8
12) set AnonymousPatron preference to 0
13) perl misc/cronjobs/anonymize_last_borrowers.pl
SUCCESS => borrower number in items_last_borrower changed to null
14) prove t/db_dependent/Koha/Patrons.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Peter Moore <peter@mrcpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-03-05 08:33:46 -07:00
Laura_Escamilla 82ff1e700b
Bug 35612: Recorded branch context for OVERDUE, LOST, and PROCESSING fees
This patch ensures that the accountlines.branchcode field correctly records
which branch's circulation rules were applied when creating OVERDUE, LOST,
and PROCESSING fee debits. Previously, this field was often NULL or set
to the logged-in user's branch, making it difficult to track which branch's
policies governed the fee calculation.

Changes made:

1. New helper method: Koha::Checkout->branch_for_fee_context()
   - Centralizes branch resolution logic based on system preferences
   - For LOST/PROCESSING: honors LostChargesControl preference
   - For OVERDUE: honors CircControl preference
   - Respects HomeOrHoldingBranch when choosing item's branch
   - Supports both Koha objects and plain hashrefs
   - Returns branchcode or undef if context unavailable
2. C4::Accounts::chargelostitem()
   - Now accepts optional $opts hashref parameter
   - Accepts interface, library_id, and issue_id in options
   - Determines appropriate branch using branch_for_fee_context
   - Passes resolved branch to add_debit as library_id
   - Issue_id lookup handles bundled items correctly
3. C4::Circulation::LostItem()
   - Calls branch_for_fee_context before chargelostitem
   - Passes interface context ('cron' for cronjob, otherwise current)
   - Passes resolved branch and issue_id to chargelostitem
4. C4::Overdues::UpdateFine()
   - Calls branch_for_fee_context to determine OVERDUE branch
   - Passes result as library_id to add_debit
   - Resolves long-standing FIXME about branch selection
5. misc/cronjobs/longoverdue.pl
   - Determines branch context before marking items lost
   - Passes library_id to LostItem when charging fees

The branch resolution logic respects these system preferences:
- CircControl: PatronLibrary | PickupLibrary | ItemHomeLibrary
- LostChargesControl: PatronLibrary | PickupLibrary | ItemHomeLibrary
- HomeOrHoldingBranch: homebranch | holdingbranch

Test plan:
1. Create three test libraries (e.g., FPL, CPL, PVL)
2. Create a test patron with home library PVL
3. Create an item with:
   - homebranch = FPL
   - holdingbranch = CPL
4. Set system preferences:
   - FinesMode: Calculate and charge
   - Create circulation rule that charges overdue fines
5. Test OVERDUE fees with CircControl:
   a. Set CircControl = PatronLibrary, HomeOrHoldingBranch = homebranch
   b. Check out item to patron at CPL, backdate to be overdue
   c. Run: perl /usr/share/koha/bin/cronjobs/fines.pl
   d. Check accountlines: SELECT accountlines_id, branchcode, debit_type_code
      FROM accountlines ORDER BY accountlines_id DESC LIMIT 5;
   e. Verify branchcode = PVL (patron's home library)
   f. Delete the fine, repeat with CircControl = PickupLibrary
   g. Verify branchcode = CPL (checkout library)
   h. Delete the fine, repeat with CircControl = ItemHomeLibrary
   i. Verify branchcode = FPL (item's home library)
   j. Change HomeOrHoldingBranch = holdingbranch, repeat
   k. Verify branchcode = CPL (item's holding library)

6. Test LOST fees with LostChargesControl:
   a. Set WhenLostChargeReplacementFee = Charge
   b. Set item replacement price > 0
   c. Ensure item is checked out to patron
   d. Set LostChargesControl = PatronLibrary
   e. Mark item as lost in staff interface
   f. Check accountlines for LOST debit
   g. Verify branchcode = PVL (patron's home library)
   h. Return item, re-checkout, repeat with LostChargesControl = PickupLibrary
   i. Verify branchcode = CPL (checkout library)
   j. Repeat with LostChargesControl = ItemHomeLibrary + homebranch
   k. Verify branchcode = FPL (item's home)
   l. Repeat with LostChargesControl = ItemHomeLibrary + holdingbranch
   m. Verify branchcode = CPL (item's holding)
7. Test longoverdue cronjob:
   a. Re-checkout item with due date triggering longoverdue
   b. Run: perl /usr/share/koha/bin/cronjobs/longoverdue.pl --lost 30=1 --charge 1 --confirm --verbose
   c. Verify LOST debit created with correct branchcode per LostChargesControl
8. Test edge cases:
   - WhenLostChargeReplacementFee = Don't charge → no LOST debit
   - Replacement price = 0 → no LOST debit
   - FinesMode = Don't calculate → no OVERDUE debits

Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-27 11:38:49 -07:00
Aleisha Amohia c72fc81b76
Bug 38549: Provide surname for create_superlibrarian.pl
Interestingly this script already had a $surname variable, just never accepted a parameter for it.

This enhancement enables the user to supply a surname parameter when creating a superlibrarian user via the commandline create_superlibrarian.pl script. Koha patrons MUST have a name, so if no surname is provided, the userid will be used for the surname instead.

To test:

1. Apply the patch and restart services
2. Attempt to create a superlibrarian with no surname provided.
  In KTD: misc/devel/create_superlibrarian.pl --userid test --cardnumber test --password XXXX --branchcode CPL --categorycode S
3. Search for your patron in Koha. Confirm the surname was automatically set to the userid 'test'
4. Attempt to create a superlibrarian, this time provide a surname that is different from the userid so easy to tell apart.
  In KTD: misc/devel/create_superlibrarian.pl --userid test1 --cardnumber test1 --password XXXX --branchcode CPL --categorycode S --surname testsurname
5. Search for your patron in Koha. Confirm the surname was set correctly using the given surname.

Sponsored-by: Catalyst IT
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-27 11:38:43 -07:00
Nick Clemens d7028939da
Bug 41393: Set the correct reply to address for advance notices
This patch additionally fetches the reply to address for advance notices

To test:
1 - Have some issues that will be due soon for a patron(s)
    Checkout with the due date set to tomorrow
2 - Verify the patron(s) have an email defined, verify the issuing branch has a reply to set
3 - Verify the patron(s) have messaging preference set to receive Advance notices by email 1 day in advance
4 - perl misc/cronjobs/advance_notices.pl -v -c
5 - Check the message queue
    SELECT * FROM message_queue WHERE borrowernumber={##}
6 - Note no rpely to is set
7 - Apply patch
8 - perl misc/cronjobs/advance_notices.pl -v -c
9 - Check the message queue
10 - Confirm newer message has the reply to populated
11 - Ensure the issued item has a different homebranch with a reply to address se
12 - perl misc/cronjobs/advance_notices.pl -v -c --frombranch item-homebranch
13 - Confirm message has correct reply to
14 - Set patron to want digest in messaging preferences
15 - Generate notices
16 - Confirm digets has the right reply to

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tidied inline
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-26 09:04:11 -07:00
Marcel de Rooy b8742964db
Bug 28528: (QA follow-up) Remove "Koha 3" reference
Thats quite old :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-26 09:04:10 -07:00
Roman Dolny 8ec1b421bf
Bug 28528: bulkmarcimport delete option doesn't delete biblio_metadata
When using bulkmarcimport with the -d switch should not only delete
biblio, biblioitems and items, but also biblio_metadata.

I haven't checked if a FK takes care of the data, but if it does,
we should still also reset the AUTO_INCREMENT:...

Test plan:
==========
1. Check (and notice) the number of records in the biblio (bCount) and
   biblio_metadata (bmCount) tables. Check the AUTO_INCREMENT value
   for these tables (bAI, bmAI).
2. Import bibliographic records with delete, turn off foreign key checks
   and non-existent filename:
   misc/migration_tools/bulkmarcimport.pl -b -d -fk -file=non-exist-file
==> "Could not open..." is OK, file doesn't exist.
3. Repeat p. 1 and compare with previously noticed:
   bCount => 0 (OK)
   bmCount => unchanged (NOT OK)
   bAI => 1 (OK)
   bmAI => unchanged (NOT OK)
4. Apply the patch.
5. Repeat p. 2-3:
   bCount => 0 (OK)
   bmCount => 0 (changed, OK)
   bAI => 1 (OK)
   bmAI => 1 (changed, OK)

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-26 09:04:09 -07:00
Marcel de Rooy 47d88a6429
Bug 41097: (QA follow-up) Clarify POD
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-25 07:37:04 -07:00
Nick Clemens 7a5fa4cd50
Bug 41097: Don't use original record twice
This patch prevents us from passing the same record twice into the choose subs
to avoid a situation where the original record is not chosen as the one to keep
and we try to merge/delete the same record twice

To test:
1 - Run the script on a test system that you can reset
    perl misc/maintenance/dedup_authorities.pl -v -v --confirm -a="PERSO_NAME"
2 - Note duplication of entries in the output like:
    Merging 1660,1662 into 1660.
    Updated 0 biblios
    Deleting 1662
    Merge done.
3 - Note how many records are merged
4 - Run again to confirm nothing is merged, i.e. the script removed the dupes
5 - Reset your DB
6 - Apply patch
7 - Run the script again
8 - Note entries no longer have duplicated ids:
    Merging 1662 into 1660.
9 - Note the same number of records are merged
10 - Run again and confirm nothing is merged
11 - Sign off!

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-25 07:37:04 -07:00
Martin Renvoize 32d277687d
Bug 39802: (QA follow-up) Typo fixes
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:39 -07:00
Nick Clemens f5377250f5
Bug 39802: Report when no branches will be selected and exit
This highlights the issue mentioned in the last patch, reporting that
nothign will be done and exiting the script

To test:
1 - perl misc/cronjobs/longoverdue.pl  -l 5=1 --library CPL
2 - Confirm script exits with warning that nothing has been done

Sponsored-by: MAIN Library Alliance
Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:37 -07:00
Nick Clemens 95789607e2
Bug 39802: Use new preference in longoverdue cron
The test plan here is largely confirming that nothing has changed.

Using CircControl here has an existing problem - when set to 'PickupLibrary'
the check in this cron looks for items from the userenv branch - the cron doesn't
have a userenv branch, it is undef, so for any library limiting by branch and
with CircControl set to 'PickupLibrary' / 'the library you are logged in at' the cron will do nothing

Sponsored-by: MAIN Library Alliance
Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:37 -07:00
Jonathan Druart ebfbd0da26
Bug 40947: Remove warning "Aborted connection" from t/db_dependent/www/search_utf8.t
We sent a SIGKILL to the daemon which does not let it cleanup

Updating to SIGTERM (15) and handle the dbh disconnect gracefully in the
daemon.

Also handle SIGINT (ctrl+c) only because I think it can be useful (?)

Test plan:
  prove t/db_dependent/www/search_utf8.t

=> Without this patch there are 3 warnings in the DB container log
db-1         | 2025-10-03 12:30:57 362 [Warning] Aborted connection 42 to db: 'koha_kohadev' user: 'koha_kohadev' host: '172.19.0.6' (Got an error reading communication packets)
=> With this patch applied there are none.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-06 15:17:12 -07:00
Jonathan Druart 849f67988f
Bug 41076: Adjust our perl tidiness for v20250105
Generated using
  `perl misc/devel/tidy.pl --perl`

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-02-05 09:03:51 -07:00
Nick Clemens b034685fe8
Bug 41315: Don't change which branch is used for getting the transports
See bug 41316 - the script uses the triggers of the issuing branch when sending
by patron library - we shouldn't change this here, but on the next bug

Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-28 14:24:04 -07:00
Nick Clemens 37eda84469
Bug 41315: (follow-up) Rename statements for clarity
Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-28 14:24:04 -07:00
Nick Clemens ce848197e5
Bug 41315: Remove unecessary conditional
We are in a loop here:
foreach my $branchcode (@branches) {

branchcode must be defined or something has gone seriously wrong with PERL

Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-28 14:24:03 -07:00
Nick Clemens 914c8be2c0
Bug 41315: Change only notice branchcode when OverDueNoticeFrom is set to patron-homelibrary
This patch adds a new variable $notice_branchcode and uses this when getting the patron's
homelibrary to ensure we don't change the branch we are using.

To test:
 1 - At branch A - checkout three items, 1 day overdue to 3 patrons of the same category from different branches (not A)
 2 - Set the system preference OverdueNoticeFrom to 'patron home library'
 3 - Browse to More->Tools->Overdue notice/status triggers
 4 - Set overdue triggers for default library and the category used above to:
     Delay: 1
     Letter: Overdue notice (ODUE)
 5 - From the command line run the overdue notices:
     perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v
 6 - Note that we begin pass 1 with CPL and then use a different branch for passes 2 and 3
 7 - Apply patch
 8 - Repeat
 9 - Confirm branch is consistent
10 - Run without branch param:
     perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v
11 - Confirm branches are consistent

Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-28 14:24:03 -07:00
Martin Renvoize a71c3a5173
Bug 33308: (QA follow-up) Use simplified File::Transport API from bug 40811
This follow-up updates runreport.pl to use the newer simplified
File::Transport API introduced by bug 40811, which provides:

- Automatic connection management (no explicit connect/disconnect)
- Simplified directory handling via options hash
- Cleaner, more maintainable code

The upload functionality now uses a single upload_file() call with
a path option instead of requiring separate connect() and
change_directory() calls.

Also fixes minor inconsistencies in error messages (missing colons
and escaped quotes).

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-21 15:28:18 -07:00
Jake Deery 875b35145f
Bug 33308: Add S/FTP upload support to runreport.pl
This patch adds S/FTP upload support to runreport.pl by adding additional command-line flags that will, when utilised, deposit a report onto the configured S/FTP Server.

== TO TEST ==
a)  Goto /cgi-bin/koha/admin/file_transports.pl?op=add_form
b)  Configure an S/FTP Server
    *)  If one needs an S/FTP Server to utilise, contact me directly
c)  Configure an SQL report under Reports > Create from SQL
    *)  If you're stuck, you can use `SELECT * FROM items` to select every item in k.t.d to report on
== APPLY PATCH ==
d)  Run `./misc/cronjobs/runreport.pl` without arguments
    *)  Notice `--sftp-dest-id` and `--filename`
    *)  `--sftp-dest-id` specifies the ID of the configured server to use, which can be garnered from the URL when editing the server (look for the file_transport_id parameter)
    *)  `--filename` optionally specifies what the file should be called when uploaded, and can be customised with bash variables if necessary
e)  Run `./misc/cronjons/runreport.pl --sftp-dest-id 1 1`
    *)  Notice the script outputs nothing, indicating success
    *)  On your S/FTP server, notice a report now named report(id)-(date).csv
    *)  Notice that the outputted file contains a CSV-formatted report
f)  Run `./misc/cronjobs/runreport.pl --format html --sftp-dest-id 1 1`
    *)  Notice the script outputs nothing, indicating success
    *)  On your S/FTP server, notice a report now named report(id)-(date).html
    *)  Notice that the outputted file contains an HTML-formatted report
g)  Run `./misc/cronjons/runreport.pl --filename custom.csv --sftp-dest-id 1 1`
    *)  Notice the script outputs nothing, indicating success
    *)  On your S/FTP server, notice a report now named custom.csv
    *)  Notice that the outputted file contains a CSV-formatted report
h)  Run `./misc/cronjons/runreport.pl --format html --filename custom.somehtml --sftp-dest-id 1 1`
    *)  Notice the script outputs nothing, indicating success
    *)  On your S/FTP server, notice a report now named custom.somehtml
    *)  Notice that the outputted file contains an HTML-formatted report
== SIGN OFF ==

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-21 15:28:18 -07:00
Jonathan Druart a4c0746370
Bug 40777: Move all biblio tests to the new package
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-21 07:44:15 -07:00
Jonathan Druart b88dd24139
Bug 40777: Introduce Koha::Database::DataInconsistency
test plan:
1. Export a record with an item from the staff interface as MARCXML (Save > MARCXML).
2. Edit the file and remove the 952$a (home library) and 952$b (current library).
3. Delete the item and record in the staff interface.
4. Import the exported record and item from the MARCXML file:
   - Cataloging > Import > Stage for import
     . Settings > Format: MARCXML
   - Stage for import
   - View batch link on the job details page (assuming successfully staged)
     . New record framework: change to Books, Booklets, Workbooks
5. Turn on the browser developer tools and view the console.
6. Access the details page for the new record.
7. Note that you get:
   - A "Processing" dialog box on screen
   - A browser pop-up window/dialog box with:
       Something went wrong when loading the table.
       500: Internal server error
   - Click OK
   - The console shows:
      . Failed to load resource: the server responded with a status of 500 (Internal Server Error)
      . Got 500 (Internal Server Error)
      . DataTables warning: table id=holdings_table - Ajax error. For more information about this error, please see https://datatables.net/tn/7
8. Run misc/maintenance/search_for_data_inconsistencies.pl, you get these result (the itemnumber may be different):
    == Not defined items.homebranch and/or items.holdingbranch ==
    	* Item with itemnumber=973 does not have home and holding library defined
    => Edit these items and set valid homebranch and/or holdingbranch
    (↑↑ don't do it, it's part of the message content)
9. Apply the patch.
10. Restart everything.
11. Refresh the details screen for the imported record.
12. You now get the same as step 7, but with added "Have a look at the "Audit" button in the toolbar" text in the browser pop-up dialog box:
    - A "Processing" dialog box on screen
    - A browser pop-up window/dialog box with:
        Something went wrong when loading the table.
        500: Internal server error
        Have a look at the "Audit" button in the toolbar
    - Click OK
    - The console shows:
      . GET http[URL for the record....] 500 (Internal Server Error)
      . Got 500 (Internal Server Error)
      . DataTables warning: table id=holdings_table - Ajax error. For more information about this error, please see https://datatables.net/tn/7
13. Click on the Audit button.
14. You get a yellow box at the top of the record with:
      Errors found
      Item with itemnumber=973 does not have home and holding library defined
    (Note that there is still the "Processing" dialog box, you can edit the item by select the "Items" option in the sidebar menu and then edit the item details - the home and current library files will be auto-populated with the current library, Centerville with KTD)
15. Repeat step 8, you get the same results.
16. The tests pass: prove t/db_dependent/Koha/Database/DataInconsistency.t
17. Check the details page for another record that doesn't have any data issues - note the 'Audit' toolbar item, and if clicked should show a blue box at the top of the record with "No data inconsistency found."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-21 07:44:13 -07:00
Rudolf Byker a762e68e0d
Bug 37538: Improve documentation for the OCLC import daemon script
This updates the documentation for the
misc/bin/connexion_import_daemon.pl --help option.

Test plan:
1. Run ./misc/bin/connexion_import_daemon.pl --help
2. Read the output and check for errors, whether grammatical,
   spelling, or factual.

Sponsored-by: Reformational Study Centre <www.refstudycentre.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-12 10:53:30 -07:00
David Nind ef2f7524c0
Bug 41494: Rename "Koha administration" module name to "Administration"
This changes "Koha administration" to "Administration" on the
staff interface home page and the administration module home page.

Everywhere else in the staff interface, such as browser page titles
and breadcrumbs, administration is used.

This improves consistency, and is how it is commonly referred to.

It also change some other occurences in the code base, such
as code comments.

Test plan:
1. Note the inconsistencies in how we name and refer to the
   administration module:
   1.1 Staff interface home page: Koha administration
   1.2 Administration module home page: Koha administration, but note
       that the breadcrumb and browser page title is "Administration".
   1.3 Breadcrumbs and browser page titles for any of the administration
       areas are just "Administration".
   1.4 More > Administration.
2. Apply the patch.
3. Note that on the staff interface home page and the administration
   home page are now labelled "Administration".

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-06 07:45:37 -07:00
Lucas Gass 28e5c1d1f6
25.11.00: Add release notes
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-12-05 13:31:40 -07:00
Katrin Fischer 59d07337de
Bug 41008: Fix bulkmarimport.pl -a -d
After bug 35659 that added the OAI harvester to Koha the -d switch
for deleting authorities before importing with bulkmarcimport.pl
was broken and resulted in a FK error.

Switching from truncate to DELETE FROM like we already did for items,
biblio etc. fixes the issue.

To test:
- Make sure you have some authorities in your database
- Export some into a file for importing
- Run bulkmarcimport -a -d --file <filename>
- Verify you get the a DB FK constraint error.
- Apply patch
- Repeat steps, verify the script now works as expected again
  * Existing authorities are deleted
  * File is imported

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jan Kissig <bibliothek@th-wildau.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-12-01 08:34:03 -07:00
Jonathan Druart beac9eae8f
Bug 40680: Move EXPORT_OK right after Modern::Perl
So it is done before the other use statements.

Also uniformize the pattern, must now be:
```
use Modern::Perl;
use base 'Exporter';
BEGIN {
    our @EXPORT_OK = qw(subroutine list);
}
```

Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
  Bug38936 exported redirect_if_opac_suppressed
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-12-01 08:33:56 -07:00
Martin Renvoize d90333e911
Bug 39532: Use new FINES restriction type to avoid conflict with SUSPENSION
This patch introduces a new unique restriction type 'FINES' specifically
for the debar_patrons_with_fines.pl script to prevent duplicate
restrictions on repeated runs.

The original fix used 'SUSPENSION' but this conflicted with the
fine-in-days feature which uses SUSPENSION for time-limited restrictions
when overdue items are returned. Running the script would overwrite
those time-limited restrictions with indefinite ones.

Changes:
- Add new 'FINES' system restriction type to patron_restriction_types.yml
  for new installations
- Create database update to add 'FINES' type to existing installations
- Update debar_patrons_with_fines.pl to use 'FINES' instead of 'SUSPENSION'
- Update AddUniqueDebarment and DelUniqueDebarment POD documentation

This keeps SUSPENSION exclusively for the fine-in-days feature while
preventing duplicate restrictions from the fines script.

Test plan:
1. Run database update
2. Verify new FINES restriction type exists in restriction_types table
3. Run debar_patrons_with_fines.pl multiple times
4. Confirm only one FINES restriction per patron (no duplicates)
5. Verify SUSPENSION restrictions from fine-in-days are not affected
6. Run tests: prove t/db_dependent/Patron/Borrower_Debarments.t

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-21 08:41:51 -07:00