Commit Graph

54494 Commits

Author SHA1 Message Date
Matt Blenkinsop a5d2239a52 Bug 37620: Fix Total-Count headers
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 e2538b5e83)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 17:50:32 +00:00
Matt Blenkinsop 0a906ca5b8 Bug 37076: Fix incorrect needsconfirmation code
This patch corrects two instances of RESERVED_WAITING to RESERVE_WAITING

Test plan:
1) Navigate to system preferences and search for AllowItemsOnHoldCheckoutSCO
2) Observe from the description that the correct status code is RESERVE_WAITING
3) Search the repository for RESERVED_WAITING - you should find two instances, one in Checkouts.pm and one in checkout.js
4) Apply patch
5) Repeat step 3 - there should be 0 instances

Signed-off-by: Lucas <lchirlias@ville-roubaix.fr>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2b7e770429)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 17:41:19 +00:00
Baptiste Wojtkowski e69480bfb7 Bug 37642: Generated letter should use https in header
_wrap_html returns a header referring to http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd and http://www.w3.org/1999/xhtml. These should be https links.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e27c3a6090)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:26:52 +00:00
Tomas Cohen Arazi 94764f4d70 Bug 37672: Add tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 765c724f98)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:25:15 +00:00
Tomas Cohen Arazi 37c5a96f56 Bug 37672: Make V1/RecordSources.pm use more helpers
This patch adapts the controller class to match the current guidelines
by makiing use of the provided helpers.

The tests are adapted.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e6ef792e10)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:25:15 +00:00
Matt Blenkinsop 613e8137e6 Bug 37687: Restore -not_in operator
Test plan:
1) Compare the API documentation on query parameters and note that'-not_in' is listed as a valid operator.
2) Look at the patch diff - you will see that previously '-not_in' was not included in the list and now is

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c3c36f2bb)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:23:21 +00:00
Jonathan Druart 242b345311 Bug 38071: Ensure search.dt is triggered
I don't really understand why the previous code is not working, but
the search.dt event handler is not correctly set when initComplete is
passed to the constructor (for instance from the patrons search)

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 503f310a14)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:17:06 +00:00
Emmi Takkinen 42e42bced4 Bug 37987: Speed up downloading reports in .tab format
Downloading SQL report in .tab format was significantly
slower after changes made in bug 37382. Apparently using
HTML::Scrubber to redeclare content variable after
mapping it is slow. Instead sending whole map function
as parameter to module speeds up downloading to couple
of seconds as it was before.

To test:
1. Find or create report that returns several thousand rows
(e.g. SELECT * FROM items LIMIT 4000).
2. Run report and attempt to download it as .tab file.
=> Notice that this takes a lot of time (around 20 seconds).
3. Apply this patch.
4. Download report again.
=> Dowloading should now take couple second.
=> Confirm that the content of .tab file still contains table
data.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5002a0dac9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:15:33 +00:00
Lucas Gass b82e05de36 Bug 36822: DBRev 24.05.05.001
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Martin Renvoize 3b20194428 Bug 36822: (follow-up) Catch MySQL 8 failure in update
We add a CAST to the fetch of 0000-00-00 dates in the database. This
prevents an error in MySQL 8.0 throws htat aborts the update.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 36a387db22)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Pedro Amorim 5ea41dd507 Bug 36822: (QA follow-up): Fix now time in tests
This is to prevent the scenario of tests failing if they take long to run, e.g.:

    #   Failed test 'updated_on correctly saved on newly created user'
    #   at t/db_dependent/Auth_with_shibboleth.t line 317.
    #     Structures begin differing at:
    #          ->[0] = '2024-11-04 11:20:13'
    #     ->[0] = '2024-11-04 11:20:14

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f945b29ca1)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Pedro Amorim 4c15fb996d Bug 36822: atomicupdate
Fix any existing updated_on issues

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 473f918ba8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Pedro Amorim bc5556acd3 Bug 36822: LDAP - Add discard_changes
Test plan:
1) Apply only LDAP rearrangement patch
2) Run that test file (to prove the rearrangement does not break tests):
$ prove t/db_dependent/Auth_with_ldap.t
3) Verify tests pass
4) Apply LDAP test patch on top
5) Run the test file. Notice it fails.
6) Apply this patch. Run LDAP tests again. Verify tests pass.

