Commit graph

8922 commits

Author SHA1 Message Date
e4c7f15c3f
Bug 34478: Log if CSRF is wrong (debug)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:51 +01:00
918fbc24f7
Bug 34478: Display programming errors in case plack.psgi caught something suspicious
It will help developpers to debug the problematic places.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:16 +01:00
4e1372b77c
Bug 34478: op =~ ^cud-
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:05 +01:00
bf9830d354
Bug 34478: op-cud - Trick CGI directly
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:04 +01:00
77e3b58eee
Bug 34478: op-cud - Adjust C4::Auth code
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:02 +01:00
348dbb1594
Bug 34478: Move C4::Auth check
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:02 +01:00
314fe71ff8
Bug 34478: Remove check_csrf from pl files
We should no longer need to check CSRF token from pl files

TODO - there is a change for some files where we returned 403

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:01 +01:00
a0dcce9ce1
Bug 34478: Check CSRF in get_template_and_user
Not sure this is the right place in get_template_and_user
Will have to test login and 2FA

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:56:00 +01:00
0e6537d199
Bug 36098: Add Koha::Session module to ease session handling
This patch adds a Koha::Session module that makes it easier
to work with Koha sessions without needing the full C4::Auth module.

Test plan:
0. Apply the patch
1. Run the following unit tests:
prove ./t/db_dependent/Auth.t
prove ./t/db_dependent/Auth_with_cas.t
prove ./t/db_dependent/Koha/Session.t
2. Observe that they all pass

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:30 +01:00
7d95c64048
Bug 36092: Pass sessionID at the end of get_template_and_user
It seems safer to pass the logged in user and session info at the end of
the sub.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:28 +01:00
3a053ebdf9
Bug 36092: Pass the sessionID from checkauth if we hit auth
If we hit the auth page we were not passing sessionID to the template

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:27 +01:00
c0d5013f2e
Bug 35918: Fix auto library connect (AutoLocation)
This code is a bit weird, its purpose it to auto select the library depending on the IP.
A problem appears if the same IP is used, then the user's choice will
might be overwritten randomly by another library.

To recreate the problem:
Turn on AutoLocation
Use koha/koha @CPL for test
And the following config:
*************************** 1. row ***************************
branchcode: CPL
branchname: Centerville
  branchip: 172.18.0.1
*************************** 2. row ***************************
branchcode: FFL
branchname: Fairfield
  branchip: 172.18.0.1
*************************** 3. row ***************************
branchcode: FPL
branchname: Fairview
  branchip: 172.18.0.4

Connect and select CPL. Randomly FFL will be picked instead.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Tested this on top of 35890 and 35904 because git bz said they were required dependencies.
Figured out the IP Koha was seeing me as coming from in /var/log/koha/kohadev/plack.log.
Added that IP to the branchip for Centerville, Fairfield and Fairview. Set AutoLocation = Yes.
After this I could recreate the problem: If i left the "Library" field in the login screen
at "My Library" I got logged into a random library selected from the three i had set
branchip for. Applying the patches fixed this, as expected.
Tests pass, with AutoLocation off.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:26 +01:00
e59623bfc2
Bug 35890: Reject login if IP is not valid
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:23 +01:00
8fb9b814aa
Bug 35904: (QA follow-up): tidy up code
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:22 +01:00
a82772d7ec
Bug 35904: Make C4::Auth::checkauth testable easily
This patch suggests to add a new flag do_not_print to
C4::Auth::checkauth to not print the headers and allow to test this
subroutine more easily.

We do no longer need to mock safe_exit and redirect STDOUT to test its
return values.

There are still 3 left:
1.
733         # checkauth will redirect and safe_exit if not authenticated and not authorized
=> Better to keep this one, not trivial to replace

2.
806         # This will fail on permissions
This should be replaced but testing $template->{VARS}->{nopermission}
fails, I dont' think the comment is better.

3.
828         # Patron does not have the borrowers permission
Same as 2.

2. and 3. should be investigated a bit more.

This patch also move duplicated code to set patron's password to a
subroutine set_weak_password.

