Jonathan Druart [Mon, 17 Jan 2022 14:45:06 +0000 (15:45 +0100)]
Bug 29893: Prevent ES mappings UI to remove hidden rows
If you are editing ES mappings and you use the DataTable filtering option,
the table won't contain all the mappings you have in the DB.
If the form is submitted they will be removed and data will be lost!
Test plan:
Edit ES mappings, filter and submit the form.
Confirm that the table are redrawn before the form submission which
prevent data loss
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Marcel de Rooy [Thu, 24 Mar 2022 07:31:12 +0000 (07:31 +0000)]
Bug 29915: Prevent bad cookie from corrupted session
If there is deleted session info but no session->id, a wrong cookie
with empty name could be generated containing expired session id.
Test plan:
Run t/db_dependent/Auth.t
Login. Check cookies in browser.
Logout. Check cookies in browser.
Without this patch, you should see an invalid cookie.
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: Fridolin Somers <fridolin.somers@biblibre.com>
David Cook [Fri, 4 Dec 2020 05:36:04 +0000 (05:36 +0000)]
Bug 26328: Cast barcode from varchar to integer for incremental barcode
Without this patch, the incremental barcode generation will
treat 978e0143019375 as having an exponent and interpret it as a very
large number.
With this patch, the incremental barcode generation will first cast
barcode varchar strings to integers before finding a max() value.
In this case 978e0143019375 becomes 978 instead of
1.7976931348623157e308
Test plan:
0. Using koha-testing-docker
Before applying patch:
1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=autobarcode
2. Set to "generated in the form 1, 2, 3"
3. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additema&searchid=scs_1607059974968
4. Add item with barcode 978e0143019375
5. Click "p - Barcode"
6. Note the barcode is "Inf"
After applying patch:
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additema&searchid=scs_1607059974968
2. Click "p - Barcode"
3. Note the barcode is "39999000019194"
Nick Clemens [Fri, 18 Mar 2022 14:25:14 +0000 (14:25 +0000)]
Bug 29802: add 'me' to filter_by_visible_in_opac query
This patch prefixes all of the fields in OpacHiddenItems with
"me." before searching.
Unit tests added to cover this case1
To test:
1 - Create a public list
2 - Set OpacHiddenItems to:
biblionumber: [1]
3 - Attempt to view list in OPAC
4 - Booom
5 - Aply patch
6 - Reload list
7 - Success
Bug 30294: Rename Koha::Recall->* used relationship names
This patch renames the underlaying relationship names used in the
'patron' and 'library' subs so they are more clearly prefetchable and
also enabling them to be embeddable and searchable through an eventual
API route for recalls.
To test:
1. Apply the patch
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/Recall*
=> SUCCESS: Tests pass, nothing really changes
3. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Test plan:
1 - Find a record in the staff catalog
2 - Edit the record
3 - In the 520 notes field, add an ASCII escape character (27 decimal, 1b hex)
On ubuntu Ctrl+Shift+u, then 1b, enter
4 - Save the record
5 - Set syspref ShowComponentRecords to 'both...'
6 - On record details: New->New child record
7 - Save the record
8 - Attempt to view the parent record in the staff client and opac
Jonathan Druart [Wed, 19 Jan 2022 13:40:14 +0000 (14:40 +0100)]
Bug 29486: Add check in search_for_data_inconsistencies.pl
If the MARC record does not contain the correct biblionumber of
biblioitemnumber, the script will display the following warning:
== Bibliographic records have MARCXML without biblionumber or biblioitemnumber ==
* Biblionumber 4242 has '1' in 999$c
* Biblionumber 4242 has biblioitemnumber '4242' but should be '1' in 999$d
=> The bibliographic records must have the biblionumber and biblioitemnumber in MARCXML
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Jonathan Druart [Tue, 16 Nov 2021 08:13:30 +0000 (09:13 +0100)]
Bug 29486: _koha_marc_update_bib_ids no longer needed for GetMarcBiblio
This subroutine is ensuring that the biblionumber and biblioitemnumber
will be part of the MARC record.
We should not need that, unless there is something broken somewhere
else.
This line has been added by the following commit:
commit 4e95e94727b09b33d2f6c597bdd218a59dcc3681
Bug 6789: biblios with many items can result in broken search results link
"""
To this end, it also moves the fix_biblio_ids portion of get_corrected_marc_record out of rebuild_zebra.pl,
and makes it a part of GetMarcBiblio (right before EmbedItemsInMarcBiblio, so the 952s still come last). fix_biblio_ids
is kept as a subroutine for the deletion portion of rebuild_zebra.pl, which still uses it.
"""
But it does not explain why it's better to have it in GetMarcBiblio.
If we need it for the reindexation process, we shouldn't impact
GetMarcBiblio which is used from several different places.
We might then consider adding the fix_biblio_ids call to
rebuild_zebra.pl, but I am failing to understand in which cases it could
be useful.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Owen Leonard [Tue, 25 Jan 2022 12:32:28 +0000 (12:32 +0000)]
Bug 29940: Phase out jquery.cookie.js in the OPAC
This patch replaces the use of jquery.cookie.js in the OPAC with the
newer js-cookie plugin. The patch adds the latest version of the
js-cookie library and removes the old jquery.cookie plugin.
To test, apply the patch and go to the advanced search page in the OPAC.
- Perform a search using a number of different limits and settings, e.g.
keyword, item type, and sort-by.
- On the search results page you should see at the top of the results
list a link to "Return to the last advanced search."
- The link should take you back to the advanced search page with all the
same settings filled into the form.
- A search with the "More options" view enabled in the advanced search
form should result in a link which returns to the "More options" view.
- Searching via the "quick search" form at the top of the page should
clear the cookies which were set in order to remember the advanced
search. See
https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector for
information on viewing your browser's stored cookies.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Nick Clemens [Thu, 10 Mar 2022 12:23:42 +0000 (12:23 +0000)]
Bug 30266: Hide pickup location input on waiting hold
This patch updates the holds table to always insert a hidden input when a hold is 'found'
and covers the case where the hold is 'found' but doesn't match known statuses
To test:
1 - Place two holds on a record for two different patrons, with different pickup locations
2 - Check in one item at expected branch to set waiting
3 - Then either:
- Use batch modification or item editor to change the holding branch for the item
- Sign in to a different branch and manually transfer the item back to it's home location
4 - View the holds for the record
5 - Note the 'Pickup library' column is blank for that hold
6 - Change pickup location for other hold and press 'Update holds'
7 - Note the waiting hold is still blank, and now second hold has no pickup location
8 - Check the DB and note the first hold has had the pickup location changed
8 - Apply patch
9 - Delete holds and repeat 1-4
10 - Note the waiting hold now displays:
Hold expected at {Branch}, please checkin to verify status
11 - Change location for second hold and update holds
12 - COnfirm location chanegd correctly and first hold unaffected
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Julian Maurice [Wed, 2 Feb 2022 12:53:48 +0000 (13:53 +0100)]
Bug 30004: Prevent TooMany from executing too many SQL queries
If a maximum number of checkouts allowed is defined in circulation
rules, C4::Circulation::TooMany will loop over all patron's checkouts.
When a patron has several hundreds of checkouts, it can really slow down
the checkout process by several seconds (or even tens of seconds)
This patch does two things:
- Always prefetch item data so that `$c->item` does not execute an
additional SQL query at every iteration of the loop. Item data is
always needed at the first line of the loop, so there is really no
downside for doing this.
- Build the `@types` array only once, out of the checkouts loop. Since
it does not depend at all on patron's checkouts data, it does not make
sense to build it inside the loop.
Test plan:
1. Before applying the patch, create a patron with a lot of checkouts.
I tested with 1000 checkouts, but the slowness should be noticeable
with less.
2. Make sure you have a circulation rule (one that apply to your patron
and the item(s) you will check out for testing) with a maximum number
of checkouts allowed
3. Check out an item for the patron with a lot of checkouts. Measure the
time it takes.
4. Apply the patch
5. Check out another item (or check in and then check out the same item
used in step 3). Measure the time it takes and compare it to step 3.
It should be faster now.
6. Run `prove t/db_dependent/Circulation/TooMany.t`
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Martin Renvoize [Mon, 14 Mar 2022 14:32:31 +0000 (14:32 +0000)]
Bug 30183: Fetch flatPickr instance prior to custom search definition
This patch updates teh search customisations in ill-list-table to
properly fetch the existing flatpickr instances for date searches.
To test:
1. Have at least one ILL request on the ILL requests page
2. Open the broser inspector
3. Choose a date on the left hand form
=> FAIL: Errors in the console, search doesn't work
4. Apply this patch
5. Reload
6. Repeat 2-3
=> SUCCESS: No more errors, filtering works!
7. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Jonathan Druart [Thu, 27 Jan 2022 14:12:40 +0000 (15:12 +0100)]
Bug 29915: Add a note for tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Marcel de Rooy [Wed, 26 Jan 2022 15:54:28 +0000 (15:54 +0000)]
Bug 29915: (QA follow-up) Add a comment in checkauth on $flags
This is quite a misleading call.
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: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Marcel de Rooy [Wed, 26 Jan 2022 12:27:56 +0000 (12:27 +0000)]
Bug 29915: Changes to Auth.t
Test plan:
Run Auth.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Jonathan Druart [Wed, 26 Jan 2022 10:58:33 +0000 (11:58 +0100)]
Bug 29915: Add tests
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: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Marcel de Rooy [Tue, 25 Jan 2022 14:52:31 +0000 (14:52 +0000)]
Bug 29915: (QA follow-up) Fix POD typo
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: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Marcel de Rooy [Tue, 25 Jan 2022 13:55:00 +0000 (13:55 +0000)]
Bug 29915: Tiny session adjustments
It may be that we need a few additional flushes.
And checking the returned session before clearing busc.
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: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Marcel de Rooy [Mon, 24 Jan 2022 13:08:01 +0000 (13:08 +0000)]
Bug 29915: Changes for get_session and check_cookie_auth
If we look for an existing session, do not create a new one.
Found a bug in the unset_userenv calls. For this moment
changing the calls in Auth here. Later fix goes to bug
29954.
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: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Jonathan Druart [Thu, 20 Jan 2022 11:05:11 +0000 (12:05 +0100)]
Bug 29915: Don't generate a new session ID for anonymous navigation
When a user is not logged in, a new session ID is generated every time a
new page is hit.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Fridolin Somers [Mon, 21 Mar 2022 22:18:57 +0000 (12:18 -1000)]
Bug 30325: (Bug 30098 follow-up) Fix broken patron search redirect when one result
Bug 30098 fixed patron search behavior when a later page has only 1 result, but broke the redirect when there is only a single result from search.
To test:
1 - Perform a patron search that returns 41 results, on koha-testing-docker, 'a' works
2 - Go to second page of results, works
3 - On third page you remain in results and are not redirected
4 - Perform a patron search that return only 1 result, name or cardnumber
5 - You get redirected to this patron page
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This patch updates t::lib::Koha::BackgroundJob::BatchTest to the new
style, and also removes a couple stray cases in which job_id was still
passed as a parameter.
Tests are rewritten a bit, so they actually test more of the behaviors.
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/BackgroundJobs.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 30181: (follow-up) Remove redundant queries and parameters
Now $self is actually an instance of the job class, there's no need to
have the job_id parameter passed, or the have the ->process method
re-fetch the object from the database.
This patch cleans things up.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 30181: Make Koha::BackgroundJob->_derived_class return the right thing
This patch makes _derived_class rely on _new_from_dbic to generate a new
object with the right class, but based on the same DB row. Not an empty
one as it was before. This way we can remove some biolerplate that is
required now when writing background job classes.
To test:
1. Apply the regression tests
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/BackgroundJob.t
=> FAIL: Boo, tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 30061: Make Koha::Patron->get_age use DateTime math
This patch does what the title says. Instead of converting dates to
strings and performing math manually, we can just use the DateTime
objects we have and calculate the DateTime::Duration there's between
them, to get the years count.
To test:
1. Run:
$ kshell
k$ prove t/db_dependent/Koha/Patrons.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass
4. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 30165: (follow-up) Fix GET /acquisitions/orders
This patch fixes the particular use case of the orders route, which has
a slightly modified version of the objects.search helped, embeded in the
controller itself. This controller gets adjusted to the fact q will now
be an array.
Because of the latter, we end up requiring more code duplication
regarding the query fix, so I moved it to an internal sub that gets
reused.
To test:
1. Apply the previous patches
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/*
=> FAIL: It t/db_dependent/api/v1/acquisitions_orders.t fails!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This patch changes the q_param definition so the defined query parameter
is repeatable. This way JSON::Validator will always generate an arrayref
for it and won't skip occurences.
The objects.search helper is updated to always consider the 'q'
parameter as an array, as expected.
To test:
1. Apply the regression tests patch
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/query.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This method will allow to filter a patron set by a given subpermission.
It will be useful on bug 30055 where we want to display only patron
with suggestion or acquisition subpermission.
Note that it could be extended to allow several subpermissions, but we
don't need it so far.
Test plan:
prove t/db_dependent/Koha/Patrons.t
must return green
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 25285: Fix wrong message about required Koha version in plugins
When you install a plugin that requires a newer Koha version, it reports
this:
<<
Warning: This report was written for a newer version of Koha. Run at your own risk.
>>
It is wrong in a couple ways:
- It is not a report.
- It feels like it dates back to when plugins were only run i.e.
pre-hooks, etc.
This patch proposes a change to reflect this.
To test:
1. Verify the string changes make sense to you
2. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Martin Renvoize [Wed, 2 Mar 2022 16:14:18 +0000 (16:14 +0000)]
Bug 30214: Add ACCTDETAILS notice to verified self registration
This patch adds the ACCTDETAILS notice trigger to the opac self
registration process. Allowing new users, with varification enabled,
to receive the ACCTDETAILS notice immediately after their account is
varified.
Test plan
1) Enable AutoEmailOpacUser system preference
2) Ensure the ACCTDETAILS notice is configured
3) Ensure `PatronSelfRegistrationVerifyByEmail` is enabled
4) Register a new user via the opac self registration process using an
email address you have access to
5) Verify the user by following the link in the verification email you
should have received.
6) The new user should have been created and you should be able to see
the account details notice in their associated notices
7) Confirm that the email address used above has received the notice.
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Martin Renvoize [Wed, 2 Mar 2022 16:03:55 +0000 (16:03 +0000)]
Bug 30214: Add ACCTDETAILS notice to self registeration
This patch adds the ACCTDETAILS notice trigger to the opac self
registration process. Allowing new users, without varification enabled,
to receive the ACCTDETAILS notice immediately after their account is
created.
Test plan
1) Enable AutoEmailOpacUser system preference
2) Ensure the ACCTDETAILS notice is configured
3) Ensure `PatronSelfRegistrationVerifyByEmail` is disabled
4) Register a new user via the opac self registration process using an
email address you have access to
5) The new user should have been created and you should be able to see
the account details notice in their associated notices
6) Confirm that the email address used above has received the notice.
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Martin Renvoize [Tue, 1 Mar 2022 16:24:55 +0000 (16:24 +0000)]
Bug 17648: (QA follow-up) Further code cleaning
We actually have a Koha::Patron method to do all the work of finding the
right patron primary email address for notices.. we can use that here
instead of doing it long hand.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Kyle M Hall [Fri, 26 Feb 2021 18:16:58 +0000 (13:16 -0500)]
Bug 27812: Remove the ability to transmit a patron's plain text password over email
We should not give libraries the ability to compromise patron accounts,
it is considered a huge security issue and nobody in network security
would never recommend allowing passwords to be transmitted in clear text
over email.
It should simply not be possible to send a patron's password in plain text
via email. As such, we should remove this ability from Koha.
Test Plan:
1) Apply this patch
2) Create a patron to generate the ACCTDETAILS email
3) Note you can no longer transmit the patron's password in the email
Signed-off-by: Amit Gupta <amitddng135@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Lucas Gass [Thu, 24 Feb 2022 16:17:11 +0000 (16:17 +0000)]
Bug 30177: When editing an existing patron set message_prefs_dirty to true
1 - Define default messaging preferences for a patron category
2 - Go into an existing account and change the patron category to the
one set in step 1.
3 - Confirm that the messaging prefs have been reset to that of the
default patron category
4 - Apply patch
5 - Repeat Step 2, this time you should see a warning asking if you want
to set messaging prefs to the category default
6 - Press OK and save. Confirm that the messaging prefs are now set to
the default for that category
7 - Try it again with an existing account and press Cancel this time.
Notice that there should be no change to the patron messaging prefs.
8 - Try making a new patron and switching the category, you should see
no warning and the message prefs should be proberly set to the
defaults of any category you choose.
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 30212: Make Select2 available for ILL backends
This patch makes select2 available for ILL backend developers to use on
their templates.
To test:
1. Have a configured backed and an ILL request
2. Open the inspector and load any action on the backend (intranet)
=> FAIL: no select2 asset is transfered from Koha to the browser
3. Apply this patch
4. Reload
=> SUCCESS: There's select2
5. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Nick Clemens [Tue, 22 Feb 2022 16:54:03 +0000 (16:54 +0000)]
Bug 30155: Don't get items that can fillholds if there are no holds
This makes two changes:
1 - We no longer call get_items_that_can_fill if there are no holds
2 - The subroutine will return an empty Koha::Items object if there are no holds passed
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
we will move to 'Locale::XGettext::TT2' 0.7 when libintl-perl-1.32 arrives
https://tracker.debian.org/pkg/libintl-perl
small change, no test plan
Signed-off-by: Mason James <mtj@kohaaloha.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Petro Vashchuk [Mon, 17 Jan 2022 14:38:53 +0000 (16:38 +0200)]
Bug 29684: add honeypot to catch other warnings in the future
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Petro Vashchuk [Mon, 17 Jan 2022 14:31:08 +0000 (16:31 +0200)]
Bug 29684: Fix warn about js/locale_data.js (paycollect.pl)
To reproduce (paycollect.pl):
1) Prepare or use some existing patron with outstanding fines, go to
the accounting section and open page where you make payment towards all
fines.
2) The error message should have appeared in your log file about
"File not found : default/js/locale_data.js".
3) Apply the patch.
4) Open the edit page again, ensure that the new error massage like
that didn't appear.
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Petro Vashchuk [Mon, 17 Jan 2022 14:17:51 +0000 (16:17 +0200)]
Bug 29684: Fix warn about js/locale_data.js (memberentry.pl)
To reproduce (memberentry.pl):
1) Head over to the patron details page, press edit button to open the
memberentry.pl page.
2) The error message should have appeared in your log file about
"File not found : default/js/locale_data.js".
3) Apply the patch.
4) Open the edit page again, ensure that the new error massage like
that didn't appear.
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Owen Leonard [Thu, 3 Mar 2022 16:45:43 +0000 (16:45 +0000)]
Bug 30220: Purchase suggestion defaults to first library
This patch updates the OPAC suggestions form to update the variable
used to pre-select the logged-in user's library.
To test, apply the patch and make sure the "suggestion" preference is
set to "Allow."
- Log in to the OPAC and click "your purchase suggestions" in the
sidebar menu on your summary page.
- Click "New purchase suggestion."
- The selected library should match the logged-in user's home library.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
George Veranis [Thu, 24 Feb 2022 14:10:14 +0000 (15:10 +0100)]
Bug 20362: (follow-up) Direct link to authority records missing in staff detail view (1xx , 7xx)
I change the magnigying glass icon to FA icon in the staff detail view
for 1xx and 7xx of the record that links to the authority records.
The following test plan is for 100 tag only but the patch can be apply
for all 1xx and 7xx tags that can be connect with an authority record.
Test Plan:
1) On the Koha staff page, create a new authority. The type of authority
will be: e.g Personal Name
2) When creating authority, in tab 1 under -HEADING--PERSONAL NAME enter
the personal name term entry element and then save the
new authority e.g. Twain, Mark.
3) In circulation, search the catalog for a random book. Click the title
of the book and you will be taken to the book details.
4) Edit the record and in tab 1 , scroll down the - MAIN ENTRY--
PERSONAL NAME and repeat this tag (the icon next to the title).
5) Edit the Personal name term entry element by clicking
the button on the right of the bar.
6) In the Search main heading ($a only) enter your personal name term
e.g. Twain, Mark.
7) Press search, and then in the table that pops up, click 'choose'.
8) Save your edits and the new personal name term will be in the 'By:'
of the book details.
9) Notice that there is no magnifying glass icon.
10) Apply this patch
11) Notice that there is now a magnifying glass icon next to the
personal name term.
12) Click on the magnifying glass and it will take you directly to the
authorities records
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
George Veranis [Tue, 11 Jan 2022 08:31:27 +0000 (09:31 +0100)]
Bug 20362: Direct link to authority records missing in staff detail view (1xx , 7xx)
I added a magnigying glass icon in the staff detail view for 1xx and 7xx
of the record that links to the authority records.
The following test plan is for 100 tag only but the patch can be apply
for all 1xx and 7xx tags that can be connect with an authority record.
Test Plan:
1) On the Koha staff page, create a new authority. The type of authority
will be: e.g Personal Name
2) When creating authority, in tab 1 under -HEADING--PERSONAL NAME enter
the personal name term entry element and then save the
new authority e.g. Twain, Mark.
3) In circulation, search the catalog for a random book. Click the title
of the book and you will be taken to the book details.
4) Edit the record and in tab 1 , scroll down the - MAIN ENTRY--
PERSONAL NAME and repeat this tag (the icon next to the title).
5) Edit the Personal name term entry element by clicking
the button on the right of the bar.
6) In the Search main heading ($a only) enter your personal name term
e.g. Twain, Mark.
7) Press search, and then in the table that pops up, click 'choose'.
8) Save your edits and the new personal name term will be in the 'By:'
of the book details.
9) Notice that there is no magnifying glass icon.
10) Apply this patch
11) Notice that there is now a magnifying glass icon next to the
personal name term.
12) Click on the magnifying glass and it will take you directly to the
authorities records
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Adam Styles [Tue, 22 Feb 2022 00:32:52 +0000 (11:32 +1100)]
Bug 30159: Fix Check() to validate both mandatory and important fields
This patch adds a check for both mandatory and important fields when
validating bibliographic records during cataloguing.
To test:
1. Go to Admin -> Biblio frameworks. View the MARC structure of your
default framework.
2. Search for tag 082. Edit the subfields for this tag.
3. Check the 'important' checkbox for subfield a and Save.
4. Go to add or edit a new biblio record under Cataloguing.
5. Ensure the 082$a field is empty and hit Save.
6. Notice the confirmation pop-up is an unreadable display of HTML.
7. Click Cancel on the pop-up box.
8. Apply the patch and refresh the editor page.
9. Ensure the 082$a field is empty and hit Save.
10. Notice the confirmation pop-up is more helpful this time. Click
Cancel on the pop-up box.
11. Notice the 082$a field is displayed at the top of the page as an
important field that is missing information. Use the 'go to field'
link and confirm this works as expected.
12. Leave 082$a empty and hit Save.
13. This time click OK on the confirmation pop-up. Confirm you are able
to save your record as normal.
Sponsored-by: Education Services Australia SCIS Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Mason James [Sat, 5 Mar 2022 02:30:21 +0000 (15:30 +1300)]
Bug 19169: Add a test to detect unneeded 'atomicupdate' files
to test...
1/ set git repo
$ git reset --hard v21.11.03
2/ run test
$ prove ./t
OK
3/ apply patch
4/ run test again, observe FAIL
$ prove ./t/00-check-atomic-updates.pl
./t/00-check-atomic-updates.pl .. 1/?
# Failed test 'check for unhandled atomic updates: bug_29596.pl'
# at ./t/00-check-atomic-updates.pl line 34.
# 'bug_29596.pl'
# matches '(?^u:.*pl$)'
# Looks like you failed 1 test of 3.
./t/00-check-atomic-updates.pl .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests
JD Amended patch: fix copyright year Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Jonathan Druart [Thu, 27 Jan 2022 13:14:27 +0000 (14:14 +0100)]
Bug 29956: Prevent login form to be serialized into cookie
To recrate:
Logout
Go to /cgi-bin/koha/opac-search.pl
Click "Log in to your account"
Fill in the login form
Submit
Check the 'form_serialized' cookie's value
=> Without this patch it contain login/password
=> With this patch applied the cookie is not created
Confirm that the "Return to the last advanced search" feature still
works as expected.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Marcel de Rooy [Mon, 24 Jan 2022 10:24:08 +0000 (10:24 +0000)]
Bug 29931: Check cookie status before continuing
Test plan:
Logout from staff.
Try to run plugins-enable (you should have some active plugin).
Like: https://yourserver:staffport/cgi-bin/koha/plugins/plugins-enable.pl?class=Koha::Plugin::Test&method=enable
Replace class and method as appropriate.
Verify that with this patch, you will be redirected to 401 page.
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: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This patch makes the different ->recalls accessors implemented on this
bug be more standard. This means:
- They don't do special things like default sorting or stripping out
special parameters. That's all left to the caller and the methods are
clean: they just return the related objects
- Useful filtering methods for Koha::Recalls resultsets are added. The
only used one (in the end) was ->filter_by_current. It seems like a
better approach, because it gives devs more control on how they want
to chain things, and there's a single place in which to maintain the
criteria of what is 'current' or 'finished'. This clearly makes the
'old' column obsolete IMHO, at least in the use cases I found. This is
covered by tests as well.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This patch makes the status attribute an ENUM, setting the default value
as 'requested' as well. The chosen names are easier to read than single
letters. Also, renamed F into fulfilled (this impacts methods names as
well). This is because 'finished' or 'completed' is more a synonym for
old => 1...
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Marcel de Rooy [Wed, 2 Mar 2022 14:33:06 +0000 (14:33 +0000)]
Bug 19532: (QA follow-up) Fix fine calculation by inserting biblionumber
The fines cron job uses Getoverdues to pass issue info to CalcFine.
It took me a while to realize that the overdue hash does not contain
a biblionumber. When testing CalcFine, we pass an item hash that
does include one.
So what happened? $item->{biblionumber} is undefined when it comes from
Getoverdues and no recall overdue fine is calculated, only a regular one.
Simple fix (without any impact): Add a biblionumber to Getoverdues.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested with fines.pl: recall fine applied now.
Ran some Circulation and Overdues unit tests. Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Marcel de Rooy [Fri, 25 Feb 2022 08:53:11 +0000 (08:53 +0000)]
Bug 19532: (QA follow-up) Fixing unit tests
(Trivial:) Number of tests in Koha/Item.t
Added a $patron object to resolve warnings like:
* Global symbol "$patron" requires explicit package name (did you forget to declare "my $patron"?) at t/db_dependent/Koha/Patron.t line 1064.
Fixed CanItemBeReserved call in Holds.t, number of tests adjusted
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Aleisha Amohia [Wed, 28 Oct 2020 03:15:39 +0000 (16:15 +1300)]
Bug 19532: (follow-up) Fixing OPAC display and staff client errors
- fixes the displays of opac-recalls.pl and opac-recall.pl
- fix the error on Recalls to pull page
- fix JS error preventing Recalled link from showing in checkouts table
- fix cancelling of recall when checking out item
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>