Co-authored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4c1e6b5e71)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Pedro Amorim dc8219cfb3 Bug 36822: LDAP - Add test
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e567f78e27)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:30 +00:00
Pedro Amorim 8d9d78493d Bug 36822: LDAP - Rearrange Auth_with_ldap.pm so it picks up on mock config from test file
Without this rearrangement, C4::Context->config('useldapserver') is always 0.
It seems that because its inside a BEGIN block, the mock coming from .t file does not get picked up

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e3d071ac54)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:29 +00:00
Pedro Amorim a9b9f587ce Bug 36822: Shibboleth - Add discard_changes
Test plan:
1) Apply only Shibboleth tests patch
2) Run that test file:
$ prove t/db_dependent/Auth_with_shibboleth.t
3) Verify tests fail with the updated_on error message.
4) Apply this patch. Repeat 2) Verify tests now pass.

Co-authored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ce9c97cda3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:29 +00:00
Pedro Amorim 701aca8307 Bug 36822: Shibboleth - Add tests
prove t/db_dependent/Auth_with_shibboleth.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 01d149b48a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:12:29 +00:00
Wainui Witika-Park 4bb4a27fcb Bug 31143: (follow-up) Add description to fix_invalid_dates.pl
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 769b394292)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:01:44 +00:00
Nick Clemens c90b470c3e Bug 31143: (QA follow-up) Tidy
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a900e9307b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:00:29 +00:00
Nick Clemens 698056d183 Bug 31143: (QA follow-up) move script to maintenance
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b598154fbf)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:00:29 +00:00
wainuiwitikapark 0abf2ede21 Bug 31143: Fix/identify all cases where '0000-00-00' may still remain in the database
This patch identifies date fields in the database (timestamp, datetime, date) that are 0000-00-00 and sets them to NULL

Test plan -

Examples of setting up some 0000-00-00 date fields:

e.g. Borrowers table
update borrowers set dateexpiry="0000-00-00" where borrowernumber=49;

e.g. Items table
update items set datelastseen="0000-00-00" where itemnumber=12;

To identify the cases:
1) Set up some 0000-00-00 date fields
2) Run the misc/maintenance/search_for_data_inconsistencies.pl script
3) Run fix_invalid_dates.pl -v

To fix the cases:
1) Run fix_invalid_dates.pl -c -v
2) Notice the value has changed from 0000-00-00 to NULL

e.g. Borrowers table
select dateexpiry from borrowers where borrowernumber=49;

e.g. Items table
select datelastseen from items where itemnumber=12;

Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d4bfae0977)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:00:29 +00:00
Pedro Amorim 36d2eb2fa7 Bug 31143: Work around subtracting datetime if date_of_birth undef
To test:
1) Run the following SQL:
update borrowers set dateofbirth = '0000-00-00' where borrowernumber = 45;
2) Access the borrower edit page through staff UI:
http://localhost:8081/cgi-bin/koha/members/memberentry.pl?op=edit_form&destination=circ&borrowernumber=45
3) Notice you get an error
4) Run the script:
perl misc/maintenance/search_for_data_inconsistencies.pl
5) Notice you get an error
6) Apply patch restart plack and repeat -> no errors

This is not perfect but its all I have time for, for now. Follow-ups are welcomed as always.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Shi Yao Wang <shi-yao.wang@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e048144d80)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-15 16:00:29 +00:00
Marcel de Rooy 5e07ef7ae7 Bug 37892: (QA follow-up) Fix condition in memberentry
Patron may be undefined. So the test may crash.
Also there is an issue with operator precedence.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cfc953a411)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-14 14:51:03 +00:00
Marcel de Rooy 74e4173dd8 Bug 37892: (QA follow-up) Add tests for ->is_guarantor/ee
Test plan:
Run t/db_dependent/Koha/Patron.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bc68a17c54)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-14 14:51:03 +00:00
Nick Clemens 812ebf0e1d Bug 37892: Fix guarantor restriction, add tests
[SQUASHED IN QA]