Test plan:
Read the code and confirm that everything makes sense.
QA: Do you have a better way for this? Yes it's dirty!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:21 +01:00
16a648e9ca
Bug 35904: Remove var loggedin
It is never used and add confusion

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 10:55:21 +01:00
Andreas Jonsson
5f9e9e5df2
Bug 36034: (bug 34893 follow-up) fix capture of return values from checkpw
Adapt code to the change of return value type of checkpw
introduced in bug 34893

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2024-02-14 10:27:47 +00:00
12b6c0e67d
Bug 34893: Unit tests for C4::Auth::checkpw
This patch introduces some tests on the current (and new) behavior for
the `checkpw` function.

I needed it to better understand if an edge case was actually possible
(it wasn't).

Found a really minor annoyance for the internal check with expired
password not returning the $patron object for consistency with the other
use cases.

I think this method deserves (at least) changing the return value to a
sane data structure. But that's not target for backporting to stable
releases. So a separate bug.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-02-02 17:31:48 +01:00
2b54d3c82b
Bug 34893: (QA follow-up) Tidy code for qa script
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-02-02 17:31:47 +01:00
c1b94fc011
Bug 34893: ILS-DI can return the wrong patron for AuthenticatePatron
Imagine we have a set of users. Some of those users have a NULL userid. We then call AuthenticatePatron from ILS-DI for a patron with a NULL userid, but a valid cardnumber. We call checkpw, which returns the cardnumber and userid. We then call Koha::Patrons->find on the userid *which is null*, meaning the borrowernumber returned is not the correct one, but instead the earliest patron inserted into the database that has a NULL userid.

Test Plan:
1) Give three patrons a userid and a password
2) From the database cli, set all patrons's userid to null
   Run this query: update borrowers set userid = null;
3) Call AuthenticatePatron with username being the 1st patron cardnumber,
   and password being the password you set for that patron
   http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=AuthenticatePatron&username=kohacard&password=koha
4) Note you get back a borrowernumber for a different patron. Refresh the page and the number is correct.
5) Do the same with the 2nd patron. Same issue at 1st and correct number after.
6) Apply this patch
7) Restart all the things!
8) Do the same with the 3rd patron.
9) Note you get the correct borrowernumber! :D
10) prove t/Auth.t t/db_dependent/Auth_with_ldap.t t/Auth_with_shibboleth.t t/db_dependent/Auth_with_cas.t

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-02-02 17:31:46 +01:00
137376ab4b
Bug 18397: Add message delivery details to the notices tab
This patch adds further delivery details to the notices tab in patron
details in the staff client.

Once a message is sent, we display the 'from:', 'to:' and 'cc:'
addresses in the 'Delivery note' column when they exist.