These patches will alter the checks for a patron that prevent a category with
'can_be_guarantee' from being a guarantor.  Two patrons in the same category should be
allowed to have a guarantee/guarantor relationship

The tests below assume you are using the KTD sample data. Update borrowernumbers if not.

To test:
 0 - Apply tests patch
 1 - Set the 'Patron' category as 'Can be a guarantee'
 2 - Add a relationship between two patrons of the same category
     This is restricted from the staff interface
     perl -e 'use Koha::Patrons; my $p = Koha::Patrons->find(5)->add_guarantor({ guarantor_id => 23, relationship => 'father'});'
 3 - Note there is no warning or exception. This should be allowed.
 4 - Checkout an item to Edna (borrowernumber 5)
 5 - Set 'TrackLastPatronActivityTriggers' to 'Checking in an item'
 6 - Try to check the item in, KABOOM
 7 - Set 'TrackLastPatronActivityTriggers' to 'Checking out an item'
 8 - Try to issue an item to Enda, KABOOM
 9 - prove -v t/db_dependent/Koha/Patron.t, fail
10 - Apply second patch
11 - prove -v t/db_dependent/Koha/Patron.t, one more test passes, but then fail
12 - Apply third patch
13 - prove -v t/db_dependent/Koha/Patron.t, pass!
14 - restart_all
15 - Checkout to Enda, OK!
16 - Checkin from Edna, OK!
17 - Find two more patrons in the category and attempt to link them
18 - 'Guarantor cannot be a guarantee'
19 - Apply fourth patch
20 - You can add a guarantor from the same category in interface
21 - Try to add a guarantor to the guarantor assigned in 20
22 - Confirm you cannot add a guarantor - "Guarantor cannot be a guarantee"

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>

Bug 37892: Fix patron updates

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>

Bug 37892: Fix patron creation

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>

Bug 37892: Fix memberentry.pl

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>

Bug 37892: (follow-up) Fix patron creation

This patch fixes the 22. of the test plan (22 - Confirm you cannot add a guarantor - "Guarantor cannot be a guarantee"
        )

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Bug 37892: (follow-up) Fix patron creation

TEST PLAN:
1 - Do the 22 parts of the test plan
2 - Add a guarantor to one patron not selected before (let's say A is
  the guarantee, B the guarantor)
3 - Try and add a guarantor to B -> you will success
4 - Remove B's guarantor
5 - Apply this patch
6 - Repeat 3 -> you will not be able to

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Bug 37892: (follow-up) Tidyness

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT]
Renamed a subtest to patron creation tests in Patron.t.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 391e150e07)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-14 14:51:03 +00:00
Lucas Gass 2896429708 Generate release notes for 24.05.05 release
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:15:54 +00:00
Lucas Gass 65b5fb5bd4 Revert "Bug 32530: When duplicating child card, guarantor is not saved"
This reverts commit 602938a82b.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
Lucas Gass 251f5b34e6 Increment version for 24.05.05 release
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
Phil Ringnalda 06acaf74f6 Bug 37786: members/cancel-charge.pl needs CSRF protection
members/cancel-charge.pl will take either a POST or a GET, and as long as the
accountline_id it is passed can be cancelled, will cancel it. That means any
link you click anywhere while logged in to Koha might cancel a charge. It also
takes a borrowernumber which isn't used for the cancelling, only to determine
what account to show after a charge is cancelled, letting a malicious link
show an account other than the one whose charge was just cancelled.