Test plan
1. Enable KTD to send email [1] (without email configured the
   delivery note displayed "Unhandled email failure, check the logs for
   further details").

2. Add email addresses to two patrons and to KohaAdminEmailAddress,
   and run misc/cronjobs/process_message_queue.pl after generating
   notices.

3. For the two patrons with email addresses, make one a guarantor.

4. Sent Welcome messages (Patron account > More > Send welcome email) -
   nothing in delivery note column.

5. Checkout out an item to the guarantee (item checkout email enabled) -
   nothing in delivery note column.

6. Send the notices by running misc/cronjobs/process_message_queue.pl
   again.

7. Now the 'Delivery note' columns should contain from:, to: and cc:
   address details.

[1] Option 1 - smpt-sink (aka the sandboxes way)
    - Install the postfix package inside ktd (sudo apt install postfix)
      When asked in the wizard, I named mine 'local'
    - Start smpt-sink with
      `nohup smtp-sink -u root -D mail 127.0.0.1:25 100 </dev/null >/dev/null 2>&1 &`

    Option 2 - To test sending emails using a Google account:
    - Set up an App password for your Google Account
    - Edit /etc/koha/sites/kohadev/koha-conf.xml file and add this
      configuration near the end (where <user_name> = your Google email
      address; <password> = your APP password, not your Google account
      password):

      <smtp_server>
        <host>smtp.gmail.com</host>
        <port>587</port>
        <timeout>5</timeout>
        <ssl_mode>STARTTLS</ssl_mode>
        <user_name>GOOGLEACCOUNTUSER</user_name>
        <password>GOOGLEAPPPASSWORD</password>
        <debug>1</debug>
      </smtp_server>

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-31 14:44:42 +01:00
3385142d7c
Bug 35490: Remove GetMarcItem from C4::Biblio module
Test plan:
Compile module, run qa tools.
Search for the use of C4::Items in C4/Biblio.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-31 14:44:40 +01:00
cb7921d8d0
Bug 35833: Silence few warnings from searching
Resolve:
[2024/01/18 11:31:24] [WARN] Use of uninitialized value $hits in numeric eq (==) at /usr/share/koha/opac/opac-search.pl line 612.
[2024/01/18 11:31:24] [WARN] Use of uninitialized value $times in subtraction (-) at /usr/share/koha/C4/Search.pm line 1715.

Test plan:
Look for a few search expressions without results.
Check log without and with patch.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-29 12:24:58 +01:00
857d8f4d82
Bug 35833: Fix warnings from C4/Koha
[2024/01/18 11:52:40] [WARN] Argument " " isn't numeric in numeric eq (==) at /usr/share/koha/C4/Koha.pm line 600.
[2024/01/18 11:52:40] [WARN] Argument " " isn't numeric in numeric eq (==) at /usr/share/koha/C4/Koha.pm line 659.

Note: According to the code in MARC::Field the indicator returned cannot be undef. So we do not return new
uninitialized warnings.

Test plan:
Check your log before and after patch.
Possibly you may need to create a record with spaces as field indicators.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-29 12:24:58 +01:00
0c96e57b0c
Bug 34913: Fix perlcritic for VirtualShelves.pm
C4/Utils/DataTables/VirtualShelves.pm: "@order_by" is declared but not used at line 86, column 9.  Unused variables clutter code and make it harder to read.  (Severity: 3)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-29 12:24:54 +01:00
bb7fc5025b
Bug 35461: Fix function call parameters causing the HASH to show in the renew all responses
"Renew All" -function aka. 65-66-messages work like this: 66-return messages has renewed items in BM-fields and non-renewables go into BN-fields.

If all items were renewable, then the reply message looks like:

Reply:
13.07.2022 10:06:17:530 OUTESTI1 6610005000020220713 100616AOOUPK|BM564N15977171|BM564N09203960|BM564N23261720|BM564N25161958|BM564N23455012|C4::SIP::SIPServer=HASHC4::SIP::SIPServer=HASHAY6AZCEFE

If items include renewables and non-renewables, the response includes the renewed  items first, then a HASH mixed into the first BN-field, then rest of the renewed ones like they should show in BN-fields and after that, anohter HASH:

13.07.2022 14:41:32:610 OUTESTI1 6610003000420220713 144130AOOUPK|BM564N23455012|BM564N23261720|BM564N25161958|C4::SIP::SIPServer=HASHBN564N09203960|BN564N04191259|BN564N15977171|BN564N13788332|C4::SIP::SIPServer=HASHAY8AZC7C5

If all loans were unrenewable (this test included just one item), you first get a HASH in a BN-field, and another at the end.

13.07.2022 14:49:00:037 OUTESTI1 6610000000120220713 144858AOOUPK|C4::SIP::SIPServer=HASHBN564N19874533|C4::SIP::SIPServer=HASHAY9AZDD3B

Our self checkout/checkin machine can handle/parse these reply messages correctly, but this might not be the case with all self checkout/checkin devices.

Test Plan:
1) Unit test patch
2) prove t/db_dependent/SIP/Message.t
3) Note failures
4) Apply this patch
5) prove t/db_dependent/SIP/Message.t
6) Tests pass!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: lmstrand <lmstrand@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-26 15:13:57 +01:00
4e480d48f6
Bug 32029: Automatic item modifications by age add biblio table
In automatic item modifications by age missing,
conditions can be on columns of tables items or biblioitems.
Table biblio is missing.

Test plan :
1) Create an automatic item modifications by age with a condition on a column of biblio table
2) Create a record and item matching the rule
3) Run misc/cronjobs/automatic_item_modification_by_age.pl -c -v
=> Check only matching items are impacted

Signed-off-by: Philip Orr <philip.orr@lmscloud.de>

Bug 32029: (follow-up) unit test

Signed-off-by: matthias le gac <matthias.le-gac@inlibro.com>

Bug 32029: (follow-up) tidy

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-26 15:13:50 +01:00
Janik Hilser
6341d520ac
Bug 29930: Cardnumber incorrectly set to userid on LDAP auth if cardnumber not mapped
In the sub the userId was given, but the cardnumber was expected, therefore at every login the cardnumber changed to the userId.

To test:
1. Login to the OPAC with an LDAP account that has a cardnumber which is different to the userId
2. Check the patron record's cardnumber.
3. The cardnumber should equal to the userId
4. Apply the patch.
5. Login to the OPAC with an LDAP account that has a cardnumber which is different to the userId
6. Check the patron record's cardnumber.
7. The cardnumber should be the same as before

Signed-off-by: Alexander Wagner <alexander.wagner@desy.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Extra test plan:
1. Apply the regression tests
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Auth_with_ldap.t
=> FAIL: Tests fail! 'cardnumber' incorrectly overwritten
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests now pass!
5. Sign off :-D

Signed-off-by: Alexander Wagner <alexander.wagner@desy.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-26 15:13:49 +01:00
99eb44c6c3
Bug 34913: Adjust C4::Utils::DataTables::VirtualShelves
And remove C4::Utils::DataTables, which should no longer be reused
anyway.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-26 15:13:42 +01:00
9b10f69ee3
Bug 35322: Fix the logic for checking for holds in CanBookBeIssued
We are having reports that AllowItemsOnHoldCheckoutSCO and AllowItemsOnHoldCheckoutSIP no longer work. It appreas that in CanBookBeIssued, the ignore reserves check was changed from "check reserves unless the ignore reserves flag was passed" to "check reserves unless the ignore reserves flag was passed *and* we have a recall". I think this was a logic mistake and we want to check reserves unless we have an ignore flag *or* there is a recall.

Test Plan:
1) Enable AllowItemsOnHoldCheckoutSCO
2) Place a hold on an item
3) Attempt to check that item out to another patron
4) Note the checkout is blocked
5) Apply this patch
6) Restart all the things!
7) Attempt the checkout again
8) The checkout now succeeds!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-16 12:06:13 +01:00
Laura Escamilla
122f29cd8f
Bug 34950: Add availability statuses for in transit and on hold items.
To test:
1. Enable the ILS-DI system preference.
2. Place a hold for a patron and put it in transit.
   Place another hold for a patron that is available for pickup at the local branch.
   And then select an item that is available for checkout but don’t change the status for it.
3. Go to your testing OPAC and make an ILS-DI “Get Availability” call using
   the item ids of the three items you worked with in step 2.
   (i.e. http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetAvailability&id=321+323+214&id_type=item)
4. Notice that the availability status for all three items is showing as available.
   The item in transit and the item with a local hold should have a status
   of not available and a message of why they are not available.
5. Apply the patch
6. Use restart_all.
7. Refresh the page and notice that the statuses are now correct.
   The item in transit has a status of not available and an availability
   message of “In transit”.
   The item with the local hold has an availability status of not
   available with an availability message of “On hold”.
   Finally the available item is correctly showing up as available.
8. Sign off and have a wonderful day. :)

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-16 12:06:12 +01:00
067034f9e0
Bug 35438: Remove skip_intermediate_commit parameter
It no longer does anything.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-16 12:06:08 +01:00
74bbb89e99
Bug 35438: Transact each record import separately
When importing a staged file we commit every 50 records
For an authority import we are also merging, which can affect many more biblios, and these all end up in the transaction.
This can cause tables locks and issues across Koha

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

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-16 12:06:07 +01:00
1847e2ab56
Bug 35702: Fetch biblios at once and loop
Test plan:
prove -v t/db_dependent/Authority/Merge.t

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

Amended-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Replace $biblio->id with $biblio->biblionumber

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-16 12:06:03 +01:00
c703bb2c1c
Bug 35702: Use framework code from biblio object
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>
2024-01-16 12:06:02 +01:00
26e7d0c9b3
Bug 35293: (follow-up) Handle all rules as well
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-11 12:10:40 +01:00
a0f83767a8
Bug 35293: Re-implement bug 30407 functionality
To test:
1. Set a book items notforloan status as -1 and set the AllowNotForLoanOverride system preference to 'Allow'
2. Add the following lines to UpdateNotForLoanStatusOnCheckin (the
formatting and indentation is important to keep):