Test plan:
 1. Without the patch, Circulation - Checkout - search for the 'koha' patron
    you log in as
 2. Accounting - Create manual invoice - Make it a Manual fee of 100.00 and
    Save
 3. Pretending it's a well-disguised link in a spear-phishing email, load
    http://localhost:8081/cgi-bin/koha/members/cancel-charge.pl?borrowernumber=5&accountlines_id=1
 4. You are now looking at charges for the patron Acosta, Edna rather than for
    the patron koha, but if you look at the patron koha, its 100.00 charge
    has been cancelled.
 5. Apply patch and reset_all (or if you don't, you'll have to manually adjust
    the link to reflect the charge being accountlines_id 3 rather than 1)
 6. Circulation - Checkout - search for the 'koha' patron you log in as
 7. Accounting - Create manual invoice - Make it a Manual fee of 100.00 and
    Save
 8. Click the link http://localhost:8081/cgi-bin/koha/members/cancel-charge.pl?borrowernumber=5&accountlines_id=1
 9. You got a 403 because you didn't pass the op cud-cancel, but if you did
    pass that op, you would also get a 403 for having a cud- op in a GET (and
    if you POST, you won't have a csrf_token)
10. Checkout - search for koha - Accounting - Cancel charge
11. Having done it the right way, you're now on koha's list of transactions,
    where you can see you just cancelled it

Sponsored-by: Chetco Community Public Library

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
Magnus Enger e2a31a2e18 Bug 33339: (Follow up) Fix more cases of formula=empty
This patch adds formula=empty to:
- Koha::ERM::EUsage::SushiCounter::_build_COUNTER_report_file()

Updated 2024-09-26: Earlier version also removed unnecessary
use of formula=empty from two places.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
Kyle M Hall 3d03eff4a4 Bug 33339: Prevent Formula Injection (CSV Injection) in CSV files
The system is vulnerable to Formula Injection attacks as the data
stored within the database and exported as CSV/Excel is not being
sanitized or validated against implanted formula payloads

This patch modifies all uses of Text::CSV and derived classes to pass
the "formula" parameter with value of "empty" which replaces formulas
by empty string.

Test Plan:
1) Apply this patch
2) For guided_reports.pl, attempt to export CSV where you've set a column to a formula somehow
   ( such as "=1+3" )
3) Export that CSV file
4) Note the formula has not been exported
5) Repeat this plan for the remaining scripts that export CSV files
   where users can define the outputted data

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Fixed two conflicts. I have tested that this works as advertised on:
- Reports (Download > Comma separated text (.csv)) [Text::CSV::Encoded]
- Circulation > Overdues > Download file of all overdues [Text::CSV_XS]
- misc/export_borrowers.pl [Text::CSV]
This covers all modules used, and both GUI and command line.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Change none to empty in the commit message ! None is the default,
doing nothing. Empty clears the formulas.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
David Cook dbaee28bbe Bug 37724: Remove Koha version number from OPAC
This change removes the Koha version number from the OPAC generator
metadata.

Test plan:
0. Apply patch
1. Enable syspref SelfCheckInModule
2. Visit /cgi-bin/koha/opac-main.pl and confirm meta tag doesn't
include version number
3. Visit /cgi-bin/koha/sci/sci-main.pl and confirm meta tag doesn't
include version number
4. Visit /cgi-bin/koha/sco/sco-main.pl) and confirm meta tag doesn't
include version number
5. Click "Help" and confirm meta tag doesn't include version number

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-11-07 23:02:54 +00:00
Artur 027758d4c0 Bug 37861: Fix XSS vulnerability in barcode append function
When user inputs were appended directly to the barcode table, the values were not properly escaped, allowing potential XSS attacks. This patch ensures that user inputs are sanitized and safely added to the DOM using .text() and .attr() methods to prevent script injection.

To test:
Enable the "SelfCheckInModule".
Open the barcode input form.
Enter a barcode with HTML or script tags.
Without the patch, observe that the script is executed.
Apply the patch.
Repeat step 2.
Verify that the input is escaped and no script execution occurs.
Check that the barcode is properly appended to the table.

Documentation:
No updates required.

Sponsored-by: KillerRabbitAos

Signed-off-by: Bo Gustavsson <bosse@gustavsson.one>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
2024-11-07 23:02:34 +00:00
Jonathan Druart 7482d093a7 Bug 37953: (bug 35138 follow-up) Fix DisplayLibraryFacets - facet order
Before bug 35138:
DisplayLibraryFacets had priority over the settings in the mappings page.
If you had DisplayLibraryFacets set to "holding library" (only) then only the holding library facet was displayed.

On 231200036 we were not adjusting the facet order/appearance, but the
label, which was wrong. The label must be adjusted for both facets and
the order depending on DisplayLibraryFacets.
Note that bug 37446 is adding a new db rev to adjust the label for
installations that have been updated already.

Test plan:
0. checkout c120975b78 (the commit right before 35138 has been pushed)
1. reset_all
2. holding library is set in DisplayLibraryFacets by default
3. checkout main (so without this patch)
4. updatedatabase
=> ES search result display both facets

5. Repeat 0,1,2 and checkout main + this patch, updatedatabase
=> ES search result display only the holding library facet

Feel free to try with another value in DisplayLibraryFacets

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 80d4d3a586)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:38:54 +00:00
Nick Clemens c61e3e9d11 Bug 35125: Respect LinkerConsiderThesaurus in update_cache
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8b691a2b9c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:35:48 +00:00
Nick Clemens 88d9ea0ea8 Bug 35125: Respect LinkerConsiderThesaurus in get_link
This patch adds a new key 'notconsidered' to the authority cache when
linking to avoid doubling when creating new authorities and wishing
to ignore thesaurus

To test:
0 - Set LinkerConsiderThesaurus to "don't"
1 - Set AutCreateAuthorities to generate
2 - Set AutLinkBiblios to Do
3 - Set CataloguingModuleRelink to Do
4 - Save a new record in Koha with the same randomized heading repeated
    but from 3 different authority sources
    ensure source is defined by indicators only and by field $2 once
    ensure the heading is random so that no matches will be found
5 - Confirm each authority is linked to a new unique authority
6 - Apply patch, restart all
7 - Repeat 4 with a new subject heading
8 - Confirm all headings are linked to the same authority

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1894fc5101)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:35:48 +00:00
Pedro Amorim f66e0c6a82 Bug 37891: (QA follow-up): Fix tt_valid QA test
1) Apply both patches
2) $ qa -c 2 -v 2

Amended-by: Jonathan Druart
Add the different attribute at the end of the node so that we can easily
see what's different between the two lines

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:32:30 +00:00
Pedro Amorim 3c46c20dc1 Bug 37891: Submit SMS related data even if SMSSendDriver is empty.
The bug is caused by the SMS data not being submitted as its fieldset is disabled if SMSSendDriver is empty.
This causes the SMS instance of the notice to not be updated when the edit happens, becoming out of sync.
Once it becomes out of sync with the other notices of same code but different transport_type, the 'GROUP BY branchcode,module,code,name,branchname' in letter.pl will fail, as the name no longer matches, listing the same notice twice on the notices table.

This patch updates the logic on the template to have the SMS input elements be disabled/readonly instead of having disabled='disabled' on the SMS fieldset.
This keeps the same functionality i.e. staff member is unable to edit SMS notice if SMSSendDriver is disabled, but ensures that SMS related data is submitted to the controller when the notice edit save happens.

Test plan:
1) Visit notices and slips:
  <staff_url>/cgi-bin/koha/tools/letter.pl
2) Search for a notice code e.g. 'ILL_REQUEST_UPDATE'.
3) Notice only one result is returned. Click 'Edit'.
4) Edit the 'Name'. Click 'Save'.
5) Repeat 2. Notice two results are now returned.
6) Apply patch. Repeat test plan. Notice only one result is returned at the end.

Signed-off-by: Jason Robb <jrobb@sekls.org>

Amended-by: Jonathan Druart
Align

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:32:30 +00:00
Nick Clemens 86e453d05d Bug 38126: Skip allocated holds when filling from transport cost matrix
This patch simply weeds out allocated holds before filling from the matrix

To test:
 1 - Enable RealTimeHoldsQueue
 2 - Enable UseTransportCostMatrix
 3 - Enable LocalHoldsPriority Give/Home/Home
 4 - Administration - Transport cost matrix - enable transfers to/from Centreville and other libraries, add a cost, and save
 5 - Find a bib with a Centerville item
 6 - Place a hold for a centerville patron
 7 - Circulation - Holds queue - All libraries
 8 - Note hold is entered twice
 9 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
10 - Run holds queue again, still there twice
11 - Apply patch
12 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
    Confirm allocated only once
13 - Delete hold, place again from bib record (to test real time allocation)
14 - Confirm allocated only once

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4ed5e6c248)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:27:10 +00:00
Lucas Gass 1c2e7237e3 Bug 38183: Get the active tab number from data-attribute
To test:

1. Have more than 1 staff member who can manage suggestions
2. Create some suggestions
3. Move some suggestions to different statuses (Pending/Accepted/Rejected) so you have multiple tabs on the "Suggestions management" page.
4. Go to the first tab, check some suggestions, and click "Select manager" under "Update manager".
5. Pick a new manager, notice nothing changes on that tab.
6. Now look at the last tab in your list of tabs, see the suggestion manager has been set incorrectly to the last tab.
7. APPLY PATCH
8. Try 4-5 again. The manager should be selected correctly.
9. Try setting the manaager from every tab, making sure it works right.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 2d28aa403a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:22:22 +00:00
Phil Ringnalda be233aadae Bug 37801: Search results with limits create URLs that cause XML errors in RSS and Atom output
The template for RSS and Atom feeds of search results (curiously named
opac-opensearch.tt) is careful to escape ampersands in the query_cgi param
while adding it to URLs, but doesn't escape the limit_cgi param at all. It
should.

Two drive-by fixes for Atom: because the <title> when your search has a limit
includes &nbsp;, which isn't an XML character entity, you couldn't get as far
as the error from the <link> URL, and as long as I was going to have blame for
the line, I couldn't bear to leave the stray undefined SEARCH_RESULT. in the
(hard-coded and bogus) <link rel="last">.

Test plan:
1. In the OPAC, Advanced search - check the boxes to limit by item type Books
   and Mixed Materials and search for the keyword Perl
2. At the top of the search results, click the orange RSS icon
3. That gives you an ugly "not well-formed" error, so in the URL for the page
   change the final "format=rss" to "format=atom"
4. That gives you an ugly "undefined entity" error, so apply the patch
5. Reload the page with the Atom feed, it should change from an error page
   to a garbled display of the feed. Click Back to go back to the RSS feed
   and reload it if it's still cached on the error page. That should give
   a pretty-printed display of the RSS feed without parsing errors

Sponsored-by: Chetco Community Public Library
Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@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 8298e708b9)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 21:01:38 +00:00
Emmi Takkinen 86fc6301a7 Bug 34585: Add data-code attribute to chargeperiod_charge_at selector
When one tries to edit circulation rule "When to charge"
columns value is always set as "End of interval". This patch adds
data-code attribute to chargeperiod_charge_at selector
to define existing rules value.

To reproduce:
1. Navigate to Circulation and fine rules page.
2. Find or create a rule with a "When to charge" value set as
"Start of interval".
3. Edit rule.
=> Note that "When to charge" value is now "End of interval",
while as the other values should be copied as they were.
4. Apply this patch.
5. Edit rule again.
=> "When to charge" should now be copied correctly.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2ca65e0a06)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 16:43:19 +00:00
Owen Leonard de5cf911bb Bug 37270: (follow-up) Fix mixed quotes in preview modal JS
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 1d6f3c4cbe)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 16:36:41 +00:00
Owen Leonard e68c56745a Bug 37270: Fix deletion of saved reports
This patch fixes deletion of saved reports in two instances which
were broken by the CSRF changes: From the dropdown menu in the table of
saved reports, and in the modal window which appears if you click the
"Preview" dropdown menu in the table of saved reports.

The patch also makes a minor change to form-submit.js so that the event
handler will attach to dynamically-generated elements (as is the case
with the preview modal).

To test, apply the patch and go to Reports -> Use saved.

- Add one or more reports if necessary.
- In the table of reports, click the secondary dropdown link in the
  "Run" button.
- Click "Delete." You should be asked to confirm, and confirming should
  correctly delete the report.
- Now test the "Preview SQL" link in the menu.
- A modal window should appear showing you the SQL of the report.
- In the footer of the modal, test the "Delete" button.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 44d0703b4a)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 16:36:41 +00:00
Phil Ringnalda 33fb560cf1 Bug 38056: Search term after deleting an authority shouldn't be URI encoded
Now that deleting an authority record uses a form, rather than building up a
URL in JavaScript, using the filter | uri on the value (confusingly named
value) which passes along the search terms to reload after deleting results
in a bad search. It should instead use the filter | html.