BK:
 -1: ONLYMESSAGE

3. Check a book item out for patron.
4. Check book item in.
=> Description of notforloan status should be displayed under 'Check in message'.
=> Confirm notforloan status HAS changed.

5. Apply patch and update database if needed
6. Set book items notforloan status as -1 (or create new one)
7. Check book item out for patron.
8. Check book item in.
=> Description of notforloan status should be displayed under 'Check in
message'.
=> Confirm notforloan status HAS NOT changed.

Also prove t/db_dependent/Circulation/issue.t

Sponsored-by: Catalyst IT, New Zealand
Signed-off-by: Anneli Österman <anneli.osterman@koha-suomi.fi>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-11 12:10:40 +01:00
Aleisha Amohia
930ad0178d
Bug 35587: Do not trigger transfer if lost item returned and BlockReturnOfLostItems enabled
This fixes current buggy behaviour - when BlockReturnOfLostItems is enabled, no transfer should be triggered and the lost status should be retained.

To test:

1. Go to Koha Administration -> Global system preferences
2. Set the BlockReturnOfLostItems system preference to Block
3. Enable the AutomaticItemReturn system preference (this is simply to make testing a bit faster)
4. Take note of your logged in library
5. Search for an item where the home library is NOT the same as your logged in library
6. Edit this item and give it a lost status
7. Check in the item
8. Notice the item is returned and a transfer is automatically triggered
9. If you go to the item record page, the lost status has been remove

10. Apply the patch and restart services

11. Edit the item again and give it a lost status. This will also cancel the transfer
12. Check in the item
13. Confirm the transfer is NOT triggered and the lost status is retained as expected.
14. Go back to system preferences and disable the BlockReturnOfLostItems system preference (set to "Don't block")
15. Check in the item
16. Confirm the transfer is triggered and lost status is removed

17. Confirm tests pass

prove t/db_dependent/Circulation/Returns.t
prove t/db_dependent/Circulation/Branch.t

Sponsored-by: Pymble Ladies' College
Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Kelly <kelly@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-05 14:04:04 +01:00
21fd864416
Bug 35070: Tidy
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-04 16:51:45 +01:00
Julian Maurice
5047e0761c
Bug 35070: Add plugin hook template_include_paths
It allows to add paths to Template::Toolkit's INCLUDE_PATH option

http://template-toolkit.org/docs/manual/Config.html#section_INCLUDE_PATH

Test plan:
1. Install the modified kitchen sink plugin:

    git clone --branch template-include-paths \
    https://github.com/jajm/dev-koha-plugin-kitchen-sink.git

2. Run misc/devel/install_plugins.pl
3. Restart memcached and koha
4. Go to Administration -> Manage Plugins
5. Run the KitchenSink plugin's tool
6. Click on "Schedule greeting"
7. Go to Administration -> Manage jobs
8. If you don't see any jobs, uncheck "Current jobs only"
9. You should see a job of type "Unknown job type
   'plugin_kitchensink_greeter". Click on the "View" button
10. Under the Report section you should see "This is the report block"
11. Under the Detailed messages section you should see "This is the
    detail block"
12. Open the browser console, you should see a message "This is the js
    block"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-04 16:51:44 +01:00
f53ebe874e
Bug 35588: Scope authorised value desc lookup according to field/subfield
This patch ensures that the authorised value descriptions looked up
are for the correct field/subfield designated in the CSV profile.

Test plan:
0. Do not apply the patch yet!
1. Go to http://localhost:8081/cgi-bin/koha/tools/csv-profiles.pl
2. Add a CSV profile with the default values and using the following
for the "Profile MARC fields":
000|001|003|005|006|007|008|010|015|016|020|022|040|050|082|100|110|
111|130|240|243|245|246|247|250|260|300|336|337|338|440|490|500|501|
505|520|530|600|610|611|630|648|650|651|690|700|710|711|856|887|942|995

3. Create a new List
4. Add all the database's bibs to that list using SQL like the following (where the shelfnumber equals the number for your list):
insert into virtualshelfcontents (shelfnumber,biblionumber,borrowernumber) select 1,biblionumber,51 from biblio;