Test plan:
 1. Without the patch, top menu - Authorities
 2. The default search, Main heading ($a only), Authority type Default,
    Operator contains, Order by Heading A-Z will work fine. You need to a
    search which will return more than one of the same thing (not hard in
    ktd) - for MARC21 search for a professional
 3. You should get five results. For one of them, Actions - Delete - Confirm
    that you meant to click it
 4. You now have a%20professional in the search box, and search results for
    whatever ElasticSearch thinks a% means. It's certainly not professional -
    you can change that term to any random string and get the same results
 5. Apply patch, top menu - Authorities
 6. Repeat steps 2 and 3, but this time after deleting another result,
    you will get a professional without the %20 in the search box, and
    your results will be the remaining Addison-Wesley professional computing
    series authorities

Sponsored-by: Chetco Community Public Library
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 6eb4d5804b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-25 15:23:24 +00:00
Lucas Gass 695c411f65 Bug 38199: [24.05.x] Add back missing print class
To test:
1. Find an item to checkout that doesn't belong to the branch you are logged in at.
2. Check the item out.
3. Go to Circulation > Check in
4. Using the check in input in the main area ("Check in"), check the item in
5. A modal should appear, "Please return this item to {branch}"
6. Click "Print slip"
7. Deal with the browsers print dialouge. ( print, cancel, or save should work for testing)
8. After the modal closes focus is not brought back to the barcode field.
9. Check the item in again, this should trigger the "Wrong transfer detected, please return item to: {branch}" modal.
10. Click "Print transfer slip", here the modal closes and properly gives focus to the #barcode input.
11. APPLY PATCH, clear browser cache.
12. Try all the steps again, each time focus should be restored to the #barcode input

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:53:40 +00:00
Tomas Cohen Arazi 3c84a93e36 Bug 38164: Skip fuzzy translations
This patch was envisioned by Julian Maurice.

Test plan:
0. Apply the 1st patch (the revert)
1. Go to `misc/translator/po`
2. es-ES-messages-js.po
3. Mark "Edit" string as fuzzy (around line 48). It should look like:

```
msgid "Edit"
msgstr "Editar"
```

4. Edit ./intranet-main.tt and add the following lines at the bottom,
   inside the `$(document).ready` block:

```javascript
  console.log(_("Edit"));
  console.log(__("Edit"));
```

5. Install the templates
  k$ koha-translate --install es-ES --dev kohadev && restart_all
6. Enable *es-ES* by searching for `language` in the sysprefs and switch
   to it for the staff interface.
7. Go to the Koha home page, open the browser console
=> FAIL: Notice that the second log in the console is displaying the
fuzzy string (i.e. is being translated when it shouldn't)
8. Apply this patch
9. Re-install the translated templates:
  k$ koha-translate --update es-ES --dev kohadev && restart_all
10. Repeat 7
=> SUCCESS: With this patch applied both logs show the English version of the
string.
11. Remove the fuzzy flag on `es-ES-messages-js.po`
12. Repeat 9 and 10
=> SUCCESS: The results are similar to step 7, but in this case they are
expected as the string is not marked fuzzy.
13. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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 5102f708a5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:51:09 +00:00
Tomas Cohen Arazi cfafd7bc2a Bug 38164: Revert "Bug 37303: Replace po2json with a JS version"
This reverts commit 4eb9816354.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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 b285fd57c8)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:51:09 +00:00
Jonathan Druart 9cee6d70f1 Bug 38211: frameworkcode must be set before read
It's a stupid global variable, we MUST have this init line BEFORE we
read it!

Test plan:
See the other bugs linked with this one, confirm the test plan for all
of them still pass.

Test plan for this specific bug report:
1. Cataloging - New record -> Audio Cassettes, CDs
2. Fill in the required fields and save
3. Switch to 'Normal', Edit - Edit record
4. Note that 001 and 003 are not visible, and the Settings menu has a checkmark by Audio Cassettes, CDs
5. Click the browser Back button, then Edit - Edit record
6. Note that 001 and 003 are not visible, and the Settings menu has a checkmark by Audio Cassettes, CDs

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e44927842b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:49:20 +00:00
Tomas Cohen Arazi 3ffb91aa07 Bug 38094: (follow-up) edit_catalogue implies fast_cataloguing
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 51055d892b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2024-10-23 22:46:35 +00:00