5. Go to that list in the staff interface
6. Download that list using your CSV profile

7. Apply the patch
8. koha-plack --reload kohadev

9. Download that list using your CSV profile
10. Note that the output is a little slower, but still quick enough.
11. Note that the output is a bit different. For records like "Gairm",
the output will end in "1" instead of "Yes". This is correct, because
this subfield isn't an authorised value!!!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2023-12-28 12:16:11 +01:00
78c0e8df8d
Bug 35579: Cache authorised value lookup by MARC field
This patch adds a "get_descriptions_by_marc_field" method
which caches AuthorisedValue descriptions when searched by
MARC field, which is used when exporting MARC to CSV.

Test plan:
0. Do not apply the patch yet!
1. Go to http://localhost:8081/cgi-bin/koha/tools/csv-profiles.pl
2. Add a CSV profile with the default values and using the following for the "Profile MARC fields":
000|001|003|005|006|007|008|010|015|016|020|022|040|050|082|100|110|111|130|240|243|245|246|247|250|260|300|336|337|338|440|490|500|501|505|520|530|600|610|611|630|648|650|651|690|700|710|711|856|887|942|995|952|952$c
3. Create a new List
4. Add all the database's bibs to that list using SQL like the following (where the shelfnumber equals the number for your list):
insert into virtualshelfcontents (shelfnumber,biblionumber,borrowernumber) select 1,biblionumber,51 from biblio;
5. Go to that list in the staff interface
6. Download that list using your CSV profile
7. Apply the patch
8. koha-plack --reload kohadev
9. Download that list using your CSV profile
10. Note that the output is the same, but that the output completes much more quickly after applying the patch

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2023-12-28 12:16:09 +01:00
4e42f1182d
Bug 35491: Add logging to RevertWaitingStatus
This patch simply adds a logaction line to RevertWaitingStatus

To test:
1 - Enable HoldsLog
2 - Place a hold
3 - Fill the hold
4 - Revert the waiting status
5 - Note there is no action log added
6 - Apply patch
7 - Repeat 2-4
8 - Confirm you now have a MODIFY action logged for the reversion

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2023-12-19 13:42:13 +01:00
ac02c1d2ad
Bug 35405: Remove noise from MARC::Record in SearchAuthorities
We are calling ->field with an undef parameter.
MARC::Record does not like that and says:
  Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 202.
For now, a fix at our side.

Test plan:
Run SearchAuthorities without passing an authtypecode.
Without this patch, it results in a warning per hit.
With this patch, the noise should be gone.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2023-12-18 15:21:09 +01:00
e62e1be323
Bug 18139: Tidy code
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2023-12-18 15:20:57 +01:00
8a9ddc1b1c
Bug 18139: Display the rule critera used to determin the checkout limits to the template
The too many checked out message can be very confusing for librarians
when the limit specified is more or less than the number of checkouts
the patron already has. We should make it clear to the librarian that
his is only counting certain types of checkouts by giving them the
issuing rule criteria used.

Test Plan:
1) Apply this patch
2) Try to check out more items than the circ rules allow for
   regular and on-site checkouts

Signed-off-by: Eric Gosselin <eric.gosselin@inlibro.com>
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2023-12-18 15:20:56 +01:00
2120e3d4c8
Bug 34868: (QA follow-up) Tidy sip_circulation_status
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-11-10 10:59:39 -03:00
1feeead338
Bug 34868: (QA follow-up) Rename new option, add comments
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-11-10 10:59:38 -03:00
5788a0f262
Bug 34868: Add ability for SIP2 to distinguish missing item from other lost types
The SIP circulation status specifies that a 12 means an item is lost, and 13 means an item is missing. In Koha, missing items are simply a type of lost item so we never send a 13. This is an important distinction for some SIP based inventory tools. It would be good to be able to specify when lost status means "missing" at the SIP login level.

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-11-10 10:59:38 -03:00
Aleisha Amohia
eb130f559e
Bug 35008: Make ILS-DI not require auth when OpacPublic disabled
To test, disable OpacPublic and ensure a call to ilsdi.pl will still return expected results from a private browser, not logged into the OPAC.

Sponsored-by: Auckland University of Technology
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-11-10 10:59:28 -03